sales-frontend-components 0.0.154 → 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.cjs.js +2 -132
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -14
- package/dist/index.esm.js +1 -131
- package/dist/index.esm.js.map +1 -1
- package/package.json +7 -5
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');
|
|
@@ -1434,32 +1435,6 @@ var getEnvironmentFromHostname = (hostname) => {
|
|
|
1434
1435
|
}
|
|
1435
1436
|
return "prd";
|
|
1436
1437
|
};
|
|
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
1438
|
var _MessageEventManager = class _MessageEventManager2 {
|
|
1464
1439
|
constructor() {
|
|
1465
1440
|
__publicField(this, "handlers", /* @__PURE__ */ new Map());
|
|
@@ -1668,111 +1643,6 @@ function getE2EDataIDs(ids, onSuccess, onFailure = () => {
|
|
|
1668
1643
|
}
|
|
1669
1644
|
}
|
|
1670
1645
|
|
|
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
1646
|
const CODES = {
|
|
1777
1647
|
appInit: {
|
|
1778
1648
|
dev: {
|
|
@@ -1903,7 +1773,7 @@ function useNxlOneModal({
|
|
|
1903
1773
|
const { isOpen, openModal, closeModal } = salesFrontendDesignSystem.useModalState();
|
|
1904
1774
|
const [nxlOnePropsState, setNxlOnePropsState] = React.useState(nxlOneProps);
|
|
1905
1775
|
const { bizCode, tmplCode } = CODES[step][env];
|
|
1906
|
-
const { Iframe, open } = useNxlOne({
|
|
1776
|
+
const { Iframe, open } = salesFrontendSolution.useNxlOne({
|
|
1907
1777
|
...nxlOnePropsState,
|
|
1908
1778
|
bizCode: nxlOnePropsState.bizCode || bizCode,
|
|
1909
1779
|
tmplCode: nxlOnePropsState.tmplCode || tmplCode
|