Merge branch 'refs/heads/main' into feature/0612_sentry_fr_merge

This commit is contained in:
2026-08-05 10:48:22 +09:00
196 changed files with 7961 additions and 1600 deletions
+7 -1
View File
@@ -1,6 +1,12 @@
{
"include": ["."],
"exclude": ["dist", "build", "node_modules"],
"exclude": [
"dist",
"build",
"node_modules",
"coverage",
"storybook-static"
],
"compilerOptions": {
"moduleResolution": "node",
"baseUrl": "."
+1
View File
@@ -19,6 +19,7 @@ packages/common/auth/
├── types.ts # 타입 정의
├── token-manager.ts # 토큰 관리 로직
├── cookie.ts # 쿠키 유틸리티
├── device-id.ts # 기기 ID (쿠키)
├── jwt-utils.ts # JWT 유틸리티
└── README.md # 문서
```
+27
View File
@@ -0,0 +1,27 @@
import { v4 as uuidv4 } from "uuid";
import { getCookie, removeCookie, setCookie } from "./cookie";
const DEVICE_ID_KEY = "x-device-id";
const COOKIE_DOMAIN = process.env.NEXT_PUBLIC_COOKIE_DOMAIN;
export function getOrCreateDeviceId(): string {
const existing = getCookie(DEVICE_ID_KEY);
if (existing) return existing;
const id = uuidv4();
const isHttps =
typeof window !== "undefined" && window.location.protocol === "https:";
setCookie(DEVICE_ID_KEY, id, {
secure: isHttps,
sameSite: "lax",
domain: COOKIE_DOMAIN,
path: "/",
expires: 365,
});
return id;
}
export function clearDeviceId(): void {
removeCookie(DEVICE_ID_KEY, { domain: COOKIE_DOMAIN, path: "/" });
}
+1
View File
@@ -2,6 +2,7 @@ export { createTokenManager } from "./token-manager";
export type { TokenManager } from "./token-manager";
export { getCookie, setCookie, removeCookie } from "./cookie";
export { clearDeviceId, getOrCreateDeviceId } from "./device-id";
export {
getJwtExpiry,
getRemainingMs,
+2 -1
View File
@@ -8,7 +8,8 @@
".": "./index.ts"
},
"dependencies": {
"js-cookie": "^3.0.5"
"js-cookie": "^3.0.5",
"uuid": "^14.0.1"
},
"devDependencies": {
"@types/js-cookie": "^3.0.6",
+7 -1
View File
@@ -3,6 +3,7 @@
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2017",
"types": ["node"],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
@@ -19,5 +20,10 @@
"incremental": true
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"exclude": [
"node_modules",
"dist",
"coverage",
"storybook-static"
]
}
+2 -2
View File
@@ -57,7 +57,7 @@ export interface SiteListResponse {
const { PROXY_HOST } = getConfig();
const BASE_URL = `${PROXY_HOST}/server`;
export const getSiteInfo = async (siteId: string) => {
export const getSiteInfo = async (siteId: string): Promise<SiteInfo> => {
const response = await fetch(
`${BASE_URL}${ENDPOINT.CMS_SERVICE.SITES}/${siteId}`,
{
@@ -66,7 +66,7 @@ export const getSiteInfo = async (siteId: string) => {
credentials: "include",
},
);
return response.json() as Promise<SiteInfo>;
return response.json();
};
export const getSiteList = async (): Promise<SiteListResponse> => {
+2
View File
@@ -1,2 +1,4 @@
export * from "./api";
export * from "./config";
export * from "./lib";
export * from "./ui";
@@ -1,59 +0,0 @@
import { useEffect, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { getSiteInfo } from "../api/site";
import { getIpList } from "../api/ip";
import { ENDPOINT } from "../config";
import { getCookie } from "../lib";
const siteId = getCookie("site-id-key") ?? "";
const ClientIpGuard = ({
currentPath,
children,
}: {
currentPath?: string;
children: React.ReactNode;
}) => {
const queryClient = useQueryClient();
const [clientIp, setClientIp] = useState("");
const [isAllowed, setIsAllowed] = useState(true);
useEffect(() => {
(async () => {
const response = await fetch("https://api.ipify.org?format=json");
const data = await response.json();
if (!data?.ip) return;
setClientIp(data.ip);
})();
}, []);
useEffect(() => {
(async () => {
if (!siteId || !clientIp) return;
const siteInfo = await queryClient.ensureQueryData({
queryKey: [ENDPOINT.CMS_SERVICE.SITES, siteId],
queryFn: () => getSiteInfo(siteId),
});
if (siteInfo.siteKndCd === "O") return;
const { content: ipList } = await getIpList({
siteId,
prmYn: "Y",
});
const allowedClientIp = ipList.some((ip) => ip.ipAddr === clientIp);
setIsAllowed(allowedClientIp);
})();
}, [queryClient, clientIp, currentPath]);
if (!isAllowed) {
alert("허용되지 않은 IP로 접근하였습니다.");
return <></>;
}
return <>{children}</>;
};
export { ClientIpGuard };
@@ -3,7 +3,6 @@ import type { QueryClient } from "@tanstack/react-query";
import { QueryProvider } from "../../provider/query-provider";
import { PopupProvider } from "../../provider/popup-provider";
import { HelpDialogProvider } from "../../provider/help-dialog-context";
import { ClientIpGuard } from "../../lib/client-ip-guard";
import type { MenuItem } from "../../api";
import { SidebarProvider } from "../sidebar";
import { LNB } from "../lnb";
@@ -29,30 +28,28 @@ export function BaseLayout({
}) {
return (
<QueryProvider queryClient={queryClient}>
<ClientIpGuard currentPath={currentPath}>
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header
authService={authService}
tokenManager={authService ? undefined : tokenManager}
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header
authService={authService}
tokenManager={authService ? undefined : tokenManager}
/>
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col">
<div className="flex-1">{children}</div>
<Footer />
</div>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col">
<div className="flex-1">{children}</div>
<Footer />
</div>
</div>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</ClientIpGuard>
</div>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</QueryProvider>
);
}
@@ -2,7 +2,6 @@ import type { QueryClient } from "@tanstack/react-query";
import { QueryProvider } from "../../provider/query-provider";
import { PopupProvider } from "../../provider/popup-provider";
import { HelpDialogProvider } from "../../provider/help-dialog-context";
import { ClientIpGuard } from "../../lib/client-ip-guard";
import type { MenuItem } from "../../api";
import { SidebarProvider } from "../sidebar";
import { LNB } from "../lnb";
@@ -25,26 +24,24 @@ export function NoFooterLayout({
}) {
return (
<QueryProvider queryClient={queryClient}>
<ClientIpGuard currentPath={currentPath}>
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header authService={authService} />
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
</div>
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header authService={authService} />
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
</div>
</div>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</ClientIpGuard>
</div>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</QueryProvider>
);
}
@@ -1,9 +1,8 @@
import type { AuthService, TokenManager } from "@common/auth";
import type { AuthService } from "@common/auth";
import type { QueryClient } from "@tanstack/react-query";
import { QueryProvider } from "../../provider/query-provider";
import { PopupProvider } from "../../provider/popup-provider";
import { HelpDialogProvider } from "../../provider/help-dialog-context";
import { ClientIpGuard } from "../../lib/client-ip-guard";
import type { MenuItem } from "../../api";
import { SidebarProvider } from "../sidebar";
import { Header } from "../header";
@@ -14,39 +13,30 @@ export function NoLNBLayout({
children,
queryClient,
authService,
tokenManager,
currentPath,
}: {
children: React.ReactNode;
queryClient?: QueryClient;
authService?: AuthService;
/** @deprecated authService를 사용하세요. authService가 없을 때만 Header legacy logout에 사용됩니다. */
tokenManager?: TokenManager;
currentPath?: string;
handleMenuClick?: (item: MenuItem) => void;
}) {
return (
<QueryProvider queryClient={queryClient}>
<ClientIpGuard currentPath={currentPath}>
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header
authService={authService}
tokenManager={authService ? undefined : tokenManager}
/>
<div className="flex">
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
<Footer />
</div>
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header authService={authService} />
<div className="flex">
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
<Footer />
</div>
</div>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</ClientIpGuard>
</div>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</QueryProvider>
);
}
+9 -8
View File
@@ -12,21 +12,22 @@
"noEmit": false,
"incremental": true,
"strict": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
"@/*": ["./src/*"]
}
},
"exclude": ["**/node_modules", "**/.*/*", "dist"],
"exclude": [
"node_modules",
".next",
"dist",
"coverage",
"storybook-static",
"public"
],
"include": [
".eslintrc.*",
"**/*.ts",
"**/*.tsx",
"**/*.mts",
"**/*.cjs",
"**/*.mjs",
"**/*.jsx",
"**/*.json",
".storybook/env.ts"
]
}
+6 -1
View File
@@ -9,5 +9,10 @@
"incremental": false
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules", "dist"]
"exclude": [
"node_modules",
"dist",
"coverage",
"storybook-static"
]
}
+4
View File
@@ -9,6 +9,8 @@ interface ClientConfig {
siteId: string;
}
const DEVICE_ID_KEY = "x-device-id";
class Client {
private static instance: Client;
private axiosInstance: AxiosInstance;
@@ -41,6 +43,7 @@ class Client {
const token = Cookies.get(CLAIM_NAME);
const userId = Cookies.get(AUTH_USER_ID);
const deviceId = Cookies.get(DEVICE_ID_KEY);
if (!token || !userId) {
return config;
@@ -48,6 +51,7 @@ class Client {
config.headers[CLAIM_NAME] = token;
config.headers[AUTH_USER_ID] = userId;
config.headers["X-Device-Id"] = deviceId;
return config;
});
+4 -3
View File
@@ -2,9 +2,10 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"module": "ESNext"
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["node"]
},
"include": ["."],
"exclude": ["node_modules", "dist"]
"exclude": ["node_modules", "dist", "coverage", "storybook-static"]
}
+1
View File
@@ -0,0 +1 @@
declare module "*.css";