Merge pull request from gnuboard:HeuJung/issue471
HeuJung/issue471
This commit is contained in:
commit
4c73db2e91
132 files changed
+10138
-312
No files matched your search
@@ -136,3 +136,10 @@ playwright-report/
|
||||
test-results/
|
||||
# Playwright MCP 세션 아티팩트(스냅샷/콘솔 로그) — 커밋 대상 아님
|
||||
.playwright-mcp/
|
||||
|
||||
# ===== 소스맵 =====
|
||||
# 소스맵은 원본 코드 전문(sourcesContent)을 담고 있어 배포 대상이 아니다.
|
||||
# 로컬 개발 빌드에서는 생성되지만(디버깅용) 저장소에는 유입되지 않는다.
|
||||
# 배포용 빌드는 `--production` 이 G7_BUILD_SOURCEMAP=0 을 주입해 생성 자체를 막는다.
|
||||
# 경로 한정 시 새 확장이 추가될 때 조용히 누락되므로 전역 규칙으로 둔다.
|
||||
*.map
|
||||
@@ -10,9 +10,11 @@
|
||||
|
||||
- 서버가 외부 주소를 대신 호출하는 기능들에서, 사내 서버나 클라우드 관리 주소처럼 외부에 공개되지 않은 내부 주소를 호출 대상으로 지정할 수 없도록 차단했습니다. 언어팩을 주소로 내려받을 때, 예약 작업으로 주소를 호출할 때, 쇼핑몰 배송비를 외부 계산 서버로 문의할 때가 해당합니다. 사내 서버를 주기적으로 호출하는 등 내부 주소가 꼭 필요한 운영 환경을 위해, 환경설정 > 보안에 "내부 네트워크 주소 호출 허용" 항목을 새로 추가했습니다. 이 항목은 기본적으로 꺼져 있습니다.
|
||||
- 주소를 검사할 때 앞부분만 맞으면 통과시키던 방식을 실제 주소가 정확히 일치하는지 확인하도록 바로잡았습니다. 이전에는 신뢰하는 주소를 앞에 붙인 가짜 주소가 검사를 통과할 수 있었습니다. 본인인증 연동과 언어팩 업데이트 확인에 적용됩니다. (KISA 측에서 제보해주셨습니다 — KVE-2026-1546)
|
||||
- 배포본에 원본 소스코드가 그대로 담긴 파일(소스맵)이 함께 포함되어, 누구나 주소만 알면 내려받아 볼 수 있던 문제를 차단했습니다. 이제 배포용으로 빌드하면 이 파일이 아예 만들어지지 않으며, 기존에 포함되어 있던 파일도 모두 제거했습니다. 아울러 이 파일이 서버에 남아 있더라도 웹으로는 내려받을 수 없도록 막았습니다. 내 컴퓨터에서 개발용으로 빌드할 때는 디버깅에 필요하므로 이전과 동일하게 생성됩니다. (#72 @glitter-gim 님께서 건의해주셨습니다.)
|
||||
|
||||
### Fixed
|
||||
|
||||
- 나이스페이먼츠 결제 플러그인을 켜 두면 홈, 게시판, 로그인 등 결제와 무관한 모든 페이지에서 주문서 조회 요청이 한 번씩 불필요하게 발생하던 문제를 수정했습니다. 장바구니가 없는 비회원에게는 이 요청이 매번 실패해 브라우저 오류로 기록됐습니다. 이제 결제 페이지에서만 요청합니다.
|
||||
- 설치 과정에서 임시로 만들어지는 파일에 관리자 비밀번호가 그대로 남을 수 있던 문제를 수정했습니다. 설치가 정상적으로 끝나면 이 파일은 지워지지만, 설치를 중간에 그만두거나 마지막 정리가 이뤄지지 않은 경우에는 남아 있을 수 있었습니다. 이제 비밀번호는 이 파일에 아예 기록되지 않으며, 설치에 꼭 필요한 동안에만 접근이 제한된 별도 파일에 보관했다가 관리자 계정이 만들어지는 즉시 지워집니다. 이미 설치를 마친 사이트도 업데이트하면 남아 있던 파일이 자동으로 정리됩니다. (sir.kr 커뮤니티의 코ppp 님께서 제보해주셨습니다.)
|
||||
- 화면 편집기를 작은 화면에서 열면 상단 도구 모음의 버튼 글자가 세로로 쪼개지는 등 화면이 찌그러지던 문제를 수정했습니다. 화면 편집기는 왼쪽 화면 목록과 미리보기 화면을 나란히 놓고 쓰는 도구라 넓은 화면이 필요합니다. 이제 창이 좁아도 편집기를 억지로 우겨넣지 않고 원래 크기를 유지하며, 모자란 만큼은 가로 스크롤로 넘겨 보면 됩니다.
|
||||
- 모바일에서 새로고침을 연속으로 눌렀을 때 간헐적으로 "초기화 실패" 또는 "페이지 로딩 실패" 화면이 뜨던 문제를 수정했습니다. 화면을 그리는 데 필요한 요청 하나가 회선 사정으로 잠깐 끊기면 그것만으로 페이지 전체가 뜨지 않았습니다. 이제 이런 일시적인 끊김은 자동으로 다시 시도해 복구하므로, 대부분의 경우 사용자는 아무것도 느끼지 못한 채 화면이 정상적으로 열립니다.
|
||||
|
||||
@@ -94,9 +94,12 @@ class BuildCoreCommand extends Command
|
||||
return $this->runWatchBundles($projectPath);
|
||||
}
|
||||
|
||||
// 3개 번들을 npm 스크립트로 순차 호출하므로 빌드 환경변수를 세 곳 모두에 주입한다.
|
||||
$buildEnv = $this->buildEnv($productionMode);
|
||||
|
||||
// ── 1) 템플릿 엔진 번들 (편집기 코드 제외) ──────────────────────────────
|
||||
$this->info('🔨 코어 빌드 시작 (템플릿 엔진)'.($productionMode ? ' (프로덕션)' : ''));
|
||||
$engineResult = $this->runNpmCommand(['npm', 'run', 'build:core'], $projectPath, true);
|
||||
$engineResult = $this->runNpmCommand(['npm', 'run', 'build:core'], $projectPath, true, $buildEnv);
|
||||
|
||||
if ($engineResult !== Command::SUCCESS) {
|
||||
return $engineResult;
|
||||
@@ -104,7 +107,7 @@ class BuildCoreCommand extends Command
|
||||
|
||||
// ── 2) 레이아웃 편집기 번들 (lazy, /admin/layout-editor/* 진입 시 로드) ──
|
||||
$this->info('🔨 코어 빌드 시작 (레이아웃 편집기)'.($productionMode ? ' (프로덕션)' : ''));
|
||||
$editorResult = $this->runNpmCommand(['npm', 'run', 'build:core-editor'], $projectPath, true);
|
||||
$editorResult = $this->runNpmCommand(['npm', 'run', 'build:core-editor'], $projectPath, true, $buildEnv);
|
||||
|
||||
if ($editorResult !== Command::SUCCESS) {
|
||||
$this->error('❌ 레이아웃 편집기 번들 빌드 실패');
|
||||
@@ -114,7 +117,7 @@ class BuildCoreCommand extends Command
|
||||
|
||||
// ── 3) DevTools 번들 (lazy, 디버그 모드에서만 로드) ──
|
||||
$this->info('🔨 코어 빌드 시작 (DevTools)'.($productionMode ? ' (프로덕션)' : ''));
|
||||
$devtoolsResult = $this->runNpmCommand(['npm', 'run', 'build:core-devtools'], $projectPath, true);
|
||||
$devtoolsResult = $this->runNpmCommand(['npm', 'run', 'build:core-devtools'], $projectPath, true, $buildEnv);
|
||||
|
||||
if ($devtoolsResult !== Command::SUCCESS) {
|
||||
$this->error('❌ DevTools 번들 빌드 실패');
|
||||
@@ -197,7 +200,13 @@ class BuildCoreCommand extends Command
|
||||
$this->info('🔨 코어 빌드 시작 (전체)'.($productionMode ? ' (프로덕션)' : ''));
|
||||
}
|
||||
|
||||
$result = $this->runNpmCommand($buildCommand, $projectPath, ! $watchMode);
|
||||
// 감시 모드에는 소스맵 억제를 주입하지 않는다 — 개발 중 디버깅 필요
|
||||
$result = $this->runNpmCommand(
|
||||
$buildCommand,
|
||||
$projectPath,
|
||||
! $watchMode,
|
||||
$watchMode ? [] : $this->buildEnv($productionMode)
|
||||
);
|
||||
|
||||
if ($result === Command::SUCCESS && ! $watchMode) {
|
||||
$this->info('✅ 코어 빌드 완료 (전체)');
|
||||
@@ -311,15 +320,30 @@ class BuildCoreCommand extends Command
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 빌드 프로세스에 주입할 환경변수를 구성합니다.
|
||||
*
|
||||
* 프로덕션 빌드에서는 소스맵을 생성하지 않습니다. 배포 산출물에 원본 코드가
|
||||
* 포함되는 것을 막기 위함이며, 각 vite config 가 이 값을 읽습니다.
|
||||
*
|
||||
* @param bool $productionMode 프로덕션 빌드 여부
|
||||
* @return array<string, string> Process 에 주입할 환경변수
|
||||
*/
|
||||
private function buildEnv(bool $productionMode): array
|
||||
{
|
||||
return $productionMode ? ['G7_BUILD_SOURCEMAP' => '0'] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* npm 명령 실행
|
||||
*
|
||||
* @param array $command 실행할 명령
|
||||
* @param string $cwd 작업 디렉토리
|
||||
* @param bool $waitForCompletion 완료 대기 여부
|
||||
* @param array<string, string> $env 추가로 주입할 환경변수 (부모 환경에 병합됨)
|
||||
* @return int 명령 실행 결과 코드
|
||||
*/
|
||||
private function runNpmCommand(array $command, string $cwd, bool $waitForCompletion = true): int
|
||||
private function runNpmCommand(array $command, string $cwd, bool $waitForCompletion = true, array $env = []): int
|
||||
{
|
||||
// Windows 환경에서는 cmd /c 사용
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
@@ -328,6 +352,11 @@ class BuildCoreCommand extends Command
|
||||
|
||||
$process = new Process($command);
|
||||
$process->setWorkingDirectory($cwd);
|
||||
|
||||
// Symfony Process 는 지정한 env 를 부모 환경에 병합하므로(PATH 등 유지) 추가분만 넘긴다.
|
||||
if ($env !== []) {
|
||||
$process->setEnv($env);
|
||||
}
|
||||
$process->setTimeout(null); // 타임아웃 없음
|
||||
|
||||
if ($waitForCompletion) {
|
||||
|
||||
@@ -189,8 +189,13 @@ class BuildModuleCommand extends Command
|
||||
$this->info("🔨 빌드 시작: {$identifier}".($productionMode ? ' (프로덕션)' : ''));
|
||||
}
|
||||
|
||||
// 빌드 실행
|
||||
$result = $this->runNpmCommand($buildCommand, $buildPath, ! $watchMode);
|
||||
// 빌드 실행 (감시 모드에는 소스맵 억제를 주입하지 않는다 — 개발 중 디버깅 필요)
|
||||
$result = $this->runNpmCommand(
|
||||
$buildCommand,
|
||||
$buildPath,
|
||||
! $watchMode,
|
||||
$watchMode ? [] : $this->buildEnv($productionMode)
|
||||
);
|
||||
|
||||
if ($result === Command::SUCCESS && ! $watchMode) {
|
||||
$this->info("✅ 빌드 완료: {$identifier}");
|
||||
@@ -338,15 +343,30 @@ class BuildModuleCommand extends Command
|
||||
return $failCount > 0 ? Command::FAILURE : Command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 빌드 프로세스에 주입할 환경변수를 구성합니다.
|
||||
*
|
||||
* 프로덕션 빌드에서는 소스맵을 생성하지 않습니다. 배포 산출물에 원본 코드가
|
||||
* 포함되는 것을 막기 위함이며, 각 vite config 가 이 값을 읽습니다.
|
||||
*
|
||||
* @param bool $productionMode 프로덕션 빌드 여부
|
||||
* @return array<string, string> Process 에 주입할 환경변수
|
||||
*/
|
||||
private function buildEnv(bool $productionMode): array
|
||||
{
|
||||
return $productionMode ? ['G7_BUILD_SOURCEMAP' => '0'] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* npm 명령 실행
|
||||
*
|
||||
* @param array $command 실행할 명령
|
||||
* @param string $cwd 작업 디렉토리
|
||||
* @param bool $waitForCompletion 완료 대기 여부
|
||||
* @param array<string, string> $env 추가로 주입할 환경변수 (부모 환경에 병합됨)
|
||||
* @return int 명령 실행 결과 코드
|
||||
*/
|
||||
private function runNpmCommand(array $command, string $cwd, bool $waitForCompletion = true): int
|
||||
private function runNpmCommand(array $command, string $cwd, bool $waitForCompletion = true, array $env = []): int
|
||||
{
|
||||
// Windows 환경에서는 cmd /c 사용
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
@@ -355,6 +375,11 @@ class BuildModuleCommand extends Command
|
||||
|
||||
$process = new Process($command);
|
||||
$process->setWorkingDirectory($cwd);
|
||||
|
||||
// Symfony Process 는 지정한 env 를 부모 환경에 병합하므로(PATH 등 유지) 추가분만 넘긴다.
|
||||
if ($env !== []) {
|
||||
$process->setEnv($env);
|
||||
}
|
||||
$process->setTimeout(null); // 타임아웃 없음
|
||||
|
||||
if ($waitForCompletion) {
|
||||
|
||||
@@ -189,8 +189,13 @@ class BuildPluginCommand extends Command
|
||||
$this->info("🔨 빌드 시작: {$identifier}".($productionMode ? ' (프로덕션)' : ''));
|
||||
}
|
||||
|
||||
// 빌드 실행
|
||||
$result = $this->runNpmCommand($buildCommand, $buildPath, ! $watchMode);
|
||||
// 빌드 실행 (감시 모드에는 소스맵 억제를 주입하지 않는다 — 개발 중 디버깅 필요)
|
||||
$result = $this->runNpmCommand(
|
||||
$buildCommand,
|
||||
$buildPath,
|
||||
! $watchMode,
|
||||
$watchMode ? [] : $this->buildEnv($productionMode)
|
||||
);
|
||||
|
||||
if ($result === Command::SUCCESS && ! $watchMode) {
|
||||
$this->info("✅ 빌드 완료: {$identifier}");
|
||||
@@ -338,15 +343,30 @@ class BuildPluginCommand extends Command
|
||||
return $failCount > 0 ? Command::FAILURE : Command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 빌드 프로세스에 주입할 환경변수를 구성합니다.
|
||||
*
|
||||
* 프로덕션 빌드에서는 소스맵을 생성하지 않습니다. 배포 산출물에 원본 코드가
|
||||
* 포함되는 것을 막기 위함이며, 각 vite config 가 이 값을 읽습니다.
|
||||
*
|
||||
* @param bool $productionMode 프로덕션 빌드 여부
|
||||
* @return array<string, string> Process 에 주입할 환경변수
|
||||
*/
|
||||
private function buildEnv(bool $productionMode): array
|
||||
{
|
||||
return $productionMode ? ['G7_BUILD_SOURCEMAP' => '0'] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* npm 명령 실행
|
||||
*
|
||||
* @param array $command 실행할 명령
|
||||
* @param string $cwd 작업 디렉토리
|
||||
* @param bool $waitForCompletion 완료 대기 여부
|
||||
* @param array<string, string> $env 추가로 주입할 환경변수 (부모 환경에 병합됨)
|
||||
* @return int 명령 실행 결과 코드
|
||||
*/
|
||||
private function runNpmCommand(array $command, string $cwd, bool $waitForCompletion = true): int
|
||||
private function runNpmCommand(array $command, string $cwd, bool $waitForCompletion = true, array $env = []): int
|
||||
{
|
||||
// Windows 환경에서는 cmd /c 사용
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
@@ -355,6 +375,11 @@ class BuildPluginCommand extends Command
|
||||
|
||||
$process = new Process($command);
|
||||
$process->setWorkingDirectory($cwd);
|
||||
|
||||
// Symfony Process 는 지정한 env 를 부모 환경에 병합하므로(PATH 등 유지) 추가분만 넘긴다.
|
||||
if ($env !== []) {
|
||||
$process->setEnv($env);
|
||||
}
|
||||
$process->setTimeout(null); // 타임아웃 없음
|
||||
|
||||
if ($waitForCompletion) {
|
||||
|
||||
@@ -181,8 +181,13 @@ class BuildTemplateCommand extends Command
|
||||
$this->info("🔨 빌드 시작: {$identifier}".($productionMode ? ' (프로덕션)' : ''));
|
||||
}
|
||||
|
||||
// 빌드 실행
|
||||
$result = $this->runNpmCommand($buildCommand, $buildPath, ! $watchMode);
|
||||
// 빌드 실행 (감시 모드에는 소스맵 억제를 주입하지 않는다 — 개발 중 디버깅 필요)
|
||||
$result = $this->runNpmCommand(
|
||||
$buildCommand,
|
||||
$buildPath,
|
||||
! $watchMode,
|
||||
$watchMode ? [] : $this->buildEnv($productionMode)
|
||||
);
|
||||
|
||||
if ($result === Command::SUCCESS && ! $watchMode) {
|
||||
$this->info("✅ 빌드 완료: {$identifier}");
|
||||
@@ -285,15 +290,30 @@ class BuildTemplateCommand extends Command
|
||||
return $failCount > 0 ? Command::FAILURE : Command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 빌드 프로세스에 주입할 환경변수를 구성합니다.
|
||||
*
|
||||
* 프로덕션 빌드에서는 소스맵을 생성하지 않습니다. 배포 산출물에 원본 코드가
|
||||
* 포함되는 것을 막기 위함이며, 각 vite config 가 이 값을 읽습니다.
|
||||
*
|
||||
* @param bool $productionMode 프로덕션 빌드 여부
|
||||
* @return array<string, string> Process 에 주입할 환경변수
|
||||
*/
|
||||
private function buildEnv(bool $productionMode): array
|
||||
{
|
||||
return $productionMode ? ['G7_BUILD_SOURCEMAP' => '0'] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* npm 명령 실행
|
||||
*
|
||||
* @param array $command 실행할 명령
|
||||
* @param string $cwd 작업 디렉토리
|
||||
* @param bool $waitForCompletion 완료 대기 여부
|
||||
* @param array<string, string> $env 추가로 주입할 환경변수 (부모 환경에 병합됨)
|
||||
* @return int 명령 실행 결과 코드
|
||||
*/
|
||||
private function runNpmCommand(array $command, string $cwd, bool $waitForCompletion = true): int
|
||||
private function runNpmCommand(array $command, string $cwd, bool $waitForCompletion = true, array $env = []): int
|
||||
{
|
||||
// Windows 환경에서는 cmd /c 사용
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
@@ -302,6 +322,11 @@ class BuildTemplateCommand extends Command
|
||||
|
||||
$process = new Process($command);
|
||||
$process->setWorkingDirectory($cwd);
|
||||
|
||||
// Symfony Process 는 지정한 env 를 부모 환경에 병합하므로(PATH 등 유지) 추가분만 넘긴다.
|
||||
if ($env !== []) {
|
||||
$process->setEnv($env);
|
||||
}
|
||||
$process->setTimeout(null); // 타임아웃 없음
|
||||
|
||||
if ($waitForCompletion) {
|
||||
|
||||
@@ -20,9 +20,6 @@ class AllowedModuleFileType implements ValidationRule
|
||||
// Data
|
||||
'json',
|
||||
|
||||
// Source Maps
|
||||
'map',
|
||||
|
||||
// Images
|
||||
'png', 'jpg', 'jpeg', 'svg', 'webp', 'gif', 'ico',
|
||||
|
||||
|
||||
@@ -20,9 +20,6 @@ class AllowedPluginFileType implements ValidationRule
|
||||
// Data
|
||||
'json',
|
||||
|
||||
// Source Maps
|
||||
'map',
|
||||
|
||||
// Images
|
||||
'png', 'jpg', 'jpeg', 'svg', 'webp', 'gif', 'ico',
|
||||
|
||||
|
||||
@@ -166,6 +166,7 @@ class ExtensionBundleService
|
||||
public function buildCssBundle(string $type): string
|
||||
{
|
||||
$ordered = $this->getOrderedGlobalAssetPaths($type);
|
||||
$isProduction = app()->environment('production');
|
||||
$segments = [];
|
||||
|
||||
foreach ($ordered as $identifier => $paths) {
|
||||
@@ -197,7 +198,7 @@ class ExtensionBundleService
|
||||
continue;
|
||||
}
|
||||
|
||||
$segments[] = $content;
|
||||
$segments[] = $this->processCssSourceMap($content, $isProduction);
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('확장 CSS 번들 병합 중 오류, 해당 확장 skip', [
|
||||
'type' => $type,
|
||||
@@ -417,6 +418,29 @@ class ExtensionBundleService
|
||||
}, $content) ?? $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSS 소스맵 주석을 환경에 맞게 처리합니다.
|
||||
*
|
||||
* CSS 는 JS 와 주석 문법이 달라 소스맵 참조를 블록 주석으로 표기하므로
|
||||
* processJsSourceMap() 의 `//#` 패턴으로는 검출되지 않는다.
|
||||
*
|
||||
* prod: 주석 strip(맵 참조 제거). dev: 원본 유지.
|
||||
* 병합 번들에서는 개별 맵 URL 이 어차피 어긋나므로 dev rewrite 는 하지 않는다.
|
||||
*
|
||||
* @param string $content 원본 CSS 내용
|
||||
* @param bool $isProduction 프로덕션 여부
|
||||
* @return string 처리된 내용
|
||||
*/
|
||||
private function processCssSourceMap(string $content, bool $isProduction): string
|
||||
{
|
||||
if (! $isProduction) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
// 구분자로 `~` 사용 — 패턴에 `/`, `#` 가 포함됨
|
||||
return preg_replace('~/\*#\s*sourceMappingURL=\S+?\s*\*/~', '', $content) ?? $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSS 내용에 상대경로 url() 참조가 있는지 확인합니다.
|
||||
*
|
||||
|
||||
@@ -1043,7 +1043,6 @@ class ModuleService
|
||||
'mjs' => 'application/javascript',
|
||||
'css' => 'text/css',
|
||||
'json' => 'application/json',
|
||||
'map' => 'application/json',
|
||||
'png' => 'image/png',
|
||||
'jpg' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
|
||||
@@ -708,7 +708,6 @@ class PluginService
|
||||
'mjs' => 'application/javascript',
|
||||
'css' => 'text/css',
|
||||
'json' => 'application/json',
|
||||
'map' => 'application/json',
|
||||
'png' => 'image/png',
|
||||
'jpg' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
### Added
|
||||
|
||||
- 환경설정 > 보안 화면의 "내부 네트워크 주소 호출 허용" 항목명·설명 일본어 번역 추가 — 새로 추가된 보안 설정이 일본어 로케일에서도 올바르게 표시됩니다.
|
||||
- 역할 관리 화면 새로고침 버튼의 일본어 번역 추가 — 일본어 로케일에서도 버튼 설명이 올바르게 표시됩니다.
|
||||
|
||||
## [1.0.2] - 2026-07-10
|
||||
|
||||
|
||||
@@ -1089,7 +1089,8 @@
|
||||
"errors": {
|
||||
"system_role_delete": "システムロールは削除できません。",
|
||||
"delete_failed": "ロール削除に失敗しました。"
|
||||
}
|
||||
},
|
||||
"refresh": "更新"
|
||||
},
|
||||
"schedules": {
|
||||
"page_title": "スケジュール管理",
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며,
|
||||
[Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다.
|
||||
|
||||
## [1.0.2] - 2026-07-14
|
||||
|
||||
### Fixed
|
||||
|
||||
- 게시판 설정 화면의 상단 고정 영역이 좌우 여백과 어긋나 내용이 가로로 밀려 보일 수 있던 문제를 수정했습니다.
|
||||
|
||||
## [1.0.1] - 2026-07-08
|
||||
|
||||
### Added
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "modules/sirsoft-board",
|
||||
"description": "Board module for Gnuboard7",
|
||||
"type": "library",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"ko": "게시판",
|
||||
"en": "Board"
|
||||
},
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "MIT",
|
||||
"description": {
|
||||
"ko": "게시판 관리를 위한 모듈",
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@g7/sirsoft-board",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@g7/sirsoft-board",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"devDependencies": {
|
||||
"jsdom": "^27.4.0",
|
||||
"typescript": "^5.3.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@g7/sirsoft-board",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "그누보드7 게시판 모듈 프론트엔드 에셋",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
+1
@@ -6,6 +6,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/modules/sirsoft-board/admin/boards",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'basic_info'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"params": {
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @file admin-board-settings-tab-scoped-datasources.test.tsx
|
||||
* @description 게시판 설정 데이터소스 탭 스코프 게이팅 회귀 가드
|
||||
*
|
||||
* 이커머스 환경설정과 동일 결함: 진입 시 전 탭의 데이터소스를 한꺼번에 fetch 했다.
|
||||
* 탭 본문은 `if` 로 게이트되어 비활성 탭은 렌더되지 않으므로 그 데이터는 아무도 읽지 않는다.
|
||||
* 엔진(DataSourceManager.filterByCondition + TemplateApp.updateQueryParams)이
|
||||
* 데이터소스 `if` 로 탭별 로딩을 지원하므로, 탭 전용 소스는 `if` 게이트를 가져야 한다.
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
const layout = require('../../../layouts/admin/admin_board_settings.json');
|
||||
|
||||
interface AnyJson { [k: string]: any }
|
||||
|
||||
const SHARED_SOURCE_IDS = ['settings'];
|
||||
|
||||
const TAB_SCOPED: Record<string, string[]> = {
|
||||
boards_list: ['basic_defaults'],
|
||||
roles: ['basic_defaults', 'report_policy'],
|
||||
board_types: ['basic_defaults'],
|
||||
boardNotificationDefinitions: ['notification_definitions', 'report_policy'],
|
||||
availableChannels: ['notification_definitions'],
|
||||
boardIdentityPolicies: ['identity_policies'],
|
||||
boardIdentityPurposes: ['identity_policies'],
|
||||
identityProviders: ['identity_policies'],
|
||||
};
|
||||
|
||||
const sources: AnyJson[] = layout.data_sources;
|
||||
const byId = (id: string) => sources.find(s => s.id === id);
|
||||
|
||||
describe('admin_board_settings — 데이터소스 탭 스코프 게이팅', () => {
|
||||
it('공유 소스(settings)는 if 게이트 없이 항상 fetch 된다', () => {
|
||||
for (const id of SHARED_SOURCE_IDS) {
|
||||
const s = byId(id);
|
||||
expect(s).toBeTruthy();
|
||||
expect(s!.if).toBeUndefined();
|
||||
expect(s!.auto_fetch).not.toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it.each(Object.keys(TAB_SCOPED))('탭 전용 소스 %s 는 if 게이트를 가진다', (id) => {
|
||||
const s = byId(id);
|
||||
expect(s).toBeTruthy();
|
||||
expect(typeof s!.if).toBe('string');
|
||||
});
|
||||
|
||||
it.each(Object.entries(TAB_SCOPED))('%s 의 if 가 소유 탭(%s)을 참조한다', (id, tabs) => {
|
||||
const cond: string = byId(id)!.if;
|
||||
for (const tab of tabs as string[]) {
|
||||
expect(cond).toContain(`'${tab}'`);
|
||||
}
|
||||
expect(cond).toContain('query.tab');
|
||||
expect(cond).toContain('activeBoardSettingsTab');
|
||||
});
|
||||
|
||||
it('탭 전용 소스를 auto_fetch:false 로 죽여두지 않는다', () => {
|
||||
for (const id of Object.keys(TAB_SCOPED)) {
|
||||
expect(byId(id)!.auto_fetch).not.toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it('탭 전환은 navigate + replace:true 로 수행한다 (if 재평가 필요)', () => {
|
||||
const seqs: AnyJson[] = [];
|
||||
const walk = (n: any) => {
|
||||
if (!n || typeof n !== 'object') return;
|
||||
if (Array.isArray(n)) { n.forEach(walk); return; }
|
||||
if (n.handler === 'sequence' && Array.isArray(n.params?.actions)) seqs.push(n);
|
||||
Object.values(n).forEach(walk);
|
||||
};
|
||||
walk(layout);
|
||||
|
||||
const tabSwitches = seqs.filter(s =>
|
||||
(s.params.actions as AnyJson[]).some(
|
||||
a => a?.handler === 'setState' && 'activeBoardSettingsTab' in (a.params ?? {})
|
||||
)
|
||||
);
|
||||
expect(tabSwitches.length).toBeGreaterThan(0);
|
||||
|
||||
for (const seq of tabSwitches) {
|
||||
const acts = seq.params.actions as AnyJson[];
|
||||
expect(acts.some(a => a.handler === 'replaceUrl')).toBe(false);
|
||||
const nav = acts.find(a => a.handler === 'navigate');
|
||||
expect(nav).toBeTruthy();
|
||||
expect(nav!.params.replace).toBe(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
+5
-2
@@ -304,8 +304,11 @@ describe('admin_board_settings.json - 메인 레이아웃', () => {
|
||||
expect(innerActions[1].handler).toBe('setState');
|
||||
expect(innerActions[1].params.target).toBe('global');
|
||||
|
||||
// replaceUrl - URL 업데이트
|
||||
expect(innerActions[2].handler).toBe('replaceUrl');
|
||||
// navigate(replace:true) - URL 업데이트 + 데이터소스 `if` 재평가
|
||||
// replaceUrl 은 history 만 교체하므로 탭 전용 데이터소스가 로드되지 않는다.
|
||||
// 가드: admin-board-settings-tab-scoped-datasources.test.tsx
|
||||
expect(innerActions[2].handler).toBe('navigate');
|
||||
expect(innerActions[2].params.replace).toBe(true);
|
||||
expect(innerActions[2].params.query.tab).toBeDefined();
|
||||
|
||||
// scrollIntoView - 탭 변경 후 본문 상단으로 스크롤 (#369)
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/modules/sirsoft-board/admin/boards?per_page=999&fields=id,title",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeBoardSettingsTab || 'general') === 'basic_defaults'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"fallback": {
|
||||
@@ -94,6 +95,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/admin/roles/active",
|
||||
"method": "GET",
|
||||
"if": "{{['basic_defaults', 'report_policy'].includes(query.tab || _global.activeBoardSettingsTab || 'general')}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"fallback": {
|
||||
@@ -106,6 +108,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/modules/sirsoft-board/admin/board-types",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeBoardSettingsTab || 'general') === 'basic_defaults'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"fallback": {
|
||||
@@ -118,6 +121,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/admin/notification-definitions?extension_type=module&extension_identifier=sirsoft-board",
|
||||
"method": "GET",
|
||||
"if": "{{['notification_definitions', 'report_policy'].includes(query.tab || _global.activeBoardSettingsTab || 'general')}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"params": {
|
||||
@@ -145,6 +149,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/admin/notification-channels",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeBoardSettingsTab || 'general') === 'notification_definitions'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"fallback": {
|
||||
@@ -159,6 +164,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/admin/identity/policies",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeBoardSettingsTab || 'general') === 'identity_policies'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"params": {
|
||||
@@ -182,6 +188,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/identity/purposes",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeBoardSettingsTab || 'general') === 'identity_policies'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"fallback": {
|
||||
@@ -194,6 +201,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/admin/identity/providers",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeBoardSettingsTab || 'general') === 'identity_policies'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"fallback": {
|
||||
@@ -243,7 +251,7 @@
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": {
|
||||
"className": "sticky-tab-nav-responsive"
|
||||
"className": "sticky-section-header"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
@@ -339,11 +347,13 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "replaceUrl",
|
||||
"handler": "navigate",
|
||||
"params": {
|
||||
"path": "/admin/boards/settings",
|
||||
"query": {
|
||||
"tab": "{{$args[0]}}"
|
||||
}
|
||||
},
|
||||
"replace": true
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"identifier": "sirsoft-ecommerce",
|
||||
"version": "1.0.0-beta.5",
|
||||
"version": "1.0.3",
|
||||
"components": {
|
||||
"basic": [],
|
||||
"composite": [],
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
var SirsoftEcommerce=function(xe){"use strict";const gt={KRW:0,JPY:0},_t={KRW:"₩",USD:"$",JPY:"¥",CNY:"元",EUR:"€",GBP:"£"},wt={KRW:1e3,JPY:100};function yt(r){if(!r)return 1;const c=r.base_unit??wt[r.code]??1;return Math.max(1,c)}function ht(r,c,e){const t=parseFloat(c)||1;if(t<=0)return r;const o=r/t;let a;switch(e){case"ceil":a=Math.ceil(o);break;case"floor":a=Math.floor(o);break;default:a=Math.round(o)}return a*t}function he(r,c){const e=typeof c=="string"?{code:c}:c,t=e.code,o=e.symbol&&e.symbol.length>0?e.symbol:_t[t]??"",a=e.decimal_places??gt[t]??2,n=r.toLocaleString(void 0,{minimumFractionDigits:a,maximumFractionDigits:a});return o?t==="KRW"||o==="₩"||o==="원"?n+"원":o+n:n+" "+t}function ae(r,c){const{basePrice:e,currencies:t}=r,o=parseFloat(String(e))||0;if(!t||!Array.isArray(t)||t.length===0)return{};const a=t.find(i=>i.is_default),n=yt(a),s={};for(const i of t){const l=i.code;if(i.is_default??!1)s[l]={price:o,formatted:he(o,i),is_default:!0,editable:!0};else if(i.exchange_rate&&i.exchange_rate>0){const d=o/n*i.exchange_rate,m=ht(d,i.rounding_unit||"0.01",i.rounding_method||"round");s[l]={price:m,formatted:he(m,i),is_default:!1,editable:!1,exchange_rate:i.exchange_rate}}}return s}const z=window.G7Core?.createLogger?.("Ecom:UpdateProduct")??{log:(...r)=>console.log("[Ecom:UpdateProduct]",...r),warn:(...r)=>console.warn("[Ecom:UpdateProduct]",...r),error:(...r)=>console.error("[Ecom:UpdateProduct]",...r)};function Ct(r,c){const e=r.params||{},{productId:t,field:o,dataSourceId:a="products"}=e;let{value:n}=e;if(n&&typeof n=="object"&&n.target!==void 0&&(n=n.target?.value,z.log("[updateProductField] Extracted value from event:",n)),!t||!o){z.warn("[updateProductField] Missing required params:",{productId:t,field:o});return}if(n===void 0){z.warn("[updateProductField] Value is undefined, skipping update");return}const s=window.G7Core;if(!s?.dataSource?.get||!s?.dataSource?.set){z.warn("[updateProductField] G7Core.dataSource API is not available");return}const i=s.dataSource.get(a);if(!i){console.warn(`[updateProductField] DataSource '${a}' not found`);return}const l=i.data?.data||[];if(!Array.isArray(l)||l.length===0){z.warn("[updateProductField] Products data is empty or invalid");return}const u=s.state.get()||{},d=u.modules?.["sirsoft-ecommerce"]?.language_currency?.currencies;let g=[...u._local?.productFieldErrors||[]];const f=l.map(C=>{if(String(C.id)===String(t)){const A=C[o];if(typeof n=="object"&&n!==null?JSON.stringify(A)===JSON.stringify(n):String(A)===String(n))return z.log(`[updateProductField] No change for product ${t}.${o}, skipping`),C;let L=n;const R=parseFloat(n)||0;if(o==="selling_price"){const F=parseFloat(C.list_price)||0;F>0&&R>F?(g.some(oe=>oe.productId===String(t)&&oe.field===o)||g.push({productId:String(t),field:"selling_price",message:"판매가는 정가를 초과할 수 없습니다."}),L=F):g=g.filter($=>!($.productId===String(t)&&$.field===o))}else g=g.filter(F=>!(F.productId===String(t)&&F.field===o));const x={...C,[o]:L,_modified:!0};return o==="selling_price"&&d&&Array.isArray(d)&&(x.multi_currency_selling_price=ae({basePrice:L,currencies:d}),z.log(`[updateProductField] Recalculated multi_currency_selling_price for product ${t}`)),x}return C});s.dataSource.set(a,{...i,data:{...i.data,data:f}});const w=s.state.getLocal()||{},y=new Set(w.modifiedProductIds||[]);y.add(t);const _={...w.modifiedProductFields||{}},p=String(t),S=new Set(_[p]||[]);S.add(o),_[p]=Array.from(S),s.state.setLocal({modifiedProductIds:Array.from(y),modifiedProductFields:_,productFieldErrors:g}),z.log(`[updateProductField] Updated product ${t}.${o} =`,n)}const K=window.G7Core?.createLogger?.("Ecom:UpdateOption")??{log:(...r)=>console.log("[Ecom:UpdateOption]",...r),warn:(...r)=>console.warn("[Ecom:UpdateOption]",...r),error:(...r)=>console.error("[Ecom:UpdateOption]",...r)};function bt(r,c){const e=r.params||{},{productId:t,optionId:o,field:a,value:n,dataSourceId:s="products"}=e;if(!t||!o||!a){K.warn("[updateOptionField] Missing required params:",{productId:t,optionId:o,field:a});return}const i=window.G7Core;if(!i?.dataSource?.get||!i?.dataSource?.set){K.warn("[updateOptionField] G7Core.dataSource API is not available");return}const l=i.dataSource.get(s);if(!l){console.warn(`[updateOptionField] DataSource '${s}' not found`);return}const u=l.data?.data||[];if(!Array.isArray(u)||u.length===0){K.warn("[updateOptionField] Products data is empty or invalid");return}const d=i.state.get()||{},m=d.modules?.["sirsoft-ecommerce"]?.language_currency?.currencies;let f=[...d._local?.optionFieldErrors||[]],w=!1;const y=u.map(L=>{if(String(L.id)===String(t)){const R=L.options||[],x=R.findIndex(D=>String(D.id)===String(o));if(x===-1)return K.warn("[updateOptionField] Option not found:",o),L;const F=R[x],$=F[a];if(typeof n=="object"&&n!==null?JSON.stringify($)===JSON.stringify(n):String($)===String(n))return K.log(`[updateOptionField] No change for option ${o}.${a}, skipping`),L;let le=n;const we=parseFloat(nLine truncated
|
||||
//# sourceMappingURL=module.iife.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"module.iife.js","sources":["../../resources/js/handlers/calculateCurrencyPrices.ts","../../resources/js/handlers/updateProductField.ts","../../resources/js/handlers/updateOptionField.ts","../../resources/js/handlers/initPreferredCurrency.ts","../../resources/js/handlers/initPreferredShippingCountry.ts","../../resources/js/handlers/setDateRange.ts","../../resources/js/handlers/setDefaultOption.ts","../../resources/js/handlers/optionSelection.ts","../../resources/js/handlers/generateCopyProductCode.ts","../../resources/js/handlers/copyProduct.ts","../../resources/js/handlers/categoryHandlers.ts","../../resources/js/handlers/brandHandlers.ts","../../resources/js/handlers/priceHandlers.ts","../../resources/js/handlers/productOptionHandlers.ts","../../resources/js/handlers/optionHandlers.ts","../../resources/js/handlers/imageHandlers.ts","../../resources/js/handlers/descriptionHandlers.ts","../../resources/js/handlers/noticeHandlers.ts","../../resources/js/handlers/miscHandlers.ts","../../resources/js/handlers/labelHandlers.ts","../../resources/js/handlers/descriptionLocaleHandlers.ts","../../resources/js/handlers/bulkUpdateHandlers.ts","../../resources/js/handlers/orderHandlers.ts","../../resources/js/handlers/productListHandlers.ts","../../resources/js/handlers/orderDetailHandlers.ts","../../resources/js/handlers/cancelOrderHandlers.ts","../../resources/js/handlers/userCancelOrderHandlers.ts","../../resources/js/handlers/userConfirmOrderHandlers.ts","../../resources/js/handlers/userChangeShippingAddressHandlers.ts","../../resources/js/handlers/userReviewHandlers.ts","../../resources/js/handlers/shippingPolicyFormHandlers.ts","../../resources/js/handlers/initCategoryFromUrl.ts","../../resources/js/handlers/initBrandFromUrl.ts","../../resources/js/handlers/initCommonInfoFromUrl.ts","../../resources/js/handlers/initNoticeFromUrl.ts","../../resources/js/handlers/index.ts","../../resources/js/index.ts"],"sourcesContent":["// e2e:allow base_unit 환산 공식(÷base_unit) 정확성은 단위 테스트(calculateCurrencyPrices.test.ts: USD base ¥0 회귀 + KRW base 등가)로 전수 검증. 다통화 표시 회귀는 product-option-multicurrency-readonly.spec.ts 가 구조적으로 차단.\n/**\n * 실시간 환율 계산 핸들러\n *\n * 기본 통화 가격을 입력받아 환율 기반으로 다중 통화 가격을 계산합니다.\n * 옵션 가격 인라인 편집 시 외화 가격 실시간 업데이트에 사용됩니다.\n */\n\nimport type { ActionContext } from '../types';\n\ninterface Currency {\n code: string;\n name?: Record<string, string>;\n exchange_rate?: number | null;\n is_default?: boolean;\n rounding_unit?: string;\n rounding_method?: string;\n base_unit?: number;\n symbol?: string;\n decimal_places?: number;\n}\n\n/**\n * 통화 코드별 소수 자릿수 폴백 (설정에 decimal_places 가 없을 때만 사용).\n */\nconst DECIMAL_PLACES_FALLBACK: Record<string, number> = {\n KRW: 0,\n JPY: 0,\n};\n\n/**\n * 통화 코드별 기본 기호 폴백 (설정 symbol 이 비어 있을 때만 사용).\n * 위안화(CNY)는 엔화(¥)와 구분되도록 元 사용 (#402 3-3).\n */\nconst SYMBOL_FALLBACK: Record<string, string> = {\n KRW: '₩',\n USD: '$',\n JPY: '¥',\n CNY: '元',\n EUR: '€',\n GBP: '£',\n};\n\n/**\n * base_unit 미설정 통화의 폴백 (소액 통화만 묶음 단위). 백엔드 CurrencyConversionService 와 동일.\n */\nconst BASE_UNIT_FALLBACK: Record<string, number> = {\n KRW: 1000,\n JPY: 100,\n};\n\n/**\n * 통화의 base_unit(기본 통화일 때 환율 분모가 되는 1단위 금액)을 반환합니다.\n *\n * @param currency 통화 설정\n * @returns base_unit (최소 1)\n */\nfunction resolveBaseUnit(currency: Currency | undefined): number {\n if (!currency) {\n return 1;\n }\n const unit = currency.base_unit ?? BASE_UNIT_FALLBACK[currency.code] ?? 1;\n return Math.max(1, unit);\n}\n\ninterface CurrencyPrice {\n price: number;\n formatted: string;\n is_default: boolean;\n editable: boolean;\n exchange_rate?: number;\n}\n\ninterface CalculateCurrencyPricesParams {\n basePrice: number | string;\n currencies?: Currency[];\n}\n\n/**\n * 절사/반올림/올림을 적용합니다.\n *\n * @param price 가격\n * @param unit 절사 단위\n * @param method 방법 (floor, round, ceil)\n * @returns 처리된 가격\n */\nfunction applyRounding(price: number, unit: string, method: string): number {\n const unitValue = parseFloat(unit) || 1;\n if (unitValue <= 0) {\n return price;\n }\n\n const divided = price / unitValue;\n let rounded: number;\n\n switch (method) {\n case 'ceil':\n rounded = Math.ceil(divided);\n break;\n case 'floor':\n rounded = Math.floor(divided);\n break;\n default:\n rounded = Math.round(divided);\n }\n\n return rounded * unitLine truncated
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* @file admin-ecommerce-settings-tab-scoped-datasources.test.tsx
|
||||
* @description 환경설정 데이터소스 탭 스코프 게이팅 회귀 가드
|
||||
*
|
||||
* 배경: 환경설정 진입 시 모든 탭의 데이터소스를 한꺼번에 fetch 했다(18건). 탭 본문은
|
||||
* `if` 로 게이트되어 비활성 탭은 렌더조차 되지 않으므로, 그 데이터는 아무도 읽지 않는
|
||||
* 순수 낭비다. 게다가 탭 전환(navigate replace:true → updateQueryParams)마다 전수 재fetch 되어
|
||||
* 요청이 2배(36건)로 불어나고 탭 클릭이 1.7초 blocking 됐다.
|
||||
*
|
||||
* 엔진의 기본 메커니즘: 데이터소스의 `if` 를 DataSourceManager.filterByCondition 이 평가해
|
||||
* fetch 대상에서 제외하고, TemplateApp.updateQueryParams 가 탭 전환 시 `if` 를 재평가해
|
||||
* 새 탭의 소스만 fetch 한다. 따라서 탭 전용 소스는 반드시 `if` 게이트를 가져야 하며,
|
||||
* 탭 전환은 navigate + replace:true 로 updateQueryParams 를 태워야 한다(replaceUrl 은
|
||||
* history 만 교체하므로 `if` 재평가가 일어나지 않음).
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
const layout = require('../../../layouts/admin/admin_ecommerce_settings.json');
|
||||
|
||||
interface AnyJson { [k: string]: any }
|
||||
|
||||
/** 모든 탭이 공유하는 소스 (폼 본체) — 항상 fetch */
|
||||
const SHARED_SOURCE_IDS = ['settings'];
|
||||
|
||||
/** 탭 전용 소스 → 소유 탭 */
|
||||
const TAB_SCOPED: Record<string, string[]> = {
|
||||
seoStats: ['seo'],
|
||||
carriers: ['shipping'],
|
||||
ecommerceNotificationDefinitions: ['notification_definitions', 'mileage'],
|
||||
availableChannels: ['notification_definitions'],
|
||||
ecommerceIdentityPolicies: ['identity_policies'],
|
||||
ecommerceIdentityPurposes: ['identity_policies'],
|
||||
identityProviders: ['identity_policies'],
|
||||
};
|
||||
|
||||
const sources: AnyJson[] = layout.data_sources;
|
||||
const byId = (id: string) => sources.find(s => s.id === id);
|
||||
|
||||
describe('admin_ecommerce_settings — 데이터소스 탭 스코프 게이팅', () => {
|
||||
it('공유 소스(settings)는 if 게이트 없이 항상 fetch 된다', () => {
|
||||
for (const id of SHARED_SOURCE_IDS) {
|
||||
const s = byId(id);
|
||||
expect(s).toBeTruthy();
|
||||
expect(s!.if).toBeUndefined();
|
||||
expect(s!.auto_fetch).not.toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it.each(Object.keys(TAB_SCOPED))('탭 전용 소스 %s 는 if 게이트를 가진다', (id) => {
|
||||
const s = byId(id);
|
||||
expect(s).toBeTruthy();
|
||||
expect(typeof s!.if).toBe('string');
|
||||
expect(s!.if.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it.each(Object.entries(TAB_SCOPED))('%s 의 if 가 소유 탭(%s)을 참조한다', (id, tabs) => {
|
||||
const cond: string = byId(id)!.if;
|
||||
for (const tab of tabs as string[]) {
|
||||
expect(cond).toContain(`'${tab}'`);
|
||||
}
|
||||
// 활성 탭 판정에 query.tab 과 _global 을 모두 사용해야 딥링크/클릭 양쪽에서 동작
|
||||
expect(cond).toContain('query.tab');
|
||||
expect(cond).toContain('activeEcommerceSettingsTab');
|
||||
});
|
||||
|
||||
it('탭 전용 소스는 auto_fetch:false 로 죽여두지 않는다 (if 선택 시 fetch 되어야 함)', () => {
|
||||
for (const id of Object.keys(TAB_SCOPED)) {
|
||||
expect(byId(id)!.auto_fetch).not.toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
// 탭 전환은 updateQueryParams 를 태워 `if` 를 재평가해야 한다.
|
||||
// replaceUrl 은 history.replaceState 만 하므로 새 탭의 소스가 영원히 로드되지 않는다.
|
||||
it('탭 전환은 navigate + replace:true 로 수행한다 (replaceUrl 금지)', () => {
|
||||
const seqs: AnyJson[] = [];
|
||||
const walk = (n: any) => {
|
||||
if (!n || typeof n !== 'object') return;
|
||||
if (Array.isArray(n)) { n.forEach(walk); return; }
|
||||
if (n.handler === 'sequence' && Array.isArray(n.params?.actions)) seqs.push(n);
|
||||
Object.values(n).forEach(walk);
|
||||
};
|
||||
walk(layout);
|
||||
|
||||
const tabSwitches = seqs.filter(s =>
|
||||
(s.params.actions as AnyJson[]).some(
|
||||
a => a?.handler === 'setState' && 'activeEcommerceSettingsTab' in (a.params ?? {})
|
||||
)
|
||||
);
|
||||
expect(tabSwitches.length).toBeGreaterThan(0);
|
||||
|
||||
for (const seq of tabSwitches) {
|
||||
const acts = seq.params.actions as AnyJson[];
|
||||
expect(acts.some(a => a.handler === 'replaceUrl')).toBe(false);
|
||||
const nav = acts.find(a => a.handler === 'navigate');
|
||||
expect(nav).toBeTruthy();
|
||||
expect(nav!.params.replace).toBe(true);
|
||||
expect(nav!.params.query?.tab).toBeTruthy();
|
||||
}
|
||||
});
|
||||
});
|
||||
+4
@@ -387,6 +387,9 @@ describe('유효기간 / 소멸 알림 카드', () => {
|
||||
expect(empty).toBeTruthy();
|
||||
});
|
||||
|
||||
// URL 갱신은 navigate + replace:true 로 수행한다 — updateQueryParams 를 거쳐야
|
||||
// 데이터소스의 `if` 가 재평가되어 알림 탭 전용 소스가 로드된다.
|
||||
// 가드: admin-ecommerce-settings-tab-scoped-datasources.test.tsx
|
||||
it('알림 설정으로 이동 버튼이 환경설정 알림 탭으로 전환한다', () => {
|
||||
const btn = findById(notificationCard, 'go_to_notification_settings');
|
||||
const seq = btn.actions[0];
|
||||
@@ -394,6 +397,7 @@ describe('유효기간 / 소멸 알림 카드', () => {
|
||||
const navigate = seq.params.actions.find((a: any) => a.handler === 'navigate');
|
||||
expect(navigate.params.path).toBe('/admin/ecommerce/settings');
|
||||
expect(navigate.params.query.tab).toBe('notification_definitions');
|
||||
expect(navigate.params.replace).toBe(true);
|
||||
const setGlobal = seq.params.actions.find((a: any) => a.handler === 'setState');
|
||||
expect(setGlobal.params.activeEcommerceSettingsTab).toBe('notification_definitions');
|
||||
});
|
||||
|
||||
+7
@@ -56,6 +56,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/modules/sirsoft-ecommerce/admin/settings/seo-cache-info",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'seo'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true
|
||||
},
|
||||
@@ -65,6 +66,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/modules/sirsoft-ecommerce/admin/shipping-carriers",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'shipping'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"errorHandling": {
|
||||
@@ -82,6 +84,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/admin/notification-definitions?extension_type=module&extension_identifier=sirsoft-ecommerce",
|
||||
"method": "GET",
|
||||
"if": "{{['notification_definitions', 'mileage'].includes(query.tab || _global.activeEcommerceSettingsTab || 'basic_info')}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"params": {
|
||||
@@ -117,6 +120,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/admin/notification-channels",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'notification_definitions'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"fallback": {
|
||||
@@ -131,6 +135,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/admin/identity/policies",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'identity_policies'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"params": {
|
||||
@@ -155,6 +160,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/identity/purposes",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'identity_policies'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"fallback": {
|
||||
@@ -167,6 +173,7 @@
|
||||
"type": "api",
|
||||
"endpoint": "/api/admin/identity/providers",
|
||||
"method": "GET",
|
||||
"if": "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'identity_policies'}}",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"fallback": {
|
||||
|
||||
@@ -20,7 +20,9 @@ export default defineConfig({
|
||||
emptyOutDir: true,
|
||||
|
||||
// 소스맵 생성
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
|
||||
rollupOptions: {
|
||||
output: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"identifier": "sirsoft-ckeditor5",
|
||||
"version": "1.0.0-beta.4",
|
||||
"version": "1.0.0",
|
||||
"components": {
|
||||
"basic": [],
|
||||
"composite": [],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var SirsoftCkeditor5=(function(G){"use strict";const E=new Map,Y="https://cdn.ckeditor.com/ckeditor5/43.3.1/ckeditor5.css",Z="https://cdn.ckeditor.com/ckeditor5/43.3.1/translations",N="ckeditor5-cdn-css",H="ckeditor5-dark-override",D="ckeditor5-tab-style",O={minimal:["bold","italic","underline","|","link","uploadImage","|","undo","redo"],standard:["heading","|","bold","italic","underline","strikethrough","|","alignment","|","link","blockQuote","|","bulletedList","numberedList","indent","outdent","|","insertTable","uploadImage","|","undo","redo"],full:["heading","|","fontSize","fontColor","fontBackgroundColor","|","bold","italic","underline","strikethrough","|","alignment","|","link","blockQuote","insertTable","uploadImage","mediaEmbed","horizontalLine","|","bulletedList","numberedList","indent","outdent","|","codeBlock","sourceEditing","|","undo","redo"]};function R(t){if(t==="en")return Promise.resolve();const o=`ckeditor5-translations-${t}`;return document.getElementById(o)?Promise.resolve():new Promise(e=>{const r=document.createElement("script");r.id=o,r.src=`${Z}/${t}.umd.js`,r.onload=()=>e(),r.onerror=()=>e(),document.head.appendChild(r)})}function K(){if(document.getElementById(N))return;const t=document.createElement("link");t.id=N,t.rel="stylesheet",t.href=Y,document.head.appendChild(t)}function tt(){if(document.getElementById(D))return;const t=document.createElement("style");t.id=D,t.textContent=`
|
||||
var SirsoftCkeditor5=function(G){"use strict";const E=new Map,Y="https://cdn.ckeditor.com/ckeditor5/43.3.1/ckeditor5.css",Z="https://cdn.ckeditor.com/ckeditor5/43.3.1/translations",N="ckeditor5-cdn-css",H="ckeditor5-dark-override",D="ckeditor5-tab-style",O={minimal:["bold","italic","underline","|","link","uploadImage","|","undo","redo"],standard:["heading","|","bold","italic","underline","strikethrough","|","alignment","|","link","blockQuote","|","bulletedList","numberedList","indent","outdent","|","insertTable","uploadImage","|","undo","redo"],full:["heading","|","fontSize","fontColor","fontBackgroundColor","|","bold","italic","underline","strikethrough","|","alignment","|","link","blockQuote","insertTable","uploadImage","mediaEmbed","horizontalLine","|","bulletedList","numberedList","indent","outdent","|","codeBlock","sourceEditing","|","undo","redo"]};function R(t){if(t==="en")return Promise.resolve();const o=`ckeditor5-translations-${t}`;return document.getElementById(o)?Promise.resolve():new Promise(e=>{const r=document.createElement("script");r.id=o,r.src=`${Z}/${t}.umd.js`,r.onload=()=>e(),r.onerror=()=>e(),document.head.appendChild(r)})}function K(){if(document.getElementById(N))return;const t=document.createElement("link");t.id=N,t.rel="stylesheet",t.href=Y,document.head.appendChild(t)}function tt(){if(document.getElementById(D))return;const t=document.createElement("style");t.id=D,t.textContent=`
|
||||
/* 다국어 탭 컨테이너 */
|
||||
.ckeditor5-locale-tabs {
|
||||
display: flex;
|
||||
@@ -369,5 +369,4 @@ var SirsoftCkeditor5=(function(G){"use strict";const E=new Map,Y="https://cdn.ck
|
||||
.ck-content ul ul ul { list-style-type: square; padding-left: 2em; }
|
||||
.ck-content ol ol { list-style-type: lower-alpha; padding-left: 2em; }
|
||||
.ck-content ol ol ol { list-style-type: lower-roman; padding-left: 2em; }
|
||||
`,document.head.appendChild(t)}}const v={initEditor:ut,destroyEditor:ft,injectContentCss:mt},z=window.G7Core?.createLogger?.(`Plugin:${m}`)??{log:(...t)=>console.log(`[Plugin:${m}]`,...t),warn:(...t)=>console.warn(`[Plugin:${m}]`,...t),error:(...t)=>console.error(`[Plugin:${m}]`,...t)};function Q(t=!1){const o=window.G7Core?.getActionDispatcher?.();if(o)Object.entries(v).forEach(([e,r])=>{const c=`${m}.${e}`;o.registerHandler(c,r,{category:"plugin",source:m})}),z.log(`${Object.keys(v).length} handler(s) registered:`,Object.keys(v).map(e=>`${m}.${e}`));else if(t){let e=0;const r=50,c=()=>{const l=window.G7Core?.getActionDispatcher?.();l?(Object.entries(v).forEach(([i,s])=>{const b=`${m}.${i}`;l.registerHandler(b,s,{category:"plugin",source:m})}),z.log(`${Object.keys(v).length} handler(s) registered:`,Object.keys(v).map(i=>`${m}.${i}`))):(e++,e<=r?(z.warn(`ActionDispatcher not found, retrying... (${e}/${r})`),setTimeout(c,100)):z.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};c()}else z.warn("ActionDispatcher not found, handlers not registered")}function j(){if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>Q(!0));else{const t=!!window.G7Core?.getActionDispatcher?.();Q(!t)}}return j(),typeof window<"u"&&(window.__SirsoftCkeditor5={identifier:m,handlers:Object.keys(v),initPlugin:j}),G.initPlugin=j,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),G})({});
|
||||
//# sourceMappingURL=plugin.iife.js.map
|
||||
`,document.head.appendChild(t)}}const v={initEditor:ut,destroyEditor:ft,injectContentCss:mt},z=window.G7Core?.createLogger?.(`Plugin:${m}`)??{log:(...t)=>console.log(`[Plugin:${m}]`,...t),warn:(...t)=>console.warn(`[Plugin:${m}]`,...t),error:(...t)=>console.error(`[Plugin:${m}]`,...t)};function Q(t=!1){const o=window.G7Core?.getActionDispatcher?.();if(o)Object.entries(v).forEach(([e,r])=>{const c=`${m}.${e}`;o.registerHandler(c,r,{category:"plugin",source:m})}),z.log(`${Object.keys(v).length} handler(s) registered:`,Object.keys(v).map(e=>`${m}.${e}`));else if(t){let e=0;const r=50,c=()=>{const l=window.G7Core?.getActionDispatcher?.();l?(Object.entries(v).forEach(([i,s])=>{const b=`${m}.${i}`;l.registerHandler(b,s,{category:"plugin",source:m})}),z.log(`${Object.keys(v).length} handler(s) registered:`,Object.keys(v).map(i=>`${m}.${i}`))):(e++,e<=r?(z.warn(`ActionDispatcher not found, retrying... (${e}/${r})`),setTimeout(c,100)):z.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};c()}else z.warn("ActionDispatcher not found, handlers not registered")}function j(){if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>Q(!0));else{const t=!!window.G7Core?.getActionDispatcher?.();Q(!t)}}return j(),typeof window<"u"&&(window.__SirsoftCkeditor5={identifier:m,handlers:Object.keys(v),initPlugin:j}),G.initPlugin=j,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),G}({});
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"plugin.iife.js","sources":["../../resources/js/handlers/editorInstances.ts","../../resources/js/handlers/initEditor.ts","../../resources/js/handlers/destroyEditor.ts","../../resources/js/index.ts"],"sourcesContent":["/**\n * CKEditor5 인스턴스 공유 저장소\n *\n * containerId → locale별 에디터 인스턴스 맵을 관리합니다.\n * initEditor / destroyEditor 핸들러가 공유합니다.\n */\n\n// containerId → Map<locale, editorInstance>\nexport const editorInstances = new Map<string, Map<string, unknown>>();\n\n// setData() 중 change:data → syncToForm 재진입 방지 플래그\nlet _syncSuppressed = false;\nexport function isSyncSuppressed(): boolean {\n return _syncSuppressed;\n}\nexport function setSyncSuppressed(value: boolean): void {\n _syncSuppressed = value;\n}\n","/**\n * CKEditor5 초기화 핸들러\n *\n * 컴포넌트 마운트 시 CKEditor5 인스턴스를 생성합니다.\n * 다국어(multilingual) 모드: locale별 탭 + 인스턴스 생성\n * 단일 모드: 단일 인스턴스 생성\n */\n\nimport { editorInstances, isSyncSuppressed } from './editorInstances';\n\n/** CKEditor5 CDN CSS URL */\nconst CKEDITOR5_CSS_URL = 'https://cdn.ckeditor.com/ckeditor5/43.3.1/ckeditor5.css';\n/** CKEditor5 CDN 번역 파일 base URL */\nconst CKEDITOR5_TRANSLATIONS_BASE = 'https://cdn.ckeditor.com/ckeditor5/43.3.1/translations';\n/** CKEditor5 CSS 로드 상태 추적용 엘리먼트 ID */\nconst CKEDITOR5_CSS_ID = 'ckeditor5-cdn-css';\n/** CKEditor5 다크 모드 CSS 엘리먼트 ID */\nconst CKEDITOR5_DARK_CSS_ID = 'ckeditor5-dark-override';\n/** CKEditor5 다국어 탭 기본 CSS 엘리먼트 ID */\nconst CKEDITOR5_TAB_CSS_ID = 'ckeditor5-tab-style';\n\n/** CKEditor 전역 객체 타입 (CDN UMD 빌드 — window.CKEDITOR) */\ninterface CKEditorGlobal {\n ClassicEditor: any;\n Essentials: any;\n Bold: any;\n Italic: any;\n Underline: any;\n Strikethrough: any;\n Link: any;\n Paragraph: any;\n Heading: any;\n BlockQuote: any;\n List: any;\n Alignment: any;\n Table: any;\n TableToolbar: any;\n TableProperties: any;\n TableCellProperties: any;\n Image: any;\n ImageUpload: any;\n ImageResize: any;\n ImageStyle: any;\n ImageCaption: any;\n ImageToolbar: any;\n SimpleUploadAdapter: any;\n MediaEmbed: any;\n HorizontalLine: any;\n Indent: any;\n IndentBlock: any;\n CodeBlock: any;\n SourceEditing: any;\n FontSize: any;\n FontColor: any;\n FontBackgroundColor: any;\n PasteFromOffice: any;\n GeneralHtmlSupport: any;\n}\n\n/** initEditor 파라미터 타입 */\ninterface InitEditorParams {\n name?: string;\n content?: string;\n multilingual?: boolean | string;\n placeholder?: string;\n readOnly?: boolean | string;\n imageUpload?: boolean | string;\n uploadPermission?: string;\n height?: number | string;\n toolbar?: string;\n}\n\n/** 툴바 프리셋 */\nconst TOOLBAR_PRESETS: Record<string, string[]> = {\n minimal: [\n 'bold', 'italic', 'underline', '|',\n 'link', 'uploadImage', '|',\n 'undo', 'redo',\n ],\n standard: [\n 'heading', '|',\n 'bold', 'italic', 'underline', 'strikethrough', '|',\n 'alignment', '|',\n 'link', 'blockQuote', '|',\n 'bulletedList', 'numberedList', 'indent', 'outdent', '|',\n 'insertTable', 'uploadImage', '|',\n 'undo', 'redo',\n ],\n full: [\n 'heading', '|',\n 'fontSize', 'fontColor', 'fontBackgroundColor', '|',\n 'bold', 'italic', 'underline', 'strikethrough', '|',\n 'alignment', '|',\n 'link', 'blockQuote', 'insertTable', 'uploadImage', 'mediaEmbed', 'horizontalLine', '|',\n 'bulletedList', 'numberedList', 'indent', 'outdent', '|',\n 'codeBlock', 'sourceEditing', '|',\n 'undo', 'redo',\n ],\n};\n\n/**\n * CKEditor5 번역 스크립트를 동적으로 로드합니다.\n * 영어(en)는 기본 내장이므로 로드하지 않습니다.\n */\nfunction loadCkeditorTranslations(locale: string): Promise<void> {\n if (locale === 'en') return Promise.resolve();\n const id = `ckeditor5-translations-${locale}`;\n if (document.getElementById(id)) return Promise.resolve();\n return new Promise((resolve) => {\n const script = document.createElement('script');\n script.id = id;\n script.src = `${CKEDITOR5_TRANSLATIONS_BASE}/${locale}.umd.js`;\n script.onload = () => resolve();\n script.onerror = () => resolve(); // 번역 실패해도 에디터는 영어로 동작\n document.head.appendChild(script);\n });\n}\n\n/**\n * CKEditor5 CSS를 동적으로 로드합니다.\n * 이미 로드된 경우 중복 삽입하지 않습니다.\n */\nfunction loadCkeditorCss(): void {\n if (document.getElementById(CKEDITOR5_CSS_ID)) {\n return;\n }\n const link = document.createElement('link');\n link.id = CKEDITOR5_CSSLine truncated
|
||||
@@ -16,7 +16,9 @@ export default defineConfig({
|
||||
|
||||
outDir: 'dist',
|
||||
emptyOutDir: true,
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
|
||||
rollupOptions: {
|
||||
output: {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"identifier": "sirsoft-daum_postcode",
|
||||
"version": "1.0.0",
|
||||
"components": {
|
||||
"basic": [],
|
||||
"composite": [],
|
||||
"layout": []
|
||||
}
|
||||
}
|
||||
@@ -34,4 +34,3 @@ var SirsoftDaumPostcode=function(m){"use strict";const y=window.G7Core?.createLo
|
||||
justify-content: center;
|
||||
z-index: 10;
|
||||
`;const r=document.createElement("div");r.style.cssText="position: relative;",r.appendChild(n),r.appendChild(t),o.appendChild(r),document.body.appendChild(o);const s=()=>{o.parentNode&&o.parentNode.removeChild(o)};n.addEventListener("click",s),o.addEventListener("click",l=>{l.target===o&&s()});const i=l=>{l.key==="Escape"&&(s(),document.removeEventListener("keydown",i))};return document.addEventListener("keydown",i),a.log("[openPostcode] Layer created with size:",{width:e,height:c}),{overlay:o,layer:t,closeLayer:s}}function L(e,c,o){const t=window.G7Core;if(!t?.dispatch){a.error("[openPostcode] G7Core.dispatch not available");return}const n=o?.state||t?.state?.getLocal?.()||{},r={state:n,setState:o?.setState,data:{...o?.data||{},_local:n,$event:c},isolatedContext:o?.isolatedContext};a.log("[openPostcode] Dispatching with componentContext:",{hasLocalState:!!n,sourceType:o?.state?"handlerContext":"getLocal",localCheckout:n?.checkout,event:c});try{const s=Array.isArray(e)?e:[e];for(const i of s)i&&typeof i=="object"&&(a.log("[openPostcode] Dispatching action:",i),t.dispatch(i,{componentContext:r}))}catch(s){a.error("[openPostcode] callbackAction failed:",s)}}function S(e,c){const o=window.G7Core;if(!o?.state?.setLocal){a.error("[openPostcode] G7Core.state.setLocal not available");return}const t={};e.zipcode&&(t[e.zipcode]=c.zipcode),e.address&&(t[e.address]=c.address),e.region&&(t[e.region]=c.region),e.city&&(t[e.city]=c.city),a.log("[openPostcode] Setting local state:",t),o.state.setLocal(t)}const p={setFieldReadOnly:C,openPostcode:x},d="sirsoft-daum_postcode",u=window.G7Core?.createLogger?.(`Plugin:${d}`)??{log:(...e)=>console.log(`[Plugin:${d}]`,...e),warn:(...e)=>console.warn(`[Plugin:${d}]`,...e),error:(...e)=>console.error(`[Plugin:${d}]`,...e)};function P(e=!1){const c=window.G7Core?.getActionDispatcher?.();if(c)Object.entries(p).forEach(([o,t])=>{const n=`${d}.${o}`;c.registerHandler(n,t,{category:"plugin",source:d})}),u.log(`${Object.keys(p).length} handler(s) registered:`,Object.keys(p).map(o=>`${d}.${o}`));else if(e){let o=0;const t=50,n=()=>{const r=window.G7Core?.getActionDispatcher?.();r?(Object.entries(p).forEach(([s,i])=>{const l=`${d}.${s}`;r.registerHandler(l,i,{category:"plugin",source:d})}),u.log(`${Object.keys(p).length} handler(s) registered:`,Object.keys(p).map(s=>`${d}.${s}`))):(o++,o<=t?(u.warn(`ActionDispatcher not found, retrying... (${o}/${t})`),setTimeout(n,100)):u.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};n()}else u.warn("ActionDispatcher not found, handlers not registered")}function w(){if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>P(!0));else{const e=!!window.G7Core?.getActionDispatcher?.();P(!e)}}return w(),typeof window<"u"&&(window.__SirsoftDaumPostcode={identifier:d,handlers:Object.keys(p),initPlugin:w}),m.initPlugin=w,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}),m}({});
|
||||
//# sourceMappingURL=plugin.iife.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"plugin.iife.js","sources":["../../resources/js/handlers/setFieldReadOnly.ts","../../resources/js/handlers/openPostcode.ts","../../resources/js/handlers/index.ts","../../resources/js/index.ts"],"sourcesContent":["/**\n * setFieldReadOnly 핸들러\n *\n * 지정된 필드명의 input 요소를 찾아 readOnly 속성을 설정합니다.\n * 주소 검색 플러그인이 설치된 경우, 우편번호/주소 필드를 readOnly로 설정하여\n * 사용자가 직접 입력하지 못하도록 합니다.\n */\n\nimport type { ActionContext } from '../types';\n\n// Logger 설정 (G7Core 초기화 전에도 동작하도록 폴백 포함)\nconst logger = ((window as any).G7Core?.createLogger?.('DaumPostcode:SetFieldReadOnly')) ?? {\n log: (...args: unknown[]) => console.log('[DaumPostcode:SetFieldReadOnly]', ...args),\n warn: (...args: unknown[]) => console.warn('[DaumPostcode:SetFieldReadOnly]', ...args),\n error: (...args: unknown[]) => console.error('[DaumPostcode:SetFieldReadOnly]', ...args),\n};\n\ninterface ActionWithParams {\n handler: string;\n params?: {\n /** readOnly로 설정할 필드명 배열 */\n fields?: string[];\n /** readOnly 값 (기본값: true) */\n readOnly?: boolean;\n };\n [key: string]: any;\n}\n\n/**\n * 지정된 필드명의 input 요소를 찾아 readOnly 속성을 설정합니다.\n *\n * @param action 액션 객체 (params.fields: 필드명 배열, params.readOnly: boolean)\n * @param _context 액션 컨텍스트\n *\n * @example\n * // 레이아웃 JSON에서 사용\n * {\n * \"handler\": \"sirsoft-daum_postcode.setFieldReadOnly\",\n * \"params\": {\n * \"fields\": [\"zonecode\", \"address\"],\n * \"readOnly\": true\n * }\n * }\n */\nexport function setFieldReadOnlyHandler(\n action: ActionWithParams,\n _context: ActionContext\n): void {\n const params = action.params || {};\n const fields = params.fields || [];\n const readOnly = params.readOnly !== false; // 기본값 true\n\n if (!fields.length) {\n logger.warn('[setFieldReadOnly] No fields specified');\n return;\n }\n\n logger.log(`[setFieldReadOnly] Setting readOnly=${readOnly} for fields:`, fields);\n\n // 각 필드에 대해 DOM에서 input 요소를 찾아 readOnly 설정\n fields.forEach((fieldName) => {\n // name 속성으로 input 요소 찾기\n const inputs = document.querySelectorAll<HTMLInputElement | HTMLTextAreaElement>(\n `input[name=\"${fieldName}\"], textarea[name=\"${fieldName}\"]`\n );\n\n if (inputs.length === 0) {\n logger.warn(`[setFieldReadOnly] No input found with name=\"${fieldName}\"`);\n return;\n }\n\n inputs.forEach((input) => {\n input.readOnly = readOnly;\n\n // readOnly 상태에 따른 시각적 피드백 (선택적)\n if (readOnly) {\n input.classList.add('readonly');\n } else {\n input.classList.remove('readonly');\n }\n\n logger.log(`[setFieldReadOnly] Set readOnly=${readOnly} on input[name=\"${fieldName}\"]`);\n });\n });\n}\n","/**\n * openPostcode 핸들러\n *\n * 다음 우편번호 API를 호출하고 G7 표준 형식으로 변환하여 콜백 실행\n * - callbackAction 있으면: 커스텀 동작 실행 (Extension Point에서 정의한 onAddressSelect)\n * - callbackAction 없으면: 플러그인 기본 동작 (설정 기반 setState)\n *\n * G7 표준 주소 이벤트 형식:\n * - zipcode: 우편번호\n * - address: 기본 주소 (도로명/지번)\n * - addressDetail: 상세 주소 (사용자 입력)\n * - region: 시/도\n * - city: 시/군/구\n * - countryCode: 국가 코드\n * - _raw: 원본 다음 API 응답 (필요 시 접근 가능)\n */\n\nimport type { ActionContext } from '../types';\n\n// Logger 설정 (G7Core 초기화 전에도 동작하도록 폴백 포함)\nconst logger = ((window as any).G7Core?.createLogger?.('DaumPostcode:OpenPostcode')) ?? {\n log: (...args: unknown[]) => console.log('[DaumPostcode:OpenPostcode]', ...args),\n warn: (...args: unknown[]) => console.warn('[DaumPostcode:OpenPostcode]', ...args),\n error: (...args: unknown[]) => console.error('[DaumPostcode:OpenPostcode]', ...args),\n};\n\ninterface ActionWithParams {\n handler: string;\n params?: {\n /** 주소 선택 시 실행할 콜백 액션 (Extension Point props에서 전달) */\n callbackAction?: any;\n /** 표시 모드 (popup | layer) */\n displayMode?: string;\n /** 팝업/레이어 너비 */\n width?: number;\n /** 팝업/레이어 높이 */\n height?: number;\n /** 테마 설정 */\n theme?: {\n searchBgColor?: string;\n queryTextColor?: string;\n };\n /** 대상 필드 매핑 (기본 동작 시 사용) */\n targetFields?: {\n zipcode?: string;\nLine truncated
|
||||
@@ -20,7 +20,9 @@ export default defineConfig({
|
||||
emptyOutDir: true,
|
||||
|
||||
// 소스맵 생성
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
|
||||
rollupOptions: {
|
||||
output: {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"identifier": "sirsoft-gdpr",
|
||||
"version": "1.0.0",
|
||||
"components": {
|
||||
"basic": [],
|
||||
"composite": [],
|
||||
"layout": []
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
.gdpr-hidden{display:none!important}.gdpr-blocked-embed{display:none}.gdpr-blocked-embed[data-gdpr-blocked-category]:not([aria-hidden=true]){display:inline-flex;align-items:center;justify-content:center;min-height:1.5rem;padding:.25rem .5rem;font-size:.75rem;color:#6b7280;background-color:#f9fafb;border:1px dashed #d1d5db;border-radius:.25rem}@media (prefers-color-scheme: dark){.gdpr-blocked-embed[data-gdpr-blocked-category]:not([aria-hidden=true]){color:#9ca3af;background-color:#1f293780;border-color:#4b5563}}.dark .gdpr-blocked-embed[data-gdpr-blocked-category]:not([aria-hidden=true]){color:#9ca3af;background-color:#1f293780;border-color:#4b5563}
|
||||
.gdpr-hidden{display:none!important}.gdpr-blocked-embed{display:none}.gdpr-blocked-embed[data-gdpr-blocked-category]:not([aria-hidden=true]){display:inline-flex;align-items:center;justify-content:center;min-height:1.5rem;padding:.25rem .5rem;font-size:.75rem;color:#6b7280;background-color:#f9fafb;border:1px dashed #d1d5db;border-radius:.25rem}@media(prefers-color-scheme:dark){.gdpr-blocked-embed[data-gdpr-blocked-category]:not([aria-hidden=true]){color:#9ca3af;background-color:#1f293780;border-color:#4b5563}}.dark .gdpr-blocked-embed[data-gdpr-blocked-category]:not([aria-hidden=true]){color:#9ca3af;background-color:#1f293780;border-color:#4b5563}
|
||||
@@ -1,2 +1 @@
|
||||
(function(){"use strict";function Q(e,t){const n=e.toLowerCase(),r=t.toLowerCase();if(r.startsWith("*.")){const o=r.slice(1);return n.endsWith(o)&&n!==o.slice(1)}return n===r}function v(e,t){if(typeof window>"u"||typeof URL>"u")return null;let n,r;try{const o=new URL(e,window.location.href);r=o.protocol,n=o.hostname}catch{return null}if(r!=="http:"&&r!=="https:"||n===""||n===window.location.hostname)return null;for(const[o,s]of Object.entries(t))if(o!=="necessary"){for(const i of s)if(Q(n,i))return o}return null}const w="data-gdpr-category",h="gdpr-blocked-embed",x="data-gdpr-original",b=[`script[${w}]`,`iframe[${w}]`,"script[src]","iframe[src]","img[src]","link[href]"].join(", ");let l=null,g={categories:{},needs_renewal:!1},R={};function j(e){if(e&&typeof e=="object"&&"categories"in e){const t=e;return{categories:{...t.categories},needs_renewal:t.needs_renewal===!0}}return{categories:{...e},needs_renewal:!1}}function N(e){g=j(e),l!==null&&p()}function V(e){R={...e},l!==null&&p()}function Z(){typeof document>"u"||l!==null||(p(),l=new MutationObserver(e=>{for(const t of e)t.addedNodes.forEach(n=>{n instanceof HTMLElement&&te(n)})}),l.observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("gdpr:consent-changed",ee))}function ee(e){const t=e.detail;t!==null&&typeof t=="object"&&(g=j(t)),p()}function te(e){re(e)&&k(e),e.querySelectorAll(b).forEach(t=>k(t))}function p(){typeof document>"u"||(document.querySelectorAll(`.${h}`).forEach(e=>{const t=e.dataset.gdprBlockedCategory;t&&_(t)&&oe(e)}),document.querySelectorAll(b).forEach(e=>k(e)))}function k(e){if(e.classList.contains(h)||e.hasAttribute("data-gdpr-blocked-category"))return;const t=e.getAttribute(w);if(t!==null&&t!==""){if(_(t))return;H(e,t);return}const n=ne(e);if(n===null)return;const r=v(n,R);r!==null&&(_(r)||H(e,r))}function ne(e){return e instanceof HTMLScriptElement||e instanceof HTMLIFrameElement||e instanceof HTMLImageElement?e.getAttribute("src"):e instanceof HTMLLinkElement?e.getAttribute("href"):null}function re(e){if(typeof e.matches!="function")return!1;try{return e.matches(b)}catch{return!1}}function H(e,t){const n=document.createElement("div");n.className=h,n.dataset.gdprBlockedCategory=t,n.dataset.gdprOriginalTag=e.tagName.toLowerCase(),n.setAttribute(x,e.outerHTML),n.setAttribute("aria-hidden","true"),n.style.display="none",e.replaceWith(n)}function oe(e){const t=e.getAttribute(x);if(!t){e.remove();return}const n=document.createElement("div");n.innerHTML=t;const r=n.firstElementChild;r!==null?e.replaceWith(r):e.remove()}function _(e){return e==="necessary"?!0:g.needs_renewal?!1:g.categories[e]===!0}const se=500,ie=["click","keydown","change","submit","pointerdown","touchstart"];let B=!1,C=0;function ce(e){e.isTrusted&&(C=Date.now())}function ae(){if(!B){B=!0;for(const e of ie){const t=ce;window.addEventListener(e,t,{capture:!0,passive:!0})}}}function M(){const e=window.event;return e&&e.isTrusted?!0:C===0?!1:Date.now()-C<=se}const u=["XSRF-TOKEN","laravel_session","laravel_maintenance","gdpr_session"];let A=!1,a=null,y={functionalConsented:!1,necessaryAllowlist:u};function le(e){const t=e.indexOf("=");return t<=0?null:e.substring(0,t).trim()}function ue(e){return y.necessaryAllowlist.includes(e)}function fe(e){const t=le(e);return t===null?!1:!!(de(e)||ue(t)||y.functionalConsented||M())}function de(e){const t=e.toLowerCase(),n=t.match(/max-age\s*=\s*(-?\d+)/);return!!(n&&parseInt(n[1],10)<=0||t.includes("expires=thu, 01 jan 1970")||t.includes("expires=thu, 01-jan-1970"))}function ge(e){if(A)return;if(A=!0,y=e,a=Object.getOwnPropertyDescriptor(Document.prototype,"cookie")??null,!a||!a.set||!a.get){A=!1;return}const t=a.set,n=a.get;Object.defineProperty(Document.prototype,"cookie",{configurable:!0,get(){return n.call(this)},set(r){fe(r)&&t.call(this,r)}})}function P(e){y=e}const f=[{key:"g7_locale",storage:"localStorage",matchType:"exact"},{key:"auth_token",storage:"localStorage",matchType:"exact"},{key:"g7_cache_version",storage:"localStorage",matchType:"exact"},{key:"g7_cart_key",storage:"localStorage",matchType:"exact"},{key:"g7-devtools-panel",storage:"localStorage",matchType:"exact"},{key:"g7_devtools_",matchType:"prefix"},{key:"g7_filters_",matchType:"prefix"},{key:"g7_columns_",matchType:"prefix"},{key:"g7_order_",matchType:"prefix"}];let $=!1,E=null,m={functionalConsented:!1,necessaryAllowlist:f};function pe(e,t){for(const n of m.necessaryAllowlist){if(n.storage&&n.storage!==t)continue;const r=n.matchType??"exact";if(r==="exact"&&n.key===e||r==="prefix"&&e.startsWith(n.key))return!0}return!1}function ye(e,t){return!!(pe(e,t)||m.functionalConsented||M())}function me(e){if($)return;$=!0,m=e;const t=Storage.prototype;E=t.setItem,t.setItem=function(n,r){const o=this===window.sessionStorage?"sessionStorage":"localStorage";ye(n,o)&&E&&E.call(this,n,r)}}function G(e){m=e}function we(e,t,n){for(const r of n){if(r.storage&&r.storage!==t)continue;const o=r.matchType??"exact";if(o==="exact"&&r.key===e||o==="prefixLine truncated
|
||||
//# sourceMappingURL=plugin.iife.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"plugin.iife.js","sources":["../../resources/js/blocker-domains.ts","../../resources/js/blocker.ts","../../resources/js/userInitiatedTracker.ts","../../resources/js/cookieInterceptor.ts","../../resources/js/storageInterceptor.ts","../../resources/js/functionalCleaner.ts","../../resources/js/layouts.ts","../../resources/js/preblocker.ts","../../resources/js/index.ts"],"sourcesContent":["/**\n * GDPR 도메인 기반 차단 매칭 + 기본 카탈로그\n *\n * 운영자가 카테고리별 차단 도메인 목록을 관리하면 `data-gdpr-category` 속성\n * 없이도 외부 추적 리소스를 동의 전 차단합니다. 매칭 알고리즘은 endsWith 기반\n * 으로 정규식을 쓰지 않아 일반 페이지 영향이 미미합니다.\n *\n * @module sirsoft-gdpr/blocker-domains\n */\n\n/**\n * 호스트가 차단 도메인 패턴과 매칭되는지 확인합니다.\n *\n * 패턴 형식:\n * - 정확 매칭: `google-analytics.com` → `google-analytics.com` 만 매칭\n * - 와일드카드: `*.hotjar.com` → `static.hotjar.com` 등 매칭. `hotjar.com`\n * 자체는 매칭 안 됨 (정확 매칭으로 별도 추가 필요)\n *\n * @param host 검사 대상 호스트\n * @param pattern 차단 패턴\n * @return 매칭 여부\n */\nexport function matchesDomain(host: string, pattern: string): boolean {\n const lowerHost = host.toLowerCase();\n const lowerPattern = pattern.toLowerCase();\n\n if (lowerPattern.startsWith('*.')) {\n const suffix = lowerPattern.slice(1); // \".hotjar.com\"\n return lowerHost.endsWith(suffix) && lowerHost !== suffix.slice(1);\n }\n\n return lowerHost === lowerPattern;\n}\n\n/**\n * URL 의 호스트가 카테고리별 차단 목록에 매칭되는지 확인합니다.\n *\n * 동일 origin 은 차단 대상 외 (운영자 자체 자산 보호). `data:`/`blob:` 등 비\n * HTTP 스킴은 외부 호스트가 없으므로 차단 대상 외. `necessary` 카테고리는\n * 매칭 자체를 skip 합니다 (필수 쿠키 보호).\n *\n * @param url 검사 대상 URL (절대 또는 상대)\n * @param patterns 카테고리 → 도메인 패턴 배열\n * @return 매칭된 카테고리, 매칭 없으면 null\n */\nexport function categorizeUrl(\n url: string,\n patterns: Record<string, readonly string[]>,\n): string | null {\n if (typeof window === 'undefined' || typeof URL === 'undefined') return null;\n\n let host: string;\n let protocol: string;\n try {\n const parsed = new URL(url, window.location.href);\n protocol = parsed.protocol;\n host = parsed.hostname;\n } catch {\n return null;\n }\n\n if (protocol !== 'http:' && protocol !== 'https:') return null;\n if (host === '' || host === window.location.hostname) return null;\n\n for (const [category, domains] of Object.entries(patterns)) {\n if (category === 'necessary') continue;\n for (const domain of domains) {\n if (matchesDomain(host, domain)) return category;\n }\n }\n\n return null;\n}\n\n/**\n * 기본 차단 도메인 카탈로그 — 운영자가 `blocked_domains_default_catalog = true`\n * 로 켜야 적용. 운영자 커스텀 목록과 합집합으로 병합됩니다.\n *\n * 카탈로그 갱신은 코드 PR 로만 가능. 사용자별 변경 불가.\n */\nexport const DEFAULT_BLOCKED_DOMAINS: Record<string, readonly string[]> = {\n // functional 카테고리는 자체 호스팅 functional 만 처리 — 외부 도구 도메인은 Phase 2 에서 보강.\n // 현재 빈 배열로 두어 운영자가 admin UI 의 functional 차단 도메인 섹션을 사용할 수 있도록 함.\n functional: [],\n analytics: [\n // Google Analytics 계열\n 'google-analytics.com',\n '*.google-analytics.com',\n 'googletagmanager.com',\n '*.googletagmanager.com',\n 'ssl.google-analytics.com',\n // 행동 분석\n '*.hotjar.com',\n 'static.hotjar.com',\n '*.mixpanel.com',\n 'cdn.mxpnl.com',\n '*.amplitude.com',\n 'cdn.amplitude.com',\n '*.segment.io',\n '*.segment.com',\n // 한국 분석 도구\n 'wcs.naver.net',\n 'wcs.naver.com',\n '*.beusable.net',\n ],\n marketing: [\n // Meta (Facebook)\n 'facebook.net',\n 'connect.facebook.net',\n 'facebook.com',\n '*.facebook.com',\n // Google Ads\n 'doubleclick.net',\n '*.doubleclick.net',\n 'googleadservices.com',\n 'googlesyndication.com',\n 'ads.google.com',\n // 광고 네트워크\n '*.criteo.com',\n 'static.criteo.net',\n '*.adnxs.com',\n '*.taboola.com',\n 'cdn.taboola.com',\n '*.outbrain.com',\n // 한국 광고 네트워크\n '*.kakao.com',\n 'analytics.ad.daum.net',\n // SNS 임베드\n 'platform.twitter.com',\n '*.twitter.comLine truncated
|
||||
@@ -19,7 +19,9 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
minify: 'esbuild',
|
||||
target: 'es2020',
|
||||
chunkSizeWarningLimit: 500,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"identifier": "sirsoft-pay_kginicis",
|
||||
"version": "1.0.0",
|
||||
"components": {
|
||||
"basic": [],
|
||||
"composite": [],
|
||||
"layout": []
|
||||
}
|
||||
}
|
||||
@@ -88,4 +88,3 @@
|
||||
</main>
|
||||
</body>
|
||||
</html>`),t.document.close()}function S(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const F="sirsoft-pay_kginicis",Le="__kginicisOrderShowInjectorInstalled",W="kginicis-mp-receipt-row",Ke=/^(?:\/mypage\/orders\/([^/]+)|\/shop\/guest\/orders\/([^/]+))$/,q=new Map;function on(e){try{const n=window.G7Core?.getState,o=n?.()?.currentDataContext?.order?.data;return o&&(o.order_number===e||o.id!==void 0&&String(o.id)===e)?o:null}catch{return null}}function an(){const e=document.getElementById("order_payment_info_panel");if(e)return Array.from(e.children).find(r=>r.className?.includes("space-y"))??e;const t=Array.from(document.querySelectorAll("h3")).find(r=>{const i=r.textContent?.trim()??"";return i.includes("결제 정보")||/^Payment Information$/i.test(i)});if(!t)return null;const n=t.parentElement?.parentElement;return n?Array.from(n.children).find(r=>r.className?.includes("space-y"))??n:null}function sn(e,t){if(!t)return!1;const n=Array.from(e.querySelectorAll("div"));for(const r of n){const i=Array.from(r.children).filter(s=>s instanceof HTMLElement&&s.tagName==="SPAN");if(i.length<2)continue;const o=i[0].textContent?.trim();if(o!=="결제 방법"&&o!=="결제수단"&&o!=="Payment Method")continue;const a=i[i.length-1];return a.textContent?.trim()===t?(r.dataset.kginicisPaymentMethodRow="true",!0):(a.textContent=t,a.dataset.kginicisPaymentMethodPatched="true",r.dataset.kginicisPaymentMethodRow="true",!0)}return!1}function cn(e,t){const n=document.createElement("div");n.id=W,n.className="flex items-center justify-between",n.dataset.kginicisReceiptRow="mypage-order";const r=document.createElement("span");r.className="text-gray-500 dark:text-gray-400 text-sm",r.textContent=nn(t);const i=document.createElement("button");return i.type="button",i.dataset.kginicisReceiptButton="mypage-order",i.className="inline-flex items-center gap-1 text-sm text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-50",i.textContent=M(t),i.addEventListener("click",async()=>{i.disabled=!0,i.textContent="로딩 중...";const o=await N(e);i.disabled=!1,i.textContent=M(o??t),v(o)&&Me(o)}),n.appendChild(r),n.appendChild(i),n}async function dn(e,t){const n=on(e),r=n?.payment;if(r&&(r.pg_provider!=="kginicis"||!r.transaction_id))return!0;const i=n?.order_number??(t?e:null);if(!i)return!1;if(!t&&n&&!r)return!0;const o=an();if(!o)return!1;const{status:a,info:s}=await Ne(i);if(!t&&a===404)return!0;const c=r?.payment_status==="paid",l=s?.receipt_type==="cbt_confirmation";if(r&&!c&&!l)return!0;if(!r&&!v(s))return!1;const d=sn(o,s?.payment_method_display_label);return!document.getElementById(W)&&v(s)&&(o.appendChild(cn(i,s)),console.info(`[${F}] receipt button injected on mypage order show`)),d&&console.info(`[${F}] payment method display patched on mypage order show`),!!(document.getElementById(W)||d)}function ln(e,t){if(q.has(e))return;let n=0;const r=window.setInterval(()=>{n++,dn(e,t).then(i=>{(i||n>=30)&&(window.clearInterval(r),q.delete(e))})},400);q.set(e,r)}function un(){const e=location.pathname.match(Ke);if(e){const t=e[1],n=e[2],r=t??n;r&&ln(r,n!==void 0)}}function fn(){if(typeof window>"u")return;const e=window;if(e[Le])return;e[Le]=!0,console.info(`[${F}] mypage order show injector installed`);let t=null;const n=(s=1500)=>{t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null,un()},s)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>n()):n();const r=history.pushState.bind(history);history.pushState=(...s)=>{r(...s),n(600)};const i=history.replaceState.bind(history);history.replaceState=(...s)=>{i(...s),n(600)},window.addEventListener("popstate",()=>n(500));const o=document.getElementById("app")??document.body;new MutationObserver(()=>{Ke.test(location.pathname)&&n(250)}).observe(o,{childList:!0,subtree:!0})}const z="sirsoft-pay_kginicis",Oe="__kginicisAdminPaymentDisplayInjectorInstalled",mn=/^\/admin\/ecommerce\/orders\/([^/]+)$/;function pn(){return localStorage.getItem("auth_token")}async function yn(e){const t=pn();if(!t)return null;try{const n=await fetch(`/api/plugins/${z}/admin/orders/${e}/transaction-status`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"}});if(!n.ok)return null;const r=await n.json();return("data"in r?r.data:r)??null}catch{return null}}function hn(e){return Array.from(e.children).filter(t=>t instanceof HTMLElement)}function gn(e,t){let n=!1;const r=Array.from(e.querySelectorAll("div"));for(const i of r){const o=hn(i),a=o.findIndex(u=>u.textContent?.trim()==="결제수단");if(a<0)continue;const s=o.slice(a+1).find(u=>u.textContent?.trim()&&u.textContent.trim()!=="결제수단");if(!s)continue;const c=o.slice(a+2).find(u=>/^\(.+\)$/.test(u.textContent?.trim()??"")),l=c?.textContent?.trim().replace(/^\(|\)$/g,"")??"",d=l&&t.endsWith(")")?t.replace(/\)$/,`, ${l})`):t;s.textContent?.trim()!==d&&(s.textContent=d,s.dataset.kginicisPaymentMethodPatched="true"),i.dataLine truncated
|
||||
//# sourceMappingURL=plugin.iife.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"plugin.iife.js","sources":["../../resources/js/paymentDomCleanup.ts","../../resources/js/paymentCloseMessageListener.ts","../../resources/js/handlers/requestPayment.ts","../../resources/js/handlers/index.ts","../../resources/js/orderResponseInterceptor.ts","../../resources/js/receiptPopup.ts","../../resources/js/mypageOrderShowInjector.ts","../../resources/js/adminOrderPaymentDisplayInjector.ts","../../resources/js/orderCompleteReceiptInjector.ts","../../resources/js/vbankInfoInjector.ts","../../resources/js/checkoutJpyPaymentMethodRestrictor.ts","../../resources/js/checkoutNaverpayBrandButton.ts","../../resources/js/adminPaymentMethodBrandInjector.ts","../../resources/js/index.ts"],"sourcesContent":["export const KOREAN_PAYMENT_FORM_ID_PREFIX = 'kginicis_pay_form_';\nconst RELOAD_STANDARD_PAY_SDK_KEY = '__sirsoftKginicisReloadStandardPaySdk';\nconst MOBILE_PAYMENT_RETURN_PENDING_KEY = '__sirsoftKginicisMobilePaymentReturnPending';\nconst MOBILE_PAYMENT_RETURN_TTL_MS = 30 * 60 * 1000;\n\nexport function removeKoreanPaymentForms(): number {\n if (typeof document === 'undefined') {\n return 0;\n }\n\n const forms = document.querySelectorAll<HTMLFormElement>(\n `form[id^=\"${KOREAN_PAYMENT_FORM_ID_PREFIX}\"]`,\n );\n\n forms.forEach((form) => form.remove());\n\n return forms.length;\n}\n\nexport function markStandardPaySdkForReload(): void {\n if (typeof window === 'undefined') {\n return;\n }\n\n (window as unknown as Record<string, unknown>)[RELOAD_STANDARD_PAY_SDK_KEY] = true;\n}\n\nexport function consumeStandardPaySdkReloadFlag(): boolean {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const w = window as unknown as Record<string, unknown>;\n const shouldReload = w[RELOAD_STANDARD_PAY_SDK_KEY] === true;\n delete w[RELOAD_STANDARD_PAY_SDK_KEY];\n\n return shouldReload;\n}\n\nexport function resetStandardPaySdk(sdkUrl: string): void {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n return;\n }\n\n (window as any).INIStdPay = undefined;\n\n document\n .querySelectorAll<HTMLScriptElement>(\n `script[src=\"${sdkUrl}\"], script[src*=\"/INIStdPay_third-party.js\"]`,\n )\n .forEach((script) => script.remove());\n}\n\nexport function markMobilePaymentReturnPending(now = Date.now()): void {\n if (typeof window === 'undefined') {\n return;\n }\n\n try {\n window.sessionStorage.setItem(MOBILE_PAYMENT_RETURN_PENDING_KEY, String(now));\n } catch {\n (window as unknown as Record<string, unknown>)[MOBILE_PAYMENT_RETURN_PENDING_KEY] = now;\n }\n}\n\nexport function clearMobilePaymentReturnPending(): void {\n if (typeof window === 'undefined') {\n return;\n }\n\n try {\n window.sessionStorage.removeItem(MOBILE_PAYMENT_RETURN_PENDING_KEY);\n } catch {\n // sessionStorage 접근이 막힌 환경에서는 window fallback 만 정리한다.\n }\n\n delete (window as unknown as Record<string, unknown>)[MOBILE_PAYMENT_RETURN_PENDING_KEY];\n}\n\nexport function hasMobilePaymentReturnPending(now = Date.now()): boolean {\n if (typeof window === 'undefined') {\n return false;\n }\n\n let markedAt: number | null = null;\n\n try {\n const stored = window.sessionStorage.getItem(MOBILE_PAYMENT_RETURN_PENDING_KEY);\n markedAt = stored ? Number(stored) : null;\n } catch {\n markedAt = null;\n }\n\n if (!Number.isFinite(markedAt)) {\n const fallback = (window as unknown as Record<string, unknown>)[MOBILE_PAYMENT_RETURN_PENDING_KEY];\n markedAt = typeof fallback === 'number' ? fallback : Number(fallback);\n }\n\n if (!Number.isFinite(markedAt)) {\n clearMobilePaymentReturnPending();\n return false;\n }\n\n if (now - markedAt > MOBILE_PAYMENT_RETURN_TTL_MS) {\n clearMobilePaymentReturnPending();\n return false;\n }\n\n return true;\n}\n\nexport function consumeMobilePaymentReturnPending(now = Date.now()): boolean {\n if (!hasMobilePaymentReturnPending(now)) {\n return false;\n }\n\n clearMobilePaymentReturnPending();\n\n return true;\n}\n","import {\n clearMobilePaymentReturnPending,\n hasMobilePaymentReturnPending,\n markStandardPaySdkForReload,\n removeKoreanPaymentForms,\n} from './paymentDomCleanup';\n\nconst PLUGIN_IDENTIFIER = 'sirsoft-pay_kginicis';\nconst CLOSE_MESSAGE_SOURCE = PLUGIN_IDENTIFIER;\nconst CLOSE_MESSAGE_TYPE = 'payment-window-closed';\nconst LISTENER_INSTALLED_KEY = '__sirsoftKginicisPaymentCloseListenerInstalled';\nconst ACTIVE_STANDARD_PAYMENT_CLOSE_CONTEXT_KEY = '__sirsoftKginicisActiveStandardPaymentCloseContext';\nconst RESET_RETRY_LIMIT = 20;\nconst RESET_RETRY_INTERVAL_MS = 100;\n\nconst logger = {\n info: (...args: unknown[]) => console.info(`[${PLUGIN_IDENTIFIER}]`, ...args),\n warn: (...args: unknown[]) => Line truncated
|
||||
+66
-29
@@ -19,6 +19,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
|
||||
private const TEST_MODE_NOTICE_ROW_ID = 'kginicis_test_mode_order_settings_notice';
|
||||
|
||||
/** 주문설정 탭이 활성일 때만 fetch (탭별 지연 로딩) */
|
||||
private const ORDER_SETTINGS_TAB_CONDITION = "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'order_settings'}}";
|
||||
|
||||
private const TEST_MODE_CONDITION = 'kginicis_test_mode_status.data?.is_test_mode === true';
|
||||
|
||||
private const CORE_NO_PG_METHODS = "['point','deposit','free','dbank']";
|
||||
@@ -26,7 +29,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
private const KGINICIS_NO_PG_METHODS = "['point','deposit','free','dbank','kginicis_samsung_pay','kginicis_naverpay','kginicis_lpay','kginicis_kakaopay','kginicis_japan_paypay','kginicis_japan_cvs']";
|
||||
|
||||
/**
|
||||
* @return array<string, array<string, mixed>>
|
||||
* 이 리스너가 구독하는 훅 정의를 반환합니다.
|
||||
*
|
||||
* @return array<string, array<string, mixed>> 훅 이름 => 구독 설정
|
||||
*/
|
||||
public static function getSubscribedHooks(): array
|
||||
{
|
||||
@@ -42,14 +47,16 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
/**
|
||||
* 기본 핸들러 (미사용).
|
||||
*
|
||||
* @param mixed ...$args
|
||||
* @param mixed ...$args
|
||||
*/
|
||||
public function handle(...$args): void {}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $layout
|
||||
* @param int $templateId
|
||||
* @return array<string, mixed>
|
||||
* 이커머스 결제수단 설정 레이아웃에 KG 이니시스 간편결제를 PG 선택 불필요 항목으로 반영합니다.
|
||||
*
|
||||
* @param array<string, mixed> $layout 대상 레이아웃 정의
|
||||
* @param int $templateId 레이아웃이 속한 템플릿 ID
|
||||
* @return array<string, mixed> 보정된 레이아웃 정의
|
||||
*/
|
||||
public function markEasyPayMethodsAsPgNotRequired(array $layout, int $templateId): array
|
||||
{
|
||||
@@ -63,14 +70,17 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $node
|
||||
* @return array<string, mixed>
|
||||
* 레이아웃 노드를 재귀 순회하며 코어의 PG 불필요 결제수단 목록을 이니시스 목록으로 치환합니다.
|
||||
*
|
||||
* @param array<string, mixed> $node 순회 대상 노드
|
||||
* @return array<string, mixed> 치환이 반영된 노드
|
||||
*/
|
||||
private function replaceNoPgMethodExpressions(array $node): array
|
||||
{
|
||||
foreach ($node as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$node[$key] = $this->replaceNoPgMethodExpressions($value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -87,8 +97,10 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $layout
|
||||
* @return array<string, mixed>
|
||||
* 테스트 모드 경고에 필요한 데이터 소스와 안내 노드를 레이아웃에 보장합니다.
|
||||
*
|
||||
* @param array<string, mixed> $layout 대상 레이아웃 정의
|
||||
* @return array<string, mixed> 경고가 보장된 레이아웃 정의
|
||||
*/
|
||||
private function ensureTestModeWarning(array $layout): array
|
||||
{
|
||||
@@ -98,8 +110,10 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $layout
|
||||
* @return array<string, mixed>
|
||||
* 테스트 모드 상태 조회 데이터 소스가 없으면 레이아웃에 추가합니다.
|
||||
*
|
||||
* @param array<string, mixed> $layout 대상 레이아웃 정의
|
||||
* @return array<string, mixed> 데이터 소스가 보장된 레이아웃 정의
|
||||
*/
|
||||
private function ensureTestModeDataSource(array $layout): array
|
||||
{
|
||||
@@ -119,6 +133,7 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
'type' => 'api',
|
||||
'endpoint' => '/api/plugins/sirsoft-pay_kginicis/admin/settings/test-mode-status',
|
||||
'method' => 'GET',
|
||||
'if' => self::ORDER_SETTINGS_TAB_CONDITION,
|
||||
'auto_fetch' => true,
|
||||
'auth_required' => true,
|
||||
];
|
||||
@@ -129,8 +144,10 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $node
|
||||
* @return array<string, mixed>
|
||||
* 주문설정 탭을 찾아 테스트 모드 안내 노드를 삽입합니다.
|
||||
*
|
||||
* @param array<string, mixed> $node 순회 대상 노드
|
||||
* @return array<string, mixed> 안내 노드가 삽입된 노드
|
||||
*/
|
||||
private function insertTestModeNotice(array $node): array
|
||||
{
|
||||
@@ -162,7 +179,11 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, mixed> $children
|
||||
* 자식 노드 목록에서 지정한 id 를 가진 노드의 인덱스를 찾습니다.
|
||||
*
|
||||
* @param array<int, mixed> $children 자식 노드 목록
|
||||
* @param string $id 찾을 노드 id
|
||||
* @return int|null 찾은 인덱스 (없으면 null)
|
||||
*/
|
||||
private function findChildIndexById(array $children, string $id): ?int
|
||||
{
|
||||
@@ -176,17 +197,27 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, mixed> $children
|
||||
* 자식 노드 목록에 지정한 id 를 가진 노드가 있는지 확인합니다.
|
||||
*
|
||||
* @param array<int, mixed> $children 자식 노드 목록
|
||||
* @param string $id 확인할 노드 id
|
||||
* @return bool 존재 여부
|
||||
*/
|
||||
private function hasChildWithId(array $children, string $id): bool
|
||||
{
|
||||
return $this->findChildIndexById($children, $id) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 기존 표시 조건에 테스트 모드 조건을 OR 로 병합합니다.
|
||||
*
|
||||
* @param string $condition 기존 표시 조건식
|
||||
* @return string 테스트 모드 조건이 병합된 조건식
|
||||
*/
|
||||
private function mergeTestModeCondition(string $condition): string
|
||||
{
|
||||
if (str_contains($condition, self::TEST_MODE_CONDITION)) {
|
||||
return $condition !== '' ? $condition : '{{' . self::TEST_MODE_CONDITION . '}}';
|
||||
return $condition !== '' ? $condition : '{{'.self::TEST_MODE_CONDITION.'}}';
|
||||
}
|
||||
|
||||
$inner = trim($condition);
|
||||
@@ -195,15 +226,17 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
if ($inner === '') {
|
||||
return '{{' . self::TEST_MODE_CONDITION . '}}';
|
||||
return '{{'.self::TEST_MODE_CONDITION.'}}';
|
||||
}
|
||||
|
||||
return '{{' . $inner . ' || ' . self::TEST_MODE_CONDITION . '}}';
|
||||
return '{{'.$inner.' || '.self::TEST_MODE_CONDITION.'}}';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $notice
|
||||
* @return array<string, mixed>
|
||||
* 안내 컨테이너에 이니시스 테스트 모드 안내 행을 중복 없이 추가합니다.
|
||||
*
|
||||
* @param array<string, mixed> $notice 안내 컨테이너 노드
|
||||
* @return array<string, mixed> 안내 행이 추가된 컨테이너 노드
|
||||
*/
|
||||
private function appendTestModeNoticeRow(array $notice): array
|
||||
{
|
||||
@@ -219,7 +252,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
* 테스트 모드 안내를 감싸는 컨테이너 노드 정의를 반환합니다.
|
||||
*
|
||||
* @return array<string, mixed> 컨테이너 노드 정의
|
||||
*/
|
||||
private function testModeNoticeContainerNode(): array
|
||||
{
|
||||
@@ -227,7 +262,7 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
'id' => self::TEST_MODE_NOTICE_ID,
|
||||
'type' => 'basic',
|
||||
'name' => 'Div',
|
||||
'if' => '{{' . self::TEST_MODE_CONDITION . '}}',
|
||||
'if' => '{{'.self::TEST_MODE_CONDITION.'}}',
|
||||
'props' => [
|
||||
'className' => 'mb-4 space-y-3 rounded-lg border border-orange-200 bg-orange-50 p-4 dark:border-orange-700 dark:bg-orange-900/20',
|
||||
],
|
||||
@@ -238,7 +273,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
* 이니시스 테스트 모드 안내 문구와 설정 이동 버튼으로 구성된 행 노드 정의를 반환합니다.
|
||||
*
|
||||
* @return array<string, mixed> 안내 행 노드 정의
|
||||
*/
|
||||
private function testModeNoticeRowNode(): array
|
||||
{
|
||||
@@ -246,7 +283,7 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
'id' => self::TEST_MODE_NOTICE_ROW_ID,
|
||||
'type' => 'basic',
|
||||
'name' => 'Div',
|
||||
'if' => '{{' . self::TEST_MODE_CONDITION . '}}',
|
||||
'if' => '{{'.self::TEST_MODE_CONDITION.'}}',
|
||||
'props' => [
|
||||
'className' => 'flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between',
|
||||
],
|
||||
@@ -293,11 +330,11 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
],
|
||||
],
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'basic',
|
||||
'name' => 'Span',
|
||||
'text' => '$t:sirsoft-pay_kginicis.admin.test_mode_settings_warning_action',
|
||||
],
|
||||
[
|
||||
'type' => 'basic',
|
||||
'name' => 'Span',
|
||||
'text' => '$t:sirsoft-pay_kginicis.admin.test_mode_settings_warning_action',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
+41
-24
@@ -3,8 +3,10 @@
|
||||
namespace Plugins\Sirsoft\PayKginicis\Tests\Feature\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Services\PluginSettingsService;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Sirsoft\Ecommerce\Database\Factories\OrderFactory;
|
||||
use Modules\Sirsoft\Ecommerce\Database\Factories\OrderPaymentFactory;
|
||||
use Modules\Sirsoft\Ecommerce\Enums\OrderStatusEnum;
|
||||
@@ -20,6 +22,21 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
|
||||
private const TEST_SIGN_KEY = 'SU5JTElURV9UUklQTEVERVNfS0VZU1RS';
|
||||
|
||||
/**
|
||||
* 애플리케이션 로그를 spy 로 감시하되 `activity` 채널은 실제 로거로 유지합니다.
|
||||
*
|
||||
* `Log::spy()` 단독 사용 시 `Log::channel('activity')` 가 null 을 반환하고,
|
||||
* 결제 완료 훅이 태우는 활동 로그가 null 에 `info()` 를 호출해 \Error 로 죽는다.
|
||||
* (`ResolvesActivityLogType::logActivity` 의 catch 는 \Exception 만 잡아 통과시킴)
|
||||
*/
|
||||
private function spyApplicationLogKeepingActivityChannel(): void
|
||||
{
|
||||
$activityChannel = Log::channel('activity');
|
||||
|
||||
Log::spy();
|
||||
Log::shouldReceive('channel')->with('activity')->andReturn($activityChannel);
|
||||
}
|
||||
|
||||
private function makeAuthorizeResponse(string $tid, string $moid, int $amount, string $resultCode = '0000', array $overrides = []): array
|
||||
{
|
||||
return array_merge([
|
||||
@@ -46,7 +63,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
|
||||
$order = OrderFactory::new()->create([
|
||||
'user_id' => $user->id,
|
||||
'order_number' => 'ORD-TEST-' . random_int(10000, 99999),
|
||||
'order_number' => 'ORD-TEST-'.random_int(10000, 99999),
|
||||
'order_status' => OrderStatusEnum::PENDING_ORDER,
|
||||
'currency' => 'KRW',
|
||||
'currency_snapshot' => self::krwCurrencySnapshot(),
|
||||
@@ -97,11 +114,11 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
'redirect_fail_url' => '/shop/checkout',
|
||||
];
|
||||
|
||||
$settingsMock = $this->createMock(\App\Services\PluginSettingsService::class);
|
||||
$settingsMock = $this->createMock(PluginSettingsService::class);
|
||||
$settingsMock->method('get')
|
||||
->willReturn(array_merge($defaults, $overrides));
|
||||
|
||||
$this->app->instance(\App\Services\PluginSettingsService::class, $settingsMock);
|
||||
$this->app->instance(PluginSettingsService::class, $settingsMock);
|
||||
}
|
||||
|
||||
private function makeCallbackParams(string $moid, int $totPrice, array $overrides = []): array
|
||||
@@ -109,7 +126,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
return array_merge([
|
||||
'resultCode' => '0000',
|
||||
'resultMsg' => '성공',
|
||||
'authToken' => 'AUTH_TOKEN_' . uniqid(),
|
||||
'authToken' => 'AUTH_TOKEN_'.uniqid(),
|
||||
'authUrl' => 'https://fcstdpay.inicis.com/api/payAuth',
|
||||
// idc_name 은 KG 이니시스가 success 콜백에 항상 포함시키는 IDC 식별자.
|
||||
// 컨트롤러가 isValidIdcAuthUrl 화이트리스트 검증에 사용 (SSRF 방어).
|
||||
@@ -127,7 +144,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$order = $this->createTestOrder(50000);
|
||||
$this->mockPluginSettings();
|
||||
|
||||
$tid = 'TID_' . uniqid();
|
||||
$tid = 'TID_'.uniqid();
|
||||
$params = $this->makeCallbackParams($order->order_number, 50000);
|
||||
|
||||
Http::fake([
|
||||
@@ -163,7 +180,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$order = $this->createTestOrder(50000);
|
||||
$this->mockPluginSettings();
|
||||
|
||||
$tid = 'TID_EASYPAY_' . uniqid();
|
||||
$tid = 'TID_EASYPAY_'.uniqid();
|
||||
$params = $this->makeCallbackParams($order->order_number, 50000);
|
||||
|
||||
Http::fake([
|
||||
@@ -306,7 +323,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$order = $this->createTestOrder(50000);
|
||||
$this->mockPluginSettings();
|
||||
|
||||
$tid = 'TID_POST_COMMIT_' . uniqid();
|
||||
$tid = 'TID_POST_COMMIT_'.uniqid();
|
||||
$params = $this->makeCallbackParams($order->order_number, 50000);
|
||||
|
||||
$orderService = $this->createMock(OrderProcessingService::class);
|
||||
@@ -316,7 +333,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$orderService->expects($this->once())
|
||||
->method('completePayment')
|
||||
->willReturnCallback(function (Order $callbackOrder, array $paymentData, ?int $paidAmount) use ($tid): void {
|
||||
\Illuminate\Support\Facades\DB::transaction(function () use ($callbackOrder, $paymentData, $paidAmount, $tid): void {
|
||||
DB::transaction(function () use ($callbackOrder, $paymentData, $paidAmount, $tid): void {
|
||||
$callbackOrder->forceFill([
|
||||
'order_status' => OrderStatusEnum::PAYMENT_COMPLETE,
|
||||
'total_paid_amount' => $paidAmount,
|
||||
@@ -477,7 +494,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$this->markVbankIssued($order, 'VBANK_TID_LOG', '1234567890');
|
||||
$this->mockPluginSettings();
|
||||
|
||||
Log::spy();
|
||||
$this->spyApplicationLogKeepingActivityChannel();
|
||||
|
||||
$response = $this->post('/plugins/sirsoft-pay_kginicis/payment/vbank-notify', $this->makeVbankNotifyPayload([
|
||||
'no_tid' => 'VBANK_TID_LOG',
|
||||
@@ -500,7 +517,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$order = $this->createTestOrder(50000);
|
||||
$this->mockPluginSettings();
|
||||
|
||||
$tid = 'MOBILE_TID_' . uniqid();
|
||||
$tid = 'MOBILE_TID_'.uniqid();
|
||||
|
||||
Http::fake([
|
||||
'fcmobile.inicis.com/smart/payReq.ini' => Http::response(http_build_query([
|
||||
@@ -521,7 +538,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
]), 200),
|
||||
]);
|
||||
|
||||
$response = $this->post('/plugins/sirsoft-pay_kginicis/payment/mobile/callback?' . http_build_query([
|
||||
$response = $this->post('/plugins/sirsoft-pay_kginicis/payment/mobile/callback?'.http_build_query([
|
||||
'orderId' => $order->order_number,
|
||||
'selectedPaymentMethod' => 'kginicis_naverpay',
|
||||
]), [
|
||||
@@ -560,7 +577,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$order = $this->createTestOrder(50000);
|
||||
$this->mockPluginSettings();
|
||||
|
||||
$tid = 'MOBILE_TID_POST_COMMIT_' . uniqid();
|
||||
$tid = 'MOBILE_TID_POST_COMMIT_'.uniqid();
|
||||
|
||||
$orderService = $this->createMock(OrderProcessingService::class);
|
||||
$orderService->method('findByOrderNumber')
|
||||
@@ -569,7 +586,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$orderService->expects($this->once())
|
||||
->method('completePayment')
|
||||
->willReturnCallback(function (Order $callbackOrder, array $paymentData, ?int $paidAmount) use ($tid): void {
|
||||
\Illuminate\Support\Facades\DB::transaction(function () use ($callbackOrder, $paymentData, $paidAmount, $tid): void {
|
||||
DB::transaction(function () use ($callbackOrder, $paymentData, $paidAmount, $tid): void {
|
||||
$callbackOrder->forceFill([
|
||||
'order_status' => OrderStatusEnum::PAYMENT_COMPLETE,
|
||||
'total_paid_amount' => $paidAmount,
|
||||
@@ -660,7 +677,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$this->markVbankIssued($order, 'MOBILE_VBANK_TID_LOG', '1234567890');
|
||||
$this->mockPluginSettings();
|
||||
|
||||
Log::spy();
|
||||
$this->spyApplicationLogKeepingActivityChannel();
|
||||
|
||||
$response = $this->post('/plugins/sirsoft-pay_kginicis/payment/mobile/vbank-notify', [
|
||||
'P_STATUS' => '02',
|
||||
@@ -731,16 +748,16 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
private function makeVbankNotifyPayload(array $overrides = []): array
|
||||
{
|
||||
return array_merge([
|
||||
'no_tid' => 'VBANK_TID_' . uniqid(),
|
||||
'no_oid' => 'ORD-TEST-VBANK',
|
||||
'id_merchant' => 'INIpayTest',
|
||||
'dt_trans' => now()->format('Ymd'),
|
||||
'tm_trans' => now()->format('His'),
|
||||
'cd_bank' => '04',
|
||||
'no_vacct' => '1234567890',
|
||||
'amt_input' => '30000',
|
||||
'no_tid' => 'VBANK_TID_'.uniqid(),
|
||||
'no_oid' => 'ORD-TEST-VBANK',
|
||||
'id_merchant' => 'INIpayTest',
|
||||
'dt_trans' => now()->format('Ymd'),
|
||||
'tm_trans' => now()->format('His'),
|
||||
'cd_bank' => '04',
|
||||
'no_vacct' => '1234567890',
|
||||
'amt_input' => '30000',
|
||||
'nm_inputbank' => '국민은행',
|
||||
'nm_input' => '홍길동',
|
||||
'nm_input' => '홍길동',
|
||||
], $overrides);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@ export default defineConfig({
|
||||
entryFileNames: 'js/plugin.iife.js',
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
minify: 'esbuild',
|
||||
target: 'es2020',
|
||||
chunkSizeWarningLimit: 500,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"identifier": "sirsoft-pay_nhnkcp",
|
||||
"version": "1.0.0-beta.4",
|
||||
"components": {
|
||||
"basic": [],
|
||||
"composite": [],
|
||||
"layout": []
|
||||
}
|
||||
}
|
||||
@@ -15,4 +15,3 @@ try {
|
||||
}
|
||||
<\/script>
|
||||
</body></html>`),C.close(),h=window.setTimeout(()=>{v(new Error("KCP SDK load timeout"))},15e3),y.__kcpReady=()=>{h!==void 0&&(clearTimeout(h),h=void 0)}})}const _t={nhnkcp_payco:"PAYCO",nhnkcp_naverpay:"네이버페이",nhnkcp_naverpay_point:"네이버페이 포인트",nhnkcp_kakaopay:"카카오페이",nhnkcp_applepay:"Apple Pay"},gt="0 0 0 2px #ffffff, 0 0 0 5px rgba(0,0,0,0.55)";function ue(){return document.querySelector(".nhnkcp-easy-pay-btns")??null}function pe(){const e=ue();e&&e.querySelectorAll("button").forEach(t=>{t.style.boxShadow="",t.style.outline=""})}function wt(e){const t=ue();if(!t)return;const n=_t[e];t.querySelectorAll("button").forEach(r=>{r.textContent?.trim()===n?(r.style.boxShadow=gt,r.style.outline="none"):(r.style.boxShadow="",r.style.outline="")})}function Pt(e){const t=e.params?.paymentMethod;if(!t)return;const n=window.G7Core;if(M(t)&&!S()){const a=H();n?.state?.setLocal?.({paymentErrorMessage:a,isSubmittingOrder:!1}),n?.modal?.open?.("nhnkcp_payment_error_modal"),pe();return}const r=typeof t=="string"&&t.startsWith("nhnkcp_");n?.state?.setLocal?.({paymentMethod:t,serverPaymentMethod:r?"card":t}),r?wt(t):pe()}function kt(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","readonly"),t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.select();try{document.execCommand("copy")}finally{t.remove()}}async function bt(e){const t=String(e.params?.text??"");if(t!==""){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function"){await navigator.clipboard.writeText(t);return}kt(t)}}const me={requestPayment:le,setPaymentMethod:Pt,copyToClipboard:bt},ye="/api/modules/sirsoft-ecommerce/user/orders",Ct="sirsoft-nhnkcp",j="sirsoft-pay_nhnkcp",fe="nhnkcp_",b={info:(...e)=>console.info(`[${j}]`,...e),warn:(...e)=>console.warn(`[${j}]`,...e),error:(...e)=>console.error(`[${j}]`,...e)};function Nt(e){return typeof e=="string"?e:e instanceof URL?e.toString():typeof Request<"u"&&e instanceof Request?e.url:String(e)}function xt(e,t){return t?.method?t.method.toUpperCase():typeof Request<"u"&&e instanceof Request?e.method.toUpperCase():"GET"}function vt(e,t){if(t!=="POST")return!1;const n=e.split("?")[0].split("#")[0];return n===ye||n.endsWith(ye)}function Et(){return window.location.pathname+window.location.search+window.location.hash}function At(e,t){const n=JSON.stringify(t);return new Response(n,{status:e.status,statusText:e.statusText,headers:e.headers})}function St(e){return new Response(JSON.stringify({success:!1,message:e,error:e,errors:{payment_method:[e]}}),{status:422,statusText:"Unprocessable Content",headers:{"Content-Type":"application/json"}})}function he(e){try{return JSON.parse(e).payment_method}catch{return}}function Kt(e,t){try{const n=JSON.parse(e);return n.payment_method=t,JSON.stringify(n)}catch{return e}}function It(){if(typeof window>"u"||typeof window.fetch!="function")return;const e="__sirsoftNhnkcpInterceptorInstalled",t=window;if(t[e])return;t[e]=!0;const n="__sirsoftPgOriginalFetch";t[n]||(t[n]=window.fetch.bind(window));const r=t[n],a=window.fetch.bind(window);window.fetch=async function(i,s){const c=Nt(i),d=xt(i,s);if(!vt(c,d))return a(i,s);let l,u=s;if(s?.body&&typeof s.body=="string"){const p=he(s.body);typeof p=="string"&&p.startsWith(fe)&&(l=p,u={...s,body:Kt(s.body,"card")},b.info(`easy pay detected: replacing payment_method '${p}' → 'card'`))}if(!l)try{const p=window.G7Core?.state?.getLocal?.()?.paymentMethod;typeof p=="string"&&p.startsWith(fe)&&(l=p,b.info(`easy pay detected from local state: '${p}'`))}catch{}if(M(l)&&!S()){const p=H();return b.warn(p),St(p)}const y=await(l?r:a)(i,u);let x;try{x=y.clone()}catch{return y}let h=null;try{h=await x.json()}catch{return y}const f=h?.data;if(!f)return y;const se=f.requires_pg_payment===!0,v=f.pg_provider===Ct;if(!l&&(!se||!v)||l&&!f.order&&!f.pg_payment_data)return y;let w=f.pg_payment_data;if(!w&&l&&f.order){const p=f.order,g=p.options,k=g?.[0]?.product_name??String(p.order_number??""),I=(g?.length??0)>1?`${k} 외 ${(g?.length??0)-1}건`:k;w={order_number:p.order_number,order_name:I,amount:Math.floor(Number(p.total_due_amount??p.total_amount??0)),currency:"KRW",customer_name:p.orderer_name??null,customer_email:p.orderer_email??null,customer_phone:String(p.orderer_phone??"").replace(/[^0-9]/g,"")},b.info("pg_payment_data constructed from order (기본 PG가 타 PG)",{order_number:w.order_number,amount:w.amount})}if(!w)return b.warn("nhnkcp order detected but pg_payment_data missing"),y;b.info("intercepted order create response — opening PG popup");const C=f.order?{tax_amount:f.order.total_tax_amount??0,vat_amount:f.order.total_vat_amount??0,tax_free_amount:f.order.total_tax_free_amount??0}:{},_=!l&&u?.body&&typeof u.body=="string"?(()=>{const p=he(u.body);return p?{...w,pay_method:p,...C}:{...w,...C}})():{...w,...C};le({params:{pgPaymentData:_,paymentMethod:l}});const E={...h,data:{...f,requires_pg_payment:!1,redirect_url:Et()}};Line truncated
|
||||
//# sourceMappingURL=plugin.iife.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"plugin.iife.js","sources":["../../resources/js/paymentCloseReport.ts","../../resources/js/support/applePayDevice.ts","../../resources/js/handlers/requestPayment.ts","../../resources/js/handlers/setPaymentMethod.ts","../../resources/js/handlers/copyToClipboard.ts","../../resources/js/handlers/index.ts","../../resources/js/orderResponseInterceptor.ts","../../resources/js/orderCompleteReceiptInjector.ts","../../resources/js/mypageOrderShowInjector.ts","../../resources/js/checkoutEasyPayInjector.ts","../../resources/js/adminApplePayNoticeInjector.ts","../../resources/js/adminPaymentMethodBrandInjector.ts","../../resources/js/adminOrderPaymentDisplayInjector.ts","../../resources/js/index.ts"],"sourcesContent":["export interface PaymentCloseReportContext {\n closeReportUrl?: string;\n oid: string;\n price: number;\n buyer_email?: string;\n buyer_phone?: string;\n payment_method?: string;\n}\n\nfunction resolveApiUrl(url: string): string {\n if (/^https?:\\/\\//i.test(url) || url.startsWith('/api/')) {\n return url;\n }\n\n if (url.startsWith('/plugins/')) {\n return `/api${url}`;\n }\n\n if (url.startsWith('plugins/')) {\n return `/api/${url}`;\n }\n\n return url;\n}\n\nfunction trimReason(reason: string): string {\n return reason.trim().slice(0, 160);\n}\n\nfunction resolveRetryUrl(closeReportUrl?: string): string | undefined {\n if (!closeReportUrl) {\n return undefined;\n }\n\n return closeReportUrl.replace(/\\/payment\\/close-report$/, '/payment/retry');\n}\n\nasync function postPaymentContext(url: string, payload: Record<string, unknown>, keepalive = false): Promise<void> {\n const apiClient = ((window as any).G7Core)?.api;\n if (typeof apiClient?.post === 'function') {\n await apiClient.post(url, payload);\n return;\n }\n\n const response = await fetch(resolveApiUrl(url), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(payload),\n keepalive,\n });\n\n if (!response.ok) {\n let message = `NHN KCP payment request failed (${response.status})`;\n try {\n const data = await response.json();\n const responseMessage = Array.isArray(data?.errors?.message)\n ? data.errors.message[0]\n : data?.error ?? data?.message;\n if (typeof responseMessage === 'string' && responseMessage.trim() !== '') {\n message = responseMessage;\n }\n } catch {\n // JSON 응답이 아니면 HTTP 상태 메시지를 사용한다.\n }\n throw new Error(message);\n }\n}\n\nexport async function preparePaymentRetry(context: PaymentCloseReportContext): Promise<void> {\n const retryUrl = resolveRetryUrl(context.closeReportUrl);\n if (!retryUrl) {\n return;\n }\n\n await postPaymentContext(retryUrl, {\n oid: context.oid,\n price: Number(context.price),\n buyer_email: context.buyer_email ?? '',\n buyer_phone: context.buyer_phone ?? '',\n payment_method: context.payment_method ?? '',\n });\n}\n\nexport async function reportPaymentWindowClosed(\n context: PaymentCloseReportContext,\n reason = 'kcp-window-closed',\n): Promise<void> {\n if (!context.closeReportUrl) {\n return;\n }\n\n const payload = {\n oid: context.oid,\n price: Number(context.price),\n buyer_email: context.buyer_email ?? '',\n buyer_phone: context.buyer_phone ?? '',\n payment_method: context.payment_method ?? '',\n reason: trimReason(reason) || 'kcp-window-closed',\n };\n\n try {\n await postPaymentContext(context.closeReportUrl, payload, true);\n } catch (error) {\n console.warn('[sirsoft-pay_nhnkcp] failed to report payment window close', error);\n }\n}\n","export const NHNKCP_APPLEPAY_METHOD = 'nhnkcp_applepay';\n\nexport function isNhnKcpApplePayMethod(paymentMethod: unknown): boolean {\n return paymentMethod === NHNKCP_APPLEPAY_METHOD;\n}\n\nexport function isIosMobileDevice(): boolean {\n if (typeof navigator === 'undefined') return false;\n\n const nav = navigator as Navigator & {\n userAgentData?: {\n mobile?: boolean;\n platform?: string;\n };\n maxTouchPoints?: number;\n };\n const ua = (nav.userAgent || '').toLowerCase();\n const platform = ((nav.userAgentData?.platform ?? nav.platform) || '').toLowerCase();\n const touchPoints = nav.maxTouchPoints ?? 0;\n\n if (/iphone|ipad|ipod/.test(ua) || /iphone|ipad|ipod|ios/.test(platform)) {\n return true;\n }\n\n return /macintosh|mac os x/.test(ua) && touchPoints > 1;\n}\n\nexport function applePayUnsupportedMessage(): string {\n const lang = typeof document !== 'undefined'\n ? document.documentElement.lang\n : '';\n\n if ((lang || '').toLowerCase(Line truncated
|
||||
+75
-30
@@ -19,6 +19,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
|
||||
private const TEST_MODE_NOTICE_ROW_ID = 'nhnkcp_test_mode_order_settings_notice';
|
||||
|
||||
/** 주문설정 탭이 활성일 때만 fetch (탭별 지연 로딩) */
|
||||
private const ORDER_SETTINGS_TAB_CONDITION = "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'order_settings'}}";
|
||||
|
||||
private const TEST_MODE_CONDITION = 'nhnkcp_test_mode_status.data?.is_test_mode === true';
|
||||
|
||||
private const CORE_NO_PG_METHODS = ['point', 'deposit', 'free', 'dbank'];
|
||||
@@ -32,7 +35,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, array<string, mixed>>
|
||||
* 이 리스너가 구독하는 훅 정의를 반환합니다.
|
||||
*
|
||||
* @return array<string, array<string, mixed>> 훅 이름 => 구독 설정
|
||||
*/
|
||||
public static function getSubscribedHooks(): array
|
||||
{
|
||||
@@ -46,14 +51,18 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed ...$args
|
||||
* 기본 핸들러 (미사용).
|
||||
*
|
||||
* @param mixed ...$args
|
||||
*/
|
||||
public function handle(...$args): void {}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $layout
|
||||
* @param int $templateId
|
||||
* @return array<string, mixed>
|
||||
* 이커머스 결제수단 설정 레이아웃에 NHN KCP 간편결제를 PG 선택 불필요 항목으로 반영합니다.
|
||||
*
|
||||
* @param array<string, mixed> $layout 대상 레이아웃 정의
|
||||
* @param int $templateId 레이아웃이 속한 템플릿 ID
|
||||
* @return array<string, mixed> 보정된 레이아웃 정의
|
||||
*/
|
||||
public function markEasyPayMethodsAsPgNotRequired(array $layout, int $templateId): array
|
||||
{
|
||||
@@ -67,14 +76,17 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $node
|
||||
* @return array<string, mixed>
|
||||
* 레이아웃 노드를 재귀 순회하며 PG 불필요 결제수단 표현식에 NHN KCP 간편결제를 추가합니다.
|
||||
*
|
||||
* @param array<string, mixed> $node 순회 대상 노드
|
||||
* @return array<string, mixed> 치환이 반영된 노드
|
||||
*/
|
||||
private function replaceNoPgMethodExpressions(array $node): array
|
||||
{
|
||||
foreach ($node as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$node[$key] = $this->replaceNoPgMethodExpressions($value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -86,6 +98,12 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* 코어 PG 불필요 결제수단 배열 표현식을 찾아 NHN KCP 간편결제 수단을 덧붙입니다.
|
||||
*
|
||||
* @param string $expression 대상 표현식
|
||||
* @return string NHN KCP 수단이 추가된 표현식 (대상이 아니면 원본 그대로)
|
||||
*/
|
||||
private function addNhnKcpMethodsToNoPgArray(string $expression): string
|
||||
{
|
||||
return preg_replace_callback(
|
||||
@@ -106,15 +124,17 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
}
|
||||
|
||||
return "['" . implode("','", $ids) . "'].includes(\$method.id)";
|
||||
return "['".implode("','", $ids)."'].includes(\$method.id)";
|
||||
},
|
||||
$expression
|
||||
) ?? $expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $layout
|
||||
* @return array<string, mixed>
|
||||
* 테스트 모드 경고에 필요한 데이터 소스와 안내 노드를 레이아웃에 보장합니다.
|
||||
*
|
||||
* @param array<string, mixed> $layout 대상 레이아웃 정의
|
||||
* @return array<string, mixed> 경고가 보장된 레이아웃 정의
|
||||
*/
|
||||
private function ensureTestModeWarning(array $layout): array
|
||||
{
|
||||
@@ -124,8 +144,10 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $layout
|
||||
* @return array<string, mixed>
|
||||
* 테스트 모드 상태 조회 데이터 소스가 없으면 레이아웃에 추가합니다.
|
||||
*
|
||||
* @param array<string, mixed> $layout 대상 레이아웃 정의
|
||||
* @return array<string, mixed> 데이터 소스가 보장된 레이아웃 정의
|
||||
*/
|
||||
private function ensureTestModeDataSource(array $layout): array
|
||||
{
|
||||
@@ -145,6 +167,7 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
'type' => 'api',
|
||||
'endpoint' => '/api/plugins/sirsoft-pay_nhnkcp/admin/settings/test-mode-status',
|
||||
'method' => 'GET',
|
||||
'if' => self::ORDER_SETTINGS_TAB_CONDITION,
|
||||
'auto_fetch' => true,
|
||||
'auth_required' => true,
|
||||
];
|
||||
@@ -155,8 +178,10 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $node
|
||||
* @return array<string, mixed>
|
||||
* 주문설정 탭을 찾아 테스트 모드 안내 노드를 삽입합니다.
|
||||
*
|
||||
* @param array<string, mixed> $node 순회 대상 노드
|
||||
* @return array<string, mixed> 안내 노드가 삽입된 노드
|
||||
*/
|
||||
private function insertTestModeNotice(array $node): array
|
||||
{
|
||||
@@ -188,7 +213,11 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, mixed> $children
|
||||
* 자식 노드 목록에서 지정한 id 를 가진 노드의 인덱스를 찾습니다.
|
||||
*
|
||||
* @param array<int, mixed> $children 자식 노드 목록
|
||||
* @param string $id 찾을 노드 id
|
||||
* @return int|null 찾은 인덱스 (없으면 null)
|
||||
*/
|
||||
private function findChildIndexById(array $children, string $id): ?int
|
||||
{
|
||||
@@ -202,17 +231,27 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, mixed> $children
|
||||
* 자식 노드 목록에 지정한 id 를 가진 노드가 있는지 확인합니다.
|
||||
*
|
||||
* @param array<int, mixed> $children 자식 노드 목록
|
||||
* @param string $id 확인할 노드 id
|
||||
* @return bool 존재 여부
|
||||
*/
|
||||
private function hasChildWithId(array $children, string $id): bool
|
||||
{
|
||||
return $this->findChildIndexById($children, $id) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 기존 표시 조건에 테스트 모드 조건을 OR 로 병합합니다.
|
||||
*
|
||||
* @param string $condition 기존 표시 조건식
|
||||
* @return string 테스트 모드 조건이 병합된 조건식
|
||||
*/
|
||||
private function mergeTestModeCondition(string $condition): string
|
||||
{
|
||||
if (str_contains($condition, self::TEST_MODE_CONDITION)) {
|
||||
return $condition !== '' ? $condition : '{{' . self::TEST_MODE_CONDITION . '}}';
|
||||
return $condition !== '' ? $condition : '{{'.self::TEST_MODE_CONDITION.'}}';
|
||||
}
|
||||
|
||||
$inner = trim($condition);
|
||||
@@ -221,15 +260,17 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
if ($inner === '') {
|
||||
return '{{' . self::TEST_MODE_CONDITION . '}}';
|
||||
return '{{'.self::TEST_MODE_CONDITION.'}}';
|
||||
}
|
||||
|
||||
return '{{' . $inner . ' || ' . self::TEST_MODE_CONDITION . '}}';
|
||||
return '{{'.$inner.' || '.self::TEST_MODE_CONDITION.'}}';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $notice
|
||||
* @return array<string, mixed>
|
||||
* 안내 컨테이너에 NHN KCP 테스트 모드 안내 행을 중복 없이 추가합니다.
|
||||
*
|
||||
* @param array<string, mixed> $notice 안내 컨테이너 노드
|
||||
* @return array<string, mixed> 안내 행이 추가된 컨테이너 노드
|
||||
*/
|
||||
private function appendTestModeNoticeRow(array $notice): array
|
||||
{
|
||||
@@ -245,7 +286,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
* 테스트 모드 안내를 감싸는 컨테이너 노드 정의를 반환합니다.
|
||||
*
|
||||
* @return array<string, mixed> 컨테이너 노드 정의
|
||||
*/
|
||||
private function testModeNoticeContainerNode(): array
|
||||
{
|
||||
@@ -253,7 +296,7 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
'id' => self::TEST_MODE_NOTICE_ID,
|
||||
'type' => 'basic',
|
||||
'name' => 'Div',
|
||||
'if' => '{{' . self::TEST_MODE_CONDITION . '}}',
|
||||
'if' => '{{'.self::TEST_MODE_CONDITION.'}}',
|
||||
'props' => [
|
||||
'className' => 'mb-4 space-y-3 rounded-lg border border-orange-200 bg-orange-50 p-4 dark:border-orange-700 dark:bg-orange-900/20',
|
||||
],
|
||||
@@ -264,7 +307,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
* NHN KCP 테스트 모드 안내 문구와 설정 이동 버튼으로 구성된 행 노드 정의를 반환합니다.
|
||||
*
|
||||
* @return array<string, mixed> 안내 행 노드 정의
|
||||
*/
|
||||
private function testModeNoticeRowNode(): array
|
||||
{
|
||||
@@ -272,7 +317,7 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
'id' => self::TEST_MODE_NOTICE_ROW_ID,
|
||||
'type' => 'basic',
|
||||
'name' => 'Div',
|
||||
'if' => '{{' . self::TEST_MODE_CONDITION . '}}',
|
||||
'if' => '{{'.self::TEST_MODE_CONDITION.'}}',
|
||||
'props' => [
|
||||
'className' => 'flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between',
|
||||
],
|
||||
@@ -319,11 +364,11 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
],
|
||||
],
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'basic',
|
||||
'name' => 'Span',
|
||||
'text' => '$t:sirsoft-pay_nhnkcp.admin.test_mode_settings_warning_action',
|
||||
],
|
||||
[
|
||||
'type' => 'basic',
|
||||
'name' => 'Span',
|
||||
'text' => '$t:sirsoft-pay_nhnkcp.admin.test_mode_settings_warning_action',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
@@ -39,20 +39,27 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
*/
|
||||
private function makeServiceWithStubbedCli(string $response, array $settingsOverrides = []): array
|
||||
{
|
||||
// CLI 스텁은 `#!/bin/sh` 스크립트라 Windows exec() 가 실행하지 못한다
|
||||
// (.exe 로 이름만 바꿔도 "not compatible with the version of Windows" 로 거부됨).
|
||||
// Windows 분기(executeCliWindows)는 별도 검증 대상이므로 여기서는 건너뛴다.
|
||||
if (DIRECTORY_SEPARATOR === '\\') {
|
||||
$this->markTestSkipped('Linux CLI 스텁 기반 테스트 — Windows 분기 별도 검증.');
|
||||
}
|
||||
|
||||
$service = $this->makeService($settingsOverrides);
|
||||
$dir = sys_get_temp_dir() . '/nhnkcp_cli_' . uniqid('', true);
|
||||
$dir = sys_get_temp_dir().'/nhnkcp_cli_'.uniqid('', true);
|
||||
$this->assertTrue(mkdir($dir), '임시 CLI 디렉터리 생성 실패');
|
||||
|
||||
$logPath = $dir . '/argv.log';
|
||||
$responsePath = $dir . '/response.txt';
|
||||
$logPath = $dir.'/argv.log';
|
||||
$responsePath = $dir.'/response.txt';
|
||||
file_put_contents($responsePath, $response);
|
||||
|
||||
$script = "#!/bin/sh\n"
|
||||
. "printf '%s\\n' \"\$@\" > " . escapeshellarg($logPath) . "\n"
|
||||
. 'cat ' . escapeshellarg($responsePath) . "\n";
|
||||
."printf '%s\\n' \"\$@\" > ".escapeshellarg($logPath)."\n"
|
||||
.'cat '.escapeshellarg($responsePath)."\n";
|
||||
|
||||
foreach (['pp_cli', 'pp_cli_x64'] as $binName) {
|
||||
$binPath = $dir . '/' . $binName;
|
||||
$binPath = $dir.'/'.$binName;
|
||||
file_put_contents($binPath, $script);
|
||||
chmod($binPath, 0755);
|
||||
}
|
||||
@@ -71,7 +78,7 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
|
||||
private function removeStubbedCliDirectory(string $dir): void
|
||||
{
|
||||
foreach (glob($dir . '/*') ?: [] as $path) {
|
||||
foreach (glob($dir.'/*') ?: [] as $path) {
|
||||
@unlink($path);
|
||||
}
|
||||
|
||||
@@ -197,7 +204,7 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
|
||||
$service->getTransaction('TNO_001', 'ORD-001');
|
||||
|
||||
$expectedAuthValue = 'Basic ' . base64_encode(self::TEST_SITE_CD . ':' . self::TEST_SITE_KEY);
|
||||
$expectedAuthValue = 'Basic '.base64_encode(self::TEST_SITE_CD.':'.self::TEST_SITE_KEY);
|
||||
|
||||
Http::assertSent(function ($request) use ($expectedAuthValue) {
|
||||
return $request->header('Authorization')[0] === $expectedAuthValue;
|
||||
@@ -221,7 +228,7 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
public function test_cancel_payment_calls_cli_with_full_cancel_params(): void
|
||||
{
|
||||
$stub = $this->makeServiceWithStubbedCli(
|
||||
'res_cd=0000' . chr(31) . 'res_msg=취소완료' . chr(31) . 'tno=KCP_TNO_CANCEL_001'
|
||||
'res_cd=0000'.chr(31).'res_msg=취소완료'.chr(31).'tno=KCP_TNO_CANCEL_001'
|
||||
);
|
||||
/** @var NhnKcpApiService $service */
|
||||
$service = $stub['service'];
|
||||
@@ -238,10 +245,10 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
|
||||
$args = $this->capturedCliArgs($stub['log']);
|
||||
$this->assertStringContainsString('tx_cd=00200000', $args);
|
||||
$this->assertStringContainsString('ordr_idxx=' . $ordrIdxx, $args);
|
||||
$this->assertStringContainsString('modx_data=mod_data=tno=' . $tno, $args);
|
||||
$this->assertStringContainsString('ordr_idxx='.$ordrIdxx, $args);
|
||||
$this->assertStringContainsString('modx_data=mod_data=tno='.$tno, $args);
|
||||
$this->assertStringContainsString('mod_type=STSC', $args);
|
||||
$this->assertStringContainsString('mod_desc=' . $cancelMsg, $args);
|
||||
$this->assertStringContainsString('mod_desc='.$cancelMsg, $args);
|
||||
$this->assertStringNotContainsString('mod_mny=', $args);
|
||||
$this->assertStringNotContainsString('rem_mny=', $args);
|
||||
} finally {
|
||||
@@ -251,7 +258,7 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
|
||||
public function test_cancel_payment_calls_cli_with_partial_cancel_params(): void
|
||||
{
|
||||
$stub = $this->makeServiceWithStubbedCli('res_cd=0000' . chr(31) . 'res_msg=부분취소완료');
|
||||
$stub = $this->makeServiceWithStubbedCli('res_cd=0000'.chr(31).'res_msg=부분취소완료');
|
||||
/** @var NhnKcpApiService $service */
|
||||
$service = $stub['service'];
|
||||
|
||||
@@ -270,7 +277,7 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
public function test_register_escrow_delivery_uses_test_site_cd_when_escrow_test_site_cd_is_empty(): void
|
||||
{
|
||||
$stub = $this->makeServiceWithStubbedCli(
|
||||
'res_cd=0000' . chr(31) . 'res_msg=배송등록완료',
|
||||
'res_cd=0000'.chr(31).'res_msg=배송등록완료',
|
||||
['escrow_test_site_cd' => '']
|
||||
);
|
||||
/** @var NhnKcpApiService $service */
|
||||
@@ -280,7 +287,7 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
$service->registerEscrowDelivery('TNO_ESCROW', 'ORD-ESCROW', '1234567890', '04');
|
||||
|
||||
$args = $this->capturedCliArgs($stub['log']);
|
||||
$this->assertStringContainsString('site_cd=' . self::TEST_SITE_CD, $args);
|
||||
$this->assertStringContainsString('site_cd='.self::TEST_SITE_CD, $args);
|
||||
} finally {
|
||||
$this->removeStubbedCliDirectory($stub['dir']);
|
||||
}
|
||||
@@ -288,7 +295,7 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
|
||||
public function test_cancel_payment_throws_on_non_0000_res_cd(): void
|
||||
{
|
||||
$stub = $this->makeServiceWithStubbedCli('res_cd=9999' . chr(31) . 'res_msg=취소 실패');
|
||||
$stub = $this->makeServiceWithStubbedCli('res_cd=9999'.chr(31).'res_msg=취소 실패');
|
||||
/** @var NhnKcpApiService $service */
|
||||
$service = $stub['service'];
|
||||
|
||||
@@ -384,7 +391,7 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
|
||||
$tmpFile = tempnam(sys_get_temp_dir(), 'kcp_cli_test_');
|
||||
$this->assertNotFalse($tmpFile);
|
||||
file_put_contents($tmpFile, '#!/bin/sh' . PHP_EOL . 'exit 0' . PHP_EOL);
|
||||
file_put_contents($tmpFile, '#!/bin/sh'.PHP_EOL.'exit 0'.PHP_EOL);
|
||||
chmod($tmpFile, 0664);
|
||||
$this->assertFalse(is_executable($tmpFile), 'precondition: 0664 는 실행 권한 없음');
|
||||
|
||||
@@ -411,7 +418,7 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
|
||||
$tmpFile = tempnam(sys_get_temp_dir(), 'kcp_cli_test_');
|
||||
$this->assertNotFalse($tmpFile);
|
||||
file_put_contents($tmpFile, '#!/bin/sh' . PHP_EOL . 'exit 0' . PHP_EOL);
|
||||
file_put_contents($tmpFile, '#!/bin/sh'.PHP_EOL.'exit 0'.PHP_EOL);
|
||||
chmod($tmpFile, 0755);
|
||||
|
||||
try {
|
||||
@@ -435,10 +442,10 @@ class NhnKcpApiServiceTest extends PluginTestCase
|
||||
$method = (new \ReflectionClass($service))->getMethod('ensureCliExecutable');
|
||||
$method->setAccessible(true);
|
||||
|
||||
$this->expectException(\Plugins\Sirsoft\PayNhnkcp\Exceptions\NhnKcpApiException::class);
|
||||
$this->expectException(NhnKcpApiException::class);
|
||||
$this->expectExceptionMessageMatches('/CLI 바이너리/');
|
||||
|
||||
$method->invoke($service, '/tmp/nonexistent_kcp_cli_' . uniqid());
|
||||
$method->invoke($service, '/tmp/nonexistent_kcp_cli_'.uniqid());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,9 @@ export default defineConfig({
|
||||
entryFileNames: 'js/plugin.iife.js',
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
minify: 'esbuild',
|
||||
target: 'es2020',
|
||||
chunkSizeWarningLimit: 500,
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- 플러그인이 활성화되어 있으면 홈, 게시판, 로그인 등 결제와 무관한 모든 페이지에서 주문서 조회 요청이 한 번씩 불필요하게 발생하던 문제를 수정했습니다. 장바구니가 없는 비회원에게는 이 요청이 매번 실패해 브라우저 오류로 기록됐습니다. 이제 결제 페이지에서만 요청합니다.
|
||||
|
||||
### Security
|
||||
|
||||
- SignData 발급 요청에 주문번호+IP 단위 rate limit과 구매자 이메일/전화번호 대조를 추가해 공개 서명 엔드포인트의 주문번호/금액 프로빙 가능성을 줄였습니다.
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"identifier": "sirsoft-pay_nicepayments",
|
||||
"version": "1.0.0-beta.4",
|
||||
"components": {
|
||||
"basic": [],
|
||||
"composite": [],
|
||||
"layout": []
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1 @@
|
||||
(function(){"use strict";function Oe(e){return/^https?:\/\//i.test(e)||e.startsWith("/api/")?e:e.startsWith("/plugins/")?`/api${e}`:e.startsWith("plugins/")?`/api/${e}`:e}function De(e){return e.trim().slice(0,160)}async function Be(e,t="nicepay-window-closed"){if(!e.closeReportUrl)return;const n={oid:e.oid,price:Number(e.price),buyer_email:e.buyer_email??"",buyer_phone:e.buyer_phone??"",payment_method:e.payment_method??"",reason:De(t)||"nicepay-window-closed"};try{const a=window.G7Core?.api;if(typeof a?.post=="function"){await a.post(e.closeReportUrl,n);return}await fetch(Oe(e.closeReportUrl),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),keepalive:!0})}catch(a){console.warn("[sirsoft-pay_nicepayments] failed to report payment window close",a)}}function Ge(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`)){t();return}const a=document.createElement("script");a.src=e,a.onload=()=>t(),a.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(a)})}function je(e,t){const n=document.createElement("form");n.id="nicepayForm",n.method="post",n.action=e,n.acceptCharset="utf-8";for(const[a,o]of Object.entries(t)){const r=document.createElement("input");r.type="hidden",r.name=a,r.value=o,n.appendChild(r)}return document.body.appendChild(n),n}const qe="/plugins/sirsoft-pay_nicepayments/payment/callback",Fe="https://web.nicepay.co.kr/v3/v3Payment.jsp";function Ye(){if(typeof navigator>"u")return!1;const e=navigator;if(e.userAgentData?.mobile!==void 0)return e.userAgentData.mobile;const t=(navigator.userAgent||"").toLowerCase();return!!(/android|iphone|ipod|windows phone|iemobile|blackberry|opera mini|mobile safari/.test(t)||(navigator.maxTouchPoints??0)>1&&!t.includes("windows")&&!t.includes("macintosh"))}async function J(e,t){const{pgPaymentData:n,paymentMethod:a}=e.params??{},o=window.__templateApp?.globalState?._local,r=a??o?.paymentMethod??"card";if(!n){console.error("[sirsoft-pay_nicepayments] pgPaymentData is required");return}const i=window.G7Core;try{const s=await i.api.get("/modules/sirsoft-ecommerce/payments/client-config/nicepayments");if(!s.data){console.error("[sirsoft-pay_nicepayments] Failed to fetch client config",s);return}const l=s.data,u=Ye();if(!u&&(await Ge(l.sdk_url),typeof window.goPay!="function")){i?.toast?.error?.("나이스페이먼츠 SDK를 불러올 수 없습니다. 잠시 후 다시 시도해주세요."),i?.state?.setLocal?.({isSubmittingOrder:!1,paymentMethod:r});return}const b=window.location.origin+l.sign_data_url,m=typeof localStorage<"u"?localStorage.getItem("auth_token"):null,p={"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",Accept:"application/json"};m&&(p.Authorization=`Bearer ${m}`);const P=await fetch(b,{method:"POST",credentials:"include",headers:p,body:JSON.stringify({amt:n.amount,moid:n.order_number,buyer_email:n.customer_email??"",buyer_phone:n.customer_phone??""})});if(!P.ok)throw new Error("SignData 생성에 실패했습니다.");const g=await P.json(),I=window.location.origin+qe,f=typeof r=="string"&&r.startsWith("nicepay_"),C=f?"CARD":{card:"CARD",vbank:"VBANK",bank:"BANK",phone:"CELLPHONE"}[r??"card"]??"CARD",d={PayMethod:C,GoodsName:n.order_name,Amt:String(n.amount),MID:g.mid,Moid:n.order_number,BuyerName:n.customer_name??"",BuyerEmail:n.customer_email??"",BuyerTel:n.customer_phone??"",ReturnURL:I,EdiDate:g.ediDate,SignData:g.signData,CharSet:"utf-8",GoodsCl:"1",DirectShowOpt:"",DirectEasyPay:"",NicepayReserved:"",EasyPayMethod:"",MallReserved:"",MallReserved1:""};C==="CELLPHONE"&&(d.GoodsCl=n.goods_cl??"1");const c=l.useEscrow&&!f;if(d.TransType=c?"1":"0",f)switch(d.DirectShowOpt="CARD",d.MallReserved=`nicepay_easy_pay_method=${encodeURIComponent(r)}`,d.MallReserved1=r,r){case"nicepay_naverpay":d.DirectEasyPay="E020",d.EasyPayMethod="E020=CARD";break;case"nicepay_kakaopay":d.NicepayReserved="DirectKakao=Y";break;case"nicepay_samsungpay":d.DirectEasyPay="E021";break;case"nicepay_applepay":d.DirectEasyPay="E025";break;case"nicepay_payco":d.NicepayReserved="DirectPayco=Y";break;case"nicepay_skpay":d.NicepayReserved="DirectPay11=Y";break;case"nicepay_ssgpay":d.DirectEasyPay="E007";break;case"nicepay_lpay":d.DirectEasyPay="E018";break}try{const w=(await i.api.get(`/modules/sirsoft-ecommerce/user/orders/${n.order_number}`))?.data;if(w){const T=Number(w.total_tax_amount??0),E=Number(w.total_vat_amount??0),$e=Number(w.total_tax_free_amount??0);(T>0||E>0||$e>0)&&(d.TaxAmt=String(T),d.VatAmt=String(E),d.TaxFreeAmt=String($e))}}catch{}const y=je(I,d);if(u){y.action=Fe,y.acceptCharset="euc-kr";const S=y.querySelector('input[name="CharSet"]');S&&(S.value="euc-kr"),y.submit();return}window.nicepaySubmit=()=>{y.submit()};let k=!1;const z=new Set(document.body.children),Re=(S,w)=>{if(k)return;k=!0;const T=[S,w].filter(Boolean).join(": ")||"nicepay-window-closed";Be({closeReportUrl:l.close_report_url,oid:n.order_number,price:Number(n.amount),buyer_email:n.customer_email??"Line truncated
|
||||
//# sourceMappingURL=plugin.iife.js.map
|
||||
(function(){"use strict";function $e(e){return/^https?:\/\//i.test(e)||e.startsWith("/api/")?e:e.startsWith("/plugins/")?`/api${e}`:e.startsWith("plugins/")?`/api/${e}`:e}function De(e){return e.trim().slice(0,160)}async function Be(e,t="nicepay-window-closed"){if(!e.closeReportUrl)return;const n={oid:e.oid,price:Number(e.price),buyer_email:e.buyer_email??"",buyer_phone:e.buyer_phone??"",payment_method:e.payment_method??"",reason:De(t)||"nicepay-window-closed"};try{const a=window.G7Core?.api;if(typeof a?.post=="function"){await a.post(e.closeReportUrl,n);return}await fetch($e(e.closeReportUrl),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),keepalive:!0})}catch(a){console.warn("[sirsoft-pay_nicepayments] failed to report payment window close",a)}}function Ge(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`)){t();return}const a=document.createElement("script");a.src=e,a.onload=()=>t(),a.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(a)})}function je(e,t){const n=document.createElement("form");n.id="nicepayForm",n.method="post",n.action=e,n.acceptCharset="utf-8";for(const[a,o]of Object.entries(t)){const r=document.createElement("input");r.type="hidden",r.name=a,r.value=o,n.appendChild(r)}return document.body.appendChild(n),n}const qe="/plugins/sirsoft-pay_nicepayments/payment/callback",Fe="https://web.nicepay.co.kr/v3/v3Payment.jsp";function He(){if(typeof navigator>"u")return!1;const e=navigator;if(e.userAgentData?.mobile!==void 0)return e.userAgentData.mobile;const t=(navigator.userAgent||"").toLowerCase();return!!(/android|iphone|ipod|windows phone|iemobile|blackberry|opera mini|mobile safari/.test(t)||(navigator.maxTouchPoints??0)>1&&!t.includes("windows")&&!t.includes("macintosh"))}async function J(e,t){const{pgPaymentData:n,paymentMethod:a}=e.params??{},o=window.__templateApp?.globalState?._local,r=a??o?.paymentMethod??"card";if(!n){console.error("[sirsoft-pay_nicepayments] pgPaymentData is required");return}const i=window.G7Core;try{const s=await i.api.get("/modules/sirsoft-ecommerce/payments/client-config/nicepayments");if(!s.data){console.error("[sirsoft-pay_nicepayments] Failed to fetch client config",s);return}const l=s.data,u=He();if(!u&&(await Ge(l.sdk_url),typeof window.goPay!="function")){i?.toast?.error?.("나이스페이먼츠 SDK를 불러올 수 없습니다. 잠시 후 다시 시도해주세요."),i?.state?.setLocal?.({isSubmittingOrder:!1,paymentMethod:r});return}const b=window.location.origin+l.sign_data_url,m=typeof localStorage<"u"?localStorage.getItem("auth_token"):null,p={"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",Accept:"application/json"};m&&(p.Authorization=`Bearer ${m}`);const P=await fetch(b,{method:"POST",credentials:"include",headers:p,body:JSON.stringify({amt:n.amount,moid:n.order_number,buyer_email:n.customer_email??"",buyer_phone:n.customer_phone??""})});if(!P.ok)throw new Error("SignData 생성에 실패했습니다.");const g=await P.json(),I=window.location.origin+qe,f=typeof r=="string"&&r.startsWith("nicepay_"),N=f?"CARD":{card:"CARD",vbank:"VBANK",bank:"BANK",phone:"CELLPHONE"}[r??"card"]??"CARD",d={PayMethod:N,GoodsName:n.order_name,Amt:String(n.amount),MID:g.mid,Moid:n.order_number,BuyerName:n.customer_name??"",BuyerEmail:n.customer_email??"",BuyerTel:n.customer_phone??"",ReturnURL:I,EdiDate:g.ediDate,SignData:g.signData,CharSet:"utf-8",GoodsCl:"1",DirectShowOpt:"",DirectEasyPay:"",NicepayReserved:"",EasyPayMethod:"",MallReserved:"",MallReserved1:""};N==="CELLPHONE"&&(d.GoodsCl=n.goods_cl??"1");const c=l.useEscrow&&!f;if(d.TransType=c?"1":"0",f)switch(d.DirectShowOpt="CARD",d.MallReserved=`nicepay_easy_pay_method=${encodeURIComponent(r)}`,d.MallReserved1=r,r){case"nicepay_naverpay":d.DirectEasyPay="E020",d.EasyPayMethod="E020=CARD";break;case"nicepay_kakaopay":d.NicepayReserved="DirectKakao=Y";break;case"nicepay_samsungpay":d.DirectEasyPay="E021";break;case"nicepay_applepay":d.DirectEasyPay="E025";break;case"nicepay_payco":d.NicepayReserved="DirectPayco=Y";break;case"nicepay_skpay":d.NicepayReserved="DirectPay11=Y";break;case"nicepay_ssgpay":d.DirectEasyPay="E007";break;case"nicepay_lpay":d.DirectEasyPay="E018";break}try{const w=(await i.api.get(`/modules/sirsoft-ecommerce/user/orders/${n.order_number}`))?.data;if(w){const T=Number(w.total_tax_amount??0),E=Number(w.total_vat_amount??0),Oe=Number(w.total_tax_free_amount??0);(T>0||E>0||Oe>0)&&(d.TaxAmt=String(T),d.VatAmt=String(E),d.TaxFreeAmt=String(Oe))}}catch{}const y=je(I,d);if(u){y.action=Fe,y.acceptCharset="euc-kr";const S=y.querySelector('input[name="CharSet"]');S&&(S.value="euc-kr"),y.submit();return}window.nicepaySubmit=()=>{y.submit()};let k=!1;const z=new Set(document.body.children),Re=(S,w)=>{if(k)return;k=!0;const T=[S,w].filter(Boolean).join(": ")||"nicepay-window-closed";Be({closeReportUrl:l.close_report_url,oid:n.order_number,price:Number(n.amount),buyer_email:n.customer_email??"Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"plugin.iife.js","sources":["../../resources/js/paymentCloseReport.ts","../../resources/js/handlers/requestPayment.ts","../../resources/js/handlers/setPaymentMethod.ts","../../resources/js/handlers/index.ts","../../resources/js/orderResponseInterceptor.ts","../../resources/js/checkoutEasyPayInjector.ts","../../resources/js/orderCompleteReceiptInjector.ts","../../resources/js/mypageOrderShowInjector.ts","../../resources/js/adminPaymentMethodBrandInjector.ts","../../resources/js/adminOrderPaymentDisplayInjector.ts","../../resources/js/index.ts"],"sourcesContent":["export interface PaymentCloseReportContext {\n closeReportUrl?: string;\n oid: string;\n price: number;\n buyer_email?: string;\n buyer_phone?: string;\n payment_method?: string;\n}\n\nfunction resolveApiUrl(url: string): string {\n if (/^https?:\\/\\//i.test(url) || url.startsWith('/api/')) {\n return url;\n }\n\n if (url.startsWith('/plugins/')) {\n return `/api${url}`;\n }\n\n if (url.startsWith('plugins/')) {\n return `/api/${url}`;\n }\n\n return url;\n}\n\nfunction trimReason(reason: string): string {\n return reason.trim().slice(0, 160);\n}\n\nexport async function reportPaymentWindowClosed(\n context: PaymentCloseReportContext,\n reason = 'nicepay-window-closed',\n): Promise<void> {\n if (!context.closeReportUrl) {\n return;\n }\n\n const payload = {\n oid: context.oid,\n price: Number(context.price),\n buyer_email: context.buyer_email ?? '',\n buyer_phone: context.buyer_phone ?? '',\n payment_method: context.payment_method ?? '',\n reason: trimReason(reason) || 'nicepay-window-closed',\n };\n\n try {\n const apiClient = ((window as any).G7Core)?.api;\n if (typeof apiClient?.post === 'function') {\n await apiClient.post(context.closeReportUrl, payload);\n return;\n }\n\n await fetch(resolveApiUrl(context.closeReportUrl), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(payload),\n keepalive: true,\n });\n } catch (error) {\n console.warn('[sirsoft-pay_nicepayments] failed to report payment window close', error);\n }\n}\n","import { reportPaymentWindowClosed } from '../paymentCloseReport';\n\ninterface G7ApiResponse {\n data?: unknown;\n}\n\ninterface G7CoreApi {\n get: (url: string) => Promise<G7ApiResponse>;\n post?: (url: string, data?: Record<string, unknown>) => Promise<G7ApiResponse>;\n}\n\ninterface G7CoreToast {\n error: (message: string) => void;\n}\n\ninterface G7CoreStateApi {\n setLocal: (state: Record<string, unknown>) => void;\n}\n\ninterface G7Core {\n api: G7CoreApi;\n toast?: G7CoreToast;\n state?: G7CoreStateApi;\n}\n\ninterface TemplateLocalState {\n paymentMethod?: string;\n}\n\ninterface TemplateApp {\n globalState?: {\n _local?: TemplateLocalState;\n };\n}\n\ninterface PgPaymentData {\n order_number: string;\n order_name: string;\n amount: number;\n currency?: string;\n customer_name?: string;\n customer_email?: string;\n customer_phone?: string;\n goods_cl?: string; // 휴대폰결제 상품 유형: '0'=디지털컨텐츠, '1'=실물\n}\n\ninterface RequestPaymentParams {\n pgPaymentData: PgPaymentData;\n paymentMethod?: string;\n}\n\ninterface ClientConfig {\n mid: string;\n sdk_url: string;\n sign_data_url: string;\n close_report_url?: string;\n useEscrow?: boolean;\n}\n\ninterface SignDataResponse {\n ediDate: string;\n signData: string;\n mid: string;\n}\n\ninterface PaymentAction {\n params?: RequestPaymentParams;\n}\n\ndeclare global {\n interface Window {\n nicepaySubmit: () => void;\n nicepayClose: (resultCode: string, resultMsg: string) => void;\n goPay: (form: HTMLFormElement) => void;\n G7Core: G7Core;\n __templateApp?: TemplateApp;\n }\n}\n\nfunction loadScript(src: string): Promise<void> {\n return new Promise((resolve, reject) => {\n if (document.querySelector(`script[src=\"${src}\"]`)) {\n resolve();\n return;\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(`Failed to load script: ${src}`));\n document.head.appendChild(script);\n });\n}\n\nfunction createPaymentForm(action: string, fields: Record<string, string>): HTMLFormElement {\n const form = document.createElement('form');\n form.id = 'nicepayForm';\n form.method = 'post';\n form.action = action;\n // CharSet 필드와 일치 — 모바일은 form.acceptCharset 으로 charset 결정\n form.acceptCharset = 'utf-8';\n\n for (const [name, value] of Object.entries(fields)) {\n const input = document.creatLine truncated
|
||||
+74
@@ -14,6 +14,34 @@ function resetNicepayWindowFlags(): void {
|
||||
delete w.__sirsoftPgOriginalFetch;
|
||||
delete w.__sirsoftNicepayPaymentInProgress;
|
||||
delete w.__sirsoftNicepayCheckoutCache;
|
||||
delete w.__sirsoftNicepayAxiosCheckoutInterceptorInstalled;
|
||||
}
|
||||
|
||||
/** 현재 경로를 지정한다 (jsdom 은 history API 로만 pathname 변경 가능) */
|
||||
function setPathname(pathname: string): void {
|
||||
window.history.replaceState({}, '', pathname);
|
||||
}
|
||||
|
||||
/**
|
||||
* G7Core.api 스파이를 설치하고 get 스파이를 반환한다.
|
||||
*
|
||||
* 캐시 프리페치는 tryInstallAxiosCheckoutInterceptor 안에 있고, 이 함수는
|
||||
* `G7Core.api.client`(Axios)가 준비될 때까지 재시도하다가 준비되면 프리페치한다.
|
||||
* 따라서 client(=interceptors 를 가진 객체)를 함께 제공해야 실제 경로를 탄다.
|
||||
*/
|
||||
function installCoreApiSpy(): ReturnType<typeof vi.fn> {
|
||||
const getSpy = vi.fn().mockResolvedValue({});
|
||||
const axiosClient = {
|
||||
interceptors: {
|
||||
request: { use: vi.fn() },
|
||||
response: { use: vi.fn() },
|
||||
},
|
||||
};
|
||||
(window as unknown as Record<string, unknown>).G7Core = {
|
||||
api: { get: getSpy, client: axiosClient },
|
||||
};
|
||||
|
||||
return getSpy;
|
||||
}
|
||||
|
||||
function buildOrderResponse(order: Record<string, unknown>): Response {
|
||||
@@ -45,9 +73,55 @@ describe('installOrderResponseInterceptor', () => {
|
||||
afterEach(() => {
|
||||
window.fetch = originalFetch;
|
||||
resetNicepayWindowFlags();
|
||||
delete (window as unknown as Record<string, unknown>).G7Core;
|
||||
setPathname('/');
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe('체크아웃 캐시 프리페치 라우트 가드', () => {
|
||||
// 플러그인 번들은 모든 페이지에 로드된다. 캐시 프리페치는 체크아웃 페이지의
|
||||
// navigate-to-self 재초기화를 위한 것이므로, 다른 라우트에서 발화하면
|
||||
// 비회원에게 무의미한 422(cart_key_required) 왕복만 발생시킨다.
|
||||
it.each([
|
||||
['홈', '/'],
|
||||
['게시판', '/board'],
|
||||
['로그인', '/login'],
|
||||
['상품 상세', '/shop/products/1'],
|
||||
['장바구니', '/shop/cart'],
|
||||
])('%s 에서는 체크아웃을 프리페치하지 않는다', async (_label, pathname) => {
|
||||
setPathname(pathname);
|
||||
const getSpy = installCoreApiSpy();
|
||||
|
||||
installOrderResponseInterceptor();
|
||||
await vi.waitFor(() => expect(true).toBe(true));
|
||||
|
||||
expect(getSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('체크아웃 페이지에서는 캐시 프리페치가 동작한다', async () => {
|
||||
setPathname('/shop/checkout');
|
||||
const getSpy = installCoreApiSpy();
|
||||
|
||||
installOrderResponseInterceptor();
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(getSpy).toHaveBeenCalledWith('/modules/sirsoft-ecommerce/checkout');
|
||||
});
|
||||
});
|
||||
|
||||
it('이미 캐시가 있으면 체크아웃 페이지에서도 재요청하지 않는다', async () => {
|
||||
setPathname('/shop/checkout');
|
||||
(window as unknown as Record<string, unknown>).__sirsoftNicepayCheckoutCache =
|
||||
JSON.stringify({ data: {} });
|
||||
const getSpy = installCoreApiSpy();
|
||||
|
||||
installOrderResponseInterceptor();
|
||||
await vi.waitFor(() => expect(true).toBe(true));
|
||||
|
||||
expect(getSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it('간편결제 fallback pg_payment_data 금액은 total_due_amount를 우선 사용', async () => {
|
||||
fetchSpy.mockResolvedValue(buildOrderResponse({
|
||||
order_number: 'ORD-NICE-001',
|
||||
|
||||
@@ -23,6 +23,9 @@ const CHECKOUT_ENDPOINT_PATH = '/api/modules/sirsoft-ecommerce/checkout';
|
||||
const PAYMENT_IN_PROGRESS_FLAG = '__sirsoftNicepayPaymentInProgress';
|
||||
const CHECKOUT_CACHE_KEY = '__sirsoftNicepayCheckoutCache';
|
||||
|
||||
/** 체크아웃 페이지 경로 (캐시 프리페치를 이 경로에서만 수행) */
|
||||
const CHECKOUT_ROUTE_RE = /^\/shop\/checkout\/?$/;
|
||||
|
||||
const logger = {
|
||||
info: (...args: unknown[]) => console.info(`[${PLUGIN_IDENTIFIER}]`, ...args),
|
||||
warn: (...args: unknown[]) => console.warn(`[${PLUGIN_IDENTIFIER}]`, ...args),
|
||||
@@ -45,6 +48,11 @@ function isCheckoutEndpoint(url: string, method: string): boolean {
|
||||
return path === CHECKOUT_ENDPOINT_PATH || path.endsWith(CHECKOUT_ENDPOINT_PATH);
|
||||
}
|
||||
|
||||
/** 현재 브라우저 경로가 체크아웃 페이지인지 판정한다. */
|
||||
function isCheckoutRoute(): boolean {
|
||||
return CHECKOUT_ROUTE_RE.test(window.location.pathname);
|
||||
}
|
||||
|
||||
function extractPaymentMethodFromBody(body: unknown): string | undefined {
|
||||
if (!body) return undefined;
|
||||
let obj: Record<string, unknown> | null = null;
|
||||
@@ -311,7 +319,12 @@ function tryInstallAxiosCheckoutInterceptor(w: Record<string, unknown>, retries:
|
||||
logger.info('axios checkout interceptor installed');
|
||||
|
||||
// 인터셉터 설치 직후 GET checkout 즉시 캐싱 — navigate-to-self 재초기화 대비
|
||||
if (!w[CHECKOUT_CACHE_KEY]) {
|
||||
//
|
||||
// 체크아웃 페이지에서만 수행한다. 플러그인 번들은 모든 페이지에 로드되므로 경로를
|
||||
// 가리지 않으면 홈/게시판/로그인 등 어디서나 이 요청이 나가고, 장바구니가 없는
|
||||
// 비회원은 매 페이지 422(cart_key_required)를 받는다. 캐시는 체크아웃 페이지의
|
||||
// navigate-to-self 재초기화 대비용이므로 다른 경로에서는 만들 이유가 없다.
|
||||
if (isCheckoutRoute() && !w[CHECKOUT_CACHE_KEY]) {
|
||||
void (async () => {
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
+73
-30
@@ -19,6 +19,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
|
||||
private const TEST_MODE_NOTICE_ROW_ID = 'nicepay_test_mode_order_settings_notice';
|
||||
|
||||
/** 주문설정 탭이 활성일 때만 fetch (탭별 지연 로딩) */
|
||||
private const ORDER_SETTINGS_TAB_CONDITION = "{{(query.tab || _global.activeEcommerceSettingsTab || 'basic_info') === 'order_settings'}}";
|
||||
|
||||
private const TEST_MODE_CONDITION = 'nicepay_test_mode_status.data?.is_test_mode === true';
|
||||
|
||||
private const CORE_NO_PG_METHODS = ['point', 'deposit', 'free', 'dbank'];
|
||||
@@ -35,7 +38,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, array<string, mixed>>
|
||||
* 이 리스너가 구독하는 훅 정의를 반환합니다.
|
||||
*
|
||||
* @return array<string, array<string, mixed>> 훅 이름 => 구독 설정
|
||||
*/
|
||||
public static function getSubscribedHooks(): array
|
||||
{
|
||||
@@ -49,14 +54,16 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed ...$args
|
||||
* @param mixed ...$args
|
||||
*/
|
||||
public function handle(...$args): void {}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $layout
|
||||
* @param int $templateId
|
||||
* @return array<string, mixed>
|
||||
* 이커머스 결제수단 설정 레이아웃에 나이스페이먼츠 간편결제를 PG 선택 불필요 항목으로 반영합니다.
|
||||
*
|
||||
* @param array<string, mixed> $layout 대상 레이아웃 정의
|
||||
* @param int $templateId 레이아웃이 속한 템플릿 ID
|
||||
* @return array<string, mixed> 보정된 레이아웃 정의
|
||||
*/
|
||||
public function markEasyPayMethodsAsPgNotRequired(array $layout, int $templateId): array
|
||||
{
|
||||
@@ -70,14 +77,17 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $node
|
||||
* @return array<string, mixed>
|
||||
* 레이아웃 노드를 재귀 순회하며 PG 불필요 결제수단 표현식에 나이스페이먼츠 간편결제를 추가합니다.
|
||||
*
|
||||
* @param array<string, mixed> $node 순회 대상 노드
|
||||
* @return array<string, mixed> 치환이 반영된 노드
|
||||
*/
|
||||
private function replaceNoPgMethodExpressions(array $node): array
|
||||
{
|
||||
foreach ($node as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$node[$key] = $this->replaceNoPgMethodExpressions($value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -89,6 +99,12 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* 코어 PG 불필요 결제수단 배열 표현식을 찾아 나이스페이먼츠 간편결제 수단을 덧붙입니다.
|
||||
*
|
||||
* @param string $expression 대상 표현식
|
||||
* @return string 나이스페이먼츠 수단이 추가된 표현식 (대상이 아니면 원본 그대로)
|
||||
*/
|
||||
private function addNicepayMethodsToNoPgArray(string $expression): string
|
||||
{
|
||||
return preg_replace_callback(
|
||||
@@ -109,15 +125,17 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
}
|
||||
|
||||
return "['" . implode("','", $ids) . "'].includes(\$method.id)";
|
||||
return "['".implode("','", $ids)."'].includes(\$method.id)";
|
||||
},
|
||||
$expression
|
||||
) ?? $expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $layout
|
||||
* @return array<string, mixed>
|
||||
* 테스트 모드 경고에 필요한 데이터 소스와 안내 노드를 레이아웃에 보장합니다.
|
||||
*
|
||||
* @param array<string, mixed> $layout 대상 레이아웃 정의
|
||||
* @return array<string, mixed> 경고가 보장된 레이아웃 정의
|
||||
*/
|
||||
private function ensureTestModeWarning(array $layout): array
|
||||
{
|
||||
@@ -127,8 +145,10 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $layout
|
||||
* @return array<string, mixed>
|
||||
* 테스트 모드 상태 조회 데이터 소스가 없으면 레이아웃에 추가합니다.
|
||||
*
|
||||
* @param array<string, mixed> $layout 대상 레이아웃 정의
|
||||
* @return array<string, mixed> 데이터 소스가 보장된 레이아웃 정의
|
||||
*/
|
||||
private function ensureTestModeDataSource(array $layout): array
|
||||
{
|
||||
@@ -148,6 +168,7 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
'type' => 'api',
|
||||
'endpoint' => '/api/plugins/sirsoft-pay_nicepayments/admin/settings/test-mode-status',
|
||||
'method' => 'GET',
|
||||
'if' => self::ORDER_SETTINGS_TAB_CONDITION,
|
||||
'auto_fetch' => true,
|
||||
'auth_required' => true,
|
||||
];
|
||||
@@ -158,8 +179,10 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $node
|
||||
* @return array<string, mixed>
|
||||
* 주문설정 탭을 찾아 테스트 모드 안내 노드를 삽입합니다.
|
||||
*
|
||||
* @param array<string, mixed> $node 순회 대상 노드
|
||||
* @return array<string, mixed> 안내 노드가 삽입된 노드
|
||||
*/
|
||||
private function insertTestModeNotice(array $node): array
|
||||
{
|
||||
@@ -191,7 +214,11 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, mixed> $children
|
||||
* 자식 노드 목록에서 지정한 id 를 가진 노드의 인덱스를 찾습니다.
|
||||
*
|
||||
* @param array<int, mixed> $children 자식 노드 목록
|
||||
* @param string $id 찾을 노드 id
|
||||
* @return int|null 찾은 인덱스 (없으면 null)
|
||||
*/
|
||||
private function findChildIndexById(array $children, string $id): ?int
|
||||
{
|
||||
@@ -205,17 +232,27 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, mixed> $children
|
||||
* 자식 노드 목록에 지정한 id 를 가진 노드가 있는지 확인합니다.
|
||||
*
|
||||
* @param array<int, mixed> $children 자식 노드 목록
|
||||
* @param string $id 확인할 노드 id
|
||||
* @return bool 존재 여부
|
||||
*/
|
||||
private function hasChildWithId(array $children, string $id): bool
|
||||
{
|
||||
return $this->findChildIndexById($children, $id) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 기존 표시 조건에 테스트 모드 조건을 OR 로 병합합니다.
|
||||
*
|
||||
* @param string $condition 기존 표시 조건식
|
||||
* @return string 테스트 모드 조건이 병합된 조건식
|
||||
*/
|
||||
private function mergeTestModeCondition(string $condition): string
|
||||
{
|
||||
if (str_contains($condition, self::TEST_MODE_CONDITION)) {
|
||||
return $condition !== '' ? $condition : '{{' . self::TEST_MODE_CONDITION . '}}';
|
||||
return $condition !== '' ? $condition : '{{'.self::TEST_MODE_CONDITION.'}}';
|
||||
}
|
||||
|
||||
$inner = trim($condition);
|
||||
@@ -224,15 +261,17 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
if ($inner === '') {
|
||||
return '{{' . self::TEST_MODE_CONDITION . '}}';
|
||||
return '{{'.self::TEST_MODE_CONDITION.'}}';
|
||||
}
|
||||
|
||||
return '{{' . $inner . ' || ' . self::TEST_MODE_CONDITION . '}}';
|
||||
return '{{'.$inner.' || '.self::TEST_MODE_CONDITION.'}}';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $notice
|
||||
* @return array<string, mixed>
|
||||
* 안내 컨테이너에 나이스페이먼츠 테스트 모드 안내 행을 중복 없이 추가합니다.
|
||||
*
|
||||
* @param array<string, mixed> $notice 안내 컨테이너 노드
|
||||
* @return array<string, mixed> 안내 행이 추가된 컨테이너 노드
|
||||
*/
|
||||
private function appendTestModeNoticeRow(array $notice): array
|
||||
{
|
||||
@@ -248,7 +287,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
* 테스트 모드 안내를 감싸는 컨테이너 노드 정의를 반환합니다.
|
||||
*
|
||||
* @return array<string, mixed> 컨테이너 노드 정의
|
||||
*/
|
||||
private function testModeNoticeContainerNode(): array
|
||||
{
|
||||
@@ -256,7 +297,7 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
'id' => self::TEST_MODE_NOTICE_ID,
|
||||
'type' => 'basic',
|
||||
'name' => 'Div',
|
||||
'if' => '{{' . self::TEST_MODE_CONDITION . '}}',
|
||||
'if' => '{{'.self::TEST_MODE_CONDITION.'}}',
|
||||
'props' => [
|
||||
'className' => 'mb-4 space-y-3 rounded-lg border border-orange-200 bg-orange-50 p-4 dark:border-orange-700 dark:bg-orange-900/20',
|
||||
],
|
||||
@@ -267,7 +308,9 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
* 나이스페이먼츠 테스트 모드 안내 문구와 설정 이동 버튼으로 구성된 행 노드 정의를 반환합니다.
|
||||
*
|
||||
* @return array<string, mixed> 안내 행 노드 정의
|
||||
*/
|
||||
private function testModeNoticeRowNode(): array
|
||||
{
|
||||
@@ -275,7 +318,7 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
'id' => self::TEST_MODE_NOTICE_ROW_ID,
|
||||
'type' => 'basic',
|
||||
'name' => 'Div',
|
||||
'if' => '{{' . self::TEST_MODE_CONDITION . '}}',
|
||||
'if' => '{{'.self::TEST_MODE_CONDITION.'}}',
|
||||
'props' => [
|
||||
'className' => 'flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between',
|
||||
],
|
||||
@@ -322,11 +365,11 @@ class AdjustEcommercePaymentMethodsLayoutListener implements HookListenerInterfa
|
||||
],
|
||||
],
|
||||
'children' => [
|
||||
[
|
||||
'type' => 'basic',
|
||||
'name' => 'Span',
|
||||
'text' => '$t:sirsoft-pay_nicepayments.admin.test_mode_settings_warning_action',
|
||||
],
|
||||
[
|
||||
'type' => 'basic',
|
||||
'name' => 'Span',
|
||||
'text' => '$t:sirsoft-pay_nicepayments.admin.test_mode_settings_warning_action',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
+27
-11
@@ -4,9 +4,10 @@ namespace Plugins\Sirsoft\PayNicepayments\Tests\Feature\Controllers;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use App\Services\PluginSettingsService;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Mockery;
|
||||
use Modules\Sirsoft\Ecommerce\Database\Factories\OrderAddressFactory;
|
||||
use Modules\Sirsoft\Ecommerce\Database\Factories\OrderFactory;
|
||||
@@ -22,6 +23,21 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
{
|
||||
private const TEST_MID = 'nicepay00m';
|
||||
|
||||
/**
|
||||
* 애플리케이션 로그를 spy 로 감시하되 `activity` 채널은 실제 로거로 유지합니다.
|
||||
*
|
||||
* `Log::spy()` 단독 사용 시 `Log::channel('activity')` 가 null 을 반환하고,
|
||||
* 결제 완료 훅이 태우는 활동 로그가 null 에 `info()` 를 호출해 \Error 로 죽는다.
|
||||
* (`ResolvesActivityLogType::logActivity` 의 catch 는 \Exception 만 잡아 통과시킴)
|
||||
*/
|
||||
private function spyApplicationLogKeepingActivityChannel(): void
|
||||
{
|
||||
$activityChannel = Log::channel('activity');
|
||||
|
||||
Log::spy();
|
||||
Log::shouldReceive('channel')->with('activity')->andReturn($activityChannel);
|
||||
}
|
||||
|
||||
private const TEST_MERCHANT_KEY = 'EYzu8jGGMfqaDEp76gSckuvnaHHu+bC4opsSN6lHv3b2lurNYkVXrZ7Z1AoqQnXI3eLuaUFyoRNC6FkrzVjceg==';
|
||||
|
||||
private function makeAuthorizeResponse(string $tid, string $moid, int $amount, string $resultCode = '3001'): array
|
||||
@@ -49,7 +65,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
|
||||
$order = OrderFactory::new()->create([
|
||||
'user_id' => $user->id,
|
||||
'order_number' => 'ORD-TEST-' . random_int(10000, 99999),
|
||||
'order_number' => 'ORD-TEST-'.random_int(10000, 99999),
|
||||
'order_status' => OrderStatusEnum::PENDING_ORDER,
|
||||
'subtotal_amount' => $totalAmount,
|
||||
'total_discount_amount' => 0,
|
||||
@@ -96,28 +112,28 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
'redirect_fail_url' => '/shop/checkout',
|
||||
];
|
||||
|
||||
$settingsMock = $this->createMock(\App\Services\PluginSettingsService::class);
|
||||
$settingsMock = $this->createMock(PluginSettingsService::class);
|
||||
$settingsMock->method('get')
|
||||
->willReturn(array_merge($defaults, $overrides));
|
||||
|
||||
$this->app->instance(\App\Services\PluginSettingsService::class, $settingsMock);
|
||||
$this->app->instance(PluginSettingsService::class, $settingsMock);
|
||||
}
|
||||
|
||||
private function makeSignature(string $authToken, string $mid, int $amt, string $merchantKey): string
|
||||
{
|
||||
return bin2hex(hash('sha256', $authToken . $mid . (string) $amt . $merchantKey, true));
|
||||
return bin2hex(hash('sha256', $authToken.$mid.(string) $amt.$merchantKey, true));
|
||||
}
|
||||
|
||||
private function makeCallbackParams(string $moid, int $amt, array $overrides = []): array
|
||||
{
|
||||
$authToken = 'AUTH_TOKEN_' . uniqid();
|
||||
$authToken = 'AUTH_TOKEN_'.uniqid();
|
||||
$signature = $this->makeSignature($authToken, self::TEST_MID, $amt, self::TEST_MERCHANT_KEY);
|
||||
|
||||
return array_merge([
|
||||
'AuthResultCode' => '0000',
|
||||
'AuthResultMsg' => '성공',
|
||||
'NextAppURL' => 'https://pay.nicepay.co.kr/v1/authorize',
|
||||
'TxTid' => 'TX_TID_' . uniqid(),
|
||||
'TxTid' => 'TX_TID_'.uniqid(),
|
||||
'AuthToken' => $authToken,
|
||||
'PayMethod' => 'CARD',
|
||||
'MID' => self::TEST_MID,
|
||||
@@ -135,7 +151,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
'PayMethod' => 'VBANK',
|
||||
'MID' => self::TEST_MID,
|
||||
'MOID' => $moid,
|
||||
'TID' => 'VBANK_TID_' . uniqid(),
|
||||
'TID' => 'VBANK_TID_'.uniqid(),
|
||||
'Amt' => $amt,
|
||||
'ResultCode' => '4110',
|
||||
'ResultMsg' => '입금완료',
|
||||
@@ -432,7 +448,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$order = $this->createTestOrder(50000);
|
||||
$this->mockPluginSettings();
|
||||
|
||||
$tid = 'TID_' . uniqid();
|
||||
$tid = 'TID_'.uniqid();
|
||||
$params = $this->makeCallbackParams($order->order_number, 50000);
|
||||
|
||||
Http::fake([
|
||||
@@ -462,7 +478,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
$order = $this->createTestOrder(50000);
|
||||
$this->mockPluginSettings();
|
||||
|
||||
$tid = 'TID_EASY_PAY_' . uniqid();
|
||||
$tid = 'TID_EASY_PAY_'.uniqid();
|
||||
$params = $this->makeCallbackParams($order->order_number, 50000, [
|
||||
'MallReserved' => 'nicepay_easy_pay_method=nicepay_kakaopay',
|
||||
'MallReserved1' => 'nicepay_kakaopay',
|
||||
@@ -1034,7 +1050,7 @@ class PaymentCallbackControllerTest extends PluginTestCase
|
||||
|
||||
public function test_vbank_notify_success_log_does_not_include_depositor_or_full_account(): void
|
||||
{
|
||||
Log::spy();
|
||||
$this->spyApplicationLogKeepingActivityChannel();
|
||||
|
||||
$tid = 'VBANK_TID_LOG_SAFE';
|
||||
$order = $this->createTestOrder(30000, PaymentMethodEnum::VBANK);
|
||||
|
||||
@@ -14,7 +14,9 @@ export default defineConfig({
|
||||
entryFileNames: 'js/plugin.iife.js',
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
minify: 'esbuild',
|
||||
target: 'es2020',
|
||||
chunkSizeWarningLimit: 500,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"identifier": "sirsoft-verification_kginicis",
|
||||
"version": "1.0.0-beta.1",
|
||||
"version": "1.0.1",
|
||||
"components": {
|
||||
"basic": [],
|
||||
"composite": [],
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
var SirsoftVerificationKginicis=function(s){"use strict";const o="sirsoft-verification_kginicis",w="inicis",A="width=400,height=640,scrollbars=yes,resizable=yes",D="https://sa.inicis.com/auth",I="identity-challenge-modal",l={info:(...e)=>console.info(`[${o}]`,...e),warn:(...e)=>console.warn(`[${o}]`,...e),error:(...e)=>console.error(`[${o}]`,...e)};function a(){return window.G7Core??null}function v(){return`${window.location.origin}/plugins/${o}/plugin/inicis/callback`}function C(e,i){const t=document.createElement("form");t.setAttribute("name","saForm"),t.setAttribute("method","POST"),t.setAttribute("action",D),t.setAttribute("target",i),t.setAttribute("accept-charset","UTF-8"),t.style.display="none";const u={mid:e.mid,reqSvcCd:e.reqSvcCd,mTxId:e.mtxid,authHash:e.authHash,flgFixedUser:e.flgFixedUser,successUrl:v(),failUrl:v(),reservedMsg:e.reservedMsg};for(const[d,c]of Object.entries(u)){const r=document.createElement("input");r.type="hidden",r.name=d,r.value=c,t.appendChild(r)}document.body.appendChild(t),t.submit(),window.setTimeout(()=>{try{t.remove()}catch{}},0)}function _(e){const t=a()?.state?.set;typeof t=="function"&&t({identityChallenge:{providerInProgress:e}})}const L={NOT_ADULT:"$t:sirsoft-verification_kginicis.errors.not_adult",INVALID_AUTH_URL:"$t:sirsoft-verification_kginicis.errors.invalid_auth_url",DECRYPT_FAILED:"$t:sirsoft-verification_kginicis.errors.decrypt_failed",REMOTE_CALL_FAILED:"$t:sirsoft-verification_kginicis.errors.remote_call_failed",NOT_FOUND:"$t:sirsoft-verification_kginicis.errors.not_found",ALREADY_CONSUMED:"$t:sirsoft-verification_kginicis.errors.already_consumed",IDENTITY_BINDING_MISMATCH:"$t:sirsoft-verification_kginicis.errors.binding_mismatch",INCOMPLETE_IDENTITY:"$t:sirsoft-verification_kginicis.errors.incomplete_identity",STORAGE_FAILED:"$t:sirsoft-verification_kginicis.errors.storage_failed"},P="$t:sirsoft-verification_kginicis.errors.verify_failed",S=new Set(["NOT_ADULT"]);function T(e){return L[e]??P}function U(){const e=a()?.identity?.markDomainNoticeShown;if(typeof e=="function")try{e()}catch{}}async function g(e,i="error"){const t=a()?.dispatch;if(typeof t=="function")try{await t({handler:"toast",params:{type:i,message:e}})}catch{}}function O(e){const i=a()?.dispatch;return typeof i!="function"?Promise.resolve():i({handler:"sequence",params:{actions:[{handler:"resolveIdentityChallenge",params:e},{handler:"closeModal",target:I}]}}).catch(()=>{})}async function h(){const e=a(),i=e?.state?.getGlobal?.()?.identityChallenge??e?.state?.get?.()?.identityChallenge;if(!i){l.error("_global.identityChallenge 미설정 — 코어 모달 진입 흐름 확인 필요");return}const t=i.public_payload;if(!t?.mid||!t?.mtxid||!t?.authHash){l.error("public_payload 의 mid/mtxid/authHash 부재 — Provider.requestChallenge 응답 확인 필요",t),await g("본인인증 페이로드가 준비되지 않았습니다. 잠시 후 다시 시도해 주세요.");return}const u="sa_popup",d=window.open("",u,A);if(!d){l.error("window.open null — 팝업 차단됨"),await g("팝업이 차단되었습니다. 브라우저 팝업 허용 설정 후 다시 시도해 주세요.");return}_(!0),C(t,u);let c=!1,r=null,f=null;const p=()=>{f&&(window.removeEventListener("message",f),f=null),r!==null&&(window.clearInterval(r),r=null)};f=y=>{if(y.origin!==window.location.origin)return;const n=y.data;if(!n||n.type!=="identity_result"||c)return;c=!0,p();try{d.close()}catch{}_(!1);const b=n.verification_token?{result:"verified",token:n.verification_token}:n.identity_error?{result:"failed",failureCode:n.identity_error}:{result:"cancelled"};n.identity_error&&(S.has(n.identity_error)&&U(),g(T(n.identity_error),"error")),O(b)},window.addEventListener("message",f),r=window.setInterval(()=>{if(c){p();return}d.closed&&(c=!0,p(),_(!1))},500)}function E(){const i=a()?.getActionDispatcher;if(typeof i!="function")return!1;const t=i();return!t||typeof t.registerHandler!="function"?!1:(t.registerHandler(`${o}.startAuth`,h,{category:"plugin",source:o}),l.info("startAuth handler registered"),!0)}function m(){if(E())return;let e=0;const i=window.setInterval(()=>{e++,(E()||e>=50)&&(window.clearInterval(i),e>=50&&l.warn("G7Core ActionDispatcher 미준비 — handler 등록 실패"))},100)}return m(),window.__SirsoftVerificationKginicis={identifier:o,init:m,startAuthHandler:h},s.MODAL_ID=I,s.PLUGIN_IDENTIFIER=o,s.PROVIDER_ID=w,s.init=m,s.startAuthHandler=h,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),s}({});
|
||||
//# sourceMappingURL=plugin.iife.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"plugin.iife.js","sources":["../../resources/js/index.ts"],"sourcesContent":["/**\n * KG이니시스 본인인증 plugin — 코어 IDV 모달 슬롯 기반 통합.\n *\n * 설계 (Phase E′ 전환):\n * - 코어 IDV 흐름 (428 → 템플릿 launcher → POST /api/identity/challenges → 모달 open) 을 그대로 사용\n * - 코어 모달의 `identity_provider_ui:text_code` Extension Point 슬롯을 본 plugin 의\n * `resources/extensions/identity_provider_inicis.json` (mode: 'replace') 로 교체\n * - 슬롯 안의 \"이니시스 본인인증 시작\" 버튼이 본 파일의 핸들러 `startAuth` 를 호출\n * - 사용자 클릭 직접 호출 → window.open 이 사용자 제스처 컨텍스트 안에서 실행 →\n * Chrome popup blocker 회피 (자동 호출은 차단됨)\n * - 인증 완료 시 bridge 페이지가 부모창에 postMessage → resolveIdentityChallenge 핸들러 →\n * 코어 모달이 닫히고 return_request 재실행\n *\n * 이전 setLauncher 덮어쓰기 방식은 popup blocker 차단으로 폐기 (Phase E′-revert).\n *\n * @since 1.0.0-beta.1\n */\n\nconst PLUGIN_IDENTIFIER = 'sirsoft-verification_kginicis';\nconst PROVIDER_ID = 'inicis';\nconst POPUP_FEATURES = 'width=400,height=640,scrollbars=yes,resizable=yes';\nconst INICIS_AUTH_URL = 'https://sa.inicis.com/auth';\nconst POPUP_CLOSED_POLL_MS = 500;\nconst MODAL_ID = 'identity-challenge-modal';\n\ninterface InicisChallengePayload {\n mid: string;\n mtxid: string;\n reqSvcCd: string;\n flgFixedUser: string;\n reservedMsg: string;\n authHash: string;\n}\n\ninterface BridgeResult {\n type: 'identity_result';\n verification_token?: string;\n challenge_id?: string;\n identity_error?: string;\n}\n\nconst logger = {\n info: (...args: unknown[]) => console.info(`[${PLUGIN_IDENTIFIER}]`, ...args),\n warn: (...args: unknown[]) => console.warn(`[${PLUGIN_IDENTIFIER}]`, ...args),\n error: (...args: unknown[]) => console.error(`[${PLUGIN_IDENTIFIER}]`, ...args),\n};\n\nfunction getG7Core(): Record<string, any> | null {\n return ((window as any).G7Core as Record<string, any> | undefined) ?? null;\n}\n\nfunction buildSuccessUrl(): string {\n return `${window.location.origin}/plugins/${PLUGIN_IDENTIFIER}/plugin/inicis/callback`;\n}\n\n/**\n * 이니시스 본인인증 form 을 동적 생성하여 지정 target 에 POST.\n *\n * KISA 샘플 (sirsoft-verification/inicis/PHP/request.php) 와 동일한 form 구조 + setAttribute 패턴.\n */\nfunction submitInicisForm(payload: InicisChallengePayload, popupName: string): void {\n const form = document.createElement('form');\n form.setAttribute('name', 'saForm');\n form.setAttribute('method', 'POST');\n form.setAttribute('action', INICIS_AUTH_URL);\n form.setAttribute('target', popupName);\n form.setAttribute('accept-charset', 'UTF-8');\n form.style.display = 'none';\n\n const fields: Record<string, string> = {\n mid: payload.mid,\n reqSvcCd: payload.reqSvcCd,\n mTxId: payload.mtxid,\n authHash: payload.authHash,\n flgFixedUser: payload.flgFixedUser,\n successUrl: buildSuccessUrl(),\n failUrl: buildSuccessUrl(),\n reservedMsg: payload.reservedMsg,\n };\n\n for (const [name, value] of Object.entries(fields)) {\n const input = document.createElement('input');\n input.type = 'hidden';\n input.name = name;\n input.value = value;\n form.appendChild(input);\n }\n\n document.body.appendChild(form);\n form.submit();\n // form 은 자동 정리되지 않으므로 다음 tick 에 제거\n window.setTimeout(() => { try { form.remove(); } catch { /* noop */ } }, 0);\n}\n\n/**\n * _global.identityChallenge.providerInProgress 플래그를 set 한다.\n *\n * 모달 슬롯의 if 분기 — true 면 진행 중 안내 (스피너 + \"팝업창에서 진행 중\") 노출,\n * false 면 사전 안내 카드 + 시작 버튼 노출.\n */\nfunction setProviderInProgress(value: boolean): void {\n const G7Core = getG7Core();\n const set = G7Core?.state?.set;\n if (typeof set !== 'function') return;\n set({ identityChallenge: { providerInProgress: value } });\n}\n\n/**\n * verify 실패 코드 → 사용자 안내 메시지 i18n 키 매핑.\n *\n * 브리지 query 에는 failureCode 만 실려오므로(다국어 메시지 미전달), 프론트에서 코드를\n * `$t:` 다국어 키로 매핑한다. 코어 toast 핸들러가 `$t:` prefix 를 자동 번역하므로\n * 하드코딩 없이 로케일별 메시지가 표시된다.\n *\n * 미성년자 차단(NOT_ADULT) 안내 + 기존 미노출 실패 다건 안내를 일괄 처리한다.\n */\nconst FAILURE_MESSAGE_KEYS: Record<string, string> = {\n NOT_ADULT: '$t:sirsoft-verification_kginicis.errors.not_adult',\n INVALID_AUTH_URL: '$t:sirsoft-verification_kginicis.errors.invalid_auth_url',\n DECRYPT_FAILED: '$t:sirsoft-verification_kgiLine truncated
|
||||
@@ -14,7 +14,9 @@ export default defineConfig({
|
||||
entryFileNames: 'js/plugin.iife.js',
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
minify: 'esbuild',
|
||||
target: 'es2020',
|
||||
chunkSizeWarningLimit: 500,
|
||||
|
||||
Vendored
-1
@@ -1558,4 +1558,3 @@ details[open] > .g7dt-summary::before {
|
||||
}
|
||||
`,ve=()=>{const d="g7-devtools-styles";if(document.getElementById(d))return;const t=document.createElement("style");t.id=d,t.textContent=be,document.head.appendChild(t)},le={state:"상태",actions:"액션",cache:"캐시",diagnose:"진단",performance:"성능",lifecycle:"라이프사이클",network:"네트워크",form:"Form",conditional:"조건부",expression:"표현식",handlers:"핸들러",events:"이벤트",datasources:"데이터소스",renders:"렌더링",styles:"스타일",auth:"인증",logs:"로그",layout:"레이아웃",changedetection:"변경감지",staleclosure:"Stale Closure",nestedcontext:"Context",modalscope:"모달스코프",namedactions:"Named Actions"},Ne=700,ue=500,re=400,ce=300,ne="g7-devtools-panel",te=d=>d===null||d===void 0?"g7dt-text-gray":typeof d=="string"?"g7dt-text-yellow":typeof d=="number"?"g7dt-text-cyan":typeof d=="boolean"?"g7dt-text-pink":Array.isArray(d)?"g7dt-text-orange":typeof d=="object"?"g7dt-text-blue":"g7dt-text-white",ye=d=>d===null?"null":d===void 0?"undefined":Array.isArray(d)?`Array(${d.length})`:typeof d=="object"?`Object(${Object.keys(d).length})`:typeof d,we=d=>d===null?"null":d===void 0?"undefined":typeof d=="string"?d.length>50?`"${d.substring(0,50)}..."`:`"${d}"`:typeof d=="boolean"?d?"true":"false":typeof d=="number"?String(d):"",oe=()=>{try{const d=localStorage.getItem(ne);if(d)return JSON.parse(d)}catch(d){console.warn("[G7DevTools] 설정 로드 실패:",d)}return{}},ie=d=>{try{const s={...oe(),...d};localStorage.setItem(ne,JSON.stringify(s))}catch(t){console.warn("[G7DevTools] 설정 저장 실패:",t)}},W=({keyName:d,value:t,path:s,expandedPaths:a,onToggle:g,searchTerm:r,depth:o=0})=>{const p=t!==null&&typeof t=="object",v=a.has(s),l=Array.isArray(t),f=r&&(d.toLowerCase().includes(r.toLowerCase())||typeof t=="string"&&t.toLowerCase().includes(r.toLowerCase())||typeof t=="number"&&String(t).includes(r)),c=y=>{y.stopPropagation(),p&&g(s)},h=p?Object.entries(t):[];return e.jsxs("div",{style:{marginLeft:o>0?"16px":"0"},children:[e.jsxs("div",{className:`g7dt-tree-node g7dt-flex g7dt-items-center g7dt-gap-1 ${f?"g7dt-ring-highlight":""}`,onClick:c,children:[p?e.jsx("span",{className:"g7dt-text-gray g7dt-w-4 g7dt-text-xs g7dt-select-none",style:{textAlign:"center"},children:v?"▼":"▶"}):e.jsx("span",{className:"g7dt-w-4"}),e.jsx("span",{className:"g7dt-text-purple g7dt-text-xs",children:d}),e.jsx("span",{className:"g7dt-text-gray-dark g7dt-text-xs",children:":"}),p?e.jsxs("span",{className:`g7dt-text-xs ${te(t)}`,children:[l?"[":"{",!v&&e.jsx("span",{className:"g7dt-text-gray",style:{margin:"0 4px"},children:ye(t)}),!v&&(l?"]":"}")]}):e.jsx("span",{className:`g7dt-text-xs ${te(t)}`,children:we(t)}),!p&&e.jsxs("span",{className:"g7dt-text-gray-dark g7dt-text-xs g7dt-ml-1",children:["(",typeof t,")"]})]}),p&&v&&e.jsxs("div",{className:"g7dt-border-l",style:{marginLeft:"8px"},children:[h.map(([y,n])=>e.jsx(W,{keyName:l?`[${y}]`:y,value:n,path:`${s}.${y}`,expandedPaths:a,onToggle:g,searchTerm:r,depth:o+1},`${s}.${y}`)),e.jsx("div",{className:"g7dt-ml-4 g7dt-text-xs",children:e.jsx("span",{className:te(t),children:l?"]":"}"})})]})]})},ke=({state:d,devTools:t})=>{const[s,a]=x.useState(new Set(["_global","_local","_computed","_isolated","$parent"])),[g,r]=x.useState(""),[o,p]=x.useState(!1),[v,l]=x.useState(!1),[f,c]=x.useState(null),h=x.useCallback(()=>{t&&c(t.getComputedDependencyTrackingInfo())},[t]);x.useEffect(()=>{if(v&&t){h();const w=setInterval(h,2e3);return()=>clearInterval(w)}},[v,t,h]);const y=w=>{switch(w){case"state-change":return"📊";case"prop-change":return"📥";case"dependency-change":return"🔗";case"manual":return"👆";case"initial":return"🚀";default:return"❓"}},n=x.useCallback(w=>{a(S=>{const z=new Set(S);return z.has(w)?z.delete(w):z.add(w),z})},[]),i=x.useCallback((w,S)=>{const z=[S];if(w!==null&&typeof w=="object")for(const[O,K]of Object.entries(w))z.push(...i(K,`${S}.${O}`));return z},[]),u=x.useCallback(()=>{if(o)a(new Set(["_global","_local","_computed","_isolated","$parent"]));else{const w=new Set;i(d._global,"_global").forEach(S=>w.add(S)),i(d._local,"_local").forEach(S=>w.add(S)),i(d._computed,"_computed").forEach(S=>w.add(S)),i(d._isolated,"_isolated").forEach(S=>w.add(S)),d.$parent&&i(d.$parent,"$parent").forEach(S=>w.add(S)),a(w)}p(!o)},[o,d,i]),m=Object.keys(d._global||{}).length,k=Object.keys(d._local||{}).length,b=Object.keys(d._computed||{}).length,N=Object.keys(d._isolated||{}).length,C=Object.keys(d.$parent||{}).length;return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-items-center g7dt-flex-shrink-0",children:[e.jsx("input",{type:"text",placeholder:"키 또는 값 검색...",value:g,onChange:w=>r(w.target.value),className:"g7dt-input g7dt-flex-1"}),e.jsx("button",{onClick:u,className:"g7dt-btn g7dt-bg-gray-700",children:o?"모두 접기":"모두 펼치기"})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-3 g7dt-text-xs g7dt-text-gray g7dt-flex-wrap g7dt-flex-
Line truncated
|
||||
... (truncated)`:v}catch{return"(직렬화 불가)"}};return e.jsxs("div",{className:"g7dt-space-y-4",children:[t.activeRequests.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-yellow g7dt-mb-2",children:["진행 중 (",t.activeRequests.length,")"]}),e.jsx("div",{className:"g7dt-space-y-1",children:t.activeRequests.map(o=>e.jsxs("details",{className:"g7dt-details",children:[e.jsxs("summary",{className:"g7dt-summary g7dt-pending-request",children:[e.jsx("span",{className:"g7dt-font-bold",children:o.method}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-lightgray g7dt-truncate",children:o.fullUrl||o.url})]}),e.jsxs("div",{className:"g7dt-card g7dt-mt-1 g7dt-text-xs",children:[a(o)&&e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsx("div",{className:"g7dt-text-blue g7dt-font-bold g7dt-mb-1",children:"쿼리 파라미터"}),e.jsx("div",{className:"g7dt-pl-2 g7dt-border-l-2 g7dt-border-blue",children:g(o.queryParams)})]}),o.requestBody&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-orange g7dt-font-bold g7dt-mb-1",children:"요청 본문"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-xs",children:r(o.requestBody,2e3)})]})]})]},o.id))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"요청 이력"}),e.jsx("div",{className:"g7dt-space-y-1 g7dt-scroll-list-lg",children:t.requestHistory.length===0?e.jsx("div",{className:"g7dt-empty-message",children:"요청 이력 없음"}):t.requestHistory.slice(-20).reverse().map(o=>e.jsxs("details",{className:"g7dt-details",children:[e.jsxs("summary",{className:"g7dt-summary g7dt-card g7dt-text-xs",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-w-full",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-font-bold",children:o.method}),e.jsx("span",{className:`g7dt-ml-2 ${s(o.status)}`,children:o.statusCode||o.status})]}),e.jsxs("span",{className:"g7dt-text-gray",children:[o.duration,"ms"]})]}),e.jsx("div",{className:"g7dt-text-gray g7dt-truncate g7dt-mt-1",children:o.fullUrl||o.url})]}),e.jsxs("div",{className:"g7dt-card g7dt-mt-1 g7dt-text-xs g7dt-ml-2 g7dt-border-l-2 g7dt-border-gray",children:[e.jsx("div",{className:"g7dt-mb-2",children:e.jsxs("div",{className:"g7dt-text-xs g7dt-space-y-1",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"URL:"})," ",e.jsx("span",{className:"g7dt-text-lightgray",children:o.fullUrl||o.url})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"상태:"})," ",e.jsx("span",{className:s(o.status),children:o.statusCode||o.status})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"소요시간:"})," ",e.jsxs("span",{className:"g7dt-text-lightgray",children:[o.duration,"ms"]})]}),o.dataSourceId&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"데이터소스:"})," ",e.jsx("span",{className:"g7dt-text-blue",children:o.dataSourceId})]}),o.error&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"에러:"})," ",e.jsx("span",{className:"g7dt-text-red",children:o.error})]})]})}),a(o)&&e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsx("div",{className:"g7dt-text-blue g7dt-font-bold g7dt-mb-1",children:"쿼리 파라미터"}),e.jsx("div",{className:"g7dt-pl-2 g7dt-border-l-2 g7dt-border-blue",children:g(o.queryParams)})]}),o.requestBody&&e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsx("div",{className:"g7dt-text-orange g7dt-font-bold g7dt-mb-1",children:"요청 본문"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-xs g7dt-max-h-40 g7dt-overflow-auto",children:r(o.requestBody,2e3)})]}),o.response!==void 0&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-green g7dt-font-bold g7dt-mb-1",children:"응답 내용"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-xs g7dt-max-h-60 g7dt-overflow-auto",children:r(o.response,5e3)})]})]})]},o.id))})]}),t.pendingDataSources.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-blue g7dt-mb-2",children:["대기 중인 데이터소스 (",t.pendingDataSources.length,")"]}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:t.pendingDataSources.map(o=>e.jsx("span",{className:"g7dt-tag-blue",children:o},o))})]})]})},Ee=({devTools:d})=>{const t=d.getFormInfo(),[s,a]=x.useState(!1),[g,r]=x.useState(null),o=x.useCallback(()=>{r(d.getFormBindingValidationTrackingInfo())},[d]);x.useEffect(()=>{if(s){o();const l=setInterval(o,2e3);return()=>clearInterval(l)}},[s,o]);const p=l=>{switch(l){case"missing-datakey":return"🔑";case"missing-input-name":return"📝";case"context-not-propagated":return"🔗";case"sortable-context-break":return"📊";case"modal-context-isolation":return"🪟";case"duplicate-input-name":return"👯";case"value-type-mismatch":return"⚠️";case"binding-path-invalid":return"❌";default:return"❓"}},v=l=>{switch(l){case"error":return"g7dt-
Line truncated
|
||||
//# sourceMappingURL=devtools.min.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"devtools.min.js","sources":["../../../resources/js/core/devtools/__runtime-shims/G7DevToolsCore.ts","../../../resources/js/core/devtools/DiagnosticEngine.ts","../../../resources/js/core/devtools/ServerConnector.ts","../../../resources/js/core/devtools/StyleTracker.ts","../../../resources/js/core/devtools/ui/styles.ts","../../../resources/js/core/devtools/ui/constants.ts","../../../resources/js/core/devtools/ui/utils.ts","../../../resources/js/core/devtools/ui/components/JsonTreeNode.tsx","../../../resources/js/core/devtools/ui/tabs/StateTab.tsx","../../../resources/js/core/devtools/ui/tabs/ActionsTab.tsx","../../../resources/js/core/devtools/ui/tabs/CacheTab.tsx","../../../resources/js/core/devtools/ui/tabs/DiagnoseTab.tsx","../../../resources/js/core/devtools/ui/tabs/PerformanceTab.tsx","../../../resources/js/core/devtools/ui/tabs/LifecycleTab.tsx","../../../resources/js/core/devtools/ui/tabs/NetworkTab.tsx","../../../resources/js/core/devtools/ui/tabs/FormTab.tsx","../../../resources/js/core/devtools/ui/tabs/ConditionalTab.tsx","../../../resources/js/core/devtools/ui/tabs/ExpressionTab.tsx","../../../resources/js/core/devtools/ui/tabs/HandlersTab.tsx","../../../resources/js/core/devtools/ui/tabs/EventsTab.tsx","../../../resources/js/core/devtools/ui/tabs/DataSourcesTab.tsx","../../../resources/js/core/devtools/ui/tabs/RendersTab.tsx","../../../resources/js/core/devtools/ui/tabs/StylesTab.tsx","../../../resources/js/core/devtools/ui/tabs/AuthTab.tsx","../../../resources/js/core/devtools/ui/tabs/LogsTab.tsx","../../../resources/js/core/devtools/ui/tabs/LayoutTab.tsx","../../../resources/js/core/devtools/ui/tabs/ChangeDetectionTab.tsx","../../../resources/js/core/devtools/ui/tabs/StaleClosureTab.tsx","../../../resources/js/core/devtools/ui/tabs/NestedContextTab.tsx","../../../resources/js/core/devtools/ui/tabs/ModalScopeTab.tsx","../../../resources/js/core/devtools/ui/tabs/NamedActionsTab.tsx","../../../resources/js/core/devtools/ui/DevToolsPanel.tsx","../../../resources/js/core/devtools-entry.ts"],"sourcesContent":["/**\n * G7DevToolsCore 런타임 shim — DevTools lazy 번들 전용 (vite.config.devtools.js alias 대상)\n * @since engine-v1.51.0\n *\n * DevTools 추적 코어는 디버그 무관 항상 필요해 메인 번들에 남는다. 디버그 lazy 번들\n * (DevToolsPanel 등)은 이 shim 으로 메인 번들의 단일 인스턴스를 빌려 쓴다(싱글톤 동일성).\n * 값은 window.G7Core.__runtime, 타입은 원본에서 재export.\n */\n\nconst runtime = (typeof window !== 'undefined'\n ? (window as any).G7Core?.__runtime\n : undefined) as { G7DevToolsCore?: unknown } | undefined;\n\nif (!runtime?.G7DevToolsCore) {\n throw new Error(\n '[devtools] window.G7Core.__runtime.G7DevToolsCore 이 없습니다. ' +\n '코어 번들(template-engine.min.js)이 devtools 번들보다 먼저 로드되어야 합니다.'\n );\n}\n\nexport const G7DevToolsCore = runtime.G7DevToolsCore as typeof import('../G7DevToolsCore').G7DevToolsCore;\nexport default G7DevToolsCore;\n","/**\n * G7 DevTools 진단 엔진\n *\n * 증상 기반으로 템플릿 엔진 문제를 자동 진단하는 규칙 엔진\n *\n * @module DiagnosticEngine\n */\n\nimport type {\n DiagnosticRule,\n DiagnosticCategory,\n DiagnosticContext,\n DiagnosisResult,\n FixSuggestion,\n CommonIssue,\n StateSnapshot,\n ActionLog,\n CacheStats,\n StateView,\n LifecycleInfo,\n PerformanceInfo,\n NetworkInfo,\n ConditionalInfo,\n FormInfo,\n WebSocketInfo,\n} from './types';\nimport { G7DevToolsCore } from './G7DevToolsCore';\n\n/**\n * 진단 규칙 정의\n *\n * 트러블슈팅 가이드의 주요 이슈를 규칙으로 정의\n */\nconst diagnosticRules: DiagnosticRule[] = [\n // ============================================\n // 상태 관련 문제\n // ============================================\n {\n id: 'stale-closure',\n name: 'Stale Closure',\n category: 'state',\n symptoms: [\n '이전 값이 전송됨',\n '저장 시 오래된 데이터',\n 'API 호출 시 첫 값만 전송',\n '클릭할 때마다 같은 값',\n ],\n detector: (ctx) => {\n // 액션 이력에서 동일한 값이 반복되는 패턴 감지\n const recentActions = ctx.actionHistory.slice(-10);\n const apiCalls = recentActions.filter(a => a.type === 'apiCall');\n if (apiCalls.length < 2) return false;\n\n // 연속된 API 호출에서 동일한 파라미터가 사용되는지 확인\n for (let i = 1; i < apiCalls.length; i++) {\n const prevParams = JSON.stringify(apiCalls[i - 1].params);\n const currParams = JSON.stringify(apiCalls[i].params);\n if (prevParams === currParams && apiCalls[i].params) {\n return true;\n }\n }\n return fLine truncated
|
||||
-1
@@ -11,4 +11,3 @@ var eM=Object.defineProperty;var tM=(ln,i,u)=>i in ln?eM(ln,i,{enumerable:!0,con
|
||||
Press space again to drop the item in its new position, or press escape to cancel.
|
||||
`},I7={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function A7(e){let{announcements:t=I7,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=E7}=e;const{announce:s,announcement:a}=S7(),l=Qr("DndLiveRegion"),[d,c]=u.useState(!1);if(u.useEffect(()=>{c(!0)},[]),C7(u.useMemo(()=>({onDragStart(f){let{active:y}=f;s(t.onDragStart({active:y}))},onDragMove(f){let{active:y,over:g}=f;t.onDragMove&&s(t.onDragMove({active:y,over:g}))},onDragOver(f){let{active:y,over:g}=f;s(t.onDragOver({active:y,over:g}))},onDragEnd(f){let{active:y,over:g}=f;s(t.onDragEnd({active:y,over:g}))},onDragCancel(f){let{active:y,over:g}=f;s(t.onDragCancel({active:y,over:g}))}}),[s,t])),!d)return null;const p=u.createElement(u.Fragment,null,u.createElement(w7,{id:o,value:r.draggable}),u.createElement(k7,{id:l,announcement:a}));return n?Sn.createPortal(p,n):p}var it;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(it||(it={}));function ti(){}function T7(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function D7(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u.useMemo(()=>[...t].filter(o=>o!=null),[...t])}const Ht=Object.freeze({x:0,y:0});function N7(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function z7(e,t){const n=ei(e);if(!n)return"0 0";const o={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return o.x+"% "+o.y+"%"}function M7(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function L7(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function P7(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function O7(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function B7(e,t){const n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),a=r-o,l=s-n;if(o<r&&n<s){const d=t.width*t.height,c=e.width*e.height,p=a*l,f=p/(d+c-p);return Number(f.toFixed(4))}return 0}const W7=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=[];for(const s of o){const{id:a}=s,l=n.get(a);if(l){const d=B7(l,t);d>0&&r.push({id:a,data:{droppableContainer:s,value:d}})}}return r.sort(L7)};function j7(e,t){const{top:n,left:o,bottom:r,right:s}=t;return n<=e.y&&e.y<=r&&o<=e.x&&e.x<=s}const H7=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:o}=e;if(!o)return[];const r=[];for(const s of t){const{id:a}=s,l=n.get(a);if(l&&j7(o,l)){const c=P7(l).reduce((f,y)=>f+N7(o,y),0),p=Number((c/4).toFixed(4));r.push({id:a,data:{droppableContainer:s,value:p}})}}return r.sort(M7)};function F7(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Op(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ht}function K7(e){return function(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),s=1;s<o;s++)r[s-1]=arguments[s];return r.reduce((a,l)=>({...a,top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),{...n})}}const V7=K7(1);function Bp(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function U7(e,t,n){const o=Bp(t);if(!o)return e;const{scaleX:r,scaleY:s,x:a,y:l}=o,d=e.left-a-(1-r)*parseFloat(n),c=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),p=r?e.width/r:e.width,f=s?e.height/s:e.height;return{width:p,height:f,top:c,right:d+p,bottom:c+f,left:d}}const q7={ignoreTransform:!1};function Bo(e,t){t===void 0&&(t=q7);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:p}=_t(e).getComputedStyle(e);c&&(n=U7(n,c,p))}const{top:o,left:r,width:s,height:a,bottom:l,right:d}=n;return{top:o,left:r,width:s,height:a,bottom:l,right:d}}function Wp(e){return Bo(e,{ignoreTransform:!0})}function G7(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Y7(e,t){return t===void 0&&(t=_t(e).getComputedStyle(e)),t.position==="fixed"}function X7(e,t){t===void 0&&(t=_t(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const s=t[r];return typeof s=="string"?n.test(s):!1})}function aa(e,t){const n=[];
Line truncated
|
||||
`:"",e.message]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:8,flexWrap:"wrap"},children:[e.kind==="unauthorized"&&i.jsx("button",{type:"button","data-testid":"g7le-access-error-action-signin",onClick:a,style:Ha,children:t("layout_editor.access_error.action.sign_in")}),e.kind==="forbidden"&&i.jsx("button",{type:"button","data-testid":"g7le-access-error-action-home",onClick:r,style:Ha,children:t("layout_editor.access_error.action.go_home")}),(e.kind==="not_found"||e.kind==="server_error"||e.kind==="network"||e.kind==="unknown")&&i.jsx("button",{type:"button","data-testid":"g7le-access-error-action-retry",onClick:s,style:Ha,children:t("layout_editor.access_error.action.retry")}),e.kind!=="unauthorized"&&i.jsx("button",{type:"button","data-testid":"g7le-access-error-action-home-secondary",onClick:r,style:h4,children:t("layout_editor.access_error.action.go_admin_home")})]})]})]})}const Ha={padding:"8px 16px",background:"#2563eb",color:"#fff",border:"1px solid #1d4ed8",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer"},h4={padding:"8px 16px",background:"#fff",color:"#475569",border:"1px solid #cbd5e1",borderRadius:6,fontSize:13,fontWeight:500,cursor:"pointer"};function y4(e){const t=window;if(typeof t>"u")return{getSnapshot:()=>({globalState:{},localState:{}}),restore:()=>{}};const n=t.G7Core||{},o={templateApp:t.__templateApp,g7CoreState:n.state,g7CoreDispatch:n.dispatch,g7CoreData:n.data,g7CoreModal:n.modal,g7CoreToast:n.toast};let r={...e.initialGlobalState??{}};r._local||(r._local={});const s=[],a=()=>{const c={globalState:{...r},localState:{...r._local??{}}};for(const p of s)try{p(r)}catch{}e.onChange?.(c)},l={},d={getGlobalState:()=>r,setGlobalState:(c,p)=>{typeof c=="function"?r=c(r):r={...r,...c},a()},onGlobalStateChange:c=>(s.push(c),()=>{const p=s.indexOf(c);p>=0&&s.splice(p,1)}),get globalState(){return r},getActionDispatcher:()=>e.actionDispatcher,getDataSource:c=>l[c]??null,setDataSource:(c,p)=>{l[c]=p},refetchDataSource:async c=>null,updateDataSourceItem:(c,p,f)=>l[c]??null,getLocale:()=>e.locale,changeLocale:c=>{},getRouter:()=>({navigate:()=>{},replace:()=>{},push:()=>{}}),updateQueryParams:()=>{}};return t.__templateApp=d,n&&typeof n.dispatch=="function"&&(n.dispatch=(c,p)=>{try{return e.actionDispatcher.executeAction(c,p??{})}catch{return}}),n&&typeof n.modal=="object"&&n.modal!==null&&(n.modal={...n.modal,open:()=>{},close:()=>{},closeAll:()=>{}}),n&&typeof n.toast=="object"&&n.toast!==null&&(n.toast={...n.toast,push:()=>{},dismiss:()=>{}}),{getSnapshot:()=>({globalState:{...r},localState:{...r._local??{}}}),restore:()=>{t.__templateApp===d&&(t.__templateApp=o.templateApp),t.G7Core&&(o.g7CoreState!==void 0&&(t.G7Core.state=o.g7CoreState),o.g7CoreDispatch!==void 0&&(t.G7Core.dispatch=o.g7CoreDispatch),o.g7CoreData!==void 0&&(t.G7Core.data=o.g7CoreData),o.g7CoreModal!==void 0&&(t.G7Core.modal=o.g7CoreModal),o.g7CoreToast!==void 0&&(t.G7Core.toast=o.g7CoreToast)),s.length=0}}}const b4=new Set(["id","userId","postId","orderId","productId","categoryId","commentId","noticeId","inquiryId","addressId","wishlistId","notificationId","roleId","menuId"]);function m4(e){if(!e)return{};const t={},n=/:([a-zA-Z_][a-zA-Z0-9_]*)/g;let o;for(;(o=n.exec(e))!==null;){const r=o[1];t[r]=v4(r)}return t}function v4(e){return b4.has(e)||/Id$|_id$/.test(e)?"1":"sample"}const _4=ar("LayoutEditor");function Go(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function hi(e){if(Array.isArray(e))return e.map(t=>hi(t));if(Go(e)){const t={};for(const[n,o]of Object.entries(e))t[n]=hi(o);return t}return e}function pg(e,t="",n=new Set){for(const[o,r]of Object.entries(e)){const s=t?`${t}.${o}`:o;Go(r)?pg(r,s,n):n.add(s)}return n}function fg(e,t,n,o,r,s=""){for(const[a,l]of Object.entries(t)){const d=s?`${s}.${a}`:a;if(n.has(d)){r(`[LayoutEditor] sampleGlobal key conflict: extension '${o}' override of core key '${d}' ignored`);continue}const c=e[a];Go(l)&&Go(c)?fg(c,l,n,o,r,d):e[a]=hi(l)}}function Fa(e){const t=e.warn??(r=>_4.warn(r)),n=hi(e.coreSeed??{});e.isGuestOnly&&"currentUser"in n&&delete n.currentUser;const o=pg(n);for(const r of e.sources)Go(r.sampleGlobal)&&fg(n,r.sampleGlobal,o,r.id,t);return e.isGuestOnly&&"currentUser"in n&&delete n.currentUser,n}function x4(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;for(const[n,o]of Object.entries(e))n.startsWith("$")&&(t[n]=o);return t}function w4(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;for(const[n,o]of Object.entries(e))n.startsWith("$")||(t[n]=o);return t}function k4(e){if(typeof e!="string")return null;const t=/^\s*\{\{\s*([\s\S]*?)\s*\}\}\s*$/.exec(e);if(!t)return null;let n=t[1];const o=n.indexOf("??");return o>=0&&(n=n.slice(0,o)),n=n.replace(/\?\./g,".").replace(/\s+/g,""),n===""||!/^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/.test(n)?null:n.split(".")}function S4(e,t){const n=k4(t);if(!n||n.length===0)return e;let o=e;for(let a=0;a<n.length;a++){if(o==null||typeof o!="obj
Line truncated
|
||||
//# sourceMappingURL=layout-editor.min.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"layout-editor.min.js","sources":["../../../resources/js/core/template-engine/layout-editor/__runtime-shims/runtime.ts","../../../resources/js/core/template-engine/layout-editor/__runtime-shims/TranslationContext.ts","../../../resources/js/core/template-engine/layout-editor/devtools/editorTrackers.ts","../../../resources/js/core/template-engine/layout-editor/LayoutEditorContext.tsx","../../../resources/js/core/template-engine/layout-editor/LayoutDocumentContext.tsx","../../../resources/js/core/template-engine/layout-editor/EditorModalContext.tsx","../../../resources/js/core/template-engine/layout-editor/components/EditorToolbar.tsx","../../../resources/js/core/template-engine/layout-editor/utils/authToken.ts","../../../resources/js/core/template-engine/layout-editor/utils/layoutAttachments.ts","../../../resources/js/core/template-engine/layout-editor/components/property-controls/LayoutAttachmentManager.tsx","../../../resources/js/core/template-engine/layout-editor/utils/customTranslations.ts","../../../resources/js/core/template-engine/layout-editor/__runtime-shims/TranslationEngine.ts","../../../resources/js/core/template-engine/layout-editor/__runtime-shims/Logger.ts","../../../resources/js/core/template-engine/layout-editor/spec/editorSpecLoader.ts","../../../resources/js/core/template-engine/layout-editor/spec/bindingCandidates.ts","../../../resources/js/core/template-engine/layout-editor/spec/inlineBindingUtils.ts","../../../resources/js/core/template-engine/layout-editor/utils/layoutTreeUtils.ts","../../../resources/js/core/template-engine/layout-editor/hooks/useInlineEdit.ts","../../../resources/js/core/template-engine/layout-editor/hooks/pendingCustomTranslations.ts","../../../resources/js/core/template-engine/layout-editor/components/LocaleSwitcher.tsx","../../../resources/js/core/template-engine/layout-editor/components/property-controls/PlaceholderChipInput.tsx","../../../resources/js/core/template-engine/layout-editor/components/property-controls/CustomTranslationManager.tsx","../../../resources/js/core/template-engine/layout-editor/hooks/usePageSettings.ts","../../../resources/js/core/template-engine/layout-editor/sample-data/sampleDataProvider.ts","../../../resources/js/core/template-engine/layout-editor/__runtime-shims/DataBindingEngine.ts","../../../resources/js/core/template-engine/layout-editor/spec/computedRecipeEngine.ts","../../../resources/js/core/template-engine/layout-editor/hooks/useBindingCandidates.ts","../../../resources/js/core/template-engine/layout-editor/hooks/useSeoBindingCandidates.ts","../../../resources/js/core/template-engine/layout-editor/spec/candidatePools.ts","../../../resources/js/core/template-engine/layout-editor/spec/actionRecipeEngine.ts","../../../resources/js/core/template-engine/layout-editor/hooks/useCustomTranslation.ts","../../../resources/js/core/template-engine/layout-editor/components/property-controls/inlineBindingApi.ts","../../../resources/js/core/template-engine/layout-editor/components/property-controls/TranslationField.tsx","../../../resources/js/core/template-engine/layout-editor/components/shared/FloatingDropdown.tsx","../../../resources/js/core/template-engine/layout-editor/components/property-controls/InlineBindingScalarPicker.tsx","../../../resources/js/core/template-engine/layout-editor/spec/expressionValueTree.ts","../../../resources/js/core/template-engine/layout-editor/components/DropLine.tsx","../../../resources/js/core/template-engine/layout-editor/hooks/useListDragReorder.ts","../../../resources/js/core/template-engine/layout-editor/components/page-settings/SegmentedValueEditor.tsx","../../../resources/js/core/template-engine/layout-editor/components/page-settings/ConditionalValueEditor.tsx","../../../resources/js/core/template-engine/layout-editor/components/property-controls/I18nTextField.tsx","../../../resources/js/core/template-engine/layout-editor/components/property-controls/TagInputControl.tsx","../../../resources/js/core/template-engine/layout-editor/spec/widgetRegistry.ts","../../../resources/js/core/template-engine/layout-editor/components/page-settings/MetaForm.tsx","../../../resources/js/core/template-engine/layout-editor/components/page-settings/FormPrimitives.tsx","../../../resources/js/core/template-engine/layout-editor/components/page-settings/BindingChipTextInput.tsx","../../../resources/js/core/template-engine/layout-editor/components/page-settings/DataChipValueInput.tsx","../../../resources/js/core/template-engine/layout-editor/components/page-settings/KeyValueChipEditor.tsx","../../../resources/js/core/template-engine/layout-editor/components/page-settings/SeoOgForm.tsx","../../../resources/js/core/template-engine/layout-editor/components/page-settings/SeoStructuredDataEditor.tsx","../../../resources/js/core/template-engine/layout-editor/components/page-settings/SeoVarsEditor.tsx","../../../resources/js/core/template-engine/layout-editor/components/page-settings/SeoBotPreviewPanel.tsx","../../..Line truncated
|
||||
-1
@@ -241,4 +241,3 @@ Error generating stack: `+c.message+`
|
||||
}
|
||||
}
|
||||
`)(a)}catch(r){B.warn(`Expression evaluation failed: ${e}`,r);return}}async executeInitActions(e,a={}){const{getActionDispatcher:r}=await Promise.resolve().then(()=>Ha),i=r();if(!i){B.warn("ActionDispatcher not available for init_actions");return}B.log("Executing init_actions:",e.map(d=>d.handler)),B.log("Init actions dataContext:",a),B.log("Init actions dataContext._global:",a._global);const l=e.map(d=>d.handler).filter(d=>d.includes("."));l.length>0&&await this.waitForHandlers(i,l);let u={...a};for(const d of e)try{const f={type:"click",handler:d.handler,target:d.target,params:d.params,resultTo:d.resultTo,onSuccess:d.onSuccess,onError:d.onError,if:d.if,conditions:d.conditions,auth_mode:d.auth_mode,auth_required:d.auth_required},g=i.createHandler(f,u),m=new Event("init");await g(m),B.log(`Init action executed: ${d.handler}`);const b=this.globalState;u={...u,_global:{...b},_local:b._local||u._local||{}},B.log(`Data context refreshed after ${d.handler}:`,{cartKey:u._global?.cartKey})}catch(f){B.error(`Failed to execute init action: ${d.handler}`,f)}}async waitForHandlers(e,a,r=5e3){const i=Date.now(),l=50,u=()=>a.every(f=>e.customHandlers?.has(f));if(u()){B.log("All module handlers already registered");return}const d=of().getFailedJsAssets();if(d.length>0){const f=d.some(b=>b==="module"||b==="plugin"),g=a.filter(b=>!e.customHandlers?.has(b)),m=g.length>0&&g.every(b=>d.some(v=>b.startsWith(`${v}.`)));if(f||m){B.warn("Extension asset load failed — not waiting for handlers that will never register:",{pending:g,failedAssets:d});return}}return B.log("Waiting for module handlers:",a),new Promise(f=>{const g=()=>{if(u()){B.log("All module handlers now registered"),f();return}if(Date.now()-i>=r){const m=a.filter(b=>!e.customHandlers?.has(b));B.warn("Timeout waiting for handlers:",m),f();return}setTimeout(g,l)};g()})}};$(Ca,"LOCALE_STORAGE_KEY","g7_locale"),$(Ca,"CACHE_VERSION_STORAGE_KEY","g7_cache_version");let mo=Ca;function cf(o){const e=new mo(o);return o.websocket&&(cc.configure(o.websocket),B.log("WebSocket 설정 완료")),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{e.init(),window.__templateApp=e}):(e.init(),window.__templateApp=e),e}typeof window<"u"&&(window.G7Core=window.G7Core||{},window.G7Core.initTemplateApp=cf,window.G7Core.dataSource={refetch:async(o,e)=>{const a=window.__templateApp;if(!a){B.warn("TemplateApp not initialized (G7Core.dataSource.refetch)");return}return a.refetchDataSource(o,e)},get:o=>{const e=window.__templateApp;if(!e){B.warn("TemplateApp not initialized (G7Core.dataSource.get)");return}return e.getDataSource(o)}});function z_(o={}){const{checked:e,value:a,name:r,type:i="checkbox"}=o,u=a!==void 0?a:i==="checkbox"||i==="radio"?e??!1:String(e??""),d={checked:e??!1,value:u,name:r??"",type:i};return{target:d,currentTarget:d,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new Event("change"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"change",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{}}}function j_(o={}){const{button:e=0,clientX:a=0,clientY:r=0}=o;return{button:e,clientX:a,clientY:r,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new MouseEvent("click"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"click",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("div"),currentTarget:document.createElement("div")}}function U_(){return{preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new Event("submit"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"submit",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("form"),currentTarget:document.createElement("form")}}function B_(o,e="keydown"){return{key:o,code:o.length===1?`Key${o.toUpperCase()}`:o,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new KeyboardEvent(e,{key:o}),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:e,isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("div"),currentTarget:document.createElement("div"),altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,repeat:!1}}const q_={justify:/^justify-(start|end|center|between|around|evenly)$/,items:/^items-(start|end|center|baseline|stretch)$/,content:/^content-(start|end|center|between|around|evenly|stretch)$/,self:/^self-(auto|start|end|center|stretch|baseline)$/,flex:/^flex-(row|row-reverse|col|col-reverse|wrap|wrap-reverse|nowrap|1|auto|initial|none)$/,grow:/^(grow|grow-0)$/,shrink:/^(shrink|shrink-0)$/,basis:/^basis-/,order:/^(order-|-)order-/,gap:/^gap(-x|-y)?-/,gridCols:/^grid-cols-/,gridRows:/^grid-rows-/,colSpan:/^col-(span-|start-|end-)/,rowSpan:/^row-(span-|start-|end-)/,displa
Line truncated
|
||||
//# sourceMappingURL=template-engine.min.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"template-engine.min.js","sources":["../../../node_modules/react/cjs/react.production.js","../../../node_modules/react/index.js","../../../node_modules/scheduler/cjs/scheduler.production.js","../../../node_modules/scheduler/index.js","../../../node_modules/react-dom/cjs/react-dom.production.js","../../../node_modules/react-dom/index.js","../../../node_modules/react-dom/cjs/react-dom-client.production.js","../../../node_modules/react-dom/client.js","../../../resources/js/core/utils/Logger.ts","../../../resources/js/core/template-engine/networkResilience.ts","../../../resources/js/core/template-engine/ComponentRegistry.ts","../../../resources/js/core/template-engine/TranslationEngine.ts","../../../resources/js/core/template-engine/PipeRegistry.ts","../../../resources/js/core/template-engine/rawMarkers.ts","../../../resources/js/core/template-engine/DataBindingEngine.ts","../../../resources/js/core/template-engine/ResponsiveManager.ts","../../../resources/js/core/template-engine/helpers/ConditionEvaluator.ts","../../../resources/js/core/template-engine/helpers/RenderHelpers.ts","../../../node_modules/axios/lib/helpers/bind.js","../../../node_modules/axios/lib/utils.js","../../../node_modules/axios/lib/helpers/parseHeaders.js","../../../node_modules/axios/lib/helpers/sanitizeHeaderValue.js","../../../node_modules/axios/lib/core/AxiosHeaders.js","../../../node_modules/axios/lib/core/AxiosError.js","../../../node_modules/axios/lib/helpers/null.js","../../../node_modules/axios/lib/helpers/toFormData.js","../../../node_modules/axios/lib/helpers/AxiosURLSearchParams.js","../../../node_modules/axios/lib/helpers/buildURL.js","../../../node_modules/axios/lib/core/InterceptorManager.js","../../../node_modules/axios/lib/defaults/transitional.js","../../../node_modules/axios/lib/platform/browser/index.js","../../../node_modules/axios/lib/platform/browser/classes/URLSearchParams.js","../../../node_modules/axios/lib/platform/browser/classes/FormData.js","../../../node_modules/axios/lib/platform/browser/classes/Blob.js","../../../node_modules/axios/lib/platform/common/utils.js","../../../node_modules/axios/lib/platform/index.js","../../../node_modules/axios/lib/helpers/toURLEncodedForm.js","../../../node_modules/axios/lib/helpers/formDataToJSON.js","../../../node_modules/axios/lib/defaults/index.js","../../../node_modules/axios/lib/core/transformData.js","../../../node_modules/axios/lib/cancel/isCancel.js","../../../node_modules/axios/lib/cancel/CanceledError.js","../../../node_modules/axios/lib/core/settle.js","../../../node_modules/axios/lib/helpers/parseProtocol.js","../../../node_modules/axios/lib/helpers/speedometer.js","../../../node_modules/axios/lib/helpers/throttle.js","../../../node_modules/axios/lib/helpers/progressEventReducer.js","../../../node_modules/axios/lib/helpers/isURLSameOrigin.js","../../../node_modules/axios/lib/helpers/cookies.js","../../../node_modules/axios/lib/helpers/isAbsoluteURL.js","../../../node_modules/axios/lib/helpers/combineURLs.js","../../../node_modules/axios/lib/core/buildFullPath.js","../../../node_modules/axios/lib/core/mergeConfig.js","../../../node_modules/axios/lib/helpers/resolveConfig.js","../../../node_modules/axios/lib/adapters/xhr.js","../../../node_modules/axios/lib/helpers/composeSignals.js","../../../node_modules/axios/lib/helpers/trackStream.js","../../../node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js","../../../node_modules/axios/lib/env/data.js","../../../node_modules/axios/lib/adapters/fetch.js","../../../node_modules/axios/lib/adapters/adapters.js","../../../node_modules/axios/lib/core/dispatchRequest.js","../../../node_modules/axios/lib/helpers/validator.js","../../../node_modules/axios/lib/core/Axios.js","../../../node_modules/axios/lib/cancel/CancelToken.js","../../../node_modules/axios/lib/helpers/spread.js","../../../node_modules/axios/lib/helpers/isAxiosError.js","../../../node_modules/axios/lib/helpers/HttpStatusCode.js","../../../node_modules/axios/lib/axios.js","../../../node_modules/axios/index.js","../../../resources/js/core/identity/types.ts","../../../resources/js/core/identity/IdentityGuardInterceptor.ts","../../../resources/js/core/api/ApiClient.ts","../../../resources/js/core/auth/AuthManager.ts","../../../resources/js/core/types/ErrorHandling.ts","../../../resources/js/core/error/ErrorHandlingResolver.ts","../../../node_modules/react/cjs/react-jsx-runtime.production.js","../../../node_modules/react/jsx-runtime.js","../../../resources/js/core/template-engine/ParentContextProvider.tsx","../../../resources/js/core/template-engine/ActionDispatcher.ts","../../../resources/js/core/template-engine/TransitionManager.ts","../../../resources/js/core/template-engine/TransitionContext.tsx","../../../resources/js/core/template-engine/localInitSlot.ts","../../../resources/js/core/template-engine/ResponsiveContext.tsx","../../../resources/js/core/hooks/useControllableState.ts","../../../resources/js/core/template-engine/FormContextLine truncated
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './src/index'
|
||||
export {}
|
||||
@@ -0,0 +1 @@
|
||||
var Gnuboard7HelloAdminTemplate=(function(r,a,c){"use strict";const s=c.forwardRef(({children:e,className:t="",...n},o)=>a.jsx("div",{ref:o,className:t,...n,children:e}));s.displayName="Div";const i=c.forwardRef(({children:e,className:t="",type:n="button",...o},_)=>a.jsx("button",{ref:_,type:n,className:t,...o,children:e}));i.displayName="Button";const l=({children:e,className:t="",...n})=>a.jsx("h1",{className:t,...n,children:e}),m=({children:e,className:t="",...n})=>a.jsx("h2",{className:t,...n,children:e}),d=({children:e,className:t="",...n})=>a.jsx("h3",{className:t,...n,children:e}),p=({children:e,className:t="",...n})=>a.jsx("a",{className:t,...n,children:e}),g=({children:e,className:t="",...n})=>a.jsx("span",{className:t,...n,children:e}),u=({className:e="",alt:t="",...n})=>a.jsx("img",{className:e,alt:t,...n}),y={identifier:"gnuboard7-hello_admin_template",vendor:"gnuboard7",name:{ko:"Hello Admin Template",en:"Hello Admin Template"},version:"0.1.0",license:"MIT",description:{ko:"그누보드7 학습용 최소 Admin 템플릿 스켈레톤",en:"Gnuboard7 minimal admin template skeleton for learning"},type:"admin",hidden:!0,locales:["ko","en"],author:{name:"gnuboard7",email:"contact@gnuboard.com",url:"https://gnuboard.com"},release_date:"2026-04-21",g7_version:">=7.0.0",dependencies:{modules:{},plugins:{}},assets:{js:["dist/components.js"]},components:{basic:["a","button","div","h1","h2","h3","img","span"],composite:[],layout:[]},error_config:{layouts:{401:"errors/401",403:"errors/403",404:"errors/404",500:"errors/500",503:"errors/503",maintenance:"errors/maintenance"}},externals:[{id:"fontawesome",type:"style",url:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",preconnect:"https://cdnjs.cloudflare.com"}]},b=window.G7Core?.createLogger?.("Template:gnuboard7-hello_admin_template")??{log:(...e)=>console.log("[Template:gnuboard7-hello_admin_template]",...e),warn:(...e)=>console.warn("[Template:gnuboard7-hello_admin_template]",...e),error:(...e)=>console.error("[Template:gnuboard7-hello_admin_template]",...e)};function f(){if(typeof window>"u")return;let e=0;const t=50,n=()=>{const o=window.G7Core?.getComponentRegistry?.()??window.__G7_COMPONENTS__;if(o&&typeof o.register=="function"){o.register("Div",s,{type:"basic",name:"Div"}),o.register("Button",i,{type:"basic",name:"Button"}),o.register("H1",l,{type:"basic",name:"H1"}),o.register("H2",m,{type:"basic",name:"H2"}),o.register("H3",d,{type:"basic",name:"H3"}),o.register("A",p,{type:"basic",name:"A"}),o.register("Span",g,{type:"basic",name:"Span"}),o.register("Img",u,{type:"basic",name:"Img"}),b.log("8 basic component(s) registered");return}e++,e<=t?setTimeout(n,100):b.error("Failed to register components: ComponentRegistry not available after maximum retries")};document.readyState==="complete"?n():window.addEventListener("load",n)}return f(),r.A=p,r.Button=i,r.Div=s,r.H1=l,r.H2=m,r.H3=d,r.Img=u,r.Span=g,r.initTemplate=f,r.templateMetadata=y,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r})({},ReactJSXRuntime,React);
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface AProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 a(링크) 컴포넌트
|
||||
*/
|
||||
export declare const A: React.FC<AProps>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 버튼 컴포넌트 (type="button" 기본값으로 submit 방지)
|
||||
*/
|
||||
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { default as React } from 'react';
|
||||
export interface DivProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
ref?: React.Ref<HTMLDivElement>;
|
||||
}
|
||||
/**
|
||||
* 기본 div 컴포넌트
|
||||
*/
|
||||
export declare const Div: React.ForwardRefExoticComponent<Omit<DivProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface H1Props extends React.HTMLAttributes<HTMLHeadingElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 h1 제목 컴포넌트
|
||||
*/
|
||||
export declare const H1: React.FC<H1Props>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface H2Props extends React.HTMLAttributes<HTMLHeadingElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 h2 제목 컴포넌트
|
||||
*/
|
||||
export declare const H2: React.FC<H2Props>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface H3Props extends React.HTMLAttributes<HTMLHeadingElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 h3 제목 컴포넌트
|
||||
*/
|
||||
export declare const H3: React.FC<H3Props>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface ImgProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 이미지 컴포넌트
|
||||
*/
|
||||
export declare const Img: React.FC<ImgProps>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface SpanProps extends React.HTMLAttributes<HTMLSpanElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 span 컴포넌트
|
||||
*/
|
||||
export declare const Span: React.FC<SpanProps>;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 기본 HTML 매핑 컴포넌트 Export
|
||||
*/
|
||||
export { Div, type DivProps } from './Div';
|
||||
export { Button, type ButtonProps } from './Button';
|
||||
export { H1, type H1Props } from './H1';
|
||||
export { H2, type H2Props } from './H2';
|
||||
export { H3, type H3Props } from './H3';
|
||||
export { A, type AProps } from './A';
|
||||
export { Span, type SpanProps } from './Span';
|
||||
export { Img, type ImgProps } from './Img';
|
||||
@@ -0,0 +1,14 @@
|
||||
import { default as templateMetadata } from '../template.json';
|
||||
/**
|
||||
* Gnuboard7 Hello Admin Template
|
||||
*
|
||||
* 학습용 최소 Admin 템플릿 스켈레톤 — Basic 8개 컴포넌트만 포함
|
||||
*/
|
||||
export * from './components/basic';
|
||||
export { templateMetadata };
|
||||
/**
|
||||
* 템플릿 초기화 함수
|
||||
*
|
||||
* 코어 엔진의 ComponentRegistry 에 Basic 8개 컴포넌트를 등록합니다.
|
||||
*/
|
||||
export declare function initTemplate(): void;
|
||||
File diff suppressed because it is too large.
Load diff
@@ -27,7 +27,9 @@ export default defineConfig({
|
||||
|
||||
outDir: 'dist',
|
||||
emptyOutDir: true,
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
|
||||
rollupOptions: {
|
||||
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface AProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 a(링크) 컴포넌트
|
||||
*/
|
||||
export declare const A: React.FC<AProps>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 버튼 컴포넌트
|
||||
*/
|
||||
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { default as React } from 'react';
|
||||
export interface DivProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
ref?: React.Ref<HTMLDivElement>;
|
||||
}
|
||||
/**
|
||||
* 기본 div 컴포넌트
|
||||
*/
|
||||
export declare const Div: React.ForwardRefExoticComponent<Omit<DivProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface H1Props extends React.HTMLAttributes<HTMLHeadingElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 h1 제목 컴포넌트
|
||||
*/
|
||||
export declare const H1: React.FC<H1Props>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface H2Props extends React.HTMLAttributes<HTMLHeadingElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 h2 제목 컴포넌트
|
||||
*/
|
||||
export declare const H2: React.FC<H2Props>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface H3Props extends React.HTMLAttributes<HTMLHeadingElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 h3 제목 컴포넌트
|
||||
*/
|
||||
export declare const H3: React.FC<H3Props>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface ImgProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 이미지 컴포넌트
|
||||
*/
|
||||
export declare const Img: React.FC<ImgProps>;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { default as React } from 'react';
|
||||
export interface SpanProps extends React.HTMLAttributes<HTMLSpanElement> {
|
||||
}
|
||||
/**
|
||||
* 기본 span 컴포넌트
|
||||
*/
|
||||
export declare const Span: React.FC<SpanProps>;
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Gnuboard7 Hello User Template
|
||||
*
|
||||
* 학습용 최소 샘플 사용자 템플릿.
|
||||
* Basic 8개 컴포넌트만 포함 (Div, Button, H1, H2, H3, A, Span, Img).
|
||||
*/
|
||||
export { Div, type DivProps } from './components/basic/Div';
|
||||
export { Button, type ButtonProps } from './components/basic/Button';
|
||||
export { H1, type H1Props } from './components/basic/H1';
|
||||
export { H2, type H2Props } from './components/basic/H2';
|
||||
export { H3, type H3Props } from './components/basic/H3';
|
||||
export { A, type AProps } from './components/basic/A';
|
||||
export { Span, type SpanProps } from './components/basic/Span';
|
||||
export { Img, type ImgProps } from './components/basic/Img';
|
||||
@@ -0,0 +1 @@
|
||||
var Gnuboard7HelloUserTemplate=(function(a,r,c){"use strict";const l=c.forwardRef(({children:e,className:t="",...n},g)=>r.jsx("div",{ref:g,className:t,...n,children:e}));l.displayName="Div";const s=c.forwardRef(({children:e,className:t="",...n},g)=>r.jsx("button",{ref:g,className:t,...n,children:e}));s.displayName="Button";const m=({children:e,className:t="",...n})=>r.jsx("h1",{className:t,...n,children:e}),i=({children:e,className:t="",...n})=>r.jsx("h2",{className:t,...n,children:e}),d=({children:e,className:t="",...n})=>r.jsx("h3",{className:t,...n,children:e}),p=({children:e,className:t="",...n})=>r.jsx("a",{className:t,...n,children:e}),u=({children:e,className:t="",...n})=>r.jsx("span",{className:t,...n,children:e}),b=({className:e="",alt:t="",...n})=>r.jsx("img",{className:e,alt:t,...n}),H=window.G7Core?.createLogger?.("Template:gnuboard7-hello_user_template")??{log:(...e)=>console.log("[Template:gnuboard7-hello_user_template]",...e),warn:(...e)=>console.warn("[Template:gnuboard7-hello_user_template]",...e),error:(...e)=>console.error("[Template:gnuboard7-hello_user_template]",...e)},o=window.G7Core?.templateEngine?.ComponentRegistry?.getInstance?.();if(o){const e=t=>({name:t,type:"basic"});o.register({component:l,metadata:e("Div")}),o.register({component:s,metadata:e("Button")}),o.register({component:m,metadata:e("H1")}),o.register({component:i,metadata:e("H2")}),o.register({component:d,metadata:e("H3")}),o.register({component:p,metadata:e("A")}),o.register({component:u,metadata:e("Span")}),o.register({component:b,metadata:e("Img")}),H.log("Registered 8 basic components")}else H.warn("ComponentRegistry not available — skipping auto-registration");return a.A=p,a.Button=s,a.Div=l,a.H1=m,a.H2=i,a.H3=d,a.Img=b,a.Span=u,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),a})({},ReactJSXRuntime,React);
|
||||
File diff suppressed because it is too large.
Load diff
@@ -32,7 +32,9 @@ export default defineConfig({
|
||||
|
||||
outDir: 'dist',
|
||||
emptyOutDir: true,
|
||||
sourcemap: true,
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
|
||||
rollupOptions: {
|
||||
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며,
|
||||
[Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다.
|
||||
|
||||
## [1.0.3] - 2026-07-14
|
||||
|
||||
### Fixed
|
||||
|
||||
- 권한 관리 화면의 새로고침 버튼이 다른 관리자 화면의 새로고침 버튼과 모양이 달랐던 문제를 수정했습니다.
|
||||
- 환경설정 화면의 탭 줄과 게시판 설정 화면의 상단 고정 영역이 화면 여백과 어긋나 가로로 밀려 보일 수 있던 문제를 정리했습니다.
|
||||
|
||||
## [1.0.2] - 2026-07-09
|
||||
|
||||
### Added
|
||||
|
||||
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user