@withwiz/toolkit 0.2.1 → 0.2.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/auth/index.js +6 -6
- package/dist/{chunk-6JZQE7ZQ.js → chunk-GSUQE3SZ.js} +8 -8
- package/dist/{chunk-FH6E36YZ.js → chunk-SLG26KHZ.js} +1 -1
- package/dist/components/ui/DataTable.js +6 -6
- package/dist/components/ui/data-table/DataTable.js +6 -6
- package/dist/components/ui/data-table/DataTableFilters.js +2 -2
- package/dist/components/ui/data-table/DataTableSearch.js +2 -2
- package/dist/constants/index.js +13 -13
- package/dist/error/index.d.ts +0 -4
- package/dist/error/index.js +12 -80
- package/dist/geolocation/index.js +4 -4
- package/dist/geolocation/providers/index.js +4 -4
- package/dist/middleware/error-handler.js +2 -2
- package/dist/middleware/index.js +3 -3
- package/dist/middleware/wrappers.js +3 -3
- package/dist/utils/format-number.js +30 -4
- package/dist/utils/short-code-generator.js +36 -4
- package/dist/utils/url-normalizer.js +194 -10
- package/package.json +1 -2
- package/dist/chunk-5ATB5D6S.js +0 -40
- package/dist/chunk-6C7HQIX4.js +0 -13
- package/dist/chunk-6UAYU5NU.js +0 -102
- package/dist/chunk-7VJNLGAS.js +0 -110
- package/dist/chunk-7XFHGAJP.js +0 -0
- package/dist/chunk-A6EAAWMK.js +0 -50
- package/dist/chunk-COK4ZXNG.js +0 -0
- package/dist/chunk-EQYTE7WD.js +0 -139
- package/dist/chunk-FW3IEJ7H.js +0 -71
- package/dist/chunk-HGC4CCKB.js +0 -29
- package/dist/chunk-JS5VI3OW.js +0 -143
- package/dist/chunk-MYLGYX4K.js +0 -57
- package/dist/chunk-TDZJ6SAI.js +0 -34
- package/dist/chunk-TEIYA7U4.js +0 -72
- package/dist/chunk-ULF5RDDX.js +0 -0
- package/dist/chunk-VWODEQ5C.js +0 -204
- package/dist/chunk-Y2TUZFCP.js +0 -0
- package/dist/chunk-YJ3TLEW3.js +0 -100
- package/dist/chunk-ZHVUK5OY.js +0 -314
- package/dist/chunk-ZZIKRBJU.js +0 -96
- package/dist/error/components/EmptyState.d.ts +0 -50
- package/dist/error/components/ErrorAlert.d.ts +0 -50
- package/dist/error/components/ErrorPage.d.ts +0 -39
- package/dist/error/components/LoadingState.d.ts +0 -37
- package/dist/error/components/index.d.ts +0 -13
- package/dist/error/components/index.js +0 -18
- package/dist/error/hooks/index.d.ts +0 -7
- package/dist/error/hooks/index.js +0 -14
- package/dist/error/hooks/useErrorHandler.d.ts +0 -67
- package/dist/error/hooks/useErrorHandler.js +0 -14
- package/dist/error/logging/error-logger.d.ts +0 -77
- package/dist/error/logging/error-logger.js +0 -10
- package/dist/error/logging/index.d.ts +0 -9
- package/dist/error/logging/index.js +0 -35
- package/dist/error/logging/transports/base.d.ts +0 -30
- package/dist/error/logging/transports/base.js +0 -7
- package/dist/error/logging/transports/console.d.ts +0 -40
- package/dist/error/logging/transports/console.js +0 -9
- package/dist/error/logging/transports/file.d.ts +0 -49
- package/dist/error/logging/transports/file.js +0 -8
- package/dist/error/logging/transports/index.d.ts +0 -12
- package/dist/error/logging/transports/index.js +0 -25
- package/dist/error/logging/transports/sentry.d.ts +0 -44
- package/dist/error/logging/transports/sentry.js +0 -9
- package/dist/error/logging/transports/slack.d.ts +0 -51
- package/dist/error/logging/transports/slack.js +0 -9
- package/dist/error/logging/types.d.ts +0 -83
- package/dist/error/logging/types.js +0 -7
- package/dist/error/recovery/circuit-breaker.d.ts +0 -85
- package/dist/error/recovery/circuit-breaker.js +0 -9
- package/dist/error/recovery/degradation.d.ts +0 -56
- package/dist/error/recovery/degradation.js +0 -7
- package/dist/error/recovery/fallback.d.ts +0 -55
- package/dist/error/recovery/fallback.js +0 -11
- package/dist/error/recovery/index.d.ts +0 -12
- package/dist/error/recovery/index.js +0 -26
- package/dist/error/recovery/retry.d.ts +0 -44
- package/dist/error/recovery/retry.js +0 -7
- package/dist/utils/shared-utils.d.ts +0 -25
- package/dist/utils/shared-utils.js +0 -43
- package/dist/{chunk-SEZJN4TC.js → chunk-LJEGM4OO.js} +3 -3
- package/dist/{chunk-S73334QY.js → chunk-QF6FH4GZ.js} +3 -3
- package/dist/{chunk-KHYY4KCV.js → chunk-TH45RVP7.js} +3 -3
- package/dist/{chunk-5OWZKYWQ.js → chunk-TMVS4F7E.js} +3 -3
package/dist/chunk-YJ3TLEW3.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseTransport
|
|
3
|
-
} from "./chunk-HGC4CCKB.js";
|
|
4
|
-
|
|
5
|
-
// src/error/logging/transports/file.ts
|
|
6
|
-
var FileTransport = class extends BaseTransport {
|
|
7
|
-
constructor(options = {}) {
|
|
8
|
-
const isServer = typeof window === "undefined";
|
|
9
|
-
super("file", isServer && options.enabled !== false);
|
|
10
|
-
this.fs = null;
|
|
11
|
-
this.path = null;
|
|
12
|
-
this.filePath = options.filePath || "./logs/error.log";
|
|
13
|
-
this.maxSize = options.maxSize || 10 * 1024 * 1024;
|
|
14
|
-
this.maxFiles = options.maxFiles || 5;
|
|
15
|
-
if (isServer) {
|
|
16
|
-
this.loadModules();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* 모듈 로드 (동적 import)
|
|
21
|
-
*/
|
|
22
|
-
async loadModules() {
|
|
23
|
-
try {
|
|
24
|
-
this.fs = await import("fs");
|
|
25
|
-
this.path = await import("path");
|
|
26
|
-
} catch (error) {
|
|
27
|
-
console.error("[FileTransport] Failed to load fs/path modules:", error);
|
|
28
|
-
this.disable();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
async log(entry) {
|
|
32
|
-
if (!this.fs || !this.path) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
const dir = this.path.dirname(this.filePath);
|
|
37
|
-
if (!this.fs.existsSync(dir)) {
|
|
38
|
-
this.fs.mkdirSync(dir, { recursive: true });
|
|
39
|
-
}
|
|
40
|
-
const logLine = this.format(entry);
|
|
41
|
-
await this.rotateIfNeeded();
|
|
42
|
-
this.fs.appendFileSync(this.filePath, logLine + "\n", "utf8");
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.error("[FileTransport] Failed to write log:", error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* 로그 포맷팅 (JSON Lines)
|
|
49
|
-
*/
|
|
50
|
-
format(entry) {
|
|
51
|
-
const logObject = {
|
|
52
|
-
timestamp: entry.timestamp.toISOString(),
|
|
53
|
-
level: entry.level,
|
|
54
|
-
message: entry.message,
|
|
55
|
-
context: entry.context,
|
|
56
|
-
error: entry.error ? {
|
|
57
|
-
message: entry.error.message,
|
|
58
|
-
stack: entry.error.stack
|
|
59
|
-
} : void 0
|
|
60
|
-
};
|
|
61
|
-
return JSON.stringify(logObject);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* 파일 rotation
|
|
65
|
-
*/
|
|
66
|
-
async rotateIfNeeded() {
|
|
67
|
-
if (!this.fs || !this.path) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
if (!this.fs.existsSync(this.filePath)) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const stats = this.fs.statSync(this.filePath);
|
|
75
|
-
if (stats.size < this.maxSize) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const ext = this.path.extname(this.filePath);
|
|
79
|
-
const base = this.filePath.slice(0, -ext.length);
|
|
80
|
-
for (let i = this.maxFiles - 1; i >= 1; i--) {
|
|
81
|
-
const oldPath = `${base}.${i}${ext}`;
|
|
82
|
-
const newPath = `${base}.${i + 1}${ext}`;
|
|
83
|
-
if (this.fs.existsSync(oldPath)) {
|
|
84
|
-
if (i === this.maxFiles - 1) {
|
|
85
|
-
this.fs.unlinkSync(oldPath);
|
|
86
|
-
} else {
|
|
87
|
-
this.fs.renameSync(oldPath, newPath);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
this.fs.renameSync(this.filePath, `${base}.1${ext}`);
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.error("[FileTransport] Failed to rotate log file:", error);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export {
|
|
99
|
-
FileTransport
|
|
100
|
-
};
|
package/dist/chunk-ZHVUK5OY.js
DELETED
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getErrorDisplayInfo
|
|
3
|
-
} from "./chunk-POKGHK3L.js";
|
|
4
|
-
|
|
5
|
-
// src/error/components/ErrorPage.tsx
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
function ErrorPage({
|
|
8
|
-
code,
|
|
9
|
-
locale = "ko",
|
|
10
|
-
showHomeButton = true,
|
|
11
|
-
homeUrl = "/",
|
|
12
|
-
showRetryButton = false,
|
|
13
|
-
onRetry,
|
|
14
|
-
additionalMessage
|
|
15
|
-
}) {
|
|
16
|
-
const errorInfo = getErrorDisplayInfo(code, locale);
|
|
17
|
-
return /* @__PURE__ */ jsx("div", { className: "flex min-h-screen items-center justify-center bg-gray-50 px-4 py-12 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md space-y-8 text-center", children: [
|
|
18
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-6xl", role: "img", "aria-label": "error-icon", children: errorInfo.icon }) }),
|
|
19
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm font-medium text-gray-500", children: [
|
|
20
|
-
locale === "ko" ? "\uC624\uB958 \uCF54\uB4DC" : "Error Code",
|
|
21
|
-
": ",
|
|
22
|
-
code
|
|
23
|
-
] }),
|
|
24
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight text-gray-900", children: errorInfo.title }) }),
|
|
25
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
26
|
-
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-600", children: errorInfo.description }),
|
|
27
|
-
errorInfo.action && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: errorInfo.action }),
|
|
28
|
-
additionalMessage && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: additionalMessage })
|
|
29
|
-
] }),
|
|
30
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:justify-center", children: [
|
|
31
|
-
showHomeButton && /* @__PURE__ */ jsx(
|
|
32
|
-
"a",
|
|
33
|
-
{
|
|
34
|
-
href: homeUrl,
|
|
35
|
-
className: "inline-flex items-center justify-center rounded-md border border-transparent bg-blue-600 px-6 py-3 text-base font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
36
|
-
children: locale === "ko" ? "\uD648\uC73C\uB85C \uB3CC\uC544\uAC00\uAE30" : "Go to Home"
|
|
37
|
-
}
|
|
38
|
-
),
|
|
39
|
-
showRetryButton && onRetry && /* @__PURE__ */ jsx(
|
|
40
|
-
"button",
|
|
41
|
-
{
|
|
42
|
-
onClick: onRetry,
|
|
43
|
-
className: "inline-flex items-center justify-center rounded-md border border-gray-300 bg-white px-6 py-3 text-base font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
44
|
-
children: locale === "ko" ? "\uB2E4\uC2DC \uC2DC\uB3C4" : "Retry"
|
|
45
|
-
}
|
|
46
|
-
)
|
|
47
|
-
] })
|
|
48
|
-
] }) });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// src/error/components/ErrorAlert.tsx
|
|
52
|
-
import { useState } from "react";
|
|
53
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
54
|
-
var severityColors = {
|
|
55
|
-
info: {
|
|
56
|
-
bg: "bg-blue-50",
|
|
57
|
-
border: "border-blue-200",
|
|
58
|
-
text: "text-blue-800",
|
|
59
|
-
icon: "text-blue-400"
|
|
60
|
-
},
|
|
61
|
-
warning: {
|
|
62
|
-
bg: "bg-yellow-50",
|
|
63
|
-
border: "border-yellow-200",
|
|
64
|
-
text: "text-yellow-800",
|
|
65
|
-
icon: "text-yellow-400"
|
|
66
|
-
},
|
|
67
|
-
error: {
|
|
68
|
-
bg: "bg-red-50",
|
|
69
|
-
border: "border-red-200",
|
|
70
|
-
text: "text-red-800",
|
|
71
|
-
icon: "text-red-400"
|
|
72
|
-
},
|
|
73
|
-
critical: {
|
|
74
|
-
bg: "bg-red-100",
|
|
75
|
-
border: "border-red-300",
|
|
76
|
-
text: "text-red-900",
|
|
77
|
-
icon: "text-red-500"
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
function ErrorAlert({
|
|
81
|
-
code,
|
|
82
|
-
locale = "ko",
|
|
83
|
-
dismissible = false,
|
|
84
|
-
onDismiss,
|
|
85
|
-
actionText,
|
|
86
|
-
onAction,
|
|
87
|
-
additionalMessage,
|
|
88
|
-
icon: customIcon,
|
|
89
|
-
variant = "filled"
|
|
90
|
-
}) {
|
|
91
|
-
const [isVisible, setIsVisible] = useState(true);
|
|
92
|
-
const errorInfo = getErrorDisplayInfo(code, locale);
|
|
93
|
-
const colors = severityColors[errorInfo.severity];
|
|
94
|
-
const handleDismiss = () => {
|
|
95
|
-
setIsVisible(false);
|
|
96
|
-
onDismiss == null ? void 0 : onDismiss();
|
|
97
|
-
};
|
|
98
|
-
if (!isVisible) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
return /* @__PURE__ */ jsxs2(
|
|
102
|
-
"div",
|
|
103
|
-
{
|
|
104
|
-
className: `rounded-lg ${variant === "filled" ? colors.bg : "bg-white"} border ${colors.border} p-4`,
|
|
105
|
-
role: "alert",
|
|
106
|
-
children: [
|
|
107
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex", children: [
|
|
108
|
-
/* @__PURE__ */ jsx2("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx2(
|
|
109
|
-
"span",
|
|
110
|
-
{
|
|
111
|
-
className: `text-xl ${colors.icon}`,
|
|
112
|
-
role: "img",
|
|
113
|
-
"aria-label": "error-icon",
|
|
114
|
-
children: customIcon || errorInfo.icon
|
|
115
|
-
}
|
|
116
|
-
) }),
|
|
117
|
-
/* @__PURE__ */ jsxs2("div", { className: "ml-3 flex-1", children: [
|
|
118
|
-
/* @__PURE__ */ jsx2("h3", { className: `text-sm font-medium ${colors.text}`, children: errorInfo.title }),
|
|
119
|
-
/* @__PURE__ */ jsxs2("div", { className: `mt-2 text-sm ${colors.text}`, children: [
|
|
120
|
-
/* @__PURE__ */ jsx2("p", { children: errorInfo.description }),
|
|
121
|
-
errorInfo.action && /* @__PURE__ */ jsx2("p", { className: "mt-1 text-xs opacity-80", children: errorInfo.action }),
|
|
122
|
-
additionalMessage && /* @__PURE__ */ jsx2("p", { className: "mt-1 text-xs opacity-80", children: additionalMessage })
|
|
123
|
-
] }),
|
|
124
|
-
actionText && onAction && /* @__PURE__ */ jsx2("div", { className: "mt-3", children: /* @__PURE__ */ jsx2(
|
|
125
|
-
"button",
|
|
126
|
-
{
|
|
127
|
-
onClick: onAction,
|
|
128
|
-
className: `rounded-md px-3 py-2 text-sm font-medium ${colors.text} hover:bg-opacity-20 focus:outline-none focus:ring-2 focus:ring-offset-2`,
|
|
129
|
-
children: actionText
|
|
130
|
-
}
|
|
131
|
-
) })
|
|
132
|
-
] }),
|
|
133
|
-
dismissible && /* @__PURE__ */ jsx2("div", { className: "ml-auto flex-shrink-0 pl-3", children: /* @__PURE__ */ jsxs2(
|
|
134
|
-
"button",
|
|
135
|
-
{
|
|
136
|
-
onClick: handleDismiss,
|
|
137
|
-
className: `inline-flex rounded-md ${colors.text} hover:bg-opacity-20 focus:outline-none focus:ring-2 focus:ring-offset-2`,
|
|
138
|
-
"aria-label": "Close",
|
|
139
|
-
children: [
|
|
140
|
-
/* @__PURE__ */ jsx2("span", { className: "sr-only", children: "Close" }),
|
|
141
|
-
/* @__PURE__ */ jsx2(
|
|
142
|
-
"svg",
|
|
143
|
-
{
|
|
144
|
-
className: "h-5 w-5",
|
|
145
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
-
viewBox: "0 0 20 20",
|
|
147
|
-
fill: "currentColor",
|
|
148
|
-
"aria-hidden": "true",
|
|
149
|
-
children: /* @__PURE__ */ jsx2(
|
|
150
|
-
"path",
|
|
151
|
-
{
|
|
152
|
-
fillRule: "evenodd",
|
|
153
|
-
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
154
|
-
clipRule: "evenodd"
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
)
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
) })
|
|
162
|
-
] }),
|
|
163
|
-
/* @__PURE__ */ jsxs2("div", { className: `ml-9 mt-2 text-xs ${colors.text} opacity-60`, children: [
|
|
164
|
-
"Code: ",
|
|
165
|
-
code
|
|
166
|
-
] })
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// src/error/components/LoadingState.tsx
|
|
173
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
174
|
-
var sizeStyles = {
|
|
175
|
-
sm: {
|
|
176
|
-
spinner: "h-4 w-4 border-2",
|
|
177
|
-
text: "text-sm",
|
|
178
|
-
dots: "h-2 w-2"
|
|
179
|
-
},
|
|
180
|
-
md: {
|
|
181
|
-
spinner: "h-8 w-8 border-2",
|
|
182
|
-
text: "text-base",
|
|
183
|
-
dots: "h-3 w-3"
|
|
184
|
-
},
|
|
185
|
-
lg: {
|
|
186
|
-
spinner: "h-12 w-12 border-4",
|
|
187
|
-
text: "text-lg",
|
|
188
|
-
dots: "h-4 w-4"
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
function LoadingState({
|
|
192
|
-
message,
|
|
193
|
-
locale = "ko",
|
|
194
|
-
size = "md",
|
|
195
|
-
fullScreen = false,
|
|
196
|
-
variant = "spinner"
|
|
197
|
-
}) {
|
|
198
|
-
const defaultMessage = locale === "ko" ? "\uB85C\uB529 \uC911..." : "Loading...";
|
|
199
|
-
const displayMessage = message || defaultMessage;
|
|
200
|
-
const styles = sizeStyles[size];
|
|
201
|
-
const renderSpinner = () => /* @__PURE__ */ jsx3(
|
|
202
|
-
"div",
|
|
203
|
-
{
|
|
204
|
-
className: `${styles.spinner} animate-spin rounded-full border-blue-600 border-t-transparent`,
|
|
205
|
-
role: "status",
|
|
206
|
-
"aria-label": "loading"
|
|
207
|
-
}
|
|
208
|
-
);
|
|
209
|
-
const renderDots = () => /* @__PURE__ */ jsx3("div", { className: "flex space-x-2", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx3(
|
|
210
|
-
"div",
|
|
211
|
-
{
|
|
212
|
-
className: `${styles.dots} animate-bounce rounded-full bg-blue-600`,
|
|
213
|
-
style: { animationDelay: `${i * 0.15}s` }
|
|
214
|
-
},
|
|
215
|
-
i
|
|
216
|
-
)) });
|
|
217
|
-
const renderPulse = () => /* @__PURE__ */ jsx3("div", { className: "flex space-x-2", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx3(
|
|
218
|
-
"div",
|
|
219
|
-
{
|
|
220
|
-
className: `${styles.dots} animate-pulse rounded-full bg-blue-600`,
|
|
221
|
-
style: { animationDelay: `${i * 0.2}s` }
|
|
222
|
-
},
|
|
223
|
-
i
|
|
224
|
-
)) });
|
|
225
|
-
const renderLoadingAnimation = () => {
|
|
226
|
-
switch (variant) {
|
|
227
|
-
case "dots":
|
|
228
|
-
return renderDots();
|
|
229
|
-
case "pulse":
|
|
230
|
-
return renderPulse();
|
|
231
|
-
case "spinner":
|
|
232
|
-
default:
|
|
233
|
-
return renderSpinner();
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
const content = /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center justify-center space-y-4", children: [
|
|
237
|
-
renderLoadingAnimation(),
|
|
238
|
-
/* @__PURE__ */ jsx3("p", { className: `${styles.text} text-gray-600`, children: displayMessage })
|
|
239
|
-
] });
|
|
240
|
-
if (fullScreen) {
|
|
241
|
-
return /* @__PURE__ */ jsx3("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-white bg-opacity-75", children: content });
|
|
242
|
-
}
|
|
243
|
-
return /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-center py-12", children: content });
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// src/error/components/EmptyState.tsx
|
|
247
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
248
|
-
var sizeStyles2 = {
|
|
249
|
-
sm: {
|
|
250
|
-
container: "py-8",
|
|
251
|
-
icon: "text-4xl",
|
|
252
|
-
title: "text-base",
|
|
253
|
-
description: "text-sm"
|
|
254
|
-
},
|
|
255
|
-
md: {
|
|
256
|
-
container: "py-12",
|
|
257
|
-
icon: "text-6xl",
|
|
258
|
-
title: "text-lg",
|
|
259
|
-
description: "text-base"
|
|
260
|
-
},
|
|
261
|
-
lg: {
|
|
262
|
-
container: "py-16",
|
|
263
|
-
icon: "text-8xl",
|
|
264
|
-
title: "text-xl",
|
|
265
|
-
description: "text-lg"
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
function EmptyState({
|
|
269
|
-
title,
|
|
270
|
-
description,
|
|
271
|
-
locale = "ko",
|
|
272
|
-
icon = "\u{1F4E6}",
|
|
273
|
-
actionText,
|
|
274
|
-
onAction,
|
|
275
|
-
size = "md"
|
|
276
|
-
}) {
|
|
277
|
-
const defaultTitle = locale === "ko" ? "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" : "No data available";
|
|
278
|
-
const defaultDescription = locale === "ko" ? "\uC544\uC9C1 \uB4F1\uB85D\uB41C \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4." : "No items have been registered yet.";
|
|
279
|
-
const displayTitle = title || defaultTitle;
|
|
280
|
-
const displayDescription = description || defaultDescription;
|
|
281
|
-
const styles = sizeStyles2[size];
|
|
282
|
-
const renderIcon = () => {
|
|
283
|
-
if (typeof icon === "string") {
|
|
284
|
-
return /* @__PURE__ */ jsx4("span", { className: `${styles.icon}`, role: "img", "aria-label": "empty-icon", children: icon });
|
|
285
|
-
}
|
|
286
|
-
return icon;
|
|
287
|
-
};
|
|
288
|
-
return /* @__PURE__ */ jsxs4(
|
|
289
|
-
"div",
|
|
290
|
-
{
|
|
291
|
-
className: `flex flex-col items-center justify-center text-center ${styles.container}`,
|
|
292
|
-
children: [
|
|
293
|
-
/* @__PURE__ */ jsx4("div", { className: "mb-4 text-gray-400", children: renderIcon() }),
|
|
294
|
-
/* @__PURE__ */ jsx4("h3", { className: `${styles.title} font-semibold text-gray-900`, children: displayTitle }),
|
|
295
|
-
/* @__PURE__ */ jsx4("p", { className: `${styles.description} mt-2 text-gray-500`, children: displayDescription }),
|
|
296
|
-
actionText && onAction && /* @__PURE__ */ jsx4(
|
|
297
|
-
"button",
|
|
298
|
-
{
|
|
299
|
-
onClick: onAction,
|
|
300
|
-
className: "mt-6 inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
301
|
-
children: actionText
|
|
302
|
-
}
|
|
303
|
-
)
|
|
304
|
-
]
|
|
305
|
-
}
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
export {
|
|
310
|
-
ErrorPage,
|
|
311
|
-
ErrorAlert,
|
|
312
|
-
LoadingState,
|
|
313
|
-
EmptyState
|
|
314
|
-
};
|
package/dist/chunk-ZZIKRBJU.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseTransport
|
|
3
|
-
} from "./chunk-HGC4CCKB.js";
|
|
4
|
-
|
|
5
|
-
// src/error/logging/transports/sentry.ts
|
|
6
|
-
var SENTRY_SEVERITY_MAP = {
|
|
7
|
-
["debug" /* DEBUG */]: "debug",
|
|
8
|
-
["info" /* INFO */]: "info",
|
|
9
|
-
["warn" /* WARN */]: "warning",
|
|
10
|
-
["error" /* ERROR */]: "error",
|
|
11
|
-
["critical" /* CRITICAL */]: "fatal"
|
|
12
|
-
};
|
|
13
|
-
var SentryTransport = class extends BaseTransport {
|
|
14
|
-
constructor(options = {}) {
|
|
15
|
-
const dsn = options.dsn || process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
|
|
16
|
-
super("sentry", Boolean(dsn) && options.enabled !== false);
|
|
17
|
-
this.Sentry = null;
|
|
18
|
-
this.dsn = dsn;
|
|
19
|
-
this.environment = options.environment || process.env.NODE_ENV || "development";
|
|
20
|
-
this.minLevel = options.minLevel || "error" /* ERROR */;
|
|
21
|
-
if (this.isEnabled()) {
|
|
22
|
-
this.initSentry();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Sentry 초기화
|
|
27
|
-
*/
|
|
28
|
-
async initSentry() {
|
|
29
|
-
try {
|
|
30
|
-
const isServer = typeof window === "undefined";
|
|
31
|
-
if (isServer) {
|
|
32
|
-
const Sentry = await import("@sentry/node");
|
|
33
|
-
this.Sentry = Sentry;
|
|
34
|
-
} else {
|
|
35
|
-
const Sentry = await import("@sentry/browser");
|
|
36
|
-
this.Sentry = Sentry;
|
|
37
|
-
}
|
|
38
|
-
this.Sentry.init({
|
|
39
|
-
dsn: this.dsn,
|
|
40
|
-
environment: this.environment,
|
|
41
|
-
// 성능 모니터링 비활성화 (에러 로깅만)
|
|
42
|
-
tracesSampleRate: 0
|
|
43
|
-
});
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error("[SentryTransport] Failed to initialize Sentry:", error);
|
|
46
|
-
this.disable();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
async log(entry) {
|
|
50
|
-
if (!this.Sentry) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (!this.shouldLog(entry.level)) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
this.Sentry.withScope((scope) => {
|
|
58
|
-
scope.setLevel(SENTRY_SEVERITY_MAP[entry.level]);
|
|
59
|
-
if (entry.context.requestId) {
|
|
60
|
-
scope.setTag("requestId", entry.context.requestId);
|
|
61
|
-
}
|
|
62
|
-
if (entry.context.userId) {
|
|
63
|
-
scope.setUser({ id: entry.context.userId });
|
|
64
|
-
}
|
|
65
|
-
if (entry.context.errorCode) {
|
|
66
|
-
scope.setTag("errorCode", entry.context.errorCode);
|
|
67
|
-
}
|
|
68
|
-
scope.setContext("error_context", entry.context);
|
|
69
|
-
if (entry.error) {
|
|
70
|
-
this.Sentry.captureException(entry.error);
|
|
71
|
-
} else {
|
|
72
|
-
this.Sentry.captureMessage(entry.message);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.error("[SentryTransport] Failed to send to Sentry:", error);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* 로그 레벨 체크
|
|
81
|
-
*/
|
|
82
|
-
shouldLog(level) {
|
|
83
|
-
const LOG_LEVEL_PRIORITY = {
|
|
84
|
-
["debug" /* DEBUG */]: 0,
|
|
85
|
-
["info" /* INFO */]: 1,
|
|
86
|
-
["warn" /* WARN */]: 2,
|
|
87
|
-
["error" /* ERROR */]: 3,
|
|
88
|
-
["critical" /* CRITICAL */]: 4
|
|
89
|
-
};
|
|
90
|
-
return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.minLevel];
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
SentryTransport
|
|
96
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EmptyState 컴포넌트
|
|
3
|
-
*
|
|
4
|
-
* 데이터가 없는 상태 표시
|
|
5
|
-
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import type { TLocale } from '@withwiz/error/messages';
|
|
8
|
-
export interface IEmptyStateProps {
|
|
9
|
-
/** 제목 */
|
|
10
|
-
title?: string;
|
|
11
|
-
/** 설명 */
|
|
12
|
-
description?: string;
|
|
13
|
-
/** 로케일 (기본값: 'ko') */
|
|
14
|
-
locale?: TLocale;
|
|
15
|
-
/** 아이콘 (이모지 또는 SVG) */
|
|
16
|
-
icon?: string | React.ReactNode;
|
|
17
|
-
/** 액션 버튼 텍스트 */
|
|
18
|
-
actionText?: string;
|
|
19
|
-
/** 액션 핸들러 */
|
|
20
|
-
onAction?: () => void;
|
|
21
|
-
/** 크기 */
|
|
22
|
-
size?: 'sm' | 'md' | 'lg';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* EmptyState 컴포넌트
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* // 기본 빈 상태
|
|
30
|
-
* <EmptyState
|
|
31
|
-
* title="데이터가 없습니다"
|
|
32
|
-
* description="아직 등록된 항목이 없습니다."
|
|
33
|
-
* />
|
|
34
|
-
*
|
|
35
|
-
* // 액션 버튼 포함
|
|
36
|
-
* <EmptyState
|
|
37
|
-
* title="링크가 없습니다"
|
|
38
|
-
* description="첫 번째 링크를 생성해보세요."
|
|
39
|
-
* actionText="링크 생성"
|
|
40
|
-
* onAction={() => router.push('/create')}
|
|
41
|
-
* />
|
|
42
|
-
*
|
|
43
|
-
* // 커스텀 아이콘
|
|
44
|
-
* <EmptyState
|
|
45
|
-
* icon="📭"
|
|
46
|
-
* title="받은 메일함이 비어있습니다"
|
|
47
|
-
* />
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export declare function EmptyState({ title, description, locale, icon, actionText, onAction, size, }: IEmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ErrorAlert 컴포넌트
|
|
3
|
-
*
|
|
4
|
-
* 배너형 에러 알림 (섹션별 에러 표시)
|
|
5
|
-
*/
|
|
6
|
-
import type { TLocale } from '@withwiz/error/messages';
|
|
7
|
-
export interface IErrorAlertProps {
|
|
8
|
-
/** 에러 코드 (예: 40907, 50001) */
|
|
9
|
-
code: number;
|
|
10
|
-
/** 로케일 (기본값: 'ko') */
|
|
11
|
-
locale?: TLocale;
|
|
12
|
-
/** 닫기 버튼 표시 여부 */
|
|
13
|
-
dismissible?: boolean;
|
|
14
|
-
/** 닫기 핸들러 */
|
|
15
|
-
onDismiss?: () => void;
|
|
16
|
-
/** 액션 버튼 텍스트 */
|
|
17
|
-
actionText?: string;
|
|
18
|
-
/** 액션 핸들러 */
|
|
19
|
-
onAction?: () => void;
|
|
20
|
-
/** 추가 메시지 */
|
|
21
|
-
additionalMessage?: string;
|
|
22
|
-
/** 커스텀 아이콘 */
|
|
23
|
-
icon?: string;
|
|
24
|
-
/** 스타일 변형 */
|
|
25
|
-
variant?: 'filled' | 'outlined';
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* ErrorAlert 컴포넌트
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```tsx
|
|
32
|
-
* // 기본 사용
|
|
33
|
-
* <ErrorAlert code={40907} />
|
|
34
|
-
*
|
|
35
|
-
* // 닫기 가능
|
|
36
|
-
* <ErrorAlert
|
|
37
|
-
* code={50001}
|
|
38
|
-
* dismissible
|
|
39
|
-
* onDismiss={() => console.log('dismissed')}
|
|
40
|
-
* />
|
|
41
|
-
*
|
|
42
|
-
* // 액션 버튼 포함
|
|
43
|
-
* <ErrorAlert
|
|
44
|
-
* code={42203}
|
|
45
|
-
* actionText="플랜 업그레이드"
|
|
46
|
-
* onAction={() => router.push('/pricing')}
|
|
47
|
-
* />
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export declare function ErrorAlert({ code, locale, dismissible, onDismiss, actionText, onAction, additionalMessage, icon: customIcon, variant, }: IErrorAlertProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ErrorPage 컴포넌트
|
|
3
|
-
*
|
|
4
|
-
* 전체 페이지 에러 표시 (404, 500 등)
|
|
5
|
-
*/
|
|
6
|
-
import type { TLocale } from '@withwiz/error/messages';
|
|
7
|
-
export interface IErrorPageProps {
|
|
8
|
-
/** 에러 코드 (예: 40401, 50001) */
|
|
9
|
-
code: number;
|
|
10
|
-
/** 로케일 (기본값: 'ko') */
|
|
11
|
-
locale?: TLocale;
|
|
12
|
-
/** 홈으로 돌아가기 버튼 표시 여부 */
|
|
13
|
-
showHomeButton?: boolean;
|
|
14
|
-
/** 홈 URL (기본값: '/') */
|
|
15
|
-
homeUrl?: string;
|
|
16
|
-
/** 재시도 버튼 표시 여부 */
|
|
17
|
-
showRetryButton?: boolean;
|
|
18
|
-
/** 재시도 핸들러 */
|
|
19
|
-
onRetry?: () => void;
|
|
20
|
-
/** 추가 메시지 */
|
|
21
|
-
additionalMessage?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* ErrorPage 컴포넌트
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* // 404 페이지
|
|
29
|
-
* <ErrorPage code={40401} showHomeButton />
|
|
30
|
-
*
|
|
31
|
-
* // 500 페이지 (재시도 가능)
|
|
32
|
-
* <ErrorPage
|
|
33
|
-
* code={50001}
|
|
34
|
-
* showRetryButton
|
|
35
|
-
* onRetry={() => window.location.reload()}
|
|
36
|
-
* />
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare function ErrorPage({ code, locale, showHomeButton, homeUrl, showRetryButton, onRetry, additionalMessage, }: IErrorPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LoadingState 컴포넌트
|
|
3
|
-
*
|
|
4
|
-
* 로딩 상태 표시
|
|
5
|
-
*/
|
|
6
|
-
import type { TLocale } from '@withwiz/error/messages';
|
|
7
|
-
export interface ILoadingStateProps {
|
|
8
|
-
/** 로딩 메시지 */
|
|
9
|
-
message?: string;
|
|
10
|
-
/** 로케일 (기본값: 'ko') */
|
|
11
|
-
locale?: TLocale;
|
|
12
|
-
/** 크기 */
|
|
13
|
-
size?: 'sm' | 'md' | 'lg';
|
|
14
|
-
/** 전체 화면 로딩 여부 */
|
|
15
|
-
fullScreen?: boolean;
|
|
16
|
-
/** 스피너 타입 */
|
|
17
|
-
variant?: 'spinner' | 'dots' | 'pulse';
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* LoadingState 컴포넌트
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* // 기본 로딩
|
|
25
|
-
* <LoadingState />
|
|
26
|
-
*
|
|
27
|
-
* // 커스텀 메시지
|
|
28
|
-
* <LoadingState message="데이터를 불러오는 중..." />
|
|
29
|
-
*
|
|
30
|
-
* // 전체 화면 로딩
|
|
31
|
-
* <LoadingState fullScreen message="처리 중..." />
|
|
32
|
-
*
|
|
33
|
-
* // Dots 애니메이션
|
|
34
|
-
* <LoadingState variant="dots" />
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function LoadingState({ message, locale, size, fullScreen, variant, }: ILoadingStateProps): import("react/jsx-runtime").JSX.Element;
|