sales-frontend-debug 0.0.2

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 ADDED
@@ -0,0 +1,1141 @@
1
+ import React5, { useEffect, useState, useMemo, useRef, useCallback } from 'react';
2
+ import { getEnvironmentFromHostname, isClient } from 'sales-frontend-utils';
3
+ import { useDebugStore } from 'sales-frontend-stores';
4
+
5
+ // src/debug-tool.tsx
6
+ var debugFloatingButtonStyle = {
7
+ position: "fixed",
8
+ right: "10px",
9
+ bottom: "80px",
10
+ borderRadius: "50%",
11
+ backgroundColor: "#f0f0f0",
12
+ border: "1px solid #ccc",
13
+ padding: "8px 12px",
14
+ fontWeight: "bold",
15
+ zIndex: 9999
16
+ };
17
+ var FloatingButton = ({ onClick }) => {
18
+ const [position, setPosition] = useState({ x: 0, y: 0 });
19
+ const [isDragging, setIsDragging] = useState(false);
20
+ const dragHappened = useRef(false);
21
+ const dragStartPos = useRef({ x: 0, y: 0 });
22
+ const elementStartPos = useRef({ x: 0, y: 0 });
23
+ const handleMouseDown = (e) => {
24
+ if (e.button !== 0) {
25
+ return;
26
+ }
27
+ dragHappened.current = false;
28
+ setIsDragging(true);
29
+ dragStartPos.current = { x: e.clientX, y: e.clientY };
30
+ elementStartPos.current = { ...position };
31
+ const handleMouseMove = (event) => {
32
+ const dx = event.clientX - dragStartPos.current.x;
33
+ const dy = event.clientY - dragStartPos.current.y;
34
+ if (!dragHappened.current && (Math.abs(dx) > 5 || Math.abs(dy) > 5)) {
35
+ dragHappened.current = true;
36
+ }
37
+ setPosition({
38
+ x: elementStartPos.current.x + dx,
39
+ y: elementStartPos.current.y + dy
40
+ });
41
+ };
42
+ const handleMouseUp = () => {
43
+ window.removeEventListener("mousemove", handleMouseMove);
44
+ window.removeEventListener("mouseup", handleMouseUp);
45
+ setIsDragging(false);
46
+ };
47
+ window.addEventListener("mousemove", handleMouseMove);
48
+ window.addEventListener("mouseup", handleMouseUp);
49
+ };
50
+ const handleClick = (e) => {
51
+ if (dragHappened.current) {
52
+ e.preventDefault();
53
+ e.stopPropagation();
54
+ return;
55
+ }
56
+ onClick();
57
+ };
58
+ const buttonStyle = {
59
+ ...debugFloatingButtonStyle,
60
+ transform: `translate(${position.x}px, ${position.y}px)`,
61
+ cursor: isDragging ? "grabbing" : "grab"
62
+ };
63
+ return /* @__PURE__ */ React5.createElement(
64
+ "button",
65
+ {
66
+ style: buttonStyle,
67
+ onMouseDown: handleMouseDown,
68
+ onClick: handleClick
69
+ },
70
+ "DEBUG"
71
+ );
72
+ };
73
+ var floating_button_default = FloatingButton;
74
+ var debugMenuPanelStyle = {
75
+ position: "fixed",
76
+ right: "20px",
77
+ bottom: "90px",
78
+ display: "flex",
79
+ flexDirection: "column",
80
+ maxHeight: "500px",
81
+ backgroundColor: "#ffffff",
82
+ border: "1px solid #e0e0e0",
83
+ borderRadius: "8px",
84
+ boxShadow: "0 4px 8px rgba(0, 0, 0, 0.1)",
85
+ zIndex: 9999
86
+ };
87
+ var panelHeaderStyle = {
88
+ display: "flex",
89
+ alignItems: "center",
90
+ justifyContent: "space-between",
91
+ padding: "10px 15px",
92
+ backgroundColor: "#f5f5f5",
93
+ borderBottom: "1px solid #e0e0e0",
94
+ flexShrink: 0
95
+ };
96
+ var h2Style = {
97
+ margin: 0,
98
+ fontSize: "16px"
99
+ };
100
+ var MenuPanel = ({ menuItems: menuItems2, onMenuItemClick, onClose }) => {
101
+ return /* @__PURE__ */ React5.createElement("div", { style: debugMenuPanelStyle }, /* @__PURE__ */ React5.createElement("div", { style: panelHeaderStyle }, /* @__PURE__ */ React5.createElement("h2", { style: h2Style }, "Debug Menu"), /* @__PURE__ */ React5.createElement("button", { onClick: onClose }, "X")), /* @__PURE__ */ React5.createElement("ul", null, menuItems2.map((item) => /* @__PURE__ */ React5.createElement(
102
+ "li",
103
+ {
104
+ key: item.id,
105
+ onClick: () => onMenuItemClick(item.component),
106
+ style: { cursor: "pointer", padding: "8px 12px" }
107
+ },
108
+ item.label
109
+ ))));
110
+ };
111
+ var menu_panel_default = MenuPanel;
112
+ var globalLogs = [];
113
+ var listeners = [];
114
+ var originalConsoleMethods = {};
115
+ var isConsoleOverridden = false;
116
+ var addLog = (type, ...args) => {
117
+ const newLog = {
118
+ id: Date.now() + Math.random(),
119
+ type,
120
+ timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString(),
121
+ message: args
122
+ };
123
+ globalLogs = [...globalLogs, newLog];
124
+ listeners.forEach((listener) => listener([...globalLogs]));
125
+ };
126
+ var initializeConsoleLogOverride = () => {
127
+ if (!isClient() || isConsoleOverridden) {
128
+ return;
129
+ }
130
+ const logTypes = ["log", "info", "warn", "error", "debug"];
131
+ logTypes.forEach((type) => {
132
+ originalConsoleMethods[type] = console[type];
133
+ console[type] = (...args) => {
134
+ if (originalConsoleMethods[type]) {
135
+ originalConsoleMethods[type]?.apply(console, args);
136
+ }
137
+ addLog(type, ...args);
138
+ };
139
+ });
140
+ isConsoleOverridden = true;
141
+ };
142
+ var restoreConsoleLog = () => {
143
+ if (!isClient() || !isConsoleOverridden) {
144
+ return;
145
+ }
146
+ const logTypes = ["log", "info", "warn", "error", "debug"];
147
+ logTypes.forEach((type) => {
148
+ if (originalConsoleMethods[type]) {
149
+ console[type] = originalConsoleMethods[type];
150
+ }
151
+ });
152
+ isConsoleOverridden = false;
153
+ };
154
+ var useConsoleLog = () => {
155
+ const [logs, setLogs] = useState(globalLogs);
156
+ useEffect(() => {
157
+ listeners.push(setLogs);
158
+ return () => {
159
+ listeners = listeners.filter((l) => l !== setLogs);
160
+ };
161
+ }, []);
162
+ const clearLogs = useCallback(() => {
163
+ globalLogs = [];
164
+ listeners.forEach((listener) => listener([]));
165
+ }, []);
166
+ return { logs, clearLogs };
167
+ };
168
+
169
+ // src/features/console-log/console-log-panel.tsx
170
+ var modalOverlayStyle = {
171
+ position: "fixed",
172
+ top: 0,
173
+ left: 0,
174
+ width: "100vw",
175
+ height: "100vh",
176
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
177
+ zIndex: 1e4
178
+ };
179
+ var debugFeaturePanelStyle = {
180
+ position: "fixed",
181
+ top: 0,
182
+ left: 0,
183
+ width: "100vw",
184
+ height: "100vh",
185
+ backgroundColor: "#ffffff",
186
+ zIndex: 10001,
187
+ display: "flex",
188
+ flexDirection: "column"
189
+ };
190
+ var panelHeaderStyle2 = {
191
+ display: "flex",
192
+ alignItems: "center",
193
+ justifyContent: "space-between",
194
+ padding: "10px 15px",
195
+ backgroundColor: "#f5f5f5",
196
+ borderBottom: "1px solid #e0e0e0",
197
+ flexShrink: 0
198
+ };
199
+ var h2Style2 = {
200
+ margin: 0,
201
+ fontSize: "16px"
202
+ };
203
+ var panelToolbarStyle = {
204
+ display: "flex",
205
+ alignItems: "center",
206
+ padding: "10px",
207
+ borderBottom: "1px solid #e0e0e0",
208
+ gap: "8px",
209
+ flexShrink: 0
210
+ };
211
+ var logListContainerStyle = {
212
+ flex: 1,
213
+ padding: "10px",
214
+ overflowY: "auto",
215
+ fontFamily: "monospace",
216
+ fontSize: "12px",
217
+ backgroundColor: "#ffffff"
218
+ };
219
+ var logItemStyle = {
220
+ display: "flex",
221
+ alignItems: "flex-start",
222
+ padding: "4px 0",
223
+ borderBottom: "1px solid #e0e0e0"
224
+ };
225
+ var logTimestampStyle = {
226
+ marginRight: "10px",
227
+ color: "#888888"
228
+ };
229
+ var logMessageStyle = {
230
+ margin: 0,
231
+ wordBreak: "break-all",
232
+ whiteSpace: "pre-wrap"
233
+ };
234
+ var logTypeStyles = {
235
+ log: { color: "#333333" },
236
+ info: { color: "#007bff" },
237
+ warn: { color: "#ffc107" },
238
+ error: { color: "#dc3545" },
239
+ debug: { color: "#6c757d" },
240
+ return: { color: "#8a2be2" }
241
+ };
242
+ var safeStringify = (obj) => {
243
+ try {
244
+ return JSON.stringify(obj, null, 2);
245
+ } catch (e) {
246
+ return "[Unserializable Object]";
247
+ }
248
+ };
249
+ var LogMessage = ({ entry }) => {
250
+ const messageParts = entry.message.map((part) => {
251
+ if (typeof part === "object" && part !== null) {
252
+ return safeStringify(part);
253
+ }
254
+ return String(part);
255
+ });
256
+ const style = { ...logMessageStyle, ...logTypeStyles[entry.type] };
257
+ return /* @__PURE__ */ React5.createElement("pre", { style }, messageParts.join(" "));
258
+ };
259
+ var ConsoleLogPanel = ({ onClose }) => {
260
+ const { logs, clearLogs } = useConsoleLog();
261
+ const [filter, setFilter] = useState("all");
262
+ const logContainerRef = useRef(null);
263
+ const filteredLogs = useMemo(() => {
264
+ if (filter === "all") {
265
+ return logs;
266
+ }
267
+ return logs.filter((log) => log.type === filter);
268
+ }, [logs, filter]);
269
+ useEffect(() => {
270
+ if (logContainerRef.current) {
271
+ logContainerRef.current.scrollTop = logContainerRef.current.scrollHeight;
272
+ }
273
+ }, [filteredLogs]);
274
+ const segmentOptions = ["all", "log", "warn", "error"];
275
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { style: modalOverlayStyle, onClick: onClose }), /* @__PURE__ */ React5.createElement("div", { style: debugFeaturePanelStyle }, /* @__PURE__ */ React5.createElement("div", { style: panelHeaderStyle2 }, /* @__PURE__ */ React5.createElement("h2", { style: h2Style2 }, "Console Logs"), /* @__PURE__ */ React5.createElement("button", { onClick: onClose }, "X")), /* @__PURE__ */ React5.createElement("div", { style: panelToolbarStyle }, /* @__PURE__ */ React5.createElement("div", null, segmentOptions.map((option) => /* @__PURE__ */ React5.createElement("button", { key: option, onClick: () => setFilter(option), disabled: filter === option }, option.charAt(0).toUpperCase() + option.slice(1)))), /* @__PURE__ */ React5.createElement("button", { onClick: clearLogs, style: { marginLeft: "auto" } }, "Clear")), /* @__PURE__ */ React5.createElement("div", { style: logListContainerStyle, ref: logContainerRef }, filteredLogs.map((log) => /* @__PURE__ */ React5.createElement("div", { key: log.id, style: logItemStyle }, /* @__PURE__ */ React5.createElement("span", { style: logTimestampStyle }, log.timestamp), /* @__PURE__ */ React5.createElement(LogMessage, { entry: log }))))));
276
+ };
277
+ var console_log_panel_default = ConsoleLogPanel;
278
+ var modalOverlayStyle2 = {
279
+ position: "fixed",
280
+ top: 0,
281
+ left: 0,
282
+ width: "100vw",
283
+ height: "100vh",
284
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
285
+ zIndex: 1e4
286
+ };
287
+ var debugFeaturePanelStyle2 = {
288
+ position: "fixed",
289
+ top: 0,
290
+ left: 0,
291
+ width: "100vw",
292
+ height: "100vh",
293
+ backgroundColor: "#ffffff",
294
+ zIndex: 10001,
295
+ display: "flex",
296
+ flexDirection: "column"
297
+ };
298
+ var panelHeaderStyle3 = {
299
+ display: "flex",
300
+ alignItems: "center",
301
+ justifyContent: "space-between",
302
+ padding: "10px 15px",
303
+ backgroundColor: "#f5f5f5",
304
+ borderBottom: "1px solid #e0e0e0",
305
+ flexShrink: 0
306
+ };
307
+ var h2Style3 = {
308
+ margin: 0,
309
+ fontSize: "16px"
310
+ };
311
+ var loginFormContainerStyle = {
312
+ display: "flex",
313
+ flex: 1,
314
+ flexDirection: "column",
315
+ gap: "15px",
316
+ padding: "20px",
317
+ overflowY: "auto"
318
+ };
319
+ var formActionsStyle = {
320
+ display: "flex",
321
+ justifyContent: "flex-end",
322
+ marginTop: "10px"
323
+ };
324
+ var LoginPanel = ({ onClose, onLogin }) => {
325
+ const [selectedTypeId, setSelectedTypeId] = useState(loginTypes[0]?.id || "");
326
+ const [formData, setFormData] = useState({});
327
+ const selectedType = useMemo(() => loginTypes.find((t) => t.id === selectedTypeId), [selectedTypeId]);
328
+ const handleInputChange = (e) => {
329
+ const { name, value } = e.target;
330
+ setFormData((prev) => ({ ...prev, [name]: value }));
331
+ };
332
+ const handleSubmit = (e) => {
333
+ e.preventDefault();
334
+ if (selectedType) {
335
+ onLogin(selectedType.id, formData);
336
+ onClose();
337
+ }
338
+ };
339
+ useEffect(() => {
340
+ setFormData({});
341
+ }, [selectedType]);
342
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { style: modalOverlayStyle2, onClick: onClose }), /* @__PURE__ */ React5.createElement("div", { style: debugFeaturePanelStyle2 }, /* @__PURE__ */ React5.createElement("div", { style: panelHeaderStyle3 }, /* @__PURE__ */ React5.createElement("h2", { style: h2Style3 }, "\uAC04\uD3B8 \uB85C\uADF8\uC778"), /* @__PURE__ */ React5.createElement("button", { onClick: onClose }, "X")), /* @__PURE__ */ React5.createElement("form", { style: loginFormContainerStyle, onSubmit: handleSubmit }, /* @__PURE__ */ React5.createElement("div", null, /* @__PURE__ */ React5.createElement("label", { htmlFor: "login-type-select" }, "\uB85C\uADF8\uC778 \uC720\uD615"), /* @__PURE__ */ React5.createElement(
343
+ "select",
344
+ {
345
+ id: "login-type-select",
346
+ value: selectedTypeId,
347
+ onChange: (e) => setSelectedTypeId(e.target.value)
348
+ },
349
+ loginTypes.map((type) => /* @__PURE__ */ React5.createElement("option", { key: type.id, value: type.id }, type.label))
350
+ )), selectedType?.fields.map((field) => /* @__PURE__ */ React5.createElement("div", { key: field.name }, /* @__PURE__ */ React5.createElement("label", { htmlFor: field.name }, field.label), /* @__PURE__ */ React5.createElement(
351
+ "input",
352
+ {
353
+ type: field.type,
354
+ id: field.name,
355
+ name: field.name,
356
+ placeholder: field.placeholder,
357
+ value: formData[field.name] || "",
358
+ onChange: handleInputChange,
359
+ required: true
360
+ }
361
+ ))), /* @__PURE__ */ React5.createElement("div", { style: formActionsStyle }, /* @__PURE__ */ React5.createElement("button", { type: "submit" }, "\uB85C\uADF8\uC778")))));
362
+ };
363
+ var login_panel_default = LoginPanel;
364
+ var modalOverlayStyle3 = {
365
+ position: "fixed",
366
+ top: 0,
367
+ left: 0,
368
+ width: "100vw",
369
+ height: "100vh",
370
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
371
+ zIndex: 1e4
372
+ };
373
+ var debugFeaturePanelStyle3 = {
374
+ position: "fixed",
375
+ top: 0,
376
+ left: 0,
377
+ width: "100vw",
378
+ height: "100vh",
379
+ backgroundColor: "#ffffff",
380
+ zIndex: 10001,
381
+ display: "flex",
382
+ flexDirection: "column"
383
+ };
384
+ var panelHeaderStyle4 = {
385
+ display: "flex",
386
+ alignItems: "center",
387
+ justifyContent: "space-between",
388
+ padding: "10px 15px",
389
+ backgroundColor: "#f5f5f5",
390
+ borderBottom: "1px solid #e0e0e0",
391
+ flexShrink: 0
392
+ };
393
+ var h2Style4 = {
394
+ margin: 0,
395
+ fontSize: "16px"
396
+ };
397
+ var searchContainerStyle = {
398
+ display: "flex",
399
+ gap: "8px",
400
+ marginBottom: "16px",
401
+ alignItems: "center"
402
+ };
403
+ var logListStyle = {
404
+ maxHeight: "60vh",
405
+ overflowY: "auto"
406
+ };
407
+ var logSummaryStyle = {
408
+ wordBreak: "break-all",
409
+ margin: 0,
410
+ cursor: "pointer"
411
+ };
412
+ var logContentStyle = {
413
+ padding: "8px",
414
+ wordBreak: "break-all",
415
+ whiteSpace: "pre-wrap",
416
+ backgroundColor: "#f5f5f5",
417
+ borderRadius: "4px"
418
+ };
419
+ var SEARCH_SECTIONS = [
420
+ { value: "all", label: "\uC804\uCCB4" },
421
+ { value: "url", label: "\uC8FC\uC18C" },
422
+ { value: "headers", label: "\uD5E4\uB354" },
423
+ { value: "params", label: "\uD30C\uB77C\uBBF8\uD130" },
424
+ { value: "data", label: "\uC694\uCCAD" },
425
+ { value: "response", label: "\uC751\uB2F5" },
426
+ { value: "error", label: "\uC5D0\uB7EC" }
427
+ ];
428
+ var getLogInfo = (log) => {
429
+ if (log.holdStatus === "held") {
430
+ if ("request" in log) {
431
+ return log.request;
432
+ }
433
+ if ("response" in log) {
434
+ return log.response;
435
+ }
436
+ if ("error" in log) {
437
+ return log.error;
438
+ }
439
+ }
440
+ return log;
441
+ };
442
+ var NetworkLog = ({ onClose }) => {
443
+ const {
444
+ requests,
445
+ responses,
446
+ errors,
447
+ clear,
448
+ isHold,
449
+ toggleHold,
450
+ heldRequests,
451
+ heldResponses,
452
+ heldErrors,
453
+ playAllRequests,
454
+ playAllResponses
455
+ } = useDebugStore();
456
+ const [searchTerm, setSearchTerm] = useState("");
457
+ const [searchSection, setSearchSection] = useState(SEARCH_SECTIONS[0]?.value);
458
+ const allLogs = useMemo(() => {
459
+ const logs = [];
460
+ requests.forEach((req) => logs.push({ ...req, type: "request" }));
461
+ responses.forEach((res) => logs.push({ ...res, type: "response" }));
462
+ errors.forEach((err) => logs.push({ ...err, type: "error" }));
463
+ heldRequests.forEach((req) => logs.push({ ...req, type: "request", holdStatus: "held" }));
464
+ heldResponses.forEach((res) => logs.push({ ...res, type: "response", holdStatus: "held" }));
465
+ heldErrors.forEach((err) => logs.push({ ...err, type: "error", holdStatus: "held" }));
466
+ logs.sort((a, b) => {
467
+ const aInfo = getLogInfo(a);
468
+ const bInfo = getLogInfo(b);
469
+ const aTime = "startTime" in aInfo ? aInfo.startTime : 0;
470
+ const bTime = "startTime" in bInfo ? bInfo.startTime : 0;
471
+ return bTime - aTime;
472
+ });
473
+ return logs;
474
+ }, [requests, responses, errors, heldRequests, heldResponses, heldErrors]);
475
+ const filteredLogs = useMemo(() => {
476
+ if (!searchTerm) {
477
+ return allLogs;
478
+ }
479
+ const lowercasedTerm = searchTerm.toLowerCase();
480
+ return allLogs.filter((log) => {
481
+ const logInfo = getLogInfo(log);
482
+ switch (searchSection) {
483
+ case "url":
484
+ return logInfo.url?.toLowerCase().includes(lowercasedTerm);
485
+ case "headers":
486
+ return "headers" in logInfo && logInfo.headers && JSON.stringify(logInfo.headers)?.toLowerCase().includes(lowercasedTerm);
487
+ case "params":
488
+ return "params" in logInfo && logInfo.params && JSON.stringify(logInfo.params)?.toLowerCase().includes(lowercasedTerm);
489
+ case "data":
490
+ return "data" in logInfo && logInfo.data && log.type === "request" && JSON.stringify(logInfo.data)?.toLowerCase().includes(lowercasedTerm);
491
+ case "response":
492
+ return "data" in logInfo && logInfo.data && log.type === "response" && JSON.stringify(logInfo.data)?.toLowerCase().includes(lowercasedTerm);
493
+ case "error":
494
+ return log.type === "error" && JSON.stringify(logInfo)?.toLowerCase().includes(lowercasedTerm);
495
+ case "all":
496
+ default:
497
+ return JSON.stringify(logInfo).toLowerCase().includes(lowercasedTerm);
498
+ }
499
+ });
500
+ }, [allLogs, searchTerm, searchSection]);
501
+ const renderLogSummary = (log) => {
502
+ const logInfo = getLogInfo(log);
503
+ const prefix = log.holdStatus === "held" ? "[HELD] " : "";
504
+ if (log.type === "request") {
505
+ return `${prefix}[REQ] ${logInfo.method.toUpperCase()} ${logInfo.url}`;
506
+ }
507
+ if (log.type === "response" && "status" in logInfo) {
508
+ return `${prefix}[RES] ${logInfo.method.toUpperCase()} ${logInfo.url} - ${logInfo.status}`;
509
+ }
510
+ if (log.type === "error" && "message" in logInfo) {
511
+ return `${prefix}[ERR] ${logInfo.method.toUpperCase()} ${logInfo.url} - ${logInfo.message}`;
512
+ }
513
+ return "Unknown Log";
514
+ };
515
+ const renderLogContent = (log) => {
516
+ const logInfo = getLogInfo(log);
517
+ return /* @__PURE__ */ React5.createElement("pre", null, JSON.stringify(logInfo, null, 2));
518
+ };
519
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { style: modalOverlayStyle3, onClick: onClose }), /* @__PURE__ */ React5.createElement("div", { style: debugFeaturePanelStyle3 }, /* @__PURE__ */ React5.createElement("div", { style: panelHeaderStyle4 }, /* @__PURE__ */ React5.createElement("h2", { style: h2Style4 }, "\uB124\uD2B8\uC6CC\uD06C \uB85C\uADF8"), /* @__PURE__ */ React5.createElement("button", { onClick: onClose }, "X")), /* @__PURE__ */ React5.createElement("div", { style: { padding: "10px", display: "flex", flexDirection: "column", flex: 1, overflow: "hidden" } }, /* @__PURE__ */ React5.createElement("div", { style: searchContainerStyle }, /* @__PURE__ */ React5.createElement("select", { value: searchSection, onChange: (e) => setSearchSection(e.target.value) }, SEARCH_SECTIONS.map((option) => /* @__PURE__ */ React5.createElement("option", { key: option.value, value: option.value }, option.label))), /* @__PURE__ */ React5.createElement(
520
+ "input",
521
+ {
522
+ type: "text",
523
+ placeholder: "\uAC80\uC0C9...",
524
+ value: searchTerm,
525
+ onChange: (e) => setSearchTerm(e.target.value),
526
+ style: { flex: 1 }
527
+ }
528
+ ), /* @__PURE__ */ React5.createElement("label", null, /* @__PURE__ */ React5.createElement("input", { type: "checkbox", id: "hold-checkbox", checked: isHold, onChange: toggleHold }), "Hold"), /* @__PURE__ */ React5.createElement("button", { onClick: clear }, "clear")), isHold && /* @__PURE__ */ React5.createElement("div", { style: { display: "flex", flexDirection: "row", gap: "8px", marginBottom: "10px" } }, /* @__PURE__ */ React5.createElement("button", { onClick: () => playAllRequests() }, "REQ Resolve"), /* @__PURE__ */ React5.createElement("button", { onClick: () => playAllResponses() }, "RES Resolve")), /* @__PURE__ */ React5.createElement("div", { style: logListStyle }, filteredLogs.length === 0 ? /* @__PURE__ */ React5.createElement("p", null, "\uD45C\uC2DC\uD560 \uB85C\uADF8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.") : /* @__PURE__ */ React5.createElement("div", null, filteredLogs.map((log, index) => /* @__PURE__ */ React5.createElement("details", { key: index }, /* @__PURE__ */ React5.createElement("summary", { style: logSummaryStyle }, renderLogSummary(log)), /* @__PURE__ */ React5.createElement("div", { style: logContentStyle }, renderLogContent(log)))))))));
529
+ };
530
+ var network_log_default = NetworkLog;
531
+ var modalOverlayStyle4 = {
532
+ position: "fixed",
533
+ top: 0,
534
+ left: 0,
535
+ width: "100vw",
536
+ height: "100vh",
537
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
538
+ zIndex: 1e4
539
+ };
540
+ var debugFeaturePanelStyle4 = {
541
+ position: "fixed",
542
+ top: 0,
543
+ left: 0,
544
+ width: "100vw",
545
+ height: "100vh",
546
+ backgroundColor: "#ffffff",
547
+ zIndex: 10001,
548
+ display: "flex",
549
+ flexDirection: "column"
550
+ };
551
+ var panelHeaderStyle5 = {
552
+ display: "flex",
553
+ alignItems: "center",
554
+ justifyContent: "space-between",
555
+ padding: "10px 15px",
556
+ backgroundColor: "#f5f5f5",
557
+ borderBottom: "1px solid #e0e0e0",
558
+ flexShrink: 0
559
+ };
560
+ var h2Style5 = {
561
+ margin: 0,
562
+ fontSize: "16px"
563
+ };
564
+ var pageNavigationContentStyle = {
565
+ display: "flex",
566
+ gap: "10px",
567
+ alignItems: "center",
568
+ padding: "20px"
569
+ };
570
+ var PageNavigationPanel = ({ onClose }) => {
571
+ const [url, setUrl] = useState("");
572
+ const handleNavigate = () => {
573
+ if (url) {
574
+ self.location.href = url;
575
+ }
576
+ };
577
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { style: modalOverlayStyle4, onClick: onClose }), /* @__PURE__ */ React5.createElement("div", { style: debugFeaturePanelStyle4 }, /* @__PURE__ */ React5.createElement("div", { style: panelHeaderStyle5 }, /* @__PURE__ */ React5.createElement("h2", { style: h2Style5 }, "\uD398\uC774\uC9C0 \uC774\uB3D9"), /* @__PURE__ */ React5.createElement("button", { onClick: onClose }, "X")), /* @__PURE__ */ React5.createElement("div", { style: pageNavigationContentStyle }, /* @__PURE__ */ React5.createElement(
578
+ "input",
579
+ {
580
+ type: "text",
581
+ value: url,
582
+ onChange: (e) => setUrl(e.target.value),
583
+ placeholder: "\uC774\uB3D9\uD560 URL\uC744 \uC785\uB825\uD558\uC138\uC694 (\uC608: /main)",
584
+ style: { flex: 1 }
585
+ }
586
+ ), /* @__PURE__ */ React5.createElement("button", { onClick: handleNavigate }, "\uC774\uB3D9"))));
587
+ };
588
+ var page_navigation_panel_default = PageNavigationPanel;
589
+ var modalOverlayStyle5 = {
590
+ position: "fixed",
591
+ top: 0,
592
+ left: 0,
593
+ width: "100vw",
594
+ height: "100vh",
595
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
596
+ zIndex: 1e4
597
+ };
598
+ var debugFeaturePanelStyle5 = {
599
+ position: "fixed",
600
+ top: 0,
601
+ left: 0,
602
+ width: "100vw",
603
+ height: "100vh",
604
+ backgroundColor: "#ffffff",
605
+ zIndex: 10001,
606
+ display: "flex",
607
+ flexDirection: "column"
608
+ };
609
+ var panelHeaderStyle6 = {
610
+ display: "flex",
611
+ alignItems: "center",
612
+ justifyContent: "space-between",
613
+ padding: "10px 15px",
614
+ backgroundColor: "#f5f5f5",
615
+ borderBottom: "1px solid #e0e0e0",
616
+ flexShrink: 0
617
+ };
618
+ var h2Style6 = {
619
+ margin: 0,
620
+ fontSize: "16px"
621
+ };
622
+ var h3Style = {
623
+ margin: 0,
624
+ fontSize: "16px"
625
+ };
626
+ var scriptExecutorContentStyle = {
627
+ display: "flex",
628
+ flex: 1,
629
+ flexDirection: "column",
630
+ overflow: "hidden"
631
+ };
632
+ var scriptInputSectionStyle = {
633
+ display: "flex",
634
+ flex: 1,
635
+ flexDirection: "column",
636
+ minHeight: "150px",
637
+ borderBottom: "1px solid #e0e0e0"
638
+ };
639
+ var scriptTextareaStyle = {
640
+ flex: 1,
641
+ width: "100%",
642
+ padding: "10px",
643
+ fontFamily: "monospace",
644
+ fontSize: "14px",
645
+ resize: "none",
646
+ outline: "none",
647
+ border: "none"
648
+ };
649
+ var scriptActionsStyle = {
650
+ display: "flex",
651
+ justifyContent: "flex-end",
652
+ gap: "8px",
653
+ padding: "8px",
654
+ borderTop: "1px solid #e0e0e0"
655
+ };
656
+ var scriptOutputSectionStyle = {
657
+ display: "flex",
658
+ flex: 1,
659
+ flexDirection: "column",
660
+ overflow: "hidden"
661
+ };
662
+ var logListContainerStyle2 = {
663
+ flex: 1,
664
+ padding: "10px",
665
+ overflowY: "auto",
666
+ fontFamily: "monospace",
667
+ fontSize: "12px",
668
+ backgroundColor: "#ffffff"
669
+ };
670
+ var logItemStyle2 = {
671
+ display: "flex",
672
+ alignItems: "flex-start",
673
+ padding: "4px 0",
674
+ borderBottom: "1px solid #e0e0e0"
675
+ };
676
+ var logTimestampStyle2 = {
677
+ marginRight: "10px",
678
+ color: "#888888"
679
+ };
680
+ var logMessageStyle2 = {
681
+ margin: 0,
682
+ wordBreak: "break-all",
683
+ whiteSpace: "pre-wrap"
684
+ };
685
+ var logTypeStyles2 = {
686
+ log: { color: "#333333" },
687
+ warn: { color: "#ffc107" },
688
+ error: { color: "#dc3545" },
689
+ return: { color: "#8a2be2" }
690
+ };
691
+ var safeStringify2 = (obj) => {
692
+ try {
693
+ const replacer = (key, value) => typeof value === "bigint" ? value.toString() : value;
694
+ return JSON.stringify(obj, replacer, 2);
695
+ } catch (e) {
696
+ return "[Unserializable Object]";
697
+ }
698
+ };
699
+ var ResultMessage = ({ log }) => {
700
+ const messageParts = log.message.map((part) => {
701
+ if (typeof part === "object" && part !== null) {
702
+ return safeStringify2(part);
703
+ }
704
+ return String(part);
705
+ });
706
+ const prefix = log.type === "return" ? "\u21A9 " : "";
707
+ const style = { ...logMessageStyle2, ...logTypeStyles2[log.type] };
708
+ return /* @__PURE__ */ React5.createElement("pre", { style }, prefix, messageParts.join(" "));
709
+ };
710
+ var ScriptExecutorPanel = ({ onClose }) => {
711
+ const [code, setCode] = useState('// \uC5EC\uAE30\uC5D0 \uC2E4\uD589\uD560 \uCF54\uB4DC\uB97C \uC785\uB825\uD558\uC138\uC694\nconsole.log("Hello, World!");');
712
+ const [results, setResults] = useState([]);
713
+ const addResult = (type, ...args) => {
714
+ setResults((prevResults) => [
715
+ ...prevResults,
716
+ {
717
+ id: Date.now() + Math.random(),
718
+ type,
719
+ timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString(),
720
+ message: args
721
+ }
722
+ ]);
723
+ };
724
+ const handleExecute = () => {
725
+ const originalConsole = { ...console };
726
+ const newConsole = {
727
+ log: (...args) => {
728
+ originalConsole.log(...args);
729
+ addResult("log", ...args);
730
+ },
731
+ warn: (...args) => {
732
+ originalConsole.warn(...args);
733
+ addResult("warn", ...args);
734
+ },
735
+ error: (...args) => {
736
+ originalConsole.error(...args);
737
+ addResult("error", ...args);
738
+ }
739
+ };
740
+ try {
741
+ Object.assign(console, newConsole);
742
+ const result = new Function(code)();
743
+ if (result !== void 0) {
744
+ addResult("return", result);
745
+ }
746
+ } catch (e) {
747
+ addResult("error", e.name, e.message);
748
+ } finally {
749
+ Object.assign(console, originalConsole);
750
+ }
751
+ };
752
+ const handleClear = () => {
753
+ setResults([]);
754
+ };
755
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { style: modalOverlayStyle5, onClick: onClose }), /* @__PURE__ */ React5.createElement("div", { style: { ...debugFeaturePanelStyle5, ...scriptExecutorContentStyle } }, /* @__PURE__ */ React5.createElement("div", { style: panelHeaderStyle6 }, /* @__PURE__ */ React5.createElement("h2", { style: h2Style6 }, "\uC2A4\uD06C\uB9BD\uD2B8 \uC2E4\uD589"), /* @__PURE__ */ React5.createElement("button", { onClick: onClose }, "X")), /* @__PURE__ */ React5.createElement("div", { style: scriptExecutorContentStyle }, /* @__PURE__ */ React5.createElement("div", { style: scriptInputSectionStyle }, /* @__PURE__ */ React5.createElement(
756
+ "textarea",
757
+ {
758
+ style: scriptTextareaStyle,
759
+ value: code,
760
+ onChange: (e) => setCode(e.target.value),
761
+ spellCheck: "false"
762
+ }
763
+ ), /* @__PURE__ */ React5.createElement("div", { style: scriptActionsStyle }, /* @__PURE__ */ React5.createElement("button", { onClick: handleExecute }, "\uC2E4\uD589 (\u25B6)"), /* @__PURE__ */ React5.createElement("button", { onClick: handleClear }, "\uACB0\uACFC \uC9C0\uC6B0\uAE30"))), /* @__PURE__ */ React5.createElement("div", { style: scriptOutputSectionStyle }, /* @__PURE__ */ React5.createElement("div", { style: panelHeaderStyle6 }, /* @__PURE__ */ React5.createElement("h3", { style: h3Style }, "\uACB0\uACFC")), /* @__PURE__ */ React5.createElement("div", { style: logListContainerStyle2 }, results.map((log) => /* @__PURE__ */ React5.createElement("div", { key: log.id, style: logItemStyle2 }, /* @__PURE__ */ React5.createElement("span", { style: logTimestampStyle2 }, log.timestamp), /* @__PURE__ */ React5.createElement(ResultMessage, { log }))))))));
764
+ };
765
+ var script_executor_panel_default = ScriptExecutorPanel;
766
+ var setCookie = (name, value) => {
767
+ document.cookie = `${name}=${encodeURIComponent(value)};path=/`;
768
+ };
769
+ var removeCookie = (name) => {
770
+ document.cookie = `${name}=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
771
+ };
772
+ var useStorage = (storageType) => {
773
+ const [items, setItems] = useState([]);
774
+ const loadItems = useCallback(() => {
775
+ const newItems = [];
776
+ if (storageType === "localStorage") {
777
+ for (let i = 0; i < localStorage.length; i++) {
778
+ const key = localStorage.key(i);
779
+ if (key) {
780
+ newItems.push({ key, value: localStorage.getItem(key) || "" });
781
+ }
782
+ }
783
+ } else {
784
+ const cookies = document.cookie.split(";");
785
+ cookies.forEach((cookie) => {
786
+ const parts = cookie.split("=");
787
+ const key = parts.shift()?.trim();
788
+ if (key) {
789
+ newItems.push({ key, value: decodeURIComponent(parts.join("=")) });
790
+ }
791
+ });
792
+ }
793
+ setItems(newItems);
794
+ }, [storageType]);
795
+ useEffect(() => {
796
+ loadItems();
797
+ }, [loadItems]);
798
+ const setItem = useCallback(
799
+ (key, value) => {
800
+ if (storageType === "localStorage") {
801
+ localStorage.setItem(key, value);
802
+ } else {
803
+ setCookie(key, value);
804
+ }
805
+ loadItems();
806
+ },
807
+ [storageType, loadItems]
808
+ );
809
+ const removeItem = useCallback(
810
+ (key) => {
811
+ if (storageType === "localStorage") {
812
+ localStorage.removeItem(key);
813
+ } else {
814
+ removeCookie(key);
815
+ }
816
+ loadItems();
817
+ },
818
+ [storageType, loadItems]
819
+ );
820
+ return { items, setItem, removeItem, loadItems };
821
+ };
822
+
823
+ // src/features/storage/storage-panel.tsx
824
+ var modalOverlayStyle6 = {
825
+ position: "fixed",
826
+ top: 0,
827
+ left: 0,
828
+ width: "100vw",
829
+ height: "100vh",
830
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
831
+ zIndex: 1e4
832
+ };
833
+ var debugFeaturePanelStyle6 = {
834
+ position: "fixed",
835
+ top: 0,
836
+ left: 0,
837
+ width: "100vw",
838
+ height: "100vh",
839
+ backgroundColor: "#ffffff",
840
+ zIndex: 10001,
841
+ display: "flex",
842
+ flexDirection: "column"
843
+ };
844
+ var panelHeaderStyle7 = {
845
+ display: "flex",
846
+ alignItems: "center",
847
+ justifyContent: "space-between",
848
+ padding: "10px 15px",
849
+ backgroundColor: "#f5f5f5",
850
+ borderBottom: "1px solid #e0e0e0",
851
+ flexShrink: 0
852
+ };
853
+ var h2Style7 = {
854
+ margin: 0,
855
+ fontSize: "16px"
856
+ };
857
+ var panelToolbarStyle2 = {
858
+ display: "flex",
859
+ alignItems: "center",
860
+ padding: "10px",
861
+ borderBottom: "1px solid #e0e0e0",
862
+ gap: "8px",
863
+ flexShrink: 0
864
+ };
865
+ var storageSearchInputStyle = {
866
+ width: "100%",
867
+ padding: "8px",
868
+ border: "1px solid #ccc",
869
+ borderRadius: "4px"
870
+ };
871
+ var storageTableContainerStyle = {
872
+ flex: 1,
873
+ overflowY: "auto",
874
+ padding: "10px"
875
+ };
876
+ var logContentStyle2 = {
877
+ padding: "8px",
878
+ wordBreak: "break-all",
879
+ whiteSpace: "pre-wrap",
880
+ backgroundColor: "#f5f5f5",
881
+ borderRadius: "4px"
882
+ };
883
+ var ValueDisplay = ({ value }) => {
884
+ try {
885
+ const parsed = JSON.parse(value);
886
+ if (typeof parsed === "object" && parsed !== null) {
887
+ return /* @__PURE__ */ React5.createElement("pre", { style: logContentStyle2 }, JSON.stringify(parsed, null, 2));
888
+ }
889
+ } catch (e) {
890
+ }
891
+ return /* @__PURE__ */ React5.createElement("div", { style: logContentStyle2 }, value);
892
+ };
893
+ var EditableRow = ({ item, onSave, onRemove }) => {
894
+ const [isEditing, setIsEditing] = useState(false);
895
+ const [value, setValue] = useState(item.value);
896
+ const handleSave = () => {
897
+ onSave(item.key, value);
898
+ setIsEditing(false);
899
+ };
900
+ const handleEdit = () => {
901
+ setValue(item.value);
902
+ setIsEditing(true);
903
+ };
904
+ return /* @__PURE__ */ React5.createElement("details", null, /* @__PURE__ */ React5.createElement("summary", null, item.key), /* @__PURE__ */ React5.createElement("div", null, isEditing ? /* @__PURE__ */ React5.createElement("button", { onClick: handleSave }, "Save") : /* @__PURE__ */ React5.createElement("button", { onClick: handleEdit }, "Edit"), /* @__PURE__ */ React5.createElement("button", { onClick: () => onRemove(item.key) }, "Remove"), isEditing ? /* @__PURE__ */ React5.createElement("textarea", { value, onChange: (e) => setValue(e.target.value), style: { width: "100%", minHeight: "80px" } }) : /* @__PURE__ */ React5.createElement(ValueDisplay, { value: item.value })));
905
+ };
906
+ var StoragePanel = ({ onClose, storageType }) => {
907
+ const { items, setItem, removeItem } = useStorage(storageType);
908
+ const [filter, setFilter] = useState("");
909
+ const filteredItems = useMemo(() => {
910
+ if (!filter) {
911
+ return items;
912
+ }
913
+ return items.filter(
914
+ (item) => item.key.toLowerCase().includes(filter.toLowerCase()) || item.value.toLowerCase().includes(filter.toLowerCase())
915
+ );
916
+ }, [items, filter]);
917
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { style: modalOverlayStyle6, onClick: onClose }), /* @__PURE__ */ React5.createElement("div", { style: debugFeaturePanelStyle6 }, /* @__PURE__ */ React5.createElement("div", { style: panelHeaderStyle7 }, /* @__PURE__ */ React5.createElement("h2", { style: h2Style7 }, storageType === "localStorage" ? "Local Storage" : "Cookies"), /* @__PURE__ */ React5.createElement("button", { onClick: onClose }, "X")), /* @__PURE__ */ React5.createElement("div", { style: panelToolbarStyle2 }, /* @__PURE__ */ React5.createElement(
918
+ "input",
919
+ {
920
+ type: "text",
921
+ placeholder: "Search key or value...",
922
+ value: filter,
923
+ onChange: (e) => setFilter(e.target.value),
924
+ style: storageSearchInputStyle
925
+ }
926
+ )), /* @__PURE__ */ React5.createElement("div", { style: storageTableContainerStyle }, filteredItems.map((item) => /* @__PURE__ */ React5.createElement(EditableRow, { key: item.key, item, onSave: setItem, onRemove: removeItem })))));
927
+ };
928
+ var storage_panel_default = StoragePanel;
929
+
930
+ // src/config.tsx
931
+ var loginTypes = [
932
+ {
933
+ id: "fp",
934
+ label: "FP \uB85C\uADF8\uC778",
935
+ fields: [{ name: "employeeId", label: "\uC0AC\uBC88", type: "text", placeholder: "\uC0AC\uBC88\uC744 \uC785\uB825\uD558\uC138\uC694" }]
936
+ },
937
+ {
938
+ id: "customer",
939
+ label: "\uACE0\uAC1D \uB85C\uADF8\uC778",
940
+ fields: [
941
+ { name: "name", label: "\uC774\uB984", type: "text", placeholder: "\uC774\uB984" },
942
+ { name: "phone", label: "\uC804\uD654\uBC88\uD638", type: "tel", placeholder: "\uC804\uD654\uBC88\uD638" },
943
+ { name: "residentNumber", label: "\uC8FC\uBBFC\uBC88\uD638", type: "text", placeholder: "\uC8FC\uBBFC\uBC88\uD638 \uC55E 7\uC790\uB9AC" },
944
+ { name: "userId", label: "\uC544\uC774\uB514", type: "text", placeholder: "\uC544\uC774\uB514" },
945
+ { name: "password", label: "\uBE44\uBC00\uBC88\uD638", type: "password", placeholder: "\uBE44\uBC00\uBC88\uD638" }
946
+ ]
947
+ }
948
+ ];
949
+ var menuItems = [
950
+ {
951
+ id: "network-log",
952
+ label: "\uB124\uD2B8\uC6CC\uD06C \uB85C\uADF8",
953
+ component: network_log_default,
954
+ display: true
955
+ },
956
+ {
957
+ id: "console-log",
958
+ label: "\uCF58\uC194 \uB85C\uADF8 \uD655\uC778",
959
+ component: console_log_panel_default,
960
+ display: true
961
+ },
962
+ {
963
+ id: "local-storage",
964
+ label: "\uB85C\uCEEC \uC2A4\uD1A0\uB9AC\uC9C0 \uAD00\uB9AC",
965
+ // StoragePanel은 재사용 가능한 컴포넌트이므로, props를 통해 어떤 스토리지를 다룰지 지정합니다.
966
+ component: (props) => /* @__PURE__ */ React5.createElement(storage_panel_default, { ...props, storageType: "localStorage" }),
967
+ display: true
968
+ },
969
+ {
970
+ id: "cookie-management",
971
+ label: "\uCFE0\uD0A4 \uAD00\uB9AC",
972
+ component: (props) => /* @__PURE__ */ React5.createElement(storage_panel_default, { ...props, storageType: "cookie" }),
973
+ display: true
974
+ },
975
+ {
976
+ id: "quick-login",
977
+ label: "\uAC04\uD3B8 \uB85C\uADF8\uC778",
978
+ component: login_panel_default,
979
+ display: true
980
+ // 실제 표시는 DebugTool.tsx에서 onLogin prop 존재 여부에 따라 결정됩니다.
981
+ },
982
+ {
983
+ id: "script-executor",
984
+ label: "\uC2A4\uD06C\uB9BD\uD2B8 \uC2E4\uD589",
985
+ component: script_executor_panel_default,
986
+ display: true
987
+ },
988
+ {
989
+ id: "page-navigation",
990
+ label: "\uD398\uC774\uC9C0 \uC774\uB3D9",
991
+ component: page_navigation_panel_default,
992
+ display: true
993
+ }
994
+ ];
995
+ var useEnvironment = () => {
996
+ const [envInfo, setEnvInfo] = useState({
997
+ env: "prd"
998
+ });
999
+ useEffect(() => {
1000
+ const { hostname } = window.location;
1001
+ setEnvInfo({ env: getEnvironmentFromHostname(hostname) });
1002
+ }, []);
1003
+ return envInfo;
1004
+ };
1005
+
1006
+ // src/debug-tool.tsx
1007
+ var DebugTool = ({ onLogin, envOverride, menuItemsOverride }) => {
1008
+ useEffect(() => {
1009
+ initializeConsoleLogOverride();
1010
+ return () => {
1011
+ restoreConsoleLog();
1012
+ };
1013
+ }, []);
1014
+ const environment = useEnvironment();
1015
+ const env = envOverride || environment.env;
1016
+ const menuItems2 = menuItemsOverride || menuItems;
1017
+ const [isMenuOpen, setMenuOpen] = useState(false);
1018
+ const [activeFeature, setActiveFeature] = useState(null);
1019
+ const isVisible = ["local", "dev", "stg"].includes(env);
1020
+ const handleMenuClick = (itemComponent) => {
1021
+ setActiveFeature(() => itemComponent);
1022
+ setMenuOpen(false);
1023
+ };
1024
+ const handleCloseFeature = () => {
1025
+ setActiveFeature(null);
1026
+ };
1027
+ if (!isVisible) {
1028
+ return null;
1029
+ }
1030
+ const toggleMenu = () => {
1031
+ setMenuOpen((prev) => !prev);
1032
+ if (!isMenuOpen) {
1033
+ setActiveFeature(null);
1034
+ }
1035
+ };
1036
+ const availableMenuItems = menuItems2.filter(
1037
+ (item) => item.display && // config에서 display가 true인 항목만 필터링합니다.
1038
+ // 'quick-login' 기능은 onLogin prop이 제공된 경우에만 활성화합니다.
1039
+ (item.id !== "quick-login" || item.id === "quick-login" && onLogin)
1040
+ );
1041
+ if (activeFeature) {
1042
+ const FeatureComponent = activeFeature;
1043
+ return /* @__PURE__ */ React5.createElement(FeatureComponent, { onClose: handleCloseFeature, onLogin });
1044
+ }
1045
+ return /* @__PURE__ */ React5.createElement(
1046
+ "div",
1047
+ {
1048
+ style: {
1049
+ position: "fixed",
1050
+ right: "20px",
1051
+ bottom: "20px",
1052
+ zIndex: 9999
1053
+ }
1054
+ },
1055
+ /* @__PURE__ */ React5.createElement(floating_button_default, { onClick: toggleMenu }),
1056
+ isMenuOpen && /* @__PURE__ */ React5.createElement(
1057
+ menu_panel_default,
1058
+ {
1059
+ menuItems: availableMenuItems,
1060
+ onMenuItemClick: handleMenuClick,
1061
+ onClose: () => setMenuOpen(false)
1062
+ }
1063
+ )
1064
+ );
1065
+ };
1066
+ function addRequestLog(config) {
1067
+ const env = getEnvironmentFromHostname(location.hostname);
1068
+ if (env !== "prd") {
1069
+ const { addRequest, isHold, holdRequest } = useDebugStore.getState();
1070
+ const startTime = Date.now();
1071
+ const requestInfo = {
1072
+ url: config.url || "",
1073
+ method: config.method || "",
1074
+ headers: config.headers,
1075
+ params: config.params,
1076
+ data: config.data,
1077
+ startTime
1078
+ };
1079
+ if (isHold) {
1080
+ return new Promise((resolver) => {
1081
+ holdRequest({ request: requestInfo, resolver });
1082
+ });
1083
+ } else {
1084
+ addRequest(requestInfo);
1085
+ }
1086
+ }
1087
+ }
1088
+ function addResponseLog(response) {
1089
+ const env = getEnvironmentFromHostname(location.hostname);
1090
+ if (env !== "prd") {
1091
+ const { addResponse, isHold, holdResponse } = useDebugStore.getState();
1092
+ const { config } = response;
1093
+ const responseInfo = {
1094
+ url: config.url || "",
1095
+ method: config.method || "",
1096
+ status: response.status,
1097
+ statusText: response.statusText,
1098
+ headers: response.headers,
1099
+ data: response.data
1100
+ };
1101
+ if (isHold) {
1102
+ return new Promise((resolver) => {
1103
+ holdResponse({ response: responseInfo, resolver });
1104
+ });
1105
+ } else {
1106
+ addResponse(responseInfo);
1107
+ }
1108
+ }
1109
+ }
1110
+ function addErrorLog(error) {
1111
+ const env = getEnvironmentFromHostname(location.hostname);
1112
+ if (env !== "prd") {
1113
+ const { addError, isHold, holdError } = useDebugStore.getState();
1114
+ const { config } = error;
1115
+ const errorInfo = {
1116
+ url: config?.url || "",
1117
+ method: config?.method || "",
1118
+ message: error.message,
1119
+ config: error.config,
1120
+ response: error.response ? {
1121
+ url: error.response.config?.url || "",
1122
+ method: error.response.config?.method || "",
1123
+ status: error.response.status,
1124
+ statusText: error.response.statusText,
1125
+ headers: error.response.headers,
1126
+ data: error.response.data
1127
+ } : void 0
1128
+ };
1129
+ if (isHold) {
1130
+ return new Promise((resolver) => {
1131
+ holdError({ error: errorInfo, resolver });
1132
+ });
1133
+ } else {
1134
+ addError(errorInfo);
1135
+ }
1136
+ }
1137
+ }
1138
+
1139
+ export { DebugTool, addErrorLog, addRequestLog, addResponseLog };
1140
+ //# sourceMappingURL=index.js.map
1141
+ //# sourceMappingURL=index.js.map