sales-frontend-components 0.0.57 → 0.0.59
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/camera/camera.module.scss +2 -4
- package/dist/debug-tool/debug-tool.module.scss +212 -0
- package/dist/debug-tool/features/network-log/network-log.module.scss +22 -0
- package/dist/index.cjs.js +681 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.esm.js +683 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +12 -11
package/dist/index.cjs.js
CHANGED
|
@@ -6,6 +6,10 @@ var salesFrontendDesignSystem = require('sales-frontend-design-system');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var styles = require('./step-indicator/step-indicator.module.scss');
|
|
8
8
|
var styles$1 = require('./camera/camera.module.scss');
|
|
9
|
+
var styles$2 = require('./debug-tool/debug-tool.module.scss');
|
|
10
|
+
var salesFrontendUtils = require('sales-frontend-utils');
|
|
11
|
+
var salesFrontendApi = require('sales-frontend-api');
|
|
12
|
+
var styles$3 = require('./debug-tool/features/network-log/network-log.module.scss');
|
|
9
13
|
|
|
10
14
|
const FormCheckboxButton = ({
|
|
11
15
|
name,
|
|
@@ -793,7 +797,684 @@ function useCanvasPaint(paintProps = {}) {
|
|
|
793
797
|
|
|
794
798
|
const testSignatureBase64Data = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAABkCAYAAACoy2Z3AAAQAElEQVR4AeydV6g2ORnHj733smvBiliws9jbhYoFREVQsYIFVBBRUBQRvbCgKIgFCyqoCCqiXiioN/ZesKEXYlkVXV11Xdde/z+/L/u95z0zSeadlmT+h+RkJvMkeZ5/kudJm3kveeQ/I1AvAncX67+S/+8B/glKM6X7uzIbwofI7YxA3QjYgNRdf1vl/p4S/Dz5L8qfLT/UfVkJLpSfymE8LjtVZs7HCNSCgA1ILTVlPkHg4/r3Z/nPy19XPteh4En7ICW4sjwzl48qHOMwQP9RBsw6hho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+Vfjw51hNeiLLJh9Djohnh9BQgnTOYtkdo8p+MQAwjuepRp+MXKPzLcNIUD7pK7RY+xFNSRaHaIAfB2cmsulEeCHcFDCtBE6KS+AoaSX5mO3PMpHabARzDFO+AoePjGAu/S+bhMBNtWpd9pnmxJWIhWdbiVWXWxlCOyuT9N5dz3rzYz+UfBDxIIegxA2tnfz7LqmvaI02Ic4a0hBpq0OgdA2GCzst4WSDjFUB+yUDNMhp8zPeW0TAU68MPqnPe139tg99BiEsRvbS6Mek6nGZ7w9jqLGmKO4l8aTMik77GOAYWgbDBaW5sflZSJAJWWSmswIGIFWENiTg895oKgx5ugEFPiSnjIp2/sYexVT+i0VVzqP5s8IGAEjYAQKRMAGpMBKMUtGwAgYgRoQsAE5pJacxggYASNgBI5sQNwIjIARMAJG4CAEbEAOgs2JjIARWAkBF1sQAjYgBVWGWTECRsAI1ISADUhNtWVejYARMAIFIWADUlBlLMGKyzACRsAITIWADchUSDofI2AEjMDGELAB2ViFW1wjYATWQqC9cm1A2qtTS2QEjIARWAQBG5BFYHYhRsAIGIH2ELABaa9OW5XIchkBI1AYAjYghVWI2TECRsAI1IKADUgtNWU+jYARMAJrIdBTrg1IDzCONgJGwAgYgTgCNiBxfPzUCBgBI2AEehCwAekBxtFGYDoEnJMRaBMBG5A269VSGQEjYARmR8AGZHaIXYARMAJGoE0EajAgbSJvqYyAETAClSNgA1J5BZp9I2AEjMBaCNiArIW8yzUCNSBgHo1ABAEbkAg4fmQEjIARMAL9CNiA9GPjJ0bACBgBIxBBwAYkAs74R87BCBgBI9AuAjYg7datJTMCRsAIzIqADcis8DpzI2AE1kLA5c6PwP8AAAD//+3/3TsAAAAGSURBVAMAJI6e9smFlTAAAAAASUVORK5CYII=";
|
|
795
799
|
|
|
800
|
+
const FloatingButton = ({ onClick }) => {
|
|
801
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
802
|
+
salesFrontendDesignSystem.Button,
|
|
803
|
+
{
|
|
804
|
+
variant: "secondary",
|
|
805
|
+
appearance: "filled",
|
|
806
|
+
size: "xsmall",
|
|
807
|
+
className: styles$2["debug-floating-button"],
|
|
808
|
+
onClick,
|
|
809
|
+
children: "DEBUG"
|
|
810
|
+
}
|
|
811
|
+
);
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
const MenuPanel = ({ menuItems, onMenuItemClick, onClose }) => {
|
|
815
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Root, { isOpen: true, onClose, modalSize: "small", children: [
|
|
816
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Overlay, {}),
|
|
817
|
+
/* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Content, { children: [
|
|
818
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Header, { headerTitle: "Debug Menu", showCloseButton: true }),
|
|
819
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.List, { selectable: true, children: menuItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.ListItem, { onClick: () => onMenuItemClick(item.component), children: item.label }, item.id)) }) })
|
|
820
|
+
] })
|
|
821
|
+
] });
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
let globalLogs = [];
|
|
825
|
+
let listeners = [];
|
|
826
|
+
const originalConsoleMethods = {};
|
|
827
|
+
let isConsoleOverridden = false;
|
|
828
|
+
const addLog = (type, ...args) => {
|
|
829
|
+
const newLog = {
|
|
830
|
+
id: Date.now() + Math.random(),
|
|
831
|
+
type,
|
|
832
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString(),
|
|
833
|
+
message: args
|
|
834
|
+
};
|
|
835
|
+
globalLogs = [...globalLogs, newLog];
|
|
836
|
+
listeners.forEach((listener) => listener([...globalLogs]));
|
|
837
|
+
};
|
|
838
|
+
const initializeConsoleLogOverride = () => {
|
|
839
|
+
if (!salesFrontendUtils.isClient() || isConsoleOverridden) {
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
const logTypes = ["log", "info", "warn", "error", "debug"];
|
|
843
|
+
logTypes.forEach((type) => {
|
|
844
|
+
originalConsoleMethods[type] = console[type];
|
|
845
|
+
console[type] = (...args) => {
|
|
846
|
+
if (originalConsoleMethods[type]) {
|
|
847
|
+
originalConsoleMethods[type]?.apply(console, args);
|
|
848
|
+
}
|
|
849
|
+
addLog(type, ...args);
|
|
850
|
+
};
|
|
851
|
+
});
|
|
852
|
+
isConsoleOverridden = true;
|
|
853
|
+
};
|
|
854
|
+
const restoreConsoleLog = () => {
|
|
855
|
+
if (!salesFrontendUtils.isClient() || !isConsoleOverridden) {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
const logTypes = ["log", "info", "warn", "error", "debug"];
|
|
859
|
+
logTypes.forEach((type) => {
|
|
860
|
+
if (originalConsoleMethods[type]) {
|
|
861
|
+
console[type] = originalConsoleMethods[type];
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
isConsoleOverridden = false;
|
|
865
|
+
};
|
|
866
|
+
const useConsoleLog = () => {
|
|
867
|
+
const [logs, setLogs] = React.useState(globalLogs);
|
|
868
|
+
React.useEffect(() => {
|
|
869
|
+
listeners.push(setLogs);
|
|
870
|
+
return () => {
|
|
871
|
+
listeners = listeners.filter((l) => l !== setLogs);
|
|
872
|
+
};
|
|
873
|
+
}, []);
|
|
874
|
+
const clearLogs = React.useCallback(() => {
|
|
875
|
+
globalLogs = [];
|
|
876
|
+
listeners.forEach((listener) => listener([]));
|
|
877
|
+
}, []);
|
|
878
|
+
return { logs, clearLogs };
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
const safeStringify$1 = (obj) => {
|
|
882
|
+
try {
|
|
883
|
+
return JSON.stringify(obj, null, 2);
|
|
884
|
+
} catch (e) {
|
|
885
|
+
return "[Unserializable Object]";
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
const LogMessage = ({ entry }) => {
|
|
889
|
+
const messageParts = entry.message.map((part) => {
|
|
890
|
+
if (typeof part === "object" && part !== null) {
|
|
891
|
+
return safeStringify$1(part);
|
|
892
|
+
}
|
|
893
|
+
return String(part);
|
|
894
|
+
});
|
|
895
|
+
return /* @__PURE__ */ jsxRuntime.jsx("pre", { className: `${styles$2["log-message"]} ${styles$2[`log-${entry.type}`]}`, children: messageParts.join(" ") });
|
|
896
|
+
};
|
|
897
|
+
const ConsoleLogPanel = ({ onClose }) => {
|
|
898
|
+
const { logs, clearLogs } = useConsoleLog();
|
|
899
|
+
const [filter, setFilter] = React.useState("all");
|
|
900
|
+
const logContainerRef = React.useRef(null);
|
|
901
|
+
const filteredLogs = React.useMemo(() => {
|
|
902
|
+
if (filter === "all") {
|
|
903
|
+
return logs;
|
|
904
|
+
}
|
|
905
|
+
return logs.filter((log) => log.type === filter);
|
|
906
|
+
}, [logs, filter]);
|
|
907
|
+
React.useEffect(() => {
|
|
908
|
+
if (logContainerRef.current) {
|
|
909
|
+
logContainerRef.current.scrollTop = logContainerRef.current.scrollHeight;
|
|
910
|
+
}
|
|
911
|
+
}, [filteredLogs]);
|
|
912
|
+
return /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Root, { isOpen: true, onClose, modalSize: "full-screen", children: /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Content, { children: [
|
|
913
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Header, { headerTitle: "Console Logs", showCloseButton: true }),
|
|
914
|
+
/* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Body, { children: [
|
|
915
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$2["panel-toolbar"], children: [
|
|
916
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
917
|
+
salesFrontendDesignSystem.Segment.Root,
|
|
918
|
+
{
|
|
919
|
+
size: "xsmall",
|
|
920
|
+
appearance: "outline",
|
|
921
|
+
align: "left",
|
|
922
|
+
defaultValue: filter,
|
|
923
|
+
onValueChange: (value) => setFilter(value),
|
|
924
|
+
children: [
|
|
925
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Segment.Item, { value: "all", children: "All" }),
|
|
926
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Segment.Item, { value: "log", children: "Log" }),
|
|
927
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Segment.Item, { value: "warn", children: "Warn" }),
|
|
928
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Segment.Item, { value: "error", children: "Error" })
|
|
929
|
+
]
|
|
930
|
+
}
|
|
931
|
+
),
|
|
932
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
933
|
+
salesFrontendDesignSystem.Button,
|
|
934
|
+
{
|
|
935
|
+
variant: "neutral",
|
|
936
|
+
appearance: "outline",
|
|
937
|
+
size: "xsmall",
|
|
938
|
+
onClick: clearLogs,
|
|
939
|
+
style: { marginLeft: "auto" },
|
|
940
|
+
children: "Clear"
|
|
941
|
+
}
|
|
942
|
+
)
|
|
943
|
+
] }),
|
|
944
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2["log-list-container"], ref: logContainerRef, children: filteredLogs.map((log) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$2["log-item"], children: [
|
|
945
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles$2["log-timestamp"], children: log.timestamp }),
|
|
946
|
+
/* @__PURE__ */ jsxRuntime.jsx(LogMessage, { entry: log })
|
|
947
|
+
] }, log.id)) })
|
|
948
|
+
] })
|
|
949
|
+
] }) });
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
const LoginPanel = ({ onClose, onLogin }) => {
|
|
953
|
+
const [selectedTypeId, setSelectedTypeId] = React.useState(loginTypes[0]?.id || "");
|
|
954
|
+
const [formData, setFormData] = React.useState({});
|
|
955
|
+
const selectedType = React.useMemo(() => loginTypes.find((t) => t.id === selectedTypeId), [selectedTypeId]);
|
|
956
|
+
const handleInputChange = (e) => {
|
|
957
|
+
const { name, value } = e.target;
|
|
958
|
+
setFormData((prev) => ({ ...prev, [name]: value }));
|
|
959
|
+
};
|
|
960
|
+
const handleSubmit = (e) => {
|
|
961
|
+
e.preventDefault();
|
|
962
|
+
if (selectedType) {
|
|
963
|
+
onLogin(selectedType.id, formData);
|
|
964
|
+
onClose();
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
React.useEffect(() => {
|
|
968
|
+
setFormData({});
|
|
969
|
+
}, [selectedType]);
|
|
970
|
+
return /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Root, { isOpen: true, onClose, modalSize: "full-screen", children: /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Content, { children: [
|
|
971
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Header, { headerTitle: "\uAC04\uD3B8 \uB85C\uADF8\uC778", showCloseButton: true }),
|
|
972
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: styles$2["login-form-container"], onSubmit: handleSubmit, children: [
|
|
973
|
+
/* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.FormField.FieldControl, { children: [
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.FormField.Label, { htmlFor: "login-type-select", children: "\uB85C\uADF8\uC778 \uC720\uD615" }),
|
|
975
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
976
|
+
salesFrontendDesignSystem.Select,
|
|
977
|
+
{
|
|
978
|
+
value: selectedTypeId,
|
|
979
|
+
onChange: setSelectedTypeId,
|
|
980
|
+
size: "xsmall",
|
|
981
|
+
rootProps: { style: { width: "100%" } },
|
|
982
|
+
children: loginTypes.map((type) => /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Select.Option, { value: type.id, children: type.label }, type.id))
|
|
983
|
+
}
|
|
984
|
+
)
|
|
985
|
+
] }),
|
|
986
|
+
selectedType?.fields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.FormField.FieldControl, { children: [
|
|
987
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.FormField.Label, { htmlFor: field.name, children: field.label }),
|
|
988
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
989
|
+
salesFrontendDesignSystem.FormField.TextField,
|
|
990
|
+
{
|
|
991
|
+
size: "xsmall",
|
|
992
|
+
type: field.type,
|
|
993
|
+
id: field.name,
|
|
994
|
+
name: field.name,
|
|
995
|
+
placeholder: field.placeholder,
|
|
996
|
+
value: formData[field.name] || "",
|
|
997
|
+
onChange: handleInputChange,
|
|
998
|
+
required: true
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] }, field.name)),
|
|
1002
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2["form-actions"], children: /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Button, { type: "submit", variant: "primary", appearance: "filled", size: "xsmall", children: "\uB85C\uADF8\uC778" }) })
|
|
1003
|
+
] }) })
|
|
1004
|
+
] }) });
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
const SEARCH_SECTIONS = [
|
|
1008
|
+
{ value: "all", label: "\uC804\uCCB4" },
|
|
1009
|
+
{ value: "url", label: "\uC8FC\uC18C" },
|
|
1010
|
+
{ value: "headers", label: "\uD5E4\uB354" },
|
|
1011
|
+
{ value: "params", label: "\uD30C\uB77C\uBBF8\uD130" },
|
|
1012
|
+
{ value: "data", label: "\uC694\uCCAD" },
|
|
1013
|
+
{ value: "response", label: "\uC751\uB2F5" },
|
|
1014
|
+
{ value: "error", label: "\uC5D0\uB7EC" }
|
|
1015
|
+
];
|
|
1016
|
+
const NetworkLog = ({ onClose }) => {
|
|
1017
|
+
const { requests, responses, errors, clear } = salesFrontendApi.useDebugStore();
|
|
1018
|
+
const [searchTerm, setSearchTerm] = React.useState("");
|
|
1019
|
+
const [searchSection, setSearchSection] = React.useState(SEARCH_SECTIONS[0]?.value);
|
|
1020
|
+
const allLogs = React.useMemo(() => {
|
|
1021
|
+
const logs = [];
|
|
1022
|
+
requests.forEach((req) => logs.push({ ...req, type: "request" }));
|
|
1023
|
+
responses.forEach((res) => logs.push({ ...res, type: "response" }));
|
|
1024
|
+
errors.forEach((err) => logs.push({ ...err, type: "error" }));
|
|
1025
|
+
logs.sort((a, b) => {
|
|
1026
|
+
const aTime = "startTime" in a ? a.startTime : 0;
|
|
1027
|
+
const bTime = "startTime" in b ? b.startTime : 0;
|
|
1028
|
+
return bTime - aTime;
|
|
1029
|
+
});
|
|
1030
|
+
return logs;
|
|
1031
|
+
}, [requests, responses, errors]);
|
|
1032
|
+
const filteredLogs = React.useMemo(() => {
|
|
1033
|
+
if (!searchTerm) {
|
|
1034
|
+
return allLogs;
|
|
1035
|
+
}
|
|
1036
|
+
const lowercasedTerm = searchTerm.toLowerCase();
|
|
1037
|
+
return allLogs.filter((log) => {
|
|
1038
|
+
switch (searchSection) {
|
|
1039
|
+
case "url":
|
|
1040
|
+
return log.url?.toLowerCase().includes(lowercasedTerm);
|
|
1041
|
+
case "headers":
|
|
1042
|
+
return "headers" in log && log.headers && JSON.stringify(log.headers)?.toLowerCase().includes(lowercasedTerm);
|
|
1043
|
+
case "params":
|
|
1044
|
+
return "params" in log && log.params && JSON.stringify(log.params)?.toLowerCase().includes(lowercasedTerm);
|
|
1045
|
+
case "data":
|
|
1046
|
+
return "data" in log && log.data && log.type === "request" && JSON.stringify(log.data)?.toLowerCase().includes(lowercasedTerm);
|
|
1047
|
+
case "response":
|
|
1048
|
+
return "data" in log && log.data && log.type === "response" && JSON.stringify(log.data)?.toLowerCase().includes(lowercasedTerm);
|
|
1049
|
+
case "error":
|
|
1050
|
+
return log.type === "error" && JSON.stringify(log)?.toLowerCase().includes(lowercasedTerm);
|
|
1051
|
+
case "all":
|
|
1052
|
+
default:
|
|
1053
|
+
return JSON.stringify(log).toLowerCase().includes(lowercasedTerm);
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
}, [allLogs, searchTerm, searchSection]);
|
|
1057
|
+
const renderLogSummary = (log) => {
|
|
1058
|
+
if (log.type === "request") {
|
|
1059
|
+
return `[REQ] ${log.method.toUpperCase()} ${log.url}`;
|
|
1060
|
+
}
|
|
1061
|
+
if (log.type === "response" && "status" in log) {
|
|
1062
|
+
return `[RES] ${log.method.toUpperCase()} ${log.url} - ${log.status}`;
|
|
1063
|
+
}
|
|
1064
|
+
if (log.type === "error" && "message" in log) {
|
|
1065
|
+
return `[ERR] ${log.method.toUpperCase()} ${log.url} - ${log.message}`;
|
|
1066
|
+
}
|
|
1067
|
+
return "Unknown Log";
|
|
1068
|
+
};
|
|
1069
|
+
const renderLogContent = (log) => {
|
|
1070
|
+
return /* @__PURE__ */ jsxRuntime.jsx("pre", { children: JSON.stringify(log, null, 2) });
|
|
1071
|
+
};
|
|
1072
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Root, { isOpen: true, onClose, modalSize: "full-screen", children: [
|
|
1073
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Overlay, {}),
|
|
1074
|
+
/* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Content, { children: [
|
|
1075
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Header, { headerTitle: "\uB124\uD2B8\uC6CC\uD06C \uB85C\uADF8", showCloseButton: true }),
|
|
1076
|
+
/* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Body, { children: [
|
|
1077
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$3["search-container"], children: [
|
|
1078
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Select, { value: searchSection, onChange: (value) => setSearchSection(value), size: "xsmall", children: SEARCH_SECTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Select.Option, { value: option.value, children: option.label }, option.value)) }),
|
|
1079
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1080
|
+
salesFrontendDesignSystem.FormField.TextField,
|
|
1081
|
+
{
|
|
1082
|
+
placeholder: "\uAC80\uC0C9...",
|
|
1083
|
+
value: searchTerm,
|
|
1084
|
+
size: "xsmall",
|
|
1085
|
+
onChange: (e) => setSearchTerm(e.target.value)
|
|
1086
|
+
}
|
|
1087
|
+
),
|
|
1088
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Button, { variant: "neutral", appearance: "outline", size: "xsmall", onClick: clear, children: "clear" })
|
|
1089
|
+
] }),
|
|
1090
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$3["log-list"], children: filteredLogs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { children: "\uD45C\uC2DC\uD560 \uB85C\uADF8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4." }) : /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Accordion.Root, { children: filteredLogs.map((log, index) => /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Accordion.Item, { children: [
|
|
1091
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Accordion.HeaderButton, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles$3["log-summary"], children: renderLogSummary(log) }) }),
|
|
1092
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Accordion.Content, { variant: "text", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$3["log-content"], children: renderLogContent(log) }) })
|
|
1093
|
+
] }, index)) }) })
|
|
1094
|
+
] })
|
|
1095
|
+
] })
|
|
1096
|
+
] });
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
const PageNavigationPanel = ({ onClose }) => {
|
|
1100
|
+
const [url, setUrl] = React.useState("");
|
|
1101
|
+
const handleNavigate = () => {
|
|
1102
|
+
if (url) {
|
|
1103
|
+
self.location.href = url;
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
return /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Root, { isOpen: true, onClose, modalSize: "full-screen", children: /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Content, { children: [
|
|
1107
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Header, { headerTitle: "\uD398\uC774\uC9C0 \uC774\uB3D9", showCloseButton: true }),
|
|
1108
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$2["page-navigation-content"], children: [
|
|
1109
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1110
|
+
salesFrontendDesignSystem.FormField.TextField,
|
|
1111
|
+
{
|
|
1112
|
+
size: "xsmall",
|
|
1113
|
+
type: "text",
|
|
1114
|
+
value: url,
|
|
1115
|
+
onChange: (e) => setUrl(e.target.value),
|
|
1116
|
+
placeholder: "\uC774\uB3D9\uD560 URL\uC744 \uC785\uB825\uD558\uC138\uC694 (\uC608: /main)",
|
|
1117
|
+
rootProps: { style: { flex: 1 } }
|
|
1118
|
+
}
|
|
1119
|
+
),
|
|
1120
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Button, { variant: "primary", appearance: "filled", size: "xsmall", onClick: handleNavigate, children: "\uC774\uB3D9" })
|
|
1121
|
+
] }) })
|
|
1122
|
+
] }) });
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
const safeStringify = (obj) => {
|
|
1126
|
+
try {
|
|
1127
|
+
const replacer = (key, value) => typeof value === "bigint" ? value.toString() : value;
|
|
1128
|
+
return JSON.stringify(obj, replacer, 2);
|
|
1129
|
+
} catch (e) {
|
|
1130
|
+
return "[Unserializable Object]";
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
const ResultMessage = ({ log }) => {
|
|
1134
|
+
const messageParts = log.message.map((part) => {
|
|
1135
|
+
if (typeof part === "object" && part !== null) {
|
|
1136
|
+
return safeStringify(part);
|
|
1137
|
+
}
|
|
1138
|
+
return String(part);
|
|
1139
|
+
});
|
|
1140
|
+
const prefix = log.type === "return" ? "\u21A9 " : "";
|
|
1141
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("pre", { className: `${styles$2["log-message"]} ${styles$2[`log-${log.type}`]}`, children: [
|
|
1142
|
+
prefix,
|
|
1143
|
+
messageParts.join(" ")
|
|
1144
|
+
] });
|
|
1145
|
+
};
|
|
1146
|
+
const ScriptExecutorPanel = ({ onClose }) => {
|
|
1147
|
+
const [code, setCode] = React.useState('// \uC5EC\uAE30\uC5D0 \uC2E4\uD589\uD560 \uCF54\uB4DC\uB97C \uC785\uB825\uD558\uC138\uC694\nconsole.log("Hello, World!");');
|
|
1148
|
+
const [results, setResults] = React.useState([]);
|
|
1149
|
+
const addResult = (type, ...args) => {
|
|
1150
|
+
setResults((prevResults) => [
|
|
1151
|
+
...prevResults,
|
|
1152
|
+
{
|
|
1153
|
+
id: Date.now() + Math.random(),
|
|
1154
|
+
type,
|
|
1155
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString(),
|
|
1156
|
+
message: args
|
|
1157
|
+
}
|
|
1158
|
+
]);
|
|
1159
|
+
};
|
|
1160
|
+
const handleExecute = () => {
|
|
1161
|
+
const originalConsole = { ...console };
|
|
1162
|
+
const newConsole = {
|
|
1163
|
+
log: (...args) => {
|
|
1164
|
+
originalConsole.log(...args);
|
|
1165
|
+
addResult("log", ...args);
|
|
1166
|
+
},
|
|
1167
|
+
warn: (...args) => {
|
|
1168
|
+
originalConsole.warn(...args);
|
|
1169
|
+
addResult("warn", ...args);
|
|
1170
|
+
},
|
|
1171
|
+
error: (...args) => {
|
|
1172
|
+
originalConsole.error(...args);
|
|
1173
|
+
addResult("error", ...args);
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
try {
|
|
1177
|
+
Object.assign(console, newConsole);
|
|
1178
|
+
const result = new Function(code)();
|
|
1179
|
+
if (result !== void 0) {
|
|
1180
|
+
addResult("return", result);
|
|
1181
|
+
}
|
|
1182
|
+
} catch (e) {
|
|
1183
|
+
addResult("error", e.name, e.message);
|
|
1184
|
+
} finally {
|
|
1185
|
+
Object.assign(console, originalConsole);
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
const handleClear = () => {
|
|
1189
|
+
setResults([]);
|
|
1190
|
+
};
|
|
1191
|
+
return /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Root, { isOpen: true, onClose, modalSize: "full-screen", children: /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Content, { children: [
|
|
1192
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Header, { headerTitle: "\uC2A4\uD06C\uB9BD\uD2B8 \uC2E4\uD589", showCloseButton: true }),
|
|
1193
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${styles$2["debug-feature-panel"]} ${styles$2["script-executor-panel"]}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$2["script-executor-content"], children: [
|
|
1194
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$2["script-input-section"], children: [
|
|
1195
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1196
|
+
"textarea",
|
|
1197
|
+
{
|
|
1198
|
+
className: styles$2["script-textarea"],
|
|
1199
|
+
value: code,
|
|
1200
|
+
onChange: (e) => setCode(e.target.value),
|
|
1201
|
+
spellCheck: "false"
|
|
1202
|
+
}
|
|
1203
|
+
),
|
|
1204
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$2["script-actions"], children: [
|
|
1205
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Button, { variant: "neutral", appearance: "outline", size: "xsmall", onClick: handleExecute, children: "\uC2E4\uD589 (\u25B6)" }),
|
|
1206
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Button, { variant: "neutral", appearance: "outline", size: "xsmall", onClick: handleClear, children: "\uACB0\uACFC \uC9C0\uC6B0\uAE30" })
|
|
1207
|
+
] })
|
|
1208
|
+
] }),
|
|
1209
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$2["script-output-section"], children: [
|
|
1210
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2["panel-header"], children: /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "\uACB0\uACFC" }) }),
|
|
1211
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2["log-list-container"], children: results.map((log) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$2["log-item"], children: [
|
|
1212
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles$2["log-timestamp"], children: log.timestamp }),
|
|
1213
|
+
/* @__PURE__ */ jsxRuntime.jsx(ResultMessage, { log })
|
|
1214
|
+
] }, log.id)) })
|
|
1215
|
+
] })
|
|
1216
|
+
] }) }) })
|
|
1217
|
+
] }) });
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
const setCookie = (name, value) => {
|
|
1221
|
+
document.cookie = `${name}=${encodeURIComponent(value)};path=/`;
|
|
1222
|
+
};
|
|
1223
|
+
const removeCookie = (name) => {
|
|
1224
|
+
document.cookie = `${name}=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
|
|
1225
|
+
};
|
|
1226
|
+
const useStorage = (storageType) => {
|
|
1227
|
+
const [items, setItems] = React.useState([]);
|
|
1228
|
+
const loadItems = React.useCallback(() => {
|
|
1229
|
+
const newItems = [];
|
|
1230
|
+
if (storageType === "localStorage") {
|
|
1231
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
1232
|
+
const key = localStorage.key(i);
|
|
1233
|
+
if (key) {
|
|
1234
|
+
newItems.push({ key, value: localStorage.getItem(key) || "" });
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
} else {
|
|
1238
|
+
const cookies = document.cookie.split(";");
|
|
1239
|
+
cookies.forEach((cookie) => {
|
|
1240
|
+
const parts = cookie.split("=");
|
|
1241
|
+
const key = parts.shift()?.trim();
|
|
1242
|
+
if (key) {
|
|
1243
|
+
newItems.push({ key, value: decodeURIComponent(parts.join("=")) });
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
setItems(newItems);
|
|
1248
|
+
}, [storageType]);
|
|
1249
|
+
React.useEffect(() => {
|
|
1250
|
+
loadItems();
|
|
1251
|
+
}, [loadItems]);
|
|
1252
|
+
const setItem = React.useCallback(
|
|
1253
|
+
(key, value) => {
|
|
1254
|
+
if (storageType === "localStorage") {
|
|
1255
|
+
localStorage.setItem(key, value);
|
|
1256
|
+
} else {
|
|
1257
|
+
setCookie(key, value);
|
|
1258
|
+
}
|
|
1259
|
+
loadItems();
|
|
1260
|
+
},
|
|
1261
|
+
[storageType, loadItems]
|
|
1262
|
+
);
|
|
1263
|
+
const removeItem = React.useCallback(
|
|
1264
|
+
(key) => {
|
|
1265
|
+
if (storageType === "localStorage") {
|
|
1266
|
+
localStorage.removeItem(key);
|
|
1267
|
+
} else {
|
|
1268
|
+
removeCookie(key);
|
|
1269
|
+
}
|
|
1270
|
+
loadItems();
|
|
1271
|
+
},
|
|
1272
|
+
[storageType, loadItems]
|
|
1273
|
+
);
|
|
1274
|
+
return { items, setItem, removeItem, loadItems };
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
const ValueDisplay = ({ value }) => {
|
|
1278
|
+
try {
|
|
1279
|
+
const parsed = JSON.parse(value);
|
|
1280
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
1281
|
+
return /* @__PURE__ */ jsxRuntime.jsx("pre", { className: styles$2["log-content"], children: JSON.stringify(parsed, null, 2) });
|
|
1282
|
+
}
|
|
1283
|
+
} catch (e) {
|
|
1284
|
+
}
|
|
1285
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2["log-content"], children: value });
|
|
1286
|
+
};
|
|
1287
|
+
const EditableRow = ({ item, onSave, onRemove }) => {
|
|
1288
|
+
const [isEditing, setIsEditing] = React.useState(false);
|
|
1289
|
+
const [value, setValue] = React.useState(item.value);
|
|
1290
|
+
const handleSave = () => {
|
|
1291
|
+
onSave(item.key, value);
|
|
1292
|
+
setIsEditing(false);
|
|
1293
|
+
};
|
|
1294
|
+
const handleEdit = () => {
|
|
1295
|
+
setValue(item.value);
|
|
1296
|
+
setIsEditing(true);
|
|
1297
|
+
};
|
|
1298
|
+
return /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Accordion.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Accordion.Item, { children: [
|
|
1299
|
+
/* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Accordion.HeaderButton, { children: [
|
|
1300
|
+
" ",
|
|
1301
|
+
item.key
|
|
1302
|
+
] }),
|
|
1303
|
+
/* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Accordion.Content, { variant: "text", style: { flex: 1, display: "flex", flexDirection: "column" }, children: [
|
|
1304
|
+
isEditing ? /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Button, { variant: "neutral", appearance: "outline", size: "xsmall", onClick: handleSave, children: "Save" }) : /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Button, { variant: "neutral", appearance: "outline", size: "xsmall", onClick: handleEdit, children: "Edit" }),
|
|
1305
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Button, { variant: "neutral", appearance: "outline", size: "xsmall", onClick: () => onRemove(item.key), children: "Remove" }),
|
|
1306
|
+
isEditing ? /* @__PURE__ */ jsxRuntime.jsx("textarea", { value, onChange: (e) => setValue(e.target.value) }) : /* @__PURE__ */ jsxRuntime.jsx(ValueDisplay, { value: item.value })
|
|
1307
|
+
] })
|
|
1308
|
+
] }) });
|
|
1309
|
+
};
|
|
1310
|
+
const StoragePanel = ({ onClose, storageType }) => {
|
|
1311
|
+
const { items, setItem, removeItem } = useStorage(storageType);
|
|
1312
|
+
const [filter, setFilter] = React.useState("");
|
|
1313
|
+
const filteredItems = React.useMemo(() => {
|
|
1314
|
+
if (!filter) {
|
|
1315
|
+
return items;
|
|
1316
|
+
}
|
|
1317
|
+
return items.filter(
|
|
1318
|
+
(item) => item.key.toLowerCase().includes(filter.toLowerCase()) || item.value.toLowerCase().includes(filter.toLowerCase())
|
|
1319
|
+
);
|
|
1320
|
+
}, [items, filter]);
|
|
1321
|
+
return /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Root, { isOpen: true, onClose, modalSize: "full-screen", children: /* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Content, { children: [
|
|
1322
|
+
/* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Modal.Header, { headerTitle: storageType === "localStorage" ? "Local Storage" : "Cookies", showCloseButton: true }),
|
|
1323
|
+
/* @__PURE__ */ jsxRuntime.jsxs(salesFrontendDesignSystem.Modal.Body, { children: [
|
|
1324
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2["panel-toolbar"], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1325
|
+
salesFrontendDesignSystem.FormField.TextField,
|
|
1326
|
+
{
|
|
1327
|
+
placeholder: "Search key or value...",
|
|
1328
|
+
size: "xsmall",
|
|
1329
|
+
value: filter,
|
|
1330
|
+
onChange: (e) => setFilter(e.target.value),
|
|
1331
|
+
rootProps: { style: { width: "100%" } }
|
|
1332
|
+
}
|
|
1333
|
+
) }),
|
|
1334
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { children: filteredItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(EditableRow, { item, onSave: setItem, onRemove: removeItem }) }, item.key)) })
|
|
1335
|
+
] })
|
|
1336
|
+
] }) });
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
const loginTypes = [
|
|
1340
|
+
{
|
|
1341
|
+
id: "fp",
|
|
1342
|
+
label: "FP \uB85C\uADF8\uC778",
|
|
1343
|
+
fields: [{ name: "employeeId", label: "\uC0AC\uBC88", type: "text", placeholder: "\uC0AC\uBC88\uC744 \uC785\uB825\uD558\uC138\uC694" }]
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
id: "customer",
|
|
1347
|
+
label: "\uACE0\uAC1D \uB85C\uADF8\uC778",
|
|
1348
|
+
fields: [
|
|
1349
|
+
{ name: "name", label: "\uC774\uB984", type: "text", placeholder: "\uC774\uB984" },
|
|
1350
|
+
{ name: "phone", label: "\uC804\uD654\uBC88\uD638", type: "tel", placeholder: "\uC804\uD654\uBC88\uD638" },
|
|
1351
|
+
{ name: "residentNumber", label: "\uC8FC\uBBFC\uBC88\uD638", type: "text", placeholder: "\uC8FC\uBBFC\uBC88\uD638 \uC55E 7\uC790\uB9AC" },
|
|
1352
|
+
{ name: "userId", label: "\uC544\uC774\uB514", type: "text", placeholder: "\uC544\uC774\uB514" },
|
|
1353
|
+
{ name: "password", label: "\uBE44\uBC00\uBC88\uD638", type: "password", placeholder: "\uBE44\uBC00\uBC88\uD638" }
|
|
1354
|
+
]
|
|
1355
|
+
}
|
|
1356
|
+
];
|
|
1357
|
+
const menuItems = [
|
|
1358
|
+
{
|
|
1359
|
+
id: "network-log",
|
|
1360
|
+
label: "\uB124\uD2B8\uC6CC\uD06C \uB85C\uADF8",
|
|
1361
|
+
component: NetworkLog,
|
|
1362
|
+
display: true
|
|
1363
|
+
},
|
|
1364
|
+
{
|
|
1365
|
+
id: "console-log",
|
|
1366
|
+
label: "\uCF58\uC194 \uB85C\uADF8 \uD655\uC778",
|
|
1367
|
+
component: ConsoleLogPanel,
|
|
1368
|
+
display: true
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
id: "local-storage",
|
|
1372
|
+
label: "\uB85C\uCEEC \uC2A4\uD1A0\uB9AC\uC9C0 \uAD00\uB9AC",
|
|
1373
|
+
// StoragePanel은 재사용 가능한 컴포넌트이므로, props를 통해 어떤 스토리지를 다룰지 지정합니다.
|
|
1374
|
+
component: (props) => /* @__PURE__ */ jsxRuntime.jsx(StoragePanel, { ...props, storageType: "localStorage" }),
|
|
1375
|
+
display: true
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
id: "cookie-management",
|
|
1379
|
+
label: "\uCFE0\uD0A4 \uAD00\uB9AC",
|
|
1380
|
+
component: (props) => /* @__PURE__ */ jsxRuntime.jsx(StoragePanel, { ...props, storageType: "cookie" }),
|
|
1381
|
+
display: true
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
id: "quick-login",
|
|
1385
|
+
label: "\uAC04\uD3B8 \uB85C\uADF8\uC778",
|
|
1386
|
+
component: LoginPanel,
|
|
1387
|
+
display: true
|
|
1388
|
+
// 실제 표시는 DebugTool.tsx에서 onLogin prop 존재 여부에 따라 결정됩니다.
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
id: "script-executor",
|
|
1392
|
+
label: "\uC2A4\uD06C\uB9BD\uD2B8 \uC2E4\uD589",
|
|
1393
|
+
component: ScriptExecutorPanel,
|
|
1394
|
+
display: true
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
id: "page-navigation",
|
|
1398
|
+
label: "\uD398\uC774\uC9C0 \uC774\uB3D9",
|
|
1399
|
+
component: PageNavigationPanel,
|
|
1400
|
+
display: true
|
|
1401
|
+
}
|
|
1402
|
+
];
|
|
1403
|
+
|
|
1404
|
+
const useEnvironment = () => {
|
|
1405
|
+
const [envInfo, setEnvInfo] = React.useState({
|
|
1406
|
+
env: "unknown"
|
|
1407
|
+
});
|
|
1408
|
+
React.useEffect(() => {
|
|
1409
|
+
const { hostname } = window.location;
|
|
1410
|
+
let currentEnv = "unknown";
|
|
1411
|
+
if (hostname.includes("localhost") || hostname.includes("127.0.0.1")) {
|
|
1412
|
+
currentEnv = "local";
|
|
1413
|
+
} else if (hostname.includes("dev.")) {
|
|
1414
|
+
currentEnv = "dev";
|
|
1415
|
+
} else if (hostname.includes("stg.")) {
|
|
1416
|
+
currentEnv = "stage";
|
|
1417
|
+
} else {
|
|
1418
|
+
currentEnv = "prod";
|
|
1419
|
+
}
|
|
1420
|
+
setEnvInfo({ env: currentEnv });
|
|
1421
|
+
}, []);
|
|
1422
|
+
return envInfo;
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1425
|
+
const DebugTool = ({ onLogin, envOverride, menuItemsOverride }) => {
|
|
1426
|
+
React.useEffect(() => {
|
|
1427
|
+
initializeConsoleLogOverride();
|
|
1428
|
+
return () => {
|
|
1429
|
+
restoreConsoleLog();
|
|
1430
|
+
};
|
|
1431
|
+
}, []);
|
|
1432
|
+
const environment = useEnvironment();
|
|
1433
|
+
const env = envOverride || environment.env;
|
|
1434
|
+
const menuItems$1 = menuItemsOverride || menuItems;
|
|
1435
|
+
const [isMenuOpen, setMenuOpen] = React.useState(false);
|
|
1436
|
+
const [activeFeature, setActiveFeature] = React.useState(null);
|
|
1437
|
+
const isVisible = ["local", "dev", "stage"].includes(env);
|
|
1438
|
+
const handleMenuClick = (itemComponent) => {
|
|
1439
|
+
setActiveFeature(() => itemComponent);
|
|
1440
|
+
setMenuOpen(false);
|
|
1441
|
+
};
|
|
1442
|
+
const handleCloseFeature = () => {
|
|
1443
|
+
setActiveFeature(null);
|
|
1444
|
+
};
|
|
1445
|
+
if (!isVisible) {
|
|
1446
|
+
return null;
|
|
1447
|
+
}
|
|
1448
|
+
const toggleMenu = () => {
|
|
1449
|
+
setMenuOpen((prev) => !prev);
|
|
1450
|
+
if (!isMenuOpen) {
|
|
1451
|
+
setActiveFeature(null);
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
const availableMenuItems = menuItems$1.filter(
|
|
1455
|
+
(item) => item.display && // config에서 display가 true인 항목만 필터링합니다.
|
|
1456
|
+
// 'quick-login' 기능은 onLogin prop이 제공된 경우에만 활성화합니다.
|
|
1457
|
+
(item.id !== "quick-login" || item.id === "quick-login" && onLogin)
|
|
1458
|
+
);
|
|
1459
|
+
if (activeFeature) {
|
|
1460
|
+
const FeatureComponent = activeFeature;
|
|
1461
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FeatureComponent, { onClose: handleCloseFeature, onLogin });
|
|
1462
|
+
}
|
|
1463
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "debug-tool-container", children: [
|
|
1464
|
+
/* @__PURE__ */ jsxRuntime.jsx(FloatingButton, { onClick: toggleMenu }),
|
|
1465
|
+
isMenuOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1466
|
+
MenuPanel,
|
|
1467
|
+
{
|
|
1468
|
+
menuItems: availableMenuItems,
|
|
1469
|
+
onMenuItemClick: handleMenuClick,
|
|
1470
|
+
onClose: () => setMenuOpen(false)
|
|
1471
|
+
}
|
|
1472
|
+
)
|
|
1473
|
+
] });
|
|
1474
|
+
};
|
|
1475
|
+
|
|
796
1476
|
exports.Attachment = Attachment;
|
|
1477
|
+
exports.DebugTool = DebugTool;
|
|
797
1478
|
exports.FormCheckbox = FormCheckbox;
|
|
798
1479
|
exports.FormCheckboxButton = FormCheckboxButton;
|
|
799
1480
|
exports.FormDatePicker = FormDatePicker;
|