sales-frontend-solution 0.0.46 → 0.0.48

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.d.ts CHANGED
@@ -23,14 +23,132 @@ type KeypadSessionType = {
23
23
 
24
24
  type KeypadType = ReactElement<KeypadFieldType>;
25
25
 
26
- type Props = {
26
+ /**
27
+ * 키패드 영역 정보
28
+ */
29
+ interface KeypadRect {
30
+ /** 키패드 높이 */
31
+ height: number;
32
+ /** 키패드 상단 위치 (viewport 기준) */
33
+ top: number;
34
+ /** 키패드 하단 위치 (viewport 기준) */
35
+ bottom: number;
36
+ /** 키패드 너비 */
37
+ width: number;
38
+ /** 키패드 왼쪽 위치 */
39
+ left: number;
40
+ /** 키패드 오른쪽 위치 */
41
+ right: number;
42
+ }
43
+ /**
44
+ * onShow 콜백 파라미터
45
+ */
46
+ interface KeypadShowEvent {
47
+ /** 키패드 표시 여부 */
48
+ isShow: boolean;
49
+ /** 키패드 DOM 요소 (열림 상태일 때만 존재) */
50
+ keypadElement: HTMLElement | null;
51
+ /** 키패드 영역 정보 (열림 상태일 때만 존재) */
52
+ keypadRect: KeypadRect | null;
53
+ /** 입력 필드 DOM 요소 */
54
+ inputElement: HTMLInputElement;
55
+ }
56
+ /**
57
+ * Keypad 컴포넌트 Props
58
+ */
59
+ interface KeypadProps {
60
+ /** 키패드 세션 값 */
27
61
  value: KeypadSessionType | null;
62
+ /** 입력 엘리먼트 (React Element) */
28
63
  inputElement: KeypadType;
64
+ /** 키패드 모드 (QWERTY_SMART, NUMBER) */
29
65
  mode: KeypadModeEnum;
66
+ /** 값 변경 콜백 */
30
67
  onChange: (value: KeypadSessionType | null) => void;
68
+ /** 최대 입력 길이 */
69
+ maxLength: number;
70
+ /**
71
+ * 키패드 표시 상태 콜백
72
+ * @param event - 키패드 상태 및 영역 정보 (keypadRect로 직접 레이아웃 처리 가능)
73
+ */
74
+ onShow?: (event: KeypadShowEvent) => void;
75
+ /** 숫자 키 행 수 (기본값: 3) */
76
+ numberKeyRowCount?: number;
77
+ /** 키패드가 input을 가릴 때 translateY 처리할 최상위 컨테이너 요소의 ID */
78
+ wrapId?: string;
79
+ }
80
+ /**
81
+ * 보안 키패드 컴포넌트
82
+ *
83
+ * 한화생명 보안 키패드를 React 컴포넌트로 래핑합니다.
84
+ * 입력 엘리먼트를 받아 키패드 기능을 추가합니다.
85
+ *
86
+ * @example
87
+ * ```tsx
88
+ * <Keypad
89
+ * value={sessionInfo}
90
+ * onChange={setSessionInfo}
91
+ * mode={KeypadModeEnum.NUMBER}
92
+ * maxLength={6}
93
+ * inputElement={<input placeholder="비밀번호 입력" />}
94
+ * onShow={({ isShow, keypadElement, keypadRect }) => {
95
+ * if (isShow && keypadRect) {
96
+ * // 키패드 높이만큼 하단 여백 추가
97
+ * document.body.style.paddingBottom = `${keypadRect.height}px`;
98
+ * } else {
99
+ * document.body.style.paddingBottom = '';
100
+ * }
101
+ * // 또는 keypadElement를 직접 활용
102
+ * console.log('키패드 DOM:', keypadElement);
103
+ * }}
104
+ * />
105
+ * ```
106
+ */
107
+ declare function Keypad({ value, onChange, mode, maxLength, inputElement, onShow, numberKeyRowCount, wrapId }: KeypadProps): react_jsx_runtime.JSX.Element;
108
+
109
+ type KeypadInitializeType = {
110
+ name: string;
111
+ editBox: HTMLInputElement;
112
+ keyType: KeypadModeEnum;
113
+ width: number;
114
+ position: {
115
+ top: number;
116
+ left: null;
117
+ };
118
+ viewType: string;
119
+ closeDelay: number;
120
+ autoKeyResize: boolean;
121
+ isE2E: boolean;
122
+ onlyMobile: boolean;
123
+ hasPressEffect: boolean;
31
124
  maxLength: number;
125
+ numberKeyRowCount: number;
126
+ onInputChange: (newLength: number) => void;
127
+ onKeypadClose: () => void;
128
+ };
129
+
130
+ declare enum KeypadMessageTypeEnum {
131
+ NotSupportDevice = -1,
132
+ Already = -2
133
+ }
134
+
135
+ type KeypadActionType = {
136
+ addIt: (name: string) => void;
137
+ alert_focus: VoidFunction;
138
+ alert_hide: VoidFunction;
139
+ alert_show: VoidFunction;
140
+ auto_refresh: VoidFunction;
141
+ refresh: VoidFunction;
142
+ clear: VoidFunction;
143
+ close: VoidFunction;
144
+ enter: VoidFunction;
145
+ get_Vinput: VoidFunction;
146
+ get_input: VoidFunction;
147
+ get_sessionInfo: () => KeypadSessionType;
148
+ isOpend: () => boolean;
149
+ isOpen: () => boolean;
150
+ initialize: (props: KeypadInitializeType) => KeypadMessageTypeEnum;
32
151
  };
33
- declare function Keypad({ value, onChange, mode, maxLength, inputElement }: Props): react_jsx_runtime.JSX.Element;
34
152
 
35
153
  type KeypadResponseType = {
36
154
  length: number;
@@ -40,47 +158,194 @@ type KeypadResponseType = {
40
158
  name: string;
41
159
  };
42
160
 
161
+ /**
162
+ * useKeypad 훅 반환 타입
163
+ */
164
+ interface UseKeypadReturn {
165
+ /** 키패드 표시 */
166
+ show: (inputRef: HTMLInputElement, onInputChange: (length: number) => void, onKeypadClose: (res: KeypadResponseType) => void, keyType?: KeypadModeEnum, maxLength?: number, numberKeyRowCount?: number) => void;
167
+ /** 키패드 닫기 */
168
+ close: (name?: string) => void;
169
+ /** 키패드 입력 초기화 */
170
+ clear: (name?: string) => void;
171
+ /** 키패드 새로고침 */
172
+ refresh: (name?: string) => void;
173
+ /** 세션 정보 조회 */
174
+ getValue: (name: string) => ReturnType<KeypadActionType['get_sessionInfo']> | null | undefined;
175
+ /** 키패드 열림 상태 확인 */
176
+ isOpen: (name?: string) => boolean;
177
+ /** 키패드 인스턴스 찾기 */
178
+ find: (name?: string) => KeypadActionType | undefined;
179
+ /** 키패드 표시 상태 */
180
+ isShow: boolean;
181
+ /** 현재 키패드 ID (DOM id는 `xk-pad-${keypadId}`) */
182
+ keypadId: string | null;
183
+ }
184
+ /**
185
+ * 보안 키패드 훅
186
+ *
187
+ * 한화생명 보안 키패드를 React에서 사용하기 위한 커스텀 훅입니다.
188
+ *
189
+ * @example
190
+ * ```tsx
191
+ * const { show, close, isShow } = useKeypad();
192
+ *
193
+ * const handleClick = () => {
194
+ * show(
195
+ * inputRef.current,
196
+ * (length) => console.log('입력 길이:', length),
197
+ * (res) => console.log('세션 정보:', res.sessionInfo),
198
+ * );
199
+ * };
200
+ * ```
201
+ */
202
+ declare function useKeypad(): UseKeypadReturn;
203
+
43
204
  type KeypadFieldType = {
44
205
  ref: React.Ref<any>;
45
206
  value: string;
46
207
  onClick: () => void;
47
208
  onFocus: () => void;
209
+ isKeypadActive?: boolean;
48
210
  };
49
211
 
50
- type NxlOneProps = {
212
+ declare const NXL_ONE_ENV_URLS: {
213
+ readonly dev: "https://nxl-nlc-dev.hanwhalife.com";
214
+ readonly stg: "https://nxl-nlc-stg.hanwhalife.com";
215
+ readonly prd: "https://nxl-nlc.hanwhalife.com";
216
+ };
217
+ type NxlOneEnv = keyof typeof NXL_ONE_ENV_URLS;
218
+ type NxlOneAction = 'error' | 'close' | 'complete';
219
+ type NxlOneResponse = {
220
+ action?: NxlOneAction;
221
+ redirectUrl?: string;
222
+ nlcCtfnId?: string;
223
+ };
224
+ /** NxlOne 에러 코드 값 */
225
+ declare const NXL_ONE_ERROR_CODES: {
226
+ /** 팝업이 브라우저에 의해 차단됨 */
227
+ readonly POPUP_BLOCKED: "POPUP_BLOCKED";
228
+ /** 사용자가 인증을 취소함 */
229
+ readonly AUTH_CANCELLED: "AUTH_CANCELLED";
230
+ /** 인증 실패 */
231
+ readonly AUTH_FAILED: "AUTH_FAILED";
232
+ /** 잘못된 응답 */
233
+ readonly INVALID_RESPONSE: "INVALID_RESPONSE";
234
+ };
235
+ /** NxlOne 에러 코드 타입 */
236
+ type NxlOneErrorCode = (typeof NXL_ONE_ERROR_CODES)[keyof typeof NXL_ONE_ERROR_CODES];
237
+ /** NxlOne 에러 객체 */
238
+ type NxlOneError = {
239
+ /** 에러 코드 */
240
+ code: NxlOneErrorCode;
241
+ /** 사용자 친화적 메시지 */
242
+ message: string;
243
+ };
244
+ /** NxlOne 에러 생성 */
245
+ declare const createNxlOneError: (code: NxlOneErrorCode, customMessage?: string) => NxlOneError;
246
+ /** NxlOneError 타입 가드 */
247
+ declare const isNxlOneError: (value: unknown) => value is NxlOneError;
248
+
249
+ /** @deprecated NxlOneResponse를 사용하세요 */
250
+ type NxlOneIframeResponse = NxlOneResponse;
251
+ type NxlOneIframeProps = {
252
+ /** 비즈니스 코드 */
51
253
  bizCode: string;
254
+ /** 템플릿 코드 */
52
255
  tmplCode: string;
256
+ /** NCSR 정보 UUID */
53
257
  ncsrInfoUuid?: string;
258
+ /** NLC 인증 ID */
54
259
  nlcCtfnId?: string;
55
- t?: string;
56
- env?: 'dev' | 'stg' | 'prod';
260
+ /** 환경 (미지정 시 현재 URL 기반 자동 감지) */
261
+ env?: NxlOneEnv;
262
+ /** iframe 너비 (기본: '100%') */
263
+ width?: number | string;
264
+ /** iframe 높이 (기본: '100%') */
265
+ height?: number | string;
266
+ /** CSS 클래스명 */
267
+ className?: string;
268
+ /** 인라인 스타일 */
269
+ style?: React.CSSProperties;
270
+ /** iframe allow 속성 */
271
+ allow?: string;
272
+ /** iframe sandbox 속성 */
273
+ sandbox?: string;
274
+ /** 인증 성공 시 호출 */
275
+ onSuccess?: (response: NxlOneResponse) => void;
276
+ /** 에러 발생 시 호출 */
277
+ onError?: (response: NxlOneResponse) => void;
278
+ /** 닫기 시 호출 */
279
+ onClose: (response: NxlOneResponse) => void;
280
+ /** origin 검증 여부 (기본: true) */
281
+ strictOrigin?: boolean;
282
+ /** 콜백 호출 시 자동으로 iframe 숨김 (기본: false) */
283
+ autoHide?: boolean;
57
284
  };
58
- type NxlOneResponse = {
59
- action?: 'error' | 'close' | 'complete';
60
- redirectUrl?: string;
285
+ /**
286
+ * NEXTLAB ONE 인증을 위한 Iframe 컴포넌트
287
+ *
288
+ * @example
289
+ * ```tsx
290
+ * <NxlOneIframe
291
+ * bizCode="BIZ001"
292
+ * tmplCode="TMPL001"
293
+ * env="dev"
294
+ * autoHide
295
+ * onSuccess={(res) => console.log("성공", res)}
296
+ * onError={(res) => console.log("에러", res)}
297
+ * onClose={(res) => console.log("닫기", res)}
298
+ * />
299
+ * ```
300
+ */
301
+ declare function NxlOneIframe({ bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, env, width, height, className, style, allow, sandbox, onSuccess, onError, onClose, strictOrigin, autoHide }: NxlOneIframeProps): react_jsx_runtime.JSX.Element | null;
302
+
303
+ type NxlOneProps = {
304
+ /** 비즈니스 코드 */
305
+ bizCode: string;
306
+ /** 템플릿 코드 */
307
+ tmplCode: string;
308
+ /** NCSR 정보 UUID */
309
+ ncsrInfoUuid?: string;
310
+ /** NLC 인증 ID */
61
311
  nlcCtfnId?: string;
312
+ /** 환경 (미지정 시 현재 URL 기반 자동 감지) */
313
+ env?: NxlOneEnv;
62
314
  };
63
- type OpenOptionType = {
64
- popupWidth?: number;
65
- popupHeight?: number;
66
- popupLeft?: number;
67
- popupTop?: number;
315
+
316
+ type PopupOptions = {
317
+ /** 팝업 너비 (기본: 744) */
318
+ width?: number;
319
+ /** 팝업 높이 (기본: 720) */
320
+ height?: number;
321
+ /** 팝업 X 위치 (기본: 화면 중앙) */
322
+ left?: number;
323
+ /** 팝업 Y 위치 (기본: 화면 중앙) */
324
+ top?: number;
325
+ /** 팝업 창 이름 (기본: "self_cert") */
68
326
  windowName?: string;
69
327
  };
70
- declare function useNxlOne({ bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, t }: NxlOneProps): {
328
+ /**
329
+ * NEXTLAB ONE 인증을 위한 훅
330
+ *
331
+ * @example
332
+ * ```tsx
333
+ * const { redirect, open } = useNxlOne({
334
+ * bizCode: "BIZ001",
335
+ * tmplCode: "TMPL001",
336
+ * env: "dev",
337
+ * });
338
+ *
339
+ * // 리다이렉트 방식
340
+ * <button onClick={redirect}>인증하기</button>
341
+ *
342
+ * // 팝업 방식
343
+ * <button onClick={() => open().then(console.log)}>팝업으로 인증</button>
344
+ * ```
345
+ */
346
+ declare function useNxlOne({ bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, env }: NxlOneProps): {
71
347
  redirect: () => void;
72
- open: (options?: OpenOptionType) => Promise<NxlOneResponse>;
73
- Iframe: ({ height, className, style, allow, sandbox, onSuccess, onError, onClose, strictOrigin }: {
74
- height?: number | string;
75
- className?: string;
76
- style?: React.CSSProperties;
77
- allow?: string;
78
- sandbox?: string;
79
- onSuccess?: (response: NxlOneResponse) => void;
80
- onError?: (response: NxlOneResponse) => void;
81
- onClose: (response: NxlOneResponse) => void;
82
- strictOrigin?: boolean;
83
- }) => react_jsx_runtime.JSX.Element;
348
+ open: (options?: PopupOptions) => Promise<NxlOneResponse>;
84
349
  };
85
350
 
86
- export { Keypad, type KeypadFieldType, KeypadModeEnum, type KeypadResponseType, type KeypadSessionType, type KeypadType, type NxlOneProps, type NxlOneResponse, V3Provider, useNxlOne, useV3 };
351
+ export { Keypad, type KeypadFieldType, KeypadModeEnum, type KeypadProps, type KeypadRect, type KeypadResponseType, type KeypadSessionType, type KeypadShowEvent, type KeypadType, NXL_ONE_ERROR_CODES, type NxlOneAction, type NxlOneEnv, type NxlOneError, type NxlOneErrorCode, NxlOneIframe, type NxlOneIframeProps, type NxlOneIframeResponse, type NxlOneProps, type NxlOneResponse, type PopupOptions, type UseKeypadReturn, V3Provider, createNxlOneError, isNxlOneError, useKeypad, useNxlOne, useV3 };