sales-frontend-utils 0.0.28 → 0.0.29

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 CHANGED
@@ -108,15 +108,22 @@ var isStorybookEnv = () => {
108
108
  var getBusinessWorkDivisionCode = () => {
109
109
  return location.pathname.split("/")[1] ?? "";
110
110
  };
111
- var getDudApiHostNameFromEnvironment = (serviceCode, hostname) => {
112
- const environment = getEnvironmentFromHostname(hostname);
111
+ var getServiceCode = () => {
112
+ if (typeof window.isStorybookEnv === "boolean") {
113
+ return "";
114
+ } else {
115
+ return `/${location.pathname.split("/")[1]}`;
116
+ }
117
+ };
118
+ var getDudApiHostNameFromEnvironment = (hostname) => {
119
+ const environment = getEnvironmentFromHostname(hostname || location.hostname);
113
120
  switch (environment) {
114
121
  /**
115
122
  * local에서 호출시, rewrite동작을 위해 상대주소를 호출합니다.
116
123
  * (cors이슈 해결을 위해 필수)
117
124
  */
118
125
  case "local":
119
- return `${serviceCode}/api/dud`;
126
+ return `${getServiceCode()}/api/dud`;
120
127
  /**
121
128
  * local 이 아닌 환경에서는 전체주소를 호출합니다.
122
129
  */
@@ -127,6 +134,30 @@ var getDudApiHostNameFromEnvironment = (serviceCode, hostname) => {
127
134
  case "prd":
128
135
  return `https://dsp-dud.hanwhalife.com`;
129
136
  default:
137
+ console.warn("DUD API environment is not defined");
138
+ return "";
139
+ }
140
+ };
141
+ var getDspApiHostNameFromEnvironment = (serviceCodeTo, hostname) => {
142
+ const environment = getEnvironmentFromHostname(hostname || location.hostname);
143
+ switch (environment) {
144
+ /**
145
+ * local에서 호출시, rewrite동작을 위해 상대주소를 호출합니다.
146
+ * (cors이슈 해결을 위해 필수)
147
+ */
148
+ case "local":
149
+ return `${getServiceCode()}/api/${serviceCodeTo}`;
150
+ /**
151
+ * local 이 아닌 환경에서는 전체주소를 호출합니다.
152
+ */
153
+ case "dev":
154
+ return `https://nxl-dsp-dev.hanwhalife.com/api/${serviceCodeTo}`;
155
+ case "stg":
156
+ return `https://nxl-dsp-stg.hanwhalife.com/api/${serviceCodeTo}`;
157
+ case "prd":
158
+ return `https://nxl-dsp.hanwhalife.com/api/${serviceCodeTo}`;
159
+ default:
160
+ console.warn("DSP API environment is not defined");
130
161
  return "";
131
162
  }
132
163
  };
@@ -783,6 +814,7 @@ exports.getCurrentBrowserVersion = getCurrentBrowserVersion;
783
814
  exports.getCurrentOSName = getCurrentOSName;
784
815
  exports.getCurrentOSVersion = getCurrentOSVersion;
785
816
  exports.getDeviceModel = getDeviceModel;
817
+ exports.getDspApiHostNameFromEnvironment = getDspApiHostNameFromEnvironment;
786
818
  exports.getDspExecutionEnvironment = getDspExecutionEnvironment;
787
819
  exports.getDudApiHostNameFromEnvironment = getDudApiHostNameFromEnvironment;
788
820
  exports.getE2EDataIDs = getE2EDataIDs;