@impakers/debug 1.4.18 → 1.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -92
- package/dist/index.mjs +1 -65
- package/dist/next.js +1 -237
- package/dist/next.mjs +1 -219
- package/dist/react.js +2625 -4803
- package/dist/react.mjs +2626 -4769
- package/dist/webpack.js +1 -103
- package/dist/webpack.mjs +1 -68
- package/package.json +1 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/react.mjs.map +0 -1
package/dist/webpack.js
CHANGED
|
@@ -1,103 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/webpack.ts
|
|
31
|
-
var webpack_exports = {};
|
|
32
|
-
__export(webpack_exports, {
|
|
33
|
-
ImpakersDebugWebpackPlugin: () => ImpakersDebugWebpackPlugin
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(webpack_exports);
|
|
36
|
-
var fs = __toESM(require("fs"));
|
|
37
|
-
var path = __toESM(require("path"));
|
|
38
|
-
var ImpakersDebugWebpackPlugin = class {
|
|
39
|
-
constructor(options = {}) {
|
|
40
|
-
this.outputDir = options.outputDir;
|
|
41
|
-
}
|
|
42
|
-
apply(compiler) {
|
|
43
|
-
compiler.hooks.afterEmit.tapAsync(
|
|
44
|
-
"ImpakersDebugStripSourceContent",
|
|
45
|
-
(compilation, callback) => {
|
|
46
|
-
const outputPath = this.outputDir || compilation.outputOptions?.path || "";
|
|
47
|
-
if (!outputPath || !fs.existsSync(outputPath)) {
|
|
48
|
-
callback();
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const findMaps = (dir) => {
|
|
52
|
-
const results = [];
|
|
53
|
-
try {
|
|
54
|
-
for (const entry of fs.readdirSync(dir, {
|
|
55
|
-
withFileTypes: true
|
|
56
|
-
})) {
|
|
57
|
-
const full = path.join(dir, entry.name);
|
|
58
|
-
if (entry.isDirectory()) results.push(...findMaps(full));
|
|
59
|
-
else if (entry.name.endsWith(".js.map")) results.push(full);
|
|
60
|
-
}
|
|
61
|
-
} catch {
|
|
62
|
-
}
|
|
63
|
-
return results;
|
|
64
|
-
};
|
|
65
|
-
let stripped = 0;
|
|
66
|
-
for (const file of findMaps(outputPath)) {
|
|
67
|
-
try {
|
|
68
|
-
const raw = fs.readFileSync(file, "utf-8");
|
|
69
|
-
const map = JSON.parse(raw);
|
|
70
|
-
let changed = false;
|
|
71
|
-
if (map.sourcesContent) {
|
|
72
|
-
delete map.sourcesContent;
|
|
73
|
-
changed = true;
|
|
74
|
-
}
|
|
75
|
-
if (map.sections) {
|
|
76
|
-
for (const section of map.sections) {
|
|
77
|
-
if (section.map?.sourcesContent) {
|
|
78
|
-
delete section.map.sourcesContent;
|
|
79
|
-
changed = true;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (changed) {
|
|
84
|
-
fs.writeFileSync(file, JSON.stringify(map));
|
|
85
|
-
stripped++;
|
|
86
|
-
}
|
|
87
|
-
} catch {
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (stripped > 0) {
|
|
91
|
-
console.log(
|
|
92
|
-
`[@impakers/debug] Stripped sourcesContent from ${stripped} sourcemap files`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
callback();
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
-
0 && (module.exports = {
|
|
102
|
-
ImpakersDebugWebpackPlugin
|
|
103
|
-
});
|
|
1
|
+
"use strict";var S=Object.create;var a=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var b=(t,s)=>{for(var e in s)a(t,e,{get:s[e],enumerable:!0})},y=(t,s,e,p)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of C(s))!k.call(t,o)&&o!==e&&a(t,o,{get:()=>s[o],enumerable:!(p=D(s,o))||p.enumerable});return t};var g=(t,s,e)=>(e=t!=null?S(O(t)):{},y(s||!t||!t.__esModule?a(e,"default",{value:t,enumerable:!0}):e,t)),w=t=>y(a({},"__esModule",{value:!0}),t);var F={};b(F,{ImpakersDebugWebpackPlugin:()=>l});module.exports=w(F);var n=g(require("fs")),d=g(require("path")),l=class{constructor(s={}){this.outputDir=s.outputDir}apply(s){s.hooks.afterEmit.tapAsync("ImpakersDebugStripSourceContent",(e,p)=>{let o=this.outputDir||e.outputOptions?.path||"";if(!o||!n.existsSync(o)){p();return}let m=u=>{let c=[];try{for(let r of n.readdirSync(u,{withFileTypes:!0})){let i=d.join(u,r.name);r.isDirectory()?c.push(...m(i)):r.name.endsWith(".js.map")&&c.push(i)}}catch{}return c},f=0;for(let u of m(o))try{let c=n.readFileSync(u,"utf-8"),r=JSON.parse(c),i=!1;if(r.sourcesContent&&(delete r.sourcesContent,i=!0),r.sections)for(let h of r.sections)h.map?.sourcesContent&&(delete h.map.sourcesContent,i=!0);i&&(n.writeFileSync(u,JSON.stringify(r)),f++)}catch{}f>0&&console.log(`[@impakers/debug] Stripped sourcesContent from ${f} sourcemap files`),p()})}};0&&(module.exports={ImpakersDebugWebpackPlugin});
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,68 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
import * as path from "path";
|
|
4
|
-
var ImpakersDebugWebpackPlugin = class {
|
|
5
|
-
constructor(options = {}) {
|
|
6
|
-
this.outputDir = options.outputDir;
|
|
7
|
-
}
|
|
8
|
-
apply(compiler) {
|
|
9
|
-
compiler.hooks.afterEmit.tapAsync(
|
|
10
|
-
"ImpakersDebugStripSourceContent",
|
|
11
|
-
(compilation, callback) => {
|
|
12
|
-
const outputPath = this.outputDir || compilation.outputOptions?.path || "";
|
|
13
|
-
if (!outputPath || !fs.existsSync(outputPath)) {
|
|
14
|
-
callback();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const findMaps = (dir) => {
|
|
18
|
-
const results = [];
|
|
19
|
-
try {
|
|
20
|
-
for (const entry of fs.readdirSync(dir, {
|
|
21
|
-
withFileTypes: true
|
|
22
|
-
})) {
|
|
23
|
-
const full = path.join(dir, entry.name);
|
|
24
|
-
if (entry.isDirectory()) results.push(...findMaps(full));
|
|
25
|
-
else if (entry.name.endsWith(".js.map")) results.push(full);
|
|
26
|
-
}
|
|
27
|
-
} catch {
|
|
28
|
-
}
|
|
29
|
-
return results;
|
|
30
|
-
};
|
|
31
|
-
let stripped = 0;
|
|
32
|
-
for (const file of findMaps(outputPath)) {
|
|
33
|
-
try {
|
|
34
|
-
const raw = fs.readFileSync(file, "utf-8");
|
|
35
|
-
const map = JSON.parse(raw);
|
|
36
|
-
let changed = false;
|
|
37
|
-
if (map.sourcesContent) {
|
|
38
|
-
delete map.sourcesContent;
|
|
39
|
-
changed = true;
|
|
40
|
-
}
|
|
41
|
-
if (map.sections) {
|
|
42
|
-
for (const section of map.sections) {
|
|
43
|
-
if (section.map?.sourcesContent) {
|
|
44
|
-
delete section.map.sourcesContent;
|
|
45
|
-
changed = true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (changed) {
|
|
50
|
-
fs.writeFileSync(file, JSON.stringify(map));
|
|
51
|
-
stripped++;
|
|
52
|
-
}
|
|
53
|
-
} catch {
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (stripped > 0) {
|
|
57
|
-
console.log(
|
|
58
|
-
`[@impakers/debug] Stripped sourcesContent from ${stripped} sourcemap files`
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
callback();
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
export {
|
|
67
|
-
ImpakersDebugWebpackPlugin
|
|
68
|
-
};
|
|
1
|
+
import*as s from"fs";import*as l from"path";var f=class{constructor(n={}){this.outputDir=n.outputDir}apply(n){n.hooks.afterEmit.tapAsync("ImpakersDebugStripSourceContent",(m,u)=>{let i=this.outputDir||m.outputOptions?.path||"";if(!i||!s.existsSync(i)){u();return}let c=o=>{let r=[];try{for(let t of s.readdirSync(o,{withFileTypes:!0})){let e=l.join(o,t.name);t.isDirectory()?r.push(...c(e)):t.name.endsWith(".js.map")&&r.push(e)}}catch{}return r},p=0;for(let o of c(i))try{let r=s.readFileSync(o,"utf-8"),t=JSON.parse(r),e=!1;if(t.sourcesContent&&(delete t.sourcesContent,e=!0),t.sections)for(let a of t.sections)a.map?.sourcesContent&&(delete a.map.sourcesContent,e=!0);e&&(s.writeFileSync(o,JSON.stringify(t)),p++)}catch{}p>0&&console.log(`[@impakers/debug] Stripped sourcesContent from ${p} sourcemap files`),u()})}};export{f as ImpakersDebugWebpackPlugin};
|
package/package.json
CHANGED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/core/auth.ts"],"sourcesContent":["// =============================================================================\n// @impakers/debug — Vanilla JS API\n// =============================================================================\n//\n// 프레임워크 없이 사용 가능한 정적 API.\n// React Provider를 사용하는 경우 이 모듈 대신 '@impakers/debug/react'를 사용.\n//\n// Usage:\n// import { ImpakersDebug } from '@impakers/debug'\n// ImpakersDebug.showAuth()\n// ImpakersDebug.isActive()\n// ImpakersDebug.deactivate()\n// ImpakersDebug.open()\n//\n\nimport { isAuthenticated, clearToken, loadToken } from \"./core/auth\";\n\nexport type { FeedbackUser, ImpakersDebugConfig } from \"./core/types\";\n\n/**\n * @impakers/debug Vanilla JS API\n *\n * React를 쓰지 않는 환경에서 사용하거나,\n * 프로그래밍 방식으로 위젯을 제어할 때 사용합니다.\n */\nexport class ImpakersDebug {\n private static _eventTarget = typeof EventTarget !== \"undefined\" ? new EventTarget() : null;\n\n /** 인증 프롬프트 띄우기 */\n static showAuth(): void {\n ImpakersDebug._eventTarget?.dispatchEvent(new CustomEvent(\"impakers-debug:show-auth\"));\n }\n\n /** 인증 상태 확인 */\n static isActive(): boolean {\n return isAuthenticated();\n }\n\n /** 로그아웃 (토큰 삭제 + UI 숨김) */\n static deactivate(): void {\n clearToken();\n ImpakersDebug._eventTarget?.dispatchEvent(new CustomEvent(\"impakers-debug:deactivate\"));\n }\n\n /** 피드백 폼 열기 (인증된 상태에서) */\n static open(): void {\n if (!isAuthenticated()) {\n ImpakersDebug.showAuth();\n return;\n }\n ImpakersDebug._eventTarget?.dispatchEvent(new CustomEvent(\"impakers-debug:open\"));\n }\n\n /** 내부 이벤트 리스너 등록 (React Provider에서 사용) */\n static _on(event: string, handler: EventListener): () => void {\n ImpakersDebug._eventTarget?.addEventListener(event, handler);\n return () => ImpakersDebug._eventTarget?.removeEventListener(event, handler);\n }\n}\n","// =============================================================================\n// @impakers/debug — Authentication\n// =============================================================================\n//\n// 시크릿 코드 → JWT 토큰 인증 플로우\n// 토큰은 localStorage에 저장되며, 피드백 전송 시 Authorization 헤더로 전달\n//\n\nimport type { AuthResponse } from \"./types\";\n\nconst STORAGE_KEY = \"impakers-debug-token\";\nconst TOKEN_DATA_KEY = \"impakers-debug-token-data\";\n\n/** 저장된 토큰 데이터 */\ninterface StoredTokenData {\n token: string;\n serviceName: string;\n expiresAt: string;\n}\n\n/** 로컬스토리지에서 토큰 로드 */\nexport function loadToken(): string | null {\n if (typeof window === \"undefined\") return null;\n try {\n const data = localStorage.getItem(TOKEN_DATA_KEY);\n if (!data) return null;\n\n const parsed: StoredTokenData = JSON.parse(data);\n\n // 만료 확인\n if (new Date(parsed.expiresAt) < new Date()) {\n clearToken();\n return null;\n }\n\n return parsed.token;\n } catch {\n return null;\n }\n}\n\n/** 토큰이 유효한지 확인 */\nexport function isAuthenticated(): boolean {\n return loadToken() !== null;\n}\n\n/** 저장된 서비스 이름 */\nexport function getServiceName(): string | null {\n if (typeof window === \"undefined\") return null;\n try {\n const data = localStorage.getItem(TOKEN_DATA_KEY);\n if (!data) return null;\n const parsed: StoredTokenData = JSON.parse(data);\n return parsed.serviceName;\n } catch {\n return null;\n }\n}\n\n/** 인증 토큰 저장 */\nexport function saveToken(authResponse: AuthResponse): void {\n if (typeof window === \"undefined\") return;\n try {\n const data: StoredTokenData = {\n token: authResponse.token,\n serviceName: authResponse.serviceName,\n expiresAt: authResponse.expiresAt,\n };\n localStorage.setItem(TOKEN_DATA_KEY, JSON.stringify(data));\n localStorage.setItem(STORAGE_KEY, authResponse.token);\n } catch {\n // localStorage 불가\n }\n}\n\n/** 인증 토큰 삭제 */\nexport function clearToken(): void {\n if (typeof window === \"undefined\") return;\n try {\n localStorage.removeItem(TOKEN_DATA_KEY);\n localStorage.removeItem(STORAGE_KEY);\n } catch {\n // ignore\n }\n}\n\n/** 시크릿 코드로 인증 요청 */\nexport async function authenticate(\n endpoint: string,\n code: string,\n): Promise<AuthResponse> {\n const domain = window.location.hostname;\n\n const res = await fetch(`${endpoint}/auth`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ code, domain }),\n });\n\n if (!res.ok) {\n const error = await res.json().catch(() => ({ message: \"인증 실패\" }));\n throw new Error(error.message || \"인증 실패\");\n }\n\n const authResponse: AuthResponse = await res.json();\n saveToken(authResponse);\n return authResponse;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUA,IAAM,cAAc;AACpB,IAAM,iBAAiB;AAUhB,SAAS,YAA2B;AACzC,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,MAAI;AACF,UAAM,OAAO,aAAa,QAAQ,cAAc;AAChD,QAAI,CAAC,KAAM,QAAO;AAElB,UAAM,SAA0B,KAAK,MAAM,IAAI;AAG/C,QAAI,IAAI,KAAK,OAAO,SAAS,IAAI,oBAAI,KAAK,GAAG;AAC3C,iBAAW;AACX,aAAO;AAAA,IACT;AAEA,WAAO,OAAO;AAAA,EAChB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,kBAA2B;AACzC,SAAO,UAAU,MAAM;AACzB;AAgCO,SAAS,aAAmB;AACjC,MAAI,OAAO,WAAW,YAAa;AACnC,MAAI;AACF,iBAAa,WAAW,cAAc;AACtC,iBAAa,WAAW,WAAW;AAAA,EACrC,QAAQ;AAAA,EAER;AACF;;;AD3DO,IAAM,iBAAN,MAAM,eAAc;AAAA;AAAA,EAIzB,OAAO,WAAiB;AACtB,mBAAc,cAAc,cAAc,IAAI,YAAY,0BAA0B,CAAC;AAAA,EACvF;AAAA;AAAA,EAGA,OAAO,WAAoB;AACzB,WAAO,gBAAgB;AAAA,EACzB;AAAA;AAAA,EAGA,OAAO,aAAmB;AACxB,eAAW;AACX,mBAAc,cAAc,cAAc,IAAI,YAAY,2BAA2B,CAAC;AAAA,EACxF;AAAA;AAAA,EAGA,OAAO,OAAa;AAClB,QAAI,CAAC,gBAAgB,GAAG;AACtB,qBAAc,SAAS;AACvB;AAAA,IACF;AACA,mBAAc,cAAc,cAAc,IAAI,YAAY,qBAAqB,CAAC;AAAA,EAClF;AAAA;AAAA,EAGA,OAAO,IAAI,OAAe,SAAoC;AAC5D,mBAAc,cAAc,iBAAiB,OAAO,OAAO;AAC3D,WAAO,MAAM,eAAc,cAAc,oBAAoB,OAAO,OAAO;AAAA,EAC7E;AACF;AAjCa,eACI,eAAe,OAAO,gBAAgB,cAAc,IAAI,YAAY,IAAI;AADlF,IAAM,gBAAN;","names":[]}
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/auth.ts","../src/index.ts"],"sourcesContent":["// =============================================================================\n// @impakers/debug — Authentication\n// =============================================================================\n//\n// 시크릿 코드 → JWT 토큰 인증 플로우\n// 토큰은 localStorage에 저장되며, 피드백 전송 시 Authorization 헤더로 전달\n//\n\nimport type { AuthResponse } from \"./types\";\n\nconst STORAGE_KEY = \"impakers-debug-token\";\nconst TOKEN_DATA_KEY = \"impakers-debug-token-data\";\n\n/** 저장된 토큰 데이터 */\ninterface StoredTokenData {\n token: string;\n serviceName: string;\n expiresAt: string;\n}\n\n/** 로컬스토리지에서 토큰 로드 */\nexport function loadToken(): string | null {\n if (typeof window === \"undefined\") return null;\n try {\n const data = localStorage.getItem(TOKEN_DATA_KEY);\n if (!data) return null;\n\n const parsed: StoredTokenData = JSON.parse(data);\n\n // 만료 확인\n if (new Date(parsed.expiresAt) < new Date()) {\n clearToken();\n return null;\n }\n\n return parsed.token;\n } catch {\n return null;\n }\n}\n\n/** 토큰이 유효한지 확인 */\nexport function isAuthenticated(): boolean {\n return loadToken() !== null;\n}\n\n/** 저장된 서비스 이름 */\nexport function getServiceName(): string | null {\n if (typeof window === \"undefined\") return null;\n try {\n const data = localStorage.getItem(TOKEN_DATA_KEY);\n if (!data) return null;\n const parsed: StoredTokenData = JSON.parse(data);\n return parsed.serviceName;\n } catch {\n return null;\n }\n}\n\n/** 인증 토큰 저장 */\nexport function saveToken(authResponse: AuthResponse): void {\n if (typeof window === \"undefined\") return;\n try {\n const data: StoredTokenData = {\n token: authResponse.token,\n serviceName: authResponse.serviceName,\n expiresAt: authResponse.expiresAt,\n };\n localStorage.setItem(TOKEN_DATA_KEY, JSON.stringify(data));\n localStorage.setItem(STORAGE_KEY, authResponse.token);\n } catch {\n // localStorage 불가\n }\n}\n\n/** 인증 토큰 삭제 */\nexport function clearToken(): void {\n if (typeof window === \"undefined\") return;\n try {\n localStorage.removeItem(TOKEN_DATA_KEY);\n localStorage.removeItem(STORAGE_KEY);\n } catch {\n // ignore\n }\n}\n\n/** 시크릿 코드로 인증 요청 */\nexport async function authenticate(\n endpoint: string,\n code: string,\n): Promise<AuthResponse> {\n const domain = window.location.hostname;\n\n const res = await fetch(`${endpoint}/auth`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ code, domain }),\n });\n\n if (!res.ok) {\n const error = await res.json().catch(() => ({ message: \"인증 실패\" }));\n throw new Error(error.message || \"인증 실패\");\n }\n\n const authResponse: AuthResponse = await res.json();\n saveToken(authResponse);\n return authResponse;\n}\n","// =============================================================================\n// @impakers/debug — Vanilla JS API\n// =============================================================================\n//\n// 프레임워크 없이 사용 가능한 정적 API.\n// React Provider를 사용하는 경우 이 모듈 대신 '@impakers/debug/react'를 사용.\n//\n// Usage:\n// import { ImpakersDebug } from '@impakers/debug'\n// ImpakersDebug.showAuth()\n// ImpakersDebug.isActive()\n// ImpakersDebug.deactivate()\n// ImpakersDebug.open()\n//\n\nimport { isAuthenticated, clearToken, loadToken } from \"./core/auth\";\n\nexport type { FeedbackUser, ImpakersDebugConfig } from \"./core/types\";\n\n/**\n * @impakers/debug Vanilla JS API\n *\n * React를 쓰지 않는 환경에서 사용하거나,\n * 프로그래밍 방식으로 위젯을 제어할 때 사용합니다.\n */\nexport class ImpakersDebug {\n private static _eventTarget = typeof EventTarget !== \"undefined\" ? new EventTarget() : null;\n\n /** 인증 프롬프트 띄우기 */\n static showAuth(): void {\n ImpakersDebug._eventTarget?.dispatchEvent(new CustomEvent(\"impakers-debug:show-auth\"));\n }\n\n /** 인증 상태 확인 */\n static isActive(): boolean {\n return isAuthenticated();\n }\n\n /** 로그아웃 (토큰 삭제 + UI 숨김) */\n static deactivate(): void {\n clearToken();\n ImpakersDebug._eventTarget?.dispatchEvent(new CustomEvent(\"impakers-debug:deactivate\"));\n }\n\n /** 피드백 폼 열기 (인증된 상태에서) */\n static open(): void {\n if (!isAuthenticated()) {\n ImpakersDebug.showAuth();\n return;\n }\n ImpakersDebug._eventTarget?.dispatchEvent(new CustomEvent(\"impakers-debug:open\"));\n }\n\n /** 내부 이벤트 리스너 등록 (React Provider에서 사용) */\n static _on(event: string, handler: EventListener): () => void {\n ImpakersDebug._eventTarget?.addEventListener(event, handler);\n return () => ImpakersDebug._eventTarget?.removeEventListener(event, handler);\n }\n}\n"],"mappings":";AAUA,IAAM,cAAc;AACpB,IAAM,iBAAiB;AAUhB,SAAS,YAA2B;AACzC,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,MAAI;AACF,UAAM,OAAO,aAAa,QAAQ,cAAc;AAChD,QAAI,CAAC,KAAM,QAAO;AAElB,UAAM,SAA0B,KAAK,MAAM,IAAI;AAG/C,QAAI,IAAI,KAAK,OAAO,SAAS,IAAI,oBAAI,KAAK,GAAG;AAC3C,iBAAW;AACX,aAAO;AAAA,IACT;AAEA,WAAO,OAAO;AAAA,EAChB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,kBAA2B;AACzC,SAAO,UAAU,MAAM;AACzB;AAgCO,SAAS,aAAmB;AACjC,MAAI,OAAO,WAAW,YAAa;AACnC,MAAI;AACF,iBAAa,WAAW,cAAc;AACtC,iBAAa,WAAW,WAAW;AAAA,EACrC,QAAQ;AAAA,EAER;AACF;;;AC3DO,IAAM,iBAAN,MAAM,eAAc;AAAA;AAAA,EAIzB,OAAO,WAAiB;AACtB,mBAAc,cAAc,cAAc,IAAI,YAAY,0BAA0B,CAAC;AAAA,EACvF;AAAA;AAAA,EAGA,OAAO,WAAoB;AACzB,WAAO,gBAAgB;AAAA,EACzB;AAAA;AAAA,EAGA,OAAO,aAAmB;AACxB,eAAW;AACX,mBAAc,cAAc,cAAc,IAAI,YAAY,2BAA2B,CAAC;AAAA,EACxF;AAAA;AAAA,EAGA,OAAO,OAAa;AAClB,QAAI,CAAC,gBAAgB,GAAG;AACtB,qBAAc,SAAS;AACvB;AAAA,IACF;AACA,mBAAc,cAAc,cAAc,IAAI,YAAY,qBAAqB,CAAC;AAAA,EAClF;AAAA;AAAA,EAGA,OAAO,IAAI,OAAe,SAAoC;AAC5D,mBAAc,cAAc,iBAAiB,OAAO,OAAO;AAC3D,WAAO,MAAM,eAAc,cAAc,oBAAoB,OAAO,OAAO;AAAA,EAC7E;AACF;AAjCa,eACI,eAAe,OAAO,gBAAgB,cAAc,IAAI,YAAY,IAAI;AADlF,IAAM,gBAAN;","names":[]}
|