sales-frontend-components 0.0.152 → 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 +13 -13
package/dist/index.cjs.js
CHANGED
|
@@ -1400,6 +1400,40 @@ const useNationalityComponent = () => {
|
|
|
1400
1400
|
var __defProp = Object.defineProperty;
|
|
1401
1401
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1402
1402
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1403
|
+
var getCookie = (name) => {
|
|
1404
|
+
if (typeof document === "undefined") {
|
|
1405
|
+
return "";
|
|
1406
|
+
}
|
|
1407
|
+
const match = document.cookie.match(new RegExp(`(^|; *)${name}=([^;]*)`));
|
|
1408
|
+
return match ? decodeURIComponent(match[2] || "") : "";
|
|
1409
|
+
};
|
|
1410
|
+
var getSubdomain = (hostname) => {
|
|
1411
|
+
if (!hostname || hostname === "localhost" || hostname === "127.0.0.1") {
|
|
1412
|
+
return "";
|
|
1413
|
+
}
|
|
1414
|
+
const parts = hostname.split(".");
|
|
1415
|
+
if (parts.length < 3) {
|
|
1416
|
+
return "";
|
|
1417
|
+
}
|
|
1418
|
+
return parts[0] ?? "";
|
|
1419
|
+
};
|
|
1420
|
+
var getEnvironmentFromHostname = (hostname) => {
|
|
1421
|
+
const debugModeEnv = getCookie("dsp-debug-mode-env")?.toLowerCase();
|
|
1422
|
+
if (debugModeEnv) {
|
|
1423
|
+
return debugModeEnv;
|
|
1424
|
+
}
|
|
1425
|
+
const subDomain = getSubdomain(hostname);
|
|
1426
|
+
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname.startsWith("localhost")) {
|
|
1427
|
+
return "local";
|
|
1428
|
+
}
|
|
1429
|
+
if (subDomain.includes(`dev`)) {
|
|
1430
|
+
return "dev";
|
|
1431
|
+
}
|
|
1432
|
+
if (subDomain.includes("stg")) {
|
|
1433
|
+
return "stg";
|
|
1434
|
+
}
|
|
1435
|
+
return "prd";
|
|
1436
|
+
};
|
|
1403
1437
|
var isClient = () => {
|
|
1404
1438
|
try {
|
|
1405
1439
|
return !!window;
|
|
@@ -1407,6 +1441,25 @@ var isClient = () => {
|
|
|
1407
1441
|
return false;
|
|
1408
1442
|
}
|
|
1409
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
|
+
};
|
|
1410
1463
|
var _MessageEventManager = class _MessageEventManager2 {
|
|
1411
1464
|
constructor() {
|
|
1412
1465
|
__publicField(this, "handlers", /* @__PURE__ */ new Map());
|
|
@@ -1615,22 +1668,10 @@ function getE2EDataIDs(ids, onSuccess, onFailure = () => {
|
|
|
1615
1668
|
}
|
|
1616
1669
|
}
|
|
1617
1670
|
|
|
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
1671
|
function useNxlOne({ bizCode, tmplCode, ncsrInfoUuid, nlcCtfnId, t = "dp" }) {
|
|
1632
1672
|
const buildUrl = React.useCallback(() => {
|
|
1633
|
-
const
|
|
1673
|
+
const baseUrl = getNlcHostFromEnvironment();
|
|
1674
|
+
const targetUrl = new URL("/auth/v1", baseUrl);
|
|
1634
1675
|
targetUrl.searchParams.set("bizCode", bizCode);
|
|
1635
1676
|
targetUrl.searchParams.set("tmplCode", tmplCode);
|
|
1636
1677
|
if (nlcCtfnId) {
|
|
@@ -1868,8 +1909,8 @@ function useNxlOneModal({
|
|
|
1868
1909
|
tmplCode: nxlOnePropsState.tmplCode || tmplCode
|
|
1869
1910
|
});
|
|
1870
1911
|
const openNxlOneModal = () => {
|
|
1871
|
-
const
|
|
1872
|
-
if (
|
|
1912
|
+
const stage = getEnvironmentFromHostname(location.hostname);
|
|
1913
|
+
if (stage === "local") {
|
|
1873
1914
|
open({ popupWidth: 500, popupHeight: 500 }).then((result) => {
|
|
1874
1915
|
onSuccess(result);
|
|
1875
1916
|
});
|