sales-frontend-components 0.0.153 → 0.0.155

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
@@ -5,6 +5,7 @@ import * as React$1 from 'react';
5
5
  import React__default from 'react';
6
6
  import * as sales_frontend_api_method from 'sales-frontend-api/method';
7
7
  import { AddressStandardizationResponseDto, AddressResponseDto, CodeDto, CustomerSearchProps, CustomerDto, NationalityResponseDto, VisaStatusResponseDto, PersonalCustomerProfileResponseDto, EmployeeProfileResponseDto, OccupationResponseDto, OccupationDetailResponseDto, OrganizationProfileResponse, RemoteIdentityVerificationSystemTokenRequestDto, ApiConfig } from 'sales-frontend-api/method';
8
+ import { NxlOneResponse, NxlOneProps } from 'sales-frontend-solution';
8
9
 
9
10
  declare const FormCheckboxButton: <TFormValues extends FieldValues>({ name, control, disabled, children, ...props }: Pick<UseControllerProps<TFormValues>, "name" | "control" | "disabled"> & Omit<CheckboxButtonProps, "id">) => react_jsx_runtime.JSX.Element;
10
11
 
@@ -314,19 +315,6 @@ declare const useNationalityComponent: () => {
314
315
  NationalitySearchComponent: () => react_jsx_runtime.JSX.Element;
315
316
  };
316
317
 
317
- type NxlOneProps = {
318
- bizCode: string;
319
- tmplCode: string;
320
- ncsrInfoUuid?: string;
321
- nlcCtfnId?: string;
322
- t?: string;
323
- };
324
- type NxlOneResponse = {
325
- action?: 'error' | 'close' | 'complete';
326
- redirectUrl?: string;
327
- nlcCtfnId?: string;
328
- };
329
-
330
318
  type Step = 'appInit' | 'tabletEformInit' | 'tabletEformRe' | 'tabletEformSubInfo' | 'smartphoneEformSubInfo' | 'smartphoneEformAlimtalkInit' | 'smartphoneEformAlimtalkRe' | 'tabletNewCustomer' | 'tabletNewCustomerLegalRep' | 'tabletCustomerInfoPlanAgreement' | 'tabletCustomerInfoProductAgreement';
331
319
  interface CodeSet {
332
320
  dev: {
@@ -620,4 +608,4 @@ declare const useDownloader: () => {
620
608
  };
621
609
 
622
610
  export { Attachment, BankStockSearchModal, CODES, CustomerSearch, CustomerSearchModal, DeaCustomerSearchModal, DudDownload, DudUpload, EmployeeSearchModal, FormCheckbox, FormCheckboxButton, FormDatePicker, FormDateRangePicker, FormSearchJobField, FormSegmentGroup, FormSelect, FormTextField, JobVehicleSearchModal, OrganizationSearchModal, RIV_SEARCH_PARAM_MAP, StepIndicator, resize, testSignatureBase64Data, useAddressComponent, useBankStockSearch, useCamera, useCanvasPaint, useDownloader, useJobSearchModal, useJobVehicleSearchModal, useNationalityComponent, useNxlOneModal, useRemoteIdentityVerification, useRemoteIdentityVerificationIframe, useRemoteIdentityVerificationPopup, useSearchAddress, useSearchNationality, useSearchVisa, useVisaComponent };
623
- export type { AttachedPhoto, AttachmentProps, BankStockSearchModalProps, CodeSet, DownloadProps, DownloadTargetInfo, DownloaderProps, FormSegmentGroupProps, NxlOneProps, NxlOneResponse, PaintProps, Pen, RemoteIdentityVerificationSuccess, RivUrlParams, Step, StepIndicatorProps, StepItem, UseRemoteIdentityVerificationProps, VerificationResponse, cameraItemType, cameraOptions };
611
+ export type { AttachedPhoto, AttachmentProps, BankStockSearchModalProps, CodeSet, DownloadProps, DownloadTargetInfo, DownloaderProps, FormSegmentGroupProps, PaintProps, Pen, RemoteIdentityVerificationSuccess, RivUrlParams, Step, StepIndicatorProps, StepItem, UseRemoteIdentityVerificationProps, VerificationResponse, cameraItemType, cameraOptions };
package/dist/index.esm.js CHANGED
@@ -8,6 +8,7 @@ import styles from './modal/standard/address-search/select-address.module.scss';
8
8
  import styles$1 from './modal/standard/bank-stock-search/bank-stock-search-modal.module.scss';
9
9
  import styles$2 from './modal/standard/customer-search/customer-search.module.scss';
10
10
  import styles$3 from './modal/standard/nationality-search/select-nationality.module.scss';
11
+ import { useNxlOne } from 'sales-frontend-solution';
11
12
  import styles$4 from './modal/standard/visa-search/select-visa.module.scss';
12
13
  import { useQuery } from '@tanstack/react-query';
13
14
  import styles$5 from './modal/pre-standard/dea-customer-search-modal/dea-customer-search-modal.module.scss';
@@ -1398,12 +1399,39 @@ const useNationalityComponent = () => {
1398
1399
  var __defProp = Object.defineProperty;
1399
1400
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1400
1401
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1401
- var isClient = () => {
1402
- try {
1403
- return !!window;
1404
- } catch {
1405
- return false;
1402
+ var getCookie = (name) => {
1403
+ if (typeof document === "undefined") {
1404
+ return "";
1406
1405
  }
1406
+ const match = document.cookie.match(new RegExp(`(^|; *)${name}=([^;]*)`));
1407
+ return match ? decodeURIComponent(match[2] || "") : "";
1408
+ };
1409
+ var getSubdomain = (hostname) => {
1410
+ if (!hostname || hostname === "localhost" || hostname === "127.0.0.1") {
1411
+ return "";
1412
+ }
1413
+ const parts = hostname.split(".");
1414
+ if (parts.length < 3) {
1415
+ return "";
1416
+ }
1417
+ return parts[0] ?? "";
1418
+ };
1419
+ var getEnvironmentFromHostname = (hostname) => {
1420
+ const debugModeEnv = getCookie("dsp-debug-mode-env")?.toLowerCase();
1421
+ if (debugModeEnv) {
1422
+ return debugModeEnv;
1423
+ }
1424
+ const subDomain = getSubdomain(hostname);
1425
+ if (hostname === "localhost" || hostname === "127.0.0.1" || hostname.startsWith("localhost")) {
1426
+ return "local";
1427
+ }
1428
+ if (subDomain.includes(`dev`)) {
1429
+ return "dev";
1430
+ }
1431
+ if (subDomain.includes("stg")) {
1432
+ return "stg";
1433
+ }
1434
+ return "prd";
1407
1435
  };
1408
1436
  var _MessageEventManager = class _MessageEventManager2 {
1409
1437
  constructor() {
@@ -1613,123 +1641,6 @@ function getE2EDataIDs(ids, onSuccess, onFailure = () => {
1613
1641
  }
1614
1642
  }
1615
1643
 
1616
- const url = (() => {
1617
- const type = isClient() ? window.location.hostname : "";
1618
- if (type.includes("localhost") || type.includes("local.hanwhalife.com")) {
1619
- return "https://nxl-nlc-stg.hanwhalife.com";
1620
- }
1621
- if (type.includes("dev")) {
1622
- return "https://nxl-nlc-dev.hanwhalife.com";
1623
- } else if (type.includes("stg")) {
1624
- return "https://nxl-nlc-stg.hanwhalife.com";
1625
- } else {
1626
- return "https://nxl-nlc.hanwhalife.com";
1627
- }
1628
- })();
1629
- function useNxlOne({ bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, t = "dp" }) {
1630
- const buildUrl = useCallback(() => {
1631
- const targetUrl = new URL("/auth/v1", url);
1632
- targetUrl.searchParams.set("bizCode", bizCode);
1633
- targetUrl.searchParams.set("tmplCode", tmplCode);
1634
- if (nlcCtfnId) {
1635
- targetUrl.searchParams.set("nlcCtfnId", nlcCtfnId);
1636
- }
1637
- if (t) {
1638
- targetUrl.searchParams.set("t", t);
1639
- }
1640
- if (ncsrInfoUuid) {
1641
- targetUrl.searchParams.set("ncsrInfoUuid", ncsrInfoUuid);
1642
- }
1643
- return targetUrl.toString();
1644
- }, [bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, t]);
1645
- const redirect = () => {
1646
- const targetUrl = buildUrl();
1647
- location.href = targetUrl;
1648
- };
1649
- const open = async (options) => {
1650
- return new Promise((resolve, reject) => {
1651
- const targetUrl = buildUrl();
1652
- console.log("targetUrl", targetUrl);
1653
- const width = options && options.popupWidth || 720;
1654
- const height = options && options.popupHeight || 720;
1655
- const left = options && options.popupLeft || (window.screen.width - width) / 2;
1656
- const top = options && options.popupTop || (window.screen.height - height) / 2;
1657
- const popupFeatures = `width=${width},height=${height},left=${left},top=${top}`;
1658
- const popup = window.open(targetUrl, options && options.windowName || "_self_cert", popupFeatures);
1659
- if (!popup) {
1660
- reject(new Error("\uCC28\uB2E8\uB418\uAC70\uB098 \uC5F4\uB9AC\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4."));
1661
- return;
1662
- }
1663
- const handleMessage = (event) => {
1664
- console.log("popup message event", event.origin, new URL(targetUrl).origin);
1665
- if (event.origin !== new URL(targetUrl).origin) {
1666
- return;
1667
- }
1668
- if (event.data) {
1669
- resolve(event.data);
1670
- } else {
1671
- reject(new Error("\uC778\uC99D\uC774 \uCDE8\uC18C\uB418\uAC70\uB098 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4."));
1672
- }
1673
- popup.close();
1674
- window.removeEventListener("message", handleMessage);
1675
- };
1676
- window.addEventListener("message", handleMessage);
1677
- });
1678
- };
1679
- const Iframe = function({
1680
- height = 720,
1681
- className,
1682
- style,
1683
- allow,
1684
- sandbox = "allow-scripts allow-forms allow-same-origin",
1685
- onSuccess,
1686
- onError,
1687
- onClose,
1688
- strictOrigin = true
1689
- }) {
1690
- const targetUrl = buildUrl();
1691
- useEffect(() => {
1692
- if (!onSuccess && !onError) {
1693
- return;
1694
- }
1695
- const handler = (e) => {
1696
- console.log("message event", e);
1697
- const d = e.data;
1698
- if (d) {
1699
- if (d.action === "close") {
1700
- onClose?.(d);
1701
- } else if (d.action === "error") {
1702
- onError?.(d);
1703
- } else if (d.action === "complete") {
1704
- onSuccess?.(d);
1705
- }
1706
- } else {
1707
- onError?.({
1708
- action: "error",
1709
- nlcCtfnId: "",
1710
- redirectUrl: ""
1711
- });
1712
- }
1713
- };
1714
- window.addEventListener("message", handler);
1715
- return () => window.removeEventListener("message", handler);
1716
- }, [onClose, onError, onSuccess, strictOrigin]);
1717
- return /* @__PURE__ */ jsx(
1718
- "iframe",
1719
- {
1720
- src: targetUrl,
1721
- width: "100%",
1722
- height: typeof height === "number" ? `${height}px` : height,
1723
- style: { border: 0, ...style },
1724
- className,
1725
- sandbox,
1726
- ...allow ? { allow } : {}
1727
- }
1728
- );
1729
- };
1730
- return { open, redirect, Iframe };
1731
- }
1732
-
1733
1644
  const CODES = {
1734
1645
  appInit: {
1735
1646
  dev: {
@@ -1866,8 +1777,8 @@ function useNxlOneModal({
1866
1777
  tmplCode: nxlOnePropsState.tmplCode || tmplCode
1867
1778
  });
1868
1779
  const openNxlOneModal = () => {
1869
- const type = isClient() ? window.location.hostname : "";
1870
- if (type.includes("localhost") || type.includes("local.hanwhalife.com")) {
1780
+ const stage = getEnvironmentFromHostname(location.hostname);
1781
+ if (stage === "local") {
1871
1782
  open({ popupWidth: 500, popupHeight: 500 }).then((result) => {
1872
1783
  onSuccess(result);
1873
1784
  });