sales-frontend-components 0.0.80 → 0.0.82

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
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { FieldValues, UseControllerProps } from 'react-hook-form';
3
3
  import { CheckboxButtonProps, CheckboxProps, DatePickerSingleHtmlProps, DatePickerRangeHtmlProps, FormField, SegmentGroupHtmlProps, SelectProps, OptionProps } from 'sales-frontend-design-system';
4
4
  import * as sales_frontend_api_method from 'sales-frontend-api/method';
5
- import { OccupationResponseDto, AddressStandardizationResponseDto, AddressResponseDto, OrganizationProfileResponse, EmployeeProfileResponseDto, Pagination } from 'sales-frontend-api/method';
5
+ import { OccupationResponseDto, AddressStandardizationResponseDto, AddressResponseDto, OrganizationProfileResponse, EmployeeProfileResponseDto, CustomerSearchProps, RemoteIdentityVerificationSystemTokenRequestDto, ApiConfig } from 'sales-frontend-api/method';
6
6
  import * as React$1 from 'react';
7
7
  import React__default from 'react';
8
8
 
@@ -264,42 +264,80 @@ interface JobSearchModalProps {
264
264
  }
265
265
  declare const JobSearchModal: React__default.FC<JobSearchModalProps>;
266
266
 
267
- interface DspResponseCustomerListResponseDto {
268
- /** @description 성공여부 */
269
- isSuccess?: boolean;
270
- /** @description 코드 */
271
- code?: string;
272
- /** @description 메시지 */
273
- message?: string;
274
- data?: CustomerListResponseDto;
275
- pagination?: Pagination;
267
+ declare const CustomerSearch: ({ onSelect }: CustomerSearchProps) => react_jsx_runtime.JSX.Element;
268
+
269
+ interface VerificationResponse {
270
+ command: 'webClose';
271
+ args: {
272
+ result: 'Y' | 'N';
273
+ code: string;
274
+ };
276
275
  }
277
- interface CustomerListResponseDto {
278
- /** @description 고객목록 */
279
- custList?: CustomerDto[];
280
- /** @description 건수 */
281
- totalCount?: string;
276
+ interface RivUrlParams {
277
+ /** 유입환경구분코드(0: 모바일웹, 1: PC, 2: App) */
278
+ envDvsnCode?: string;
279
+ /** 완료페이지 스킵여부(0: Skip Off, 1: Skip On) */
280
+ skipFinalPage?: string;
281
+ /** 시작페이지 스킵여부(0: Skip Off, 1: Skip On) */
282
+ skipFirstPage?: string;
283
+ /** 국적타입(D: 내국인, F: 외국인) */
284
+ nationalityType?: 'D' | 'F';
282
285
  }
283
- /** @description 고객정보 */
284
- interface CustomerDto {
285
- /** @description 고객ID */
286
- customerId?: string;
287
- /** @description 고객명 */
288
- customerName?: string;
289
- /** @description 기본주소 */
290
- baseAddress?: string;
291
- /** @description 상세주소 */
292
- detailAddress?: string;
293
- /** @description 생년월일(YYYYMMDD) */
294
- birthDate?: string;
295
- /** @description 성별코드 */
296
- genderCode?: string;
286
+ interface RemoteIdentityVerificationSuccess {
287
+ rivsRqstId: string;
297
288
  }
298
- interface CustomerSearchProps {
299
- onSelect?: (customer: CustomerDto) => void;
289
+ interface UseRemoteIdentityVerificationProps {
290
+ rivEnv?: 'prd' | 'stg' | 'dev';
291
+ rivOrigin?: string;
292
+ tokenRequestParams: RemoteIdentityVerificationSystemTokenRequestDto;
293
+ rivSearchParams?: RivUrlParams;
294
+ apiConfig?: ApiConfig;
295
+ onSuccess?: (result: VerificationResponse['args'], remoteIdentityVerificationSuccess: RemoteIdentityVerificationSuccess) => void;
296
+ onError?: (result: VerificationResponse['args']) => void;
297
+ onCancel?: (result: VerificationResponse['args']) => void;
300
298
  }
301
299
 
302
- declare const CustomerSearch: ({ onSelect }: CustomerSearchProps) => react_jsx_runtime.JSX.Element;
300
+ /**
301
+ * 비대면인증시스템 기본 로직
302
+ * @param config
303
+ */
304
+ declare const useRemoteIdentityVerification: ({ rivEnv, rivOrigin, tokenRequestParams, apiConfig, onCancel, onError, onSuccess, rivSearchParams }: UseRemoteIdentityVerificationProps) => {
305
+ createRemoteIdentityVerificationUrl: () => Promise<{
306
+ fullUrl: string;
307
+ rivsRqstId: string;
308
+ }>;
309
+ createMessageHandler: ({ rivsRqstId }: RemoteIdentityVerificationSuccess, cleanup?: () => void) => (event: MessageEvent) => void;
310
+ };
311
+ /**
312
+ * Iframe용 비대면인증시스템 훅
313
+ * @param config
314
+ * @returns
315
+ */
316
+ declare const useRemoteIdentityVerificationIframe: (config: UseRemoteIdentityVerificationProps) => {
317
+ RivModalIframe: ({ width, height, loadingComponent, ...iframeProps }: React.IframeHTMLAttributes<HTMLIFrameElement> & {
318
+ width?: string;
319
+ height?: string;
320
+ loadingComponent?: React.ReactNode;
321
+ }) => react_jsx_runtime.JSX.Element;
322
+ RivIframe: ({ width, height, ...iframeProps }: React.IframeHTMLAttributes<HTMLIFrameElement> & {
323
+ width?: string;
324
+ height?: string;
325
+ }) => react_jsx_runtime.JSX.Element | null;
326
+ openRivIframe: () => Promise<void>;
327
+ closeRivIframe: () => void;
328
+ remoteIdentityVerificationUrl: string;
329
+ isCreatingUrl: boolean;
330
+ isFullyLoaded: boolean;
331
+ };
332
+ /**
333
+ * 팝업용 비대면인증시스템 훅
334
+ * @param config
335
+ * @returns
336
+ */
337
+ declare const useRemoteIdentityVerificationPopup: (config: UseRemoteIdentityVerificationProps) => {
338
+ openPopup: (target?: string, features?: string) => Promise<void>;
339
+ isCreatingUrl: boolean;
340
+ };
303
341
 
304
- export { Attachment, BankStockSearchModal, CustomerSearch, EmployeeSearchModal, FormCheckbox, FormCheckboxButton, FormDatePicker, FormDateRangePicker, FormSearchJobField, FormSegmentGroup, FormSelect, FormTextField, JobSearchModal, OrganizationSearchModal, StepIndicator, resize, testSignatureBase64Data, useAddressComponent, useBankStockSearch, useCamera, useCanvasPaint, useJobVehicleSearchModal, useSearchAddress };
305
- export type { AttachedPhoto, AttachmentProps, BankStockItem, BankStockSearchModalProps, CustomerDto, CustomerListResponseDto, CustomerSearchProps, DownloadProps, DspResponseCustomerListResponseDto, PaintProps, Pen, StepIndicatorProps, StepItem, cameraItemType, cameraOptions };
342
+ export { Attachment, BankStockSearchModal, CustomerSearch, EmployeeSearchModal, FormCheckbox, FormCheckboxButton, FormDatePicker, FormDateRangePicker, FormSearchJobField, FormSegmentGroup, FormSelect, FormTextField, JobSearchModal, OrganizationSearchModal, StepIndicator, resize, testSignatureBase64Data, useAddressComponent, useBankStockSearch, useCamera, useCanvasPaint, useJobVehicleSearchModal, useRemoteIdentityVerification, useRemoteIdentityVerificationIframe, useRemoteIdentityVerificationPopup, useSearchAddress };
343
+ export type { AttachedPhoto, AttachmentProps, BankStockItem, BankStockSearchModalProps, DownloadProps, PaintProps, Pen, RemoteIdentityVerificationSuccess, RivUrlParams, StepIndicatorProps, StepItem, UseRemoteIdentityVerificationProps, VerificationResponse, cameraItemType, cameraOptions };
package/dist/index.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import { useController } from 'react-hook-form';
3
- import { CheckboxButton, Checkbox, DatePicker, DateRangePicker, Accordion, Radio, Table, Button, FormField, Select, Tab, useModalState, Modal, SegmentGroup, ModalUtils, FormCore, RadioGroup, useDropDown, List, ListItem } from 'sales-frontend-design-system';
3
+ import { CheckboxButton, Checkbox, DatePicker, DateRangePicker, Accordion, Radio, Table, Button, FormField, Select, Tab, useModalState, Modal, SegmentGroup, ModalUtils, FormCore, RadioGroup, useDropDown, List, ListItem, Loading } from 'sales-frontend-design-system';
4
4
  import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
5
- import { useSearchOccupationQuery, useSearchAddressQuery, useSearchPostalCodeQuery, useSearchAddressStandardizationQuery, useSearchOrganizationQuery, useSearchEmployeeProfileQuery, useSearchVehicleQuery } from 'sales-frontend-api/method';
5
+ import { useSearchOccupationDetailQuery, useSearchOccupationQuery, useSearchAddressQuery, useSearchPostalCodeQuery, useSearchAddressStandardizationQuery, useSearchOrganizationQuery, useSearchEmployeeProfileQuery, useSearchVehicleQuery, useSearchCustomerListQuery, getRemoteIdentityVerificationSystemToken } from 'sales-frontend-api/method';
6
6
  import { IconMainUiSearch, IconIllustCamera, IconGraphicsBankHsbc, IconGraphicsBankKebHana, IconGraphicsBankScJeil, IconGraphicsBankGyeongnam, IconGraphicsBankGwangju, IconGraphicsBankKukmin, IconGraphicsBankKiup, IconGraphicsBankJiyeokNonghyeop, IconGraphicsBankNhNonghyeop, IconGraphicsBankDaegu, IconGraphicsBankBusan, IconGraphicsBankSanlim, IconGraphicsBankSaneop, IconGraphicsBankSaemaulGeumgo, IconGraphicsBankSuhyeop, IconGraphicsBankSinhan, IconGraphicsBankSinhyeop, IconGraphicsBankOehwan, IconGraphicsBankWoori, IconGraphicsBankPost, IconGraphicsBankJeochuk, IconGraphicsBankJeonbuk, IconGraphicsBankJeju, IconGraphicsBankKakaoBank, IconGraphicsBankKBank, IconGraphicsBankHankookCity, IconGraphicsStockDbGeumyungTujajeungkwon, IconGraphicsStockKbJeungkwon, IconGraphicsStockNhWooriTujajeungkwon, IconGraphicsStockNhTujajeungkwon, IconGraphicsStockSkJeungkwon, IconGraphicsStockGyoboJeungkwon, IconGraphicsStockDaesinJeungkwon, IconGraphicsStockMeritzJeungkwon, IconGraphicsStockMiraeAssetJeungkwon, IconGraphicsStockBugukJeungkwon, IconGraphicsStockSamsungJeungkwon, IconGraphicsStockSinyeongJeungkwon, IconGraphicsStockSinhanTujajeungkwon, IconGraphicsStockYuantaJeungkwon, IconGraphicsStockYujinTujajeungkwon, IconGraphicsStockKiwoomJeungkwon, IconGraphicsStockHanaGeumyungTujajeungkwon, IconGraphicsStockHiTujajeungkwon, IconGraphicsStockHankookJeungkwonGeumyung, IconGraphicsStockHankookTujajeungkwon, IconGraphicsStockHanwhaTujajeungkwon, IconGraphicsStockHyundaiChaJeungkwon, IconGraphicsStockHochulEopsum, IconGraphicsFeedbackEmpty, IconIllustGrade, IconIllustJob, IconSubUiArrowRight, IconIllustVehicle } from 'sales-frontend-assets';
7
7
  import styles from './modal/pre-standard/job-search-modal/job-search-modal.module.scss';
8
8
  import styles$1 from './step-indicator/step-indicator.module.scss';
@@ -14,6 +14,7 @@ import styles$6 from './modal/pre-standard/employee-search-modal/employee-search
14
14
  import styles$7 from './modal/pre-standard/job-vehicle-search-modal/job-vehicle-search-modal.module.scss';
15
15
  import styles$8 from './modal/pre-standard/vehicle-search-modal/vehicle-search-modal.module.scss';
16
16
  import styles$9 from './modal/standard/customer-search/customer-search.module.scss';
17
+ import { MessageEventManager } from 'sales-frontend-utils';
17
18
 
18
19
  const FormCheckboxButton = ({
19
20
  name,
@@ -281,6 +282,73 @@ function JobSearchCategory({ filteredJobs, onJobSelect, searchTerm }) {
281
282
  ] }) });
282
283
  }
283
284
 
285
+ function JobSearchDetail({ occupationTypeCode, occupationIndustryCode }) {
286
+ const { data: detail } = useSearchOccupationDetailQuery({
287
+ occupationIndustryCode,
288
+ occupationIndustryTypeCode: occupationTypeCode
289
+ });
290
+ if (!detail || !detail.data) {
291
+ return null;
292
+ }
293
+ const {
294
+ /** @description 직종해설내용 */
295
+ occupationExplanationContent,
296
+ /** @description 직업예시명 */
297
+ occupationExampleName,
298
+ /** @description 위험등급명 */
299
+ riskGradeName,
300
+ /** @description 위험등급코드 */
301
+ riskGradeCode,
302
+ /** @description 상해위험등급코드명 */
303
+ injuryRiskGradeCodeName,
304
+ /** @description 상해위험등급코드 */
305
+ injuryRiskGradeCode,
306
+ /** @description 입원등급코드명 */
307
+ hospitalizationGradeCodeName,
308
+ /** @description 입원등급코드 */
309
+ hospitalizationGradeCode,
310
+ /** @description 상해직종코드 */
311
+ injuryOccupationCode
312
+ } = detail.data;
313
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Table, { variant: "horizontal", children: /* @__PURE__ */ jsxs("tbody", { children: [
314
+ /* @__PURE__ */ jsxs("tr", { children: [
315
+ /* @__PURE__ */ jsx("th", { className: "px-small", children: "\uC9C1\uC885 \uD574\uC124" }),
316
+ /* @__PURE__ */ jsx("td", { className: "px-small", children: occupationExplanationContent })
317
+ ] }),
318
+ /* @__PURE__ */ jsxs("tr", { children: [
319
+ /* @__PURE__ */ jsx("th", { className: "px-small", children: "\uC9C1\uC885 \uC608\uC2DC" }),
320
+ /* @__PURE__ */ jsx("td", { className: "px-small", children: occupationExampleName })
321
+ ] }),
322
+ /* @__PURE__ */ jsxs("tr", { children: [
323
+ /* @__PURE__ */ jsx("th", { className: "px-small", children: "\uC704\uD5D8 \uB4F1\uAE09" }),
324
+ /* @__PURE__ */ jsxs("td", { className: "px-small", children: [
325
+ riskGradeName,
326
+ "(",
327
+ riskGradeCode,
328
+ ")"
329
+ ] })
330
+ ] }),
331
+ /* @__PURE__ */ jsxs("tr", { children: [
332
+ /* @__PURE__ */ jsx("th", { className: "px-small", children: "\uC785\uC6D0 \uB4F1\uAE09" }),
333
+ /* @__PURE__ */ jsxs("td", { className: "px-small", children: [
334
+ hospitalizationGradeCodeName,
335
+ "(",
336
+ hospitalizationGradeCode,
337
+ ")"
338
+ ] })
339
+ ] }),
340
+ /* @__PURE__ */ jsxs("tr", { children: [
341
+ /* @__PURE__ */ jsx("th", { className: "px-small", children: "\uC0C1\uD574 \uB4F1\uAE09" }),
342
+ /* @__PURE__ */ jsxs("td", { className: "px-small", children: [
343
+ injuryRiskGradeCodeName,
344
+ "(",
345
+ injuryRiskGradeCode,
346
+ ")"
347
+ ] })
348
+ ] })
349
+ ] }) }) });
350
+ }
351
+
284
352
  const cx$d = classNames.bind(styles);
285
353
  function JobSearchFavorite({ filteredJobs, onJobSelect }) {
286
354
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: cx$d("popular-jobs"), children: [
@@ -306,7 +374,13 @@ function JobSearchFavorite({ filteredJobs, onJobSelect }) {
306
374
  ]
307
375
  }
308
376
  ) }),
309
- /* @__PURE__ */ jsx(Accordion.Content, { variant: "text", children: "\uD56D\uBAA9 1 \uB0B4\uC6A9" })
377
+ /* @__PURE__ */ jsx(Accordion.Content, { variant: "text", children: /* @__PURE__ */ jsx(
378
+ JobSearchDetail,
379
+ {
380
+ occupationTypeCode: job.occupationTypeCode || "",
381
+ occupationIndustryCode: job.occupationIndustryCode
382
+ }
383
+ ) })
310
384
  ]
311
385
  },
312
386
  `item-${job.occupationIndustryCode}-${index}`
@@ -339,22 +413,13 @@ function JobSearchResult({ filteredJobs, onJobSelect, searchTerm }) {
339
413
  children: highlightOnSearchKeyword$1(job.occupationIndustryName, searchTerm)
340
414
  }
341
415
  ) }) }),
342
- /* @__PURE__ */ jsx(Accordion.Content, { variant: "text", children: /* @__PURE__ */ jsx(Table, { variant: "horizontal", children: /* @__PURE__ */ jsxs("tbody", { children: [
343
- /* @__PURE__ */ jsxs("tr", { children: [
344
- /* @__PURE__ */ jsx("th", { children: "\uD5E4\uB354 1" }),
345
- /* @__PURE__ */ jsx("td", { className: "px-24", children: "1\uD589 1\uBC88\uC9F8" }),
346
- /* @__PURE__ */ jsx("th", { children: "\uD5E4\uB354 1-2" }),
347
- /* @__PURE__ */ jsx("td", { className: "px-24 ", children: "1\uD589 2\uBC88\uC9F8" })
348
- ] }),
349
- /* @__PURE__ */ jsxs("tr", { children: [
350
- /* @__PURE__ */ jsx("th", { children: "\uD5E4\uB354 2" }),
351
- /* @__PURE__ */ jsx("td", { className: "pl-24 pr-16", colSpan: 3, children: /* @__PURE__ */ jsxs("p", { className: "d-flex-center-center", children: [
352
- "2\uD589 1\uBC88\uC9F8 ",
353
- /* @__PURE__ */ jsx("span", { className: "flex-1 pipe-left", children: "\uC11C\uBE0C\uD14D\uC2A4\uD2B8" }),
354
- /* @__PURE__ */ jsx(Button, { variant: "neutral", size: "xsmall", appearance: "outline", children: "\uBC84\uD2BC\uBA85" })
355
- ] }) })
356
- ] })
357
- ] }) }) })
416
+ /* @__PURE__ */ jsx(Accordion.Content, { variant: "text", children: /* @__PURE__ */ jsx(
417
+ JobSearchDetail,
418
+ {
419
+ occupationTypeCode: job.occupationTypeCode || "",
420
+ occupationIndustryCode: job.occupationIndustryCode
421
+ }
422
+ ) })
358
423
  ]
359
424
  },
360
425
  job.occupationIndustryCode
@@ -2384,34 +2449,20 @@ const JobSearchModal = ({ onClose }) => {
2384
2449
  ] });
2385
2450
  };
2386
2451
 
2387
- const mockCustomers = [
2388
- { customerId: "1", customerName: "\uAE40\uD55C\uD654", birthDate: "1999.01.01", genderCode: "\uB0A8\uC131" },
2389
- {
2390
- customerId: "2",
2391
- customerName: "\uAE40\uD55C\uD654\uC0DD\uBA85",
2392
- birthDate: "1989.01.01",
2393
- genderCode: "\uC5EC\uC131",
2394
- baseAddress: "\uC11C\uC6B8\uC2DC \uB9C8\uD3EC\uAD6C"
2395
- },
2396
- {
2397
- customerId: "3",
2398
- customerName: "\uAE40\uD55C\uD654\uC190\uD574\uBCF4\uD5D8",
2399
- birthDate: "1999.01.01",
2400
- genderCode: "\uB0A8\uC131",
2401
- baseAddress: "\uC11C\uC6B8\uC2DC \uB9C8\uD3EC\uAD6C"
2402
- }
2403
- ];
2404
2452
  const useCustomerSearch = (onSelect) => {
2405
2453
  const { triggerRef, isOpen, setIsOpen, DropDown } = useDropDown();
2406
2454
  const [searchKeyword, setSearchKeyword] = useState("");
2407
2455
  const [searchInput, setSearchInput] = useState("");
2408
2456
  const [customerList, setCustomerList] = useState([]);
2409
2457
  const [selectedCustomer, setSelectedCustomer] = useState(null);
2458
+ const { data } = useSearchCustomerListQuery({ customerName: searchKeyword });
2410
2459
  const search = () => {
2411
2460
  if (searchInput.length >= 2) {
2412
2461
  setSearchKeyword(searchInput);
2413
- const filtered = mockCustomers.filter((c) => c.customerName?.toLowerCase().includes(searchInput.toLowerCase()));
2414
- setCustomerList(filtered);
2462
+ const filtered = data?.data?.custList?.filter(
2463
+ (c) => c.customerName?.toLowerCase().includes(searchInput.toLowerCase())
2464
+ );
2465
+ setCustomerList(filtered || []);
2415
2466
  setIsOpen(true);
2416
2467
  } else {
2417
2468
  setCustomerList([]);
@@ -2527,5 +2578,203 @@ const CustomerSearch = ({ onSelect }) => {
2527
2578
  ] });
2528
2579
  };
2529
2580
 
2530
- export { Attachment, BankStockSearchModal, CustomerSearch, EmployeeSearchModal, FormCheckbox, FormCheckboxButton, FormDatePicker, FormDateRangePicker, FormSearchJobField, FormSegmentGroup, FormSelect, FormTextField, JobSearchModal, OrganizationSearchModal, StepIndicator, resize, testSignatureBase64Data, useAddressComponent, useBankStockSearch, useCamera, useCanvasPaint, useJobVehicleSearchModal, useSearchAddress };
2581
+ const VERIFICATION_CODES = {
2582
+ SUCCESS: "0000",
2583
+ USER_CANCEL: "9000",
2584
+ TOKEN_ERROR: "9001",
2585
+ CAMERA_PERMISSION: "9002",
2586
+ ATTEMPT_EXCEEDED: "9003",
2587
+ SERVER_ERROR: "9999"
2588
+ };
2589
+ const useRemoteIdentityVerification = ({
2590
+ rivEnv,
2591
+ rivOrigin,
2592
+ tokenRequestParams,
2593
+ apiConfig,
2594
+ onCancel,
2595
+ onError,
2596
+ onSuccess,
2597
+ rivSearchParams
2598
+ }) => {
2599
+ const rivHost = rivOrigin ?? `https://${rivEnv === "prd" ? "" : rivEnv === "stg" ? "qa" : "dev"}riv.hanwhalife.com`;
2600
+ const createRemoteIdentityVerificationUrl = async () => {
2601
+ const response = await getRemoteIdentityVerificationSystemToken(tokenRequestParams, apiConfig);
2602
+ const { accessToken, remoteIdentityVerificationSystemRequestId } = response.data;
2603
+ const urlParams = new URLSearchParams({
2604
+ authorization: accessToken,
2605
+ rivsRqstId: remoteIdentityVerificationSystemRequestId,
2606
+ ...rivSearchParams
2607
+ });
2608
+ return { fullUrl: `${rivHost}/?${urlParams.toString()}`, rivsRqstId: remoteIdentityVerificationSystemRequestId };
2609
+ };
2610
+ const createMessageHandler = ({ rivsRqstId }, cleanup) => {
2611
+ return (event) => {
2612
+ try {
2613
+ const response = typeof event.data === "string" ? JSON.parse(decodeURIComponent(event.data)) : event.data;
2614
+ if (response.command !== "webClose") {
2615
+ return;
2616
+ }
2617
+ const { result, code } = response.args;
2618
+ switch (code) {
2619
+ case VERIFICATION_CODES.USER_CANCEL:
2620
+ console.log("=====\uC0AC\uC6A9\uC790 \uC885\uB8CC!=====", { result, code });
2621
+ onCancel?.({ result, code });
2622
+ cleanup?.();
2623
+ break;
2624
+ case VERIFICATION_CODES.TOKEN_ERROR:
2625
+ case VERIFICATION_CODES.CAMERA_PERMISSION:
2626
+ case VERIFICATION_CODES.ATTEMPT_EXCEEDED:
2627
+ case VERIFICATION_CODES.SERVER_ERROR:
2628
+ console.log("=====\uBE44\uB300\uBA74\uC778\uC99D \uC2E4\uD328!=====", { result, code });
2629
+ onError?.({ result, code });
2630
+ cleanup?.();
2631
+ break;
2632
+ case VERIFICATION_CODES.SUCCESS:
2633
+ console.log("=====\uBE44\uB300\uBA74\uC778\uC99D \uC131\uACF5!=====", { result, code });
2634
+ onSuccess?.({ result, code }, { rivsRqstId });
2635
+ cleanup?.();
2636
+ break;
2637
+ default:
2638
+ console.warn("Unknown verification code:", code);
2639
+ }
2640
+ } catch (error) {
2641
+ console.error("Failed to parse postMessage:", error);
2642
+ }
2643
+ };
2644
+ };
2645
+ return {
2646
+ createRemoteIdentityVerificationUrl,
2647
+ createMessageHandler
2648
+ };
2649
+ };
2650
+ const useRemoteIdentityVerificationIframe = (config) => {
2651
+ const { createMessageHandler, createRemoteIdentityVerificationUrl } = useRemoteIdentityVerification(config);
2652
+ const { isOpen, openModal, closeModal } = useModalState();
2653
+ const [remoteIdentityVerificationUrl, setRemoteIdentityVerificationUrl] = useState("");
2654
+ const [rivsRqstId, setRivsRqstId] = useState("");
2655
+ const [isCreatingUrl, setIsCreatingUrl] = useState(false);
2656
+ const [isIframeLoaded, setIsIframeLoaded] = useState(false);
2657
+ const createIframeUrl = async () => {
2658
+ if (remoteIdentityVerificationUrl || isCreatingUrl) {
2659
+ return;
2660
+ }
2661
+ setIsCreatingUrl(true);
2662
+ setIsIframeLoaded(false);
2663
+ try {
2664
+ const { fullUrl, rivsRqstId: rivsRqstId2 } = await createRemoteIdentityVerificationUrl();
2665
+ setRemoteIdentityVerificationUrl(fullUrl);
2666
+ setRivsRqstId(rivsRqstId2);
2667
+ } catch (error) {
2668
+ console.error("Failed to create URL:", error);
2669
+ throw error;
2670
+ } finally {
2671
+ setIsCreatingUrl(false);
2672
+ }
2673
+ };
2674
+ const openRivIframe = async () => {
2675
+ try {
2676
+ await createIframeUrl();
2677
+ openModal();
2678
+ } catch (error) {
2679
+ console.error("openRivIframe error::", error);
2680
+ await ModalUtils.alert("\uBE44\uB300\uBA74 \uC778\uC99D URL \uC0DD\uC131\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694.");
2681
+ }
2682
+ };
2683
+ const closeRivIframe = () => {
2684
+ setRemoteIdentityVerificationUrl("");
2685
+ setRivsRqstId("");
2686
+ setIsIframeLoaded(false);
2687
+ closeModal();
2688
+ };
2689
+ useEffect(() => {
2690
+ if (!remoteIdentityVerificationUrl) {
2691
+ return;
2692
+ }
2693
+ const messageHandler = createMessageHandler({ rivsRqstId }, closeRivIframe);
2694
+ MessageEventManager.getInstance().registerHandler("riv-iframe-handler", messageHandler);
2695
+ return () => MessageEventManager.getInstance().unregisterHandler("riv-iframe-handler");
2696
+ }, [remoteIdentityVerificationUrl, rivsRqstId]);
2697
+ const RivIframe = ({
2698
+ width = "100%",
2699
+ height = "100%",
2700
+ ...iframeProps
2701
+ }) => {
2702
+ if (!remoteIdentityVerificationUrl) {
2703
+ return null;
2704
+ }
2705
+ return /* @__PURE__ */ jsx(
2706
+ "iframe",
2707
+ {
2708
+ src: remoteIdentityVerificationUrl,
2709
+ width,
2710
+ height,
2711
+ allow: "camera *;",
2712
+ onLoad: () => setIsIframeLoaded(true),
2713
+ ...iframeProps
2714
+ }
2715
+ );
2716
+ };
2717
+ const RivModalIframe = ({
2718
+ width = "100%",
2719
+ height = "100%",
2720
+ loadingComponent,
2721
+ ...iframeProps
2722
+ }) => {
2723
+ const isLoading = isCreatingUrl || !!remoteIdentityVerificationUrl && !isIframeLoaded;
2724
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Modal.Root, { isOpen, children: [
2725
+ isLoading && (loadingComponent || /* @__PURE__ */ jsx(Loading.Wait, { bodyText: "\uBD88\uB7EC\uC624\uB294 \uC911" })),
2726
+ /* @__PURE__ */ jsx(RivIframe, { width, height, allow: "camera *;", ...iframeProps })
2727
+ ] }) });
2728
+ };
2729
+ return {
2730
+ RivModalIframe,
2731
+ RivIframe,
2732
+ openRivIframe,
2733
+ closeRivIframe,
2734
+ remoteIdentityVerificationUrl,
2735
+ isCreatingUrl,
2736
+ isFullyLoaded: isIframeLoaded
2737
+ };
2738
+ };
2739
+ const useRemoteIdentityVerificationPopup = (config) => {
2740
+ const { createRemoteIdentityVerificationUrl, createMessageHandler } = useRemoteIdentityVerification(config);
2741
+ const [isCreatingUrl, setIsCreatingUrl] = useState(false);
2742
+ const [rivsRqstId, setRivsRqstId] = useState("");
2743
+ const popupRef = useRef(null);
2744
+ const openPopup = async (target = "_blank", features) => {
2745
+ if (popupRef.current && !popupRef.current.closed) {
2746
+ popupRef.current.close();
2747
+ }
2748
+ setIsCreatingUrl(true);
2749
+ try {
2750
+ const { fullUrl, rivsRqstId: rivsRqstId2 } = await createRemoteIdentityVerificationUrl();
2751
+ const popup = window.open(fullUrl, target, features);
2752
+ if (!popup) {
2753
+ await ModalUtils.alert("\uD31D\uC5C5\uC774 \uCC28\uB2E8\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD31D\uC5C5\uC744 \uD5C8\uC6A9\uD574\uC8FC\uC138\uC694.");
2754
+ return;
2755
+ }
2756
+ setRivsRqstId(rivsRqstId2);
2757
+ popupRef.current = popup;
2758
+ } catch (error) {
2759
+ console.error("openPopup error::", error);
2760
+ await ModalUtils.alert("\uBE44\uB300\uBA74 \uC778\uC99D URL \uC0DD\uC131\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694.");
2761
+ } finally {
2762
+ setIsCreatingUrl(false);
2763
+ }
2764
+ };
2765
+ const cleanPopup = () => {
2766
+ popupRef.current = null;
2767
+ };
2768
+ useEffect(() => {
2769
+ const messageHandler = createMessageHandler({ rivsRqstId }, cleanPopup);
2770
+ MessageEventManager.getInstance().registerHandler("riv-popup-handler", messageHandler);
2771
+ return () => MessageEventManager.getInstance().unregisterHandler("riv-popup-handler");
2772
+ }, [rivsRqstId]);
2773
+ return {
2774
+ openPopup,
2775
+ isCreatingUrl
2776
+ };
2777
+ };
2778
+
2779
+ export { Attachment, BankStockSearchModal, CustomerSearch, EmployeeSearchModal, FormCheckbox, FormCheckboxButton, FormDatePicker, FormDateRangePicker, FormSearchJobField, FormSegmentGroup, FormSelect, FormTextField, JobSearchModal, OrganizationSearchModal, StepIndicator, resize, testSignatureBase64Data, useAddressComponent, useBankStockSearch, useCamera, useCanvasPaint, useJobVehicleSearchModal, useRemoteIdentityVerification, useRemoteIdentityVerificationIframe, useRemoteIdentityVerificationPopup, useSearchAddress };
2531
2780
  //# sourceMappingURL=index.esm.js.map