sales-frontend-components 0.0.153 → 0.0.154
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 +57 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +57 -16
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -14
package/dist/index.esm.js
CHANGED
|
@@ -1398,6 +1398,40 @@ const useNationalityComponent = () => {
|
|
|
1398
1398
|
var __defProp = Object.defineProperty;
|
|
1399
1399
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1400
1400
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1401
|
+
var getCookie = (name) => {
|
|
1402
|
+
if (typeof document === "undefined") {
|
|
1403
|
+
return "";
|
|
1404
|
+
}
|
|
1405
|
+
const match = document.cookie.match(new RegExp(`(^|; *)${name}=([^;]*)`));
|
|
1406
|
+
return match ? decodeURIComponent(match[2] || "") : "";
|
|
1407
|
+
};
|
|
1408
|
+
var getSubdomain = (hostname) => {
|
|
1409
|
+
if (!hostname || hostname === "localhost" || hostname === "127.0.0.1") {
|
|
1410
|
+
return "";
|
|
1411
|
+
}
|
|
1412
|
+
const parts = hostname.split(".");
|
|
1413
|
+
if (parts.length < 3) {
|
|
1414
|
+
return "";
|
|
1415
|
+
}
|
|
1416
|
+
return parts[0] ?? "";
|
|
1417
|
+
};
|
|
1418
|
+
var getEnvironmentFromHostname = (hostname) => {
|
|
1419
|
+
const debugModeEnv = getCookie("dsp-debug-mode-env")?.toLowerCase();
|
|
1420
|
+
if (debugModeEnv) {
|
|
1421
|
+
return debugModeEnv;
|
|
1422
|
+
}
|
|
1423
|
+
const subDomain = getSubdomain(hostname);
|
|
1424
|
+
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname.startsWith("localhost")) {
|
|
1425
|
+
return "local";
|
|
1426
|
+
}
|
|
1427
|
+
if (subDomain.includes(`dev`)) {
|
|
1428
|
+
return "dev";
|
|
1429
|
+
}
|
|
1430
|
+
if (subDomain.includes("stg")) {
|
|
1431
|
+
return "stg";
|
|
1432
|
+
}
|
|
1433
|
+
return "prd";
|
|
1434
|
+
};
|
|
1401
1435
|
var isClient = () => {
|
|
1402
1436
|
try {
|
|
1403
1437
|
return !!window;
|
|
@@ -1405,6 +1439,25 @@ var isClient = () => {
|
|
|
1405
1439
|
return false;
|
|
1406
1440
|
}
|
|
1407
1441
|
};
|
|
1442
|
+
var getNlcHostFromEnvironment = (hostname) => {
|
|
1443
|
+
if (!isClient()) {
|
|
1444
|
+
return "";
|
|
1445
|
+
}
|
|
1446
|
+
const environment = getEnvironmentFromHostname(location.hostname);
|
|
1447
|
+
switch (environment) {
|
|
1448
|
+
case "local":
|
|
1449
|
+
return `https://nxl-nlc-stg.hanwhalife.com`;
|
|
1450
|
+
case "dev":
|
|
1451
|
+
return `https://nxl-nlc-dev.hanwhalife.com`;
|
|
1452
|
+
case "stg":
|
|
1453
|
+
return `https://nxl-nlc-stg.hanwhalife.com`;
|
|
1454
|
+
case "prd":
|
|
1455
|
+
return `https://nxl-nlc.hanwhalife.com`;
|
|
1456
|
+
default:
|
|
1457
|
+
console.warn("NLC environment is not defined");
|
|
1458
|
+
return "";
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1408
1461
|
var _MessageEventManager = class _MessageEventManager2 {
|
|
1409
1462
|
constructor() {
|
|
1410
1463
|
__publicField(this, "handlers", /* @__PURE__ */ new Map());
|
|
@@ -1613,22 +1666,10 @@ function getE2EDataIDs(ids, onSuccess, onFailure = () => {
|
|
|
1613
1666
|
}
|
|
1614
1667
|
}
|
|
1615
1668
|
|
|
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
1669
|
function useNxlOne({ bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, t = "dp" }) {
|
|
1630
1670
|
const buildUrl = useCallback(() => {
|
|
1631
|
-
const
|
|
1671
|
+
const baseUrl = getNlcHostFromEnvironment();
|
|
1672
|
+
const targetUrl = new URL("/auth/v1", baseUrl);
|
|
1632
1673
|
targetUrl.searchParams.set("bizCode", bizCode);
|
|
1633
1674
|
targetUrl.searchParams.set("tmplCode", tmplCode);
|
|
1634
1675
|
if (nlcCtfnId) {
|
|
@@ -1866,8 +1907,8 @@ function useNxlOneModal({
|
|
|
1866
1907
|
tmplCode: nxlOnePropsState.tmplCode || tmplCode
|
|
1867
1908
|
});
|
|
1868
1909
|
const openNxlOneModal = () => {
|
|
1869
|
-
const
|
|
1870
|
-
if (
|
|
1910
|
+
const stage = getEnvironmentFromHostname(location.hostname);
|
|
1911
|
+
if (stage === "local") {
|
|
1871
1912
|
open({ popupWidth: 500, popupHeight: 500 }).then((result) => {
|
|
1872
1913
|
onSuccess(result);
|
|
1873
1914
|
});
|