sales-frontend-components 0.0.154 → 0.0.156

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.js CHANGED
@@ -10,6 +10,7 @@ var styles = require('./modal/standard/address-search/select-address.module.scss
10
10
  var styles$1 = require('./modal/standard/bank-stock-search/bank-stock-search-modal.module.scss');
11
11
  var styles$2 = require('./modal/standard/customer-search/customer-search.module.scss');
12
12
  var styles$3 = require('./modal/standard/nationality-search/select-nationality.module.scss');
13
+ var salesFrontendSolution = require('sales-frontend-solution');
13
14
  var styles$4 = require('./modal/standard/visa-search/select-visa.module.scss');
14
15
  var reactQuery = require('@tanstack/react-query');
15
16
  var styles$5 = require('./modal/pre-standard/dea-customer-search-modal/dea-customer-search-modal.module.scss');
@@ -632,7 +633,17 @@ const useAddressComponent = () => {
632
633
  };
633
634
  };
634
635
 
635
- const CODE_ICON_LIST = [
636
+ const BANK_STOCK_SEARCH_MODAL_TABS = [
637
+ {
638
+ value: "bank",
639
+ label: "\uC740\uD589"
640
+ },
641
+ {
642
+ value: "stock",
643
+ label: "\uC99D\uAD8C\uC0AC"
644
+ }
645
+ ];
646
+ const BANK_STOCK_ICON_LIST = [
636
647
  {
637
648
  codeVal: "002",
638
649
  codeName: "\uC0B0\uC5C5\uC740\uD589",
@@ -973,7 +984,7 @@ function BankStockSearchModal({ open, onClose, onSelect }) {
973
984
  const chunkedList = chunk(list, 5);
974
985
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$1["list-container"], children: chunkedList.map((chunk2, chunkIndex) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$1.row, children: [
975
986
  chunk2.map((item) => {
976
- const findItem = CODE_ICON_LIST.find((icon) => icon.codeVal === item.codeVal);
987
+ const findItem = BANK_STOCK_ICON_LIST.find((icon) => icon.codeVal === item.codeVal);
977
988
  const convertedItem = findItem ? findItem : {
978
989
  icon: /* @__PURE__ */ jsxRuntime.jsx(salesFrontendAssets.IconGraphicsStockHochulEopsum, {}),
979
990
  replaceName: item.codeName
@@ -1434,32 +1445,6 @@ var getEnvironmentFromHostname = (hostname) => {
1434
1445
  }
1435
1446
  return "prd";
1436
1447
  };
1437
- var isClient = () => {
1438
- try {
1439
- return !!window;
1440
- } catch {
1441
- return false;
1442
- }
1443
- };
1444
- var getNlcHostFromEnvironment = (hostname) => {
1445
- if (!isClient()) {
1446
- return "";
1447
- }
1448
- const environment = getEnvironmentFromHostname(location.hostname);
1449
- switch (environment) {
1450
- case "local":
1451
- return `https://nxl-nlc-stg.hanwhalife.com`;
1452
- case "dev":
1453
- return `https://nxl-nlc-dev.hanwhalife.com`;
1454
- case "stg":
1455
- return `https://nxl-nlc-stg.hanwhalife.com`;
1456
- case "prd":
1457
- return `https://nxl-nlc.hanwhalife.com`;
1458
- default:
1459
- console.warn("NLC environment is not defined");
1460
- return "";
1461
- }
1462
- };
1463
1448
  var _MessageEventManager = class _MessageEventManager2 {
1464
1449
  constructor() {
1465
1450
  __publicField(this, "handlers", /* @__PURE__ */ new Map());
@@ -1668,111 +1653,6 @@ function getE2EDataIDs(ids, onSuccess, onFailure = () => {
1668
1653
  }
1669
1654
  }
1670
1655
 
1671
- function useNxlOne({ bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, t = "dp" }) {
1672
- const buildUrl = React.useCallback(() => {
1673
- const baseUrl = getNlcHostFromEnvironment();
1674
- const targetUrl = new URL("/auth/v1", baseUrl);
1675
- targetUrl.searchParams.set("bizCode", bizCode);
1676
- targetUrl.searchParams.set("tmplCode", tmplCode);
1677
- if (nlcCtfnId) {
1678
- targetUrl.searchParams.set("nlcCtfnId", nlcCtfnId);
1679
- }
1680
- if (t) {
1681
- targetUrl.searchParams.set("t", t);
1682
- }
1683
- if (ncsrInfoUuid) {
1684
- targetUrl.searchParams.set("ncsrInfoUuid", ncsrInfoUuid);
1685
- }
1686
- return targetUrl.toString();
1687
- }, [bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, t]);
1688
- const redirect = () => {
1689
- const targetUrl = buildUrl();
1690
- location.href = targetUrl;
1691
- };
1692
- const open = async (options) => {
1693
- return new Promise((resolve, reject) => {
1694
- const targetUrl = buildUrl();
1695
- console.log("targetUrl", targetUrl);
1696
- const width = options && options.popupWidth || 720;
1697
- const height = options && options.popupHeight || 720;
1698
- const left = options && options.popupLeft || (window.screen.width - width) / 2;
1699
- const top = options && options.popupTop || (window.screen.height - height) / 2;
1700
- const popupFeatures = `width=${width},height=${height},left=${left},top=${top}`;
1701
- const popup = window.open(targetUrl, options && options.windowName || "_self_cert", popupFeatures);
1702
- if (!popup) {
1703
- reject(new Error("\uCC28\uB2E8\uB418\uAC70\uB098 \uC5F4\uB9AC\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4."));
1704
- return;
1705
- }
1706
- const handleMessage = (event) => {
1707
- console.log("popup message event", event.origin, new URL(targetUrl).origin);
1708
- if (event.origin !== new URL(targetUrl).origin) {
1709
- return;
1710
- }
1711
- if (event.data) {
1712
- resolve(event.data);
1713
- } else {
1714
- reject(new Error("\uC778\uC99D\uC774 \uCDE8\uC18C\uB418\uAC70\uB098 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4."));
1715
- }
1716
- popup.close();
1717
- window.removeEventListener("message", handleMessage);
1718
- };
1719
- window.addEventListener("message", handleMessage);
1720
- });
1721
- };
1722
- const Iframe = function({
1723
- height = 720,
1724
- className,
1725
- style,
1726
- allow,
1727
- sandbox = "allow-scripts allow-forms allow-same-origin",
1728
- onSuccess,
1729
- onError,
1730
- onClose,
1731
- strictOrigin = true
1732
- }) {
1733
- const targetUrl = buildUrl();
1734
- React.useEffect(() => {
1735
- if (!onSuccess && !onError) {
1736
- return;
1737
- }
1738
- const handler = (e) => {
1739
- console.log("message event", e);
1740
- const d = e.data;
1741
- if (d) {
1742
- if (d.action === "close") {
1743
- onClose?.(d);
1744
- } else if (d.action === "error") {
1745
- onError?.(d);
1746
- } else if (d.action === "complete") {
1747
- onSuccess?.(d);
1748
- }
1749
- } else {
1750
- onError?.({
1751
- action: "error",
1752
- nlcCtfnId: "",
1753
- redirectUrl: ""
1754
- });
1755
- }
1756
- };
1757
- window.addEventListener("message", handler);
1758
- return () => window.removeEventListener("message", handler);
1759
- }, [onClose, onError, onSuccess, strictOrigin]);
1760
- return /* @__PURE__ */ jsxRuntime.jsx(
1761
- "iframe",
1762
- {
1763
- src: targetUrl,
1764
- width: "100%",
1765
- height: typeof height === "number" ? `${height}px` : height,
1766
- style: { border: 0, ...style },
1767
- className,
1768
- sandbox,
1769
- ...allow ? { allow } : {}
1770
- }
1771
- );
1772
- };
1773
- return { open, redirect, Iframe };
1774
- }
1775
-
1776
1656
  const CODES = {
1777
1657
  appInit: {
1778
1658
  dev: {
@@ -1903,7 +1783,7 @@ function useNxlOneModal({
1903
1783
  const { isOpen, openModal, closeModal } = salesFrontendDesignSystem.useModalState();
1904
1784
  const [nxlOnePropsState, setNxlOnePropsState] = React.useState(nxlOneProps);
1905
1785
  const { bizCode, tmplCode } = CODES[step][env];
1906
- const { Iframe, open } = useNxlOne({
1786
+ const { Iframe, open } = salesFrontendSolution.useNxlOne({
1907
1787
  ...nxlOnePropsState,
1908
1788
  bizCode: nxlOnePropsState.bizCode || bizCode,
1909
1789
  tmplCode: nxlOnePropsState.tmplCode || tmplCode
@@ -4549,6 +4429,8 @@ const useDownloader = () => {
4549
4429
  };
4550
4430
 
4551
4431
  exports.Attachment = Attachment;
4432
+ exports.BANK_STOCK_ICON_LIST = BANK_STOCK_ICON_LIST;
4433
+ exports.BANK_STOCK_SEARCH_MODAL_TABS = BANK_STOCK_SEARCH_MODAL_TABS;
4552
4434
  exports.BankStockSearchModal = BankStockSearchModal;
4553
4435
  exports.CODES = CODES;
4554
4436
  exports.CustomerSearch = CustomerSearch;