From 440cd11ece20928ffd3c923da7600d445674df3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Thu, 12 Feb 2026 10:35:04 +0900 Subject: [PATCH] =?UTF-8?q?refactor:esign=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=A0=84=EC=97=AD=20=EB=A0=88=EC=9D=B4=EC=95=84?= =?UTF-8?q?=EC=9B=83=20React=20CDN=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - esign 전자서명 관련 9개 파일 업데이트 - layouts/app.blade.php 업데이트 - fcm.js React 관련 변경사항 반영 --- public/js/fcm.js | 31 ++++++++++++----------- resources/views/esign/create.blade.php | 6 ++--- resources/views/esign/dashboard.blade.php | 8 +++--- resources/views/esign/detail.blade.php | 6 ++--- resources/views/esign/fields.blade.php | 6 ++--- resources/views/esign/send.blade.php | 6 ++--- resources/views/esign/sign/auth.blade.php | 9 ++++--- resources/views/esign/sign/done.blade.php | 9 ++++--- resources/views/esign/sign/sign.blade.php | 9 ++++--- resources/views/layouts/app.blade.php | 1 + 10 files changed, 46 insertions(+), 45 deletions(-) diff --git a/public/js/fcm.js b/public/js/fcm.js index 07133a9d..49a5c9a7 100644 --- a/public/js/fcm.js +++ b/public/js/fcm.js @@ -11,7 +11,8 @@ 'use strict'; - console.log('[FCM] fcm.js LOADED v2'); + const DEBUG = window.SAM_CONFIG?.debug || false; + const log = (...args) => { if (DEBUG) console.log('[FCM]', ...args); }; const CONFIG = { apiBaseUrl: window.SAM_CONFIG?.apiBaseUrl || 'https://api.codebridge-x.com', @@ -36,12 +37,12 @@ // Capacitor 네이티브 환경(ios, android)에서만 실행 const platform = window.Capacitor?.getPlatform?.(); if (platform !== 'ios' && platform !== 'android') { - console.log('[FCM] Not running in native app (platform:', platform || 'web', ')'); + log(' Not running in native app (platform:', platform || 'web', ')'); return; } if (!window.Capacitor?.Plugins?.PushNotifications) { - console.log('[FCM] PushNotifications plugin not available'); + log(' PushNotifications plugin not available'); return; } @@ -51,7 +52,7 @@ App.addListener('appStateChange', ({ isActive }) => { isAppForeground = isActive; - console.log('[FCM] App state:', isActive ? 'foreground' : 'background'); + log(' App state:', isActive ? 'foreground' : 'background'); }); } @@ -67,8 +68,8 @@ // ✅ 2. 리스너를 먼저 등록 (가장 중요) PushNotifications.addListener('registration', async (token) => { - console.log('[FCM] 🔥 registration event fired'); - console.log('[FCM] Token received:', token.value?.substring(0, 20) + '...'); + log(' 🔥 registration event fired'); + log(' Token received:', token.value?.substring(0, 20) + '...'); await handleTokenRegistration(token.value); }); @@ -77,12 +78,12 @@ }); PushNotifications.addListener('pushNotificationReceived', (notification) => { - console.log('[FCM] Push received (foreground):', notification); + log(' Push received (foreground):', notification); handleForegroundNotification(notification); }); PushNotifications.addListener('pushNotificationActionPerformed', (action) => { - console.log('[FCM] Push action performed:', action); + log(' Push action performed:', action); const data = action.notification?.data; if (data?.url) { window.location.href = data.url; @@ -91,10 +92,10 @@ // ✅ 3. 그 다음에 권한 요청 const perm = await PushNotifications.requestPermissions(); - console.log('[FCM] Push permission:', perm.receive); + log(' Push permission:', perm.receive); if (perm.receive !== 'granted') { - console.log('[FCM] Push permission not granted'); + log(' Push permission not granted'); return; } @@ -110,7 +111,7 @@ const oldToken = sessionStorage.getItem(CONFIG.fcmTokenKey); if (oldToken === newToken) { - console.log('[FCM] Token unchanged, skip'); + log(' Token unchanged, skip'); return; } @@ -118,7 +119,7 @@ if (success) { sessionStorage.setItem(CONFIG.fcmTokenKey, newToken); - console.log('[FCM] Token saved to sessionStorage'); + log(' Token saved to sessionStorage'); } } @@ -153,7 +154,7 @@ }); if (response.ok) { - console.log('[FCM] Token registered successfully'); + log(' Token registered successfully'); return true; } @@ -216,7 +217,7 @@ const url = data.url; const soundKey = data.sound_key; - console.log('[FCM] Notification data:', { type, url, soundKey }); + log(' Notification data:', { type, url, soundKey }); // 1. 포그라운드에서만 사운드 재생 (백그라운드는 OS 채널 사운드) if (isAppForeground && soundKey) { @@ -299,7 +300,7 @@ if (typeof showToast === 'function') { showToast(`${title}: ${body}`, 'info'); } - console.log('[FCM] showClickableToast not implemented, URL click ignored'); + log(' showClickableToast not implemented, URL click ignored'); }; } diff --git a/resources/views/esign/create.blade.php b/resources/views/esign/create.blade.php index b080c48d..83054b22 100644 --- a/resources/views/esign/create.blade.php +++ b/resources/views/esign/create.blade.php @@ -8,9 +8,7 @@ @endsection @push('scripts') - - - +@include('partials.react-cdn') @verbatim @endverbatim @endpush diff --git a/resources/views/esign/dashboard.blade.php b/resources/views/esign/dashboard.blade.php index 57b11fec..fd87204b 100644 --- a/resources/views/esign/dashboard.blade.php +++ b/resources/views/esign/dashboard.blade.php @@ -8,10 +8,8 @@ @endsection @push('scripts') - - - - +@include('partials.react-cdn') + @verbatim @endverbatim @endpush diff --git a/resources/views/esign/detail.blade.php b/resources/views/esign/detail.blade.php index 5379c1eb..b7e4bdbc 100644 --- a/resources/views/esign/detail.blade.php +++ b/resources/views/esign/detail.blade.php @@ -8,9 +8,7 @@ @endsection @push('scripts') - - - +@include('partials.react-cdn') @verbatim @endverbatim @endpush diff --git a/resources/views/esign/fields.blade.php b/resources/views/esign/fields.blade.php index 45c0c043..141be1ee 100644 --- a/resources/views/esign/fields.blade.php +++ b/resources/views/esign/fields.blade.php @@ -8,9 +8,7 @@ @endsection @push('scripts') - - - +@include('partials.react-cdn') @verbatim @@ -249,7 +247,7 @@ className="border rounded px-2 py-1 text-xs" /> ); }; -ReactDOM.render(, document.getElementById('esign-fields-root')); +ReactDOM.createRoot(document.getElementById('esign-fields-root')).render(); @endverbatim @endpush diff --git a/resources/views/esign/send.blade.php b/resources/views/esign/send.blade.php index f1af338d..42b16b16 100644 --- a/resources/views/esign/send.blade.php +++ b/resources/views/esign/send.blade.php @@ -8,9 +8,7 @@ @endsection @push('scripts') - - - +@include('partials.react-cdn') @verbatim @endverbatim @endpush diff --git a/resources/views/esign/sign/auth.blade.php b/resources/views/esign/sign/auth.blade.php index a21a1879..b989cd1c 100644 --- a/resources/views/esign/sign/auth.blade.php +++ b/resources/views/esign/sign/auth.blade.php @@ -9,8 +9,11 @@
- - + + + diff --git a/resources/views/esign/sign/done.blade.php b/resources/views/esign/sign/done.blade.php index 91bcc3e9..f8f19926 100644 --- a/resources/views/esign/sign/done.blade.php +++ b/resources/views/esign/sign/done.blade.php @@ -9,8 +9,11 @@
- - + + + diff --git a/resources/views/esign/sign/sign.blade.php b/resources/views/esign/sign/sign.blade.php index 4aaacd64..2dc136b4 100644 --- a/resources/views/esign/sign/sign.blade.php +++ b/resources/views/esign/sign/sign.blade.php @@ -9,8 +9,11 @@
- - + + + diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index e938475e..50850b20 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -12,6 +12,7 @@ apiBaseUrl: '{{ config('services.api.base_url', 'https://api.codebridge-x.com') }}', apiKey: '{{ config('services.api.key', '') }}', appVersion: '{{ config('app.version', '1.0.0') }}', + debug: {{ config('app.debug') ? 'true' : 'false' }}, }; // API 토큰 sessionStorage 동기화 (FCM 등에서 사용)