hia-frontend-debug-tool 0.0.1
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 +1381 -0
- package/dist/index.d.cts +72 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +1371 -0
- package/package.json +52 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1 from 'react';
|
|
3
|
+
import { getEnvironmentFromHostname } from 'hia-frontend-utils';
|
|
4
|
+
import { AxiosError, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @file 디버그 툴 전체에서 사용되는 공용 TypeScript 타입을 정의합니다.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** 실행 환경 ("local" | "dev" | "stg" | "prd") */
|
|
11
|
+
type Environment = ReturnType<typeof getEnvironmentFromHostname>;
|
|
12
|
+
/** `config.ts`에서 메뉴 아이템을 정의하기 위한 구조 */
|
|
13
|
+
interface MenuItem {
|
|
14
|
+
/** 메뉴의 고유 식별자 (예: 'console-log') */
|
|
15
|
+
id: string;
|
|
16
|
+
/** 메뉴에 표시될 이름 (예: '콘솔 로그 확인') */
|
|
17
|
+
label: string;
|
|
18
|
+
/** 메뉴 클릭 시 렌더링될 리액트 컴포넌트 */
|
|
19
|
+
component: React.ComponentType<any>;
|
|
20
|
+
/** 메뉴 노출 여부. `false`이면 메뉴에 표시되지 않습니다. */
|
|
21
|
+
display: boolean;
|
|
22
|
+
}
|
|
23
|
+
type DebugToolServiceCode = 'hia' | 'etc';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @file DebugTool의 메인 컴포넌트 파일입니다.
|
|
27
|
+
* @description
|
|
28
|
+
* - 환경에 따라 디버그 툴의 노출 여부를 결정합니다.
|
|
29
|
+
* - 플로팅 버튼과 메뉴 패널의 상태를 관리합니다.
|
|
30
|
+
* - 선택된 기능(Feature) 컴포넌트를 렌더링합니다.
|
|
31
|
+
* - `onLogin`, `envOverride`, `menuItemsOverride` 등의 props를 통해 외부에서 동작을 제어할 수 있습니다.
|
|
32
|
+
*/
|
|
33
|
+
interface DebugToolProps {
|
|
34
|
+
/** 간편 로그인 기능을 위한 콜백 함수. 이 함수가 제공되어야 '간편 로그인' 메뉴가 활성화됩니다. */
|
|
35
|
+
onLogin?: (loginType: string, data: Record<string, string>) => void;
|
|
36
|
+
/** 현재 환경을 강제로 재정의합니다. 'prd' 환경에서도 디버그 툴을 테스트할 때 유용합니다. */
|
|
37
|
+
envOverride?: Environment;
|
|
38
|
+
/** 기본 메뉴 설정을 재정의합니다. 동적으로 메뉴를 추가하거나 변경할 때 사용합니다. */
|
|
39
|
+
menuItemsOverride?: (Omit<MenuItem, 'component'> & {
|
|
40
|
+
component: React$1.ComponentType<any>;
|
|
41
|
+
})[];
|
|
42
|
+
/** 서비스 코드. 'hia'일 경우 추가 디버깅 옵션(필터, 폼팩터, 호스트 변경 등)이 표시됩니다. */
|
|
43
|
+
serviceCode?: DebugToolServiceCode;
|
|
44
|
+
}
|
|
45
|
+
declare const DebugTool: ({ onLogin, envOverride, menuItemsOverride, serviceCode }: DebugToolProps) => react_jsx_runtime.JSX.Element | null;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @description debug-tool 에서 사용될 요청 로그 저장
|
|
49
|
+
* @param config Axios 요청 설정
|
|
50
|
+
*/
|
|
51
|
+
declare function addRequestLog(config: InternalAxiosRequestConfig): Promise<unknown> | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* @description debug-tool 에서 사용될 응답 로그 저장
|
|
54
|
+
* @param response Axios 응답
|
|
55
|
+
*/
|
|
56
|
+
declare function addResponseLog(response: AxiosResponse): Promise<unknown> | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* @description debug-tool 에서 사용될 에러 로그 저장
|
|
59
|
+
* @param error Axios 에러
|
|
60
|
+
*/
|
|
61
|
+
declare function addErrorLog(error: AxiosError): Promise<unknown> | undefined;
|
|
62
|
+
|
|
63
|
+
type DebugFilterKey = 'console-log' | 'http-log' | 'validation-off' | 'data-init-button';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @description 원하는 기능에 따라 쿠키를 확인하여 true/false를 리턴한다.
|
|
67
|
+
* @param name DebugFilterKey
|
|
68
|
+
* @returns boolean
|
|
69
|
+
*/
|
|
70
|
+
declare function isDebugByFilterName(name: DebugFilterKey): boolean;
|
|
71
|
+
|
|
72
|
+
export { DebugTool, addErrorLog, addRequestLog, addResponseLog, isDebugByFilterName };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1 from 'react';
|
|
3
|
+
import { getEnvironmentFromHostname } from 'hia-frontend-utils';
|
|
4
|
+
import { AxiosError, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @file 디버그 툴 전체에서 사용되는 공용 TypeScript 타입을 정의합니다.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** 실행 환경 ("local" | "dev" | "stg" | "prd") */
|
|
11
|
+
type Environment = ReturnType<typeof getEnvironmentFromHostname>;
|
|
12
|
+
/** `config.ts`에서 메뉴 아이템을 정의하기 위한 구조 */
|
|
13
|
+
interface MenuItem {
|
|
14
|
+
/** 메뉴의 고유 식별자 (예: 'console-log') */
|
|
15
|
+
id: string;
|
|
16
|
+
/** 메뉴에 표시될 이름 (예: '콘솔 로그 확인') */
|
|
17
|
+
label: string;
|
|
18
|
+
/** 메뉴 클릭 시 렌더링될 리액트 컴포넌트 */
|
|
19
|
+
component: React.ComponentType<any>;
|
|
20
|
+
/** 메뉴 노출 여부. `false`이면 메뉴에 표시되지 않습니다. */
|
|
21
|
+
display: boolean;
|
|
22
|
+
}
|
|
23
|
+
type DebugToolServiceCode = 'hia' | 'etc';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @file DebugTool의 메인 컴포넌트 파일입니다.
|
|
27
|
+
* @description
|
|
28
|
+
* - 환경에 따라 디버그 툴의 노출 여부를 결정합니다.
|
|
29
|
+
* - 플로팅 버튼과 메뉴 패널의 상태를 관리합니다.
|
|
30
|
+
* - 선택된 기능(Feature) 컴포넌트를 렌더링합니다.
|
|
31
|
+
* - `onLogin`, `envOverride`, `menuItemsOverride` 등의 props를 통해 외부에서 동작을 제어할 수 있습니다.
|
|
32
|
+
*/
|
|
33
|
+
interface DebugToolProps {
|
|
34
|
+
/** 간편 로그인 기능을 위한 콜백 함수. 이 함수가 제공되어야 '간편 로그인' 메뉴가 활성화됩니다. */
|
|
35
|
+
onLogin?: (loginType: string, data: Record<string, string>) => void;
|
|
36
|
+
/** 현재 환경을 강제로 재정의합니다. 'prd' 환경에서도 디버그 툴을 테스트할 때 유용합니다. */
|
|
37
|
+
envOverride?: Environment;
|
|
38
|
+
/** 기본 메뉴 설정을 재정의합니다. 동적으로 메뉴를 추가하거나 변경할 때 사용합니다. */
|
|
39
|
+
menuItemsOverride?: (Omit<MenuItem, 'component'> & {
|
|
40
|
+
component: React$1.ComponentType<any>;
|
|
41
|
+
})[];
|
|
42
|
+
/** 서비스 코드. 'hia'일 경우 추가 디버깅 옵션(필터, 폼팩터, 호스트 변경 등)이 표시됩니다. */
|
|
43
|
+
serviceCode?: DebugToolServiceCode;
|
|
44
|
+
}
|
|
45
|
+
declare const DebugTool: ({ onLogin, envOverride, menuItemsOverride, serviceCode }: DebugToolProps) => react_jsx_runtime.JSX.Element | null;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @description debug-tool 에서 사용될 요청 로그 저장
|
|
49
|
+
* @param config Axios 요청 설정
|
|
50
|
+
*/
|
|
51
|
+
declare function addRequestLog(config: InternalAxiosRequestConfig): Promise<unknown> | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* @description debug-tool 에서 사용될 응답 로그 저장
|
|
54
|
+
* @param response Axios 응답
|
|
55
|
+
*/
|
|
56
|
+
declare function addResponseLog(response: AxiosResponse): Promise<unknown> | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* @description debug-tool 에서 사용될 에러 로그 저장
|
|
59
|
+
* @param error Axios 에러
|
|
60
|
+
*/
|
|
61
|
+
declare function addErrorLog(error: AxiosError): Promise<unknown> | undefined;
|
|
62
|
+
|
|
63
|
+
type DebugFilterKey = 'console-log' | 'http-log' | 'validation-off' | 'data-init-button';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @description 원하는 기능에 따라 쿠키를 확인하여 true/false를 리턴한다.
|
|
67
|
+
* @param name DebugFilterKey
|
|
68
|
+
* @returns boolean
|
|
69
|
+
*/
|
|
70
|
+
declare function isDebugByFilterName(name: DebugFilterKey): boolean;
|
|
71
|
+
|
|
72
|
+
export { DebugTool, addErrorLog, addRequestLog, addResponseLog, isDebugByFilterName };
|