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.cjs.js +36 -125
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -14
- package/dist/index.esm.js +35 -124
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -12
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');
|
|
@@ -1400,12 +1401,39 @@ const useNationalityComponent = () => {
|
|
|
1400
1401
|
var __defProp = Object.defineProperty;
|
|
1401
1402
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1402
1403
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1403
|
-
var
|
|
1404
|
-
|
|
1405
|
-
return
|
|
1406
|
-
} catch {
|
|
1407
|
-
return false;
|
|
1404
|
+
var getCookie = (name) => {
|
|
1405
|
+
if (typeof document === "undefined") {
|
|
1406
|
+
return "";
|
|
1408
1407
|
}
|
|
1408
|
+
const match = document.cookie.match(new RegExp(`(^|; *)${name}=([^;]*)`));
|
|
1409
|
+
return match ? decodeURIComponent(match[2] || "") : "";
|
|
1410
|
+
};
|
|
1411
|
+
var getSubdomain = (hostname) => {
|
|
1412
|
+
if (!hostname || hostname === "localhost" || hostname === "127.0.0.1") {
|
|
1413
|
+
return "";
|
|
1414
|
+
}
|
|
1415
|
+
const parts = hostname.split(".");
|
|
1416
|
+
if (parts.length < 3) {
|
|
1417
|
+
return "";
|
|
1418
|
+
}
|
|
1419
|
+
return parts[0] ?? "";
|
|
1420
|
+
};
|
|
1421
|
+
var getEnvironmentFromHostname = (hostname) => {
|
|
1422
|
+
const debugModeEnv = getCookie("dsp-debug-mode-env")?.toLowerCase();
|
|
1423
|
+
if (debugModeEnv) {
|
|
1424
|
+
return debugModeEnv;
|
|
1425
|
+
}
|
|
1426
|
+
const subDomain = getSubdomain(hostname);
|
|
1427
|
+
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname.startsWith("localhost")) {
|
|
1428
|
+
return "local";
|
|
1429
|
+
}
|
|
1430
|
+
if (subDomain.includes(`dev`)) {
|
|
1431
|
+
return "dev";
|
|
1432
|
+
}
|
|
1433
|
+
if (subDomain.includes("stg")) {
|
|
1434
|
+
return "stg";
|
|
1435
|
+
}
|
|
1436
|
+
return "prd";
|
|
1409
1437
|
};
|
|
1410
1438
|
var _MessageEventManager = class _MessageEventManager2 {
|
|
1411
1439
|
constructor() {
|
|
@@ -1615,123 +1643,6 @@ function getE2EDataIDs(ids, onSuccess, onFailure = () => {
|
|
|
1615
1643
|
}
|
|
1616
1644
|
}
|
|
1617
1645
|
|
|
1618
|
-
const url = (() => {
|
|
1619
|
-
const type = isClient() ? window.location.hostname : "";
|
|
1620
|
-
if (type.includes("localhost") || type.includes("local.hanwhalife.com")) {
|
|
1621
|
-
return "https://nxl-nlc-stg.hanwhalife.com";
|
|
1622
|
-
}
|
|
1623
|
-
if (type.includes("dev")) {
|
|
1624
|
-
return "https://nxl-nlc-dev.hanwhalife.com";
|
|
1625
|
-
} else if (type.includes("stg")) {
|
|
1626
|
-
return "https://nxl-nlc-stg.hanwhalife.com";
|
|
1627
|
-
} else {
|
|
1628
|
-
return "https://nxl-nlc.hanwhalife.com";
|
|
1629
|
-
}
|
|
1630
|
-
})();
|
|
1631
|
-
function useNxlOne({ bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, t = "dp" }) {
|
|
1632
|
-
const buildUrl = React.useCallback(() => {
|
|
1633
|
-
const targetUrl = new URL("/auth/v1", url);
|
|
1634
|
-
targetUrl.searchParams.set("bizCode", bizCode);
|
|
1635
|
-
targetUrl.searchParams.set("tmplCode", tmplCode);
|
|
1636
|
-
if (nlcCtfnId) {
|
|
1637
|
-
targetUrl.searchParams.set("nlcCtfnId", nlcCtfnId);
|
|
1638
|
-
}
|
|
1639
|
-
if (t) {
|
|
1640
|
-
targetUrl.searchParams.set("t", t);
|
|
1641
|
-
}
|
|
1642
|
-
if (ncsrInfoUuid) {
|
|
1643
|
-
targetUrl.searchParams.set("ncsrInfoUuid", ncsrInfoUuid);
|
|
1644
|
-
}
|
|
1645
|
-
return targetUrl.toString();
|
|
1646
|
-
}, [bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, t]);
|
|
1647
|
-
const redirect = () => {
|
|
1648
|
-
const targetUrl = buildUrl();
|
|
1649
|
-
location.href = targetUrl;
|
|
1650
|
-
};
|
|
1651
|
-
const open = async (options) => {
|
|
1652
|
-
return new Promise((resolve, reject) => {
|
|
1653
|
-
const targetUrl = buildUrl();
|
|
1654
|
-
console.log("targetUrl", targetUrl);
|
|
1655
|
-
const width = options && options.popupWidth || 720;
|
|
1656
|
-
const height = options && options.popupHeight || 720;
|
|
1657
|
-
const left = options && options.popupLeft || (window.screen.width - width) / 2;
|
|
1658
|
-
const top = options && options.popupTop || (window.screen.height - height) / 2;
|
|
1659
|
-
const popupFeatures = `width=${width},height=${height},left=${left},top=${top}`;
|
|
1660
|
-
const popup = window.open(targetUrl, options && options.windowName || "_self_cert", popupFeatures);
|
|
1661
|
-
if (!popup) {
|
|
1662
|
-
reject(new Error("\uCC28\uB2E8\uB418\uAC70\uB098 \uC5F4\uB9AC\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4."));
|
|
1663
|
-
return;
|
|
1664
|
-
}
|
|
1665
|
-
const handleMessage = (event) => {
|
|
1666
|
-
console.log("popup message event", event.origin, new URL(targetUrl).origin);
|
|
1667
|
-
if (event.origin !== new URL(targetUrl).origin) {
|
|
1668
|
-
return;
|
|
1669
|
-
}
|
|
1670
|
-
if (event.data) {
|
|
1671
|
-
resolve(event.data);
|
|
1672
|
-
} else {
|
|
1673
|
-
reject(new Error("\uC778\uC99D\uC774 \uCDE8\uC18C\uB418\uAC70\uB098 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4."));
|
|
1674
|
-
}
|
|
1675
|
-
popup.close();
|
|
1676
|
-
window.removeEventListener("message", handleMessage);
|
|
1677
|
-
};
|
|
1678
|
-
window.addEventListener("message", handleMessage);
|
|
1679
|
-
});
|
|
1680
|
-
};
|
|
1681
|
-
const Iframe = function({
|
|
1682
|
-
height = 720,
|
|
1683
|
-
className,
|
|
1684
|
-
style,
|
|
1685
|
-
allow,
|
|
1686
|
-
sandbox = "allow-scripts allow-forms allow-same-origin",
|
|
1687
|
-
onSuccess,
|
|
1688
|
-
onError,
|
|
1689
|
-
onClose,
|
|
1690
|
-
strictOrigin = true
|
|
1691
|
-
}) {
|
|
1692
|
-
const targetUrl = buildUrl();
|
|
1693
|
-
React.useEffect(() => {
|
|
1694
|
-
if (!onSuccess && !onError) {
|
|
1695
|
-
return;
|
|
1696
|
-
}
|
|
1697
|
-
const handler = (e) => {
|
|
1698
|
-
console.log("message event", e);
|
|
1699
|
-
const d = e.data;
|
|
1700
|
-
if (d) {
|
|
1701
|
-
if (d.action === "close") {
|
|
1702
|
-
onClose?.(d);
|
|
1703
|
-
} else if (d.action === "error") {
|
|
1704
|
-
onError?.(d);
|
|
1705
|
-
} else if (d.action === "complete") {
|
|
1706
|
-
onSuccess?.(d);
|
|
1707
|
-
}
|
|
1708
|
-
} else {
|
|
1709
|
-
onError?.({
|
|
1710
|
-
action: "error",
|
|
1711
|
-
nlcCtfnId: "",
|
|
1712
|
-
redirectUrl: ""
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
};
|
|
1716
|
-
window.addEventListener("message", handler);
|
|
1717
|
-
return () => window.removeEventListener("message", handler);
|
|
1718
|
-
}, [onClose, onError, onSuccess, strictOrigin]);
|
|
1719
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1720
|
-
"iframe",
|
|
1721
|
-
{
|
|
1722
|
-
src: targetUrl,
|
|
1723
|
-
width: "100%",
|
|
1724
|
-
height: typeof height === "number" ? `${height}px` : height,
|
|
1725
|
-
style: { border: 0, ...style },
|
|
1726
|
-
className,
|
|
1727
|
-
sandbox,
|
|
1728
|
-
...allow ? { allow } : {}
|
|
1729
|
-
}
|
|
1730
|
-
);
|
|
1731
|
-
};
|
|
1732
|
-
return { open, redirect, Iframe };
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
1646
|
const CODES = {
|
|
1736
1647
|
appInit: {
|
|
1737
1648
|
dev: {
|
|
@@ -1862,14 +1773,14 @@ function useNxlOneModal({
|
|
|
1862
1773
|
const { isOpen, openModal, closeModal } = salesFrontendDesignSystem.useModalState();
|
|
1863
1774
|
const [nxlOnePropsState, setNxlOnePropsState] = React.useState(nxlOneProps);
|
|
1864
1775
|
const { bizCode, tmplCode } = CODES[step][env];
|
|
1865
|
-
const { Iframe, open } = useNxlOne({
|
|
1776
|
+
const { Iframe, open } = salesFrontendSolution.useNxlOne({
|
|
1866
1777
|
...nxlOnePropsState,
|
|
1867
1778
|
bizCode: nxlOnePropsState.bizCode || bizCode,
|
|
1868
1779
|
tmplCode: nxlOnePropsState.tmplCode || tmplCode
|
|
1869
1780
|
});
|
|
1870
1781
|
const openNxlOneModal = () => {
|
|
1871
|
-
const
|
|
1872
|
-
if (
|
|
1782
|
+
const stage = getEnvironmentFromHostname(location.hostname);
|
|
1783
|
+
if (stage === "local") {
|
|
1873
1784
|
open({ popupWidth: 500, popupHeight: 500 }).then((result) => {
|
|
1874
1785
|
onSuccess(result);
|
|
1875
1786
|
});
|