sales-frontend-utils 0.0.51 → 0.0.52

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.js CHANGED
@@ -96,9 +96,11 @@ var getSubdomain = (hostname) => {
96
96
  return parts[0] ?? "";
97
97
  };
98
98
  var getEnvironmentFromHostname = (hostname) => {
99
- const debugModeEnv = getCookie("dsp-debug-mode-env")?.toLowerCase();
100
- if (debugModeEnv) {
101
- return debugModeEnv;
99
+ if (isClient()) {
100
+ const debugModeEnv = getCookie("dsp-debug-mode-env")?.toLowerCase();
101
+ if (debugModeEnv) {
102
+ return debugModeEnv;
103
+ }
102
104
  }
103
105
  const subDomain = getSubdomain(hostname);
104
106
  if (hostname === "localhost" || hostname === "127.0.0.1" || hostname.startsWith("localhost")) {
@@ -175,18 +177,15 @@ var getCdnHostNameFromEnvironment = (currentHostname, forceApiHostName) => {
175
177
  return "";
176
178
  }
177
179
  };
178
- var getDudApiBasePathFromEnvironment = (hostname) => {
179
- if (!isClient()) {
180
- return "";
181
- }
182
- const environment = getEnvironmentFromHostname(hostname || location.hostname);
180
+ var getDudApiBasePathFromEnvironment = (hostname, servicePath) => {
181
+ const environment = getEnvironmentFromHostname(hostname);
183
182
  switch (environment) {
184
183
  /**
185
184
  * local에서 호출시, rewrite동작을 위해 상대주소를 호출합니다.
186
185
  * (cors이슈 해결을 위해 필수)
187
186
  */
188
187
  case "local":
189
- return `${getServicePath()}/api/dud`;
188
+ return `${servicePath}/api/dud`;
190
189
  /**
191
190
  * local 이 아닌 환경에서는 전체주소를 호출합니다.
192
191
  */