sales-frontend-components 0.0.58 → 0.0.60

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