sales-frontend-utils 0.0.27 → 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,6 +108,59 @@ var isStorybookEnv = () => {
108
108
  var getBusinessWorkDivisionCode = () => {
109
109
  return location.pathname.split("/")[1] ?? "";
110
110
  };
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);
120
+ switch (environment) {
121
+ /**
122
+ * local에서 호출시, rewrite동작을 위해 상대주소를 호출합니다.
123
+ * (cors이슈 해결을 위해 필수)
124
+ */
125
+ case "local":
126
+ return `${getServiceCode()}/api/dud`;
127
+ /**
128
+ * local 이 아닌 환경에서는 전체주소를 호출합니다.
129
+ */
130
+ case "dev":
131
+ return `https://dsp-dud-dev.hanwhalife.com:10101`;
132
+ case "stg":
133
+ return `https://dsp-dud-stg.hanwhalife.com:10102`;
134
+ case "prd":
135
+ return `https://dsp-dud.hanwhalife.com`;
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");
161
+ return "";
162
+ }
163
+ };
111
164
 
112
165
  // src/utils/user-agent-utils.ts
113
166
  var getDspExecutionEnvironment = () => {
@@ -761,7 +814,9 @@ exports.getCurrentBrowserVersion = getCurrentBrowserVersion;
761
814
  exports.getCurrentOSName = getCurrentOSName;
762
815
  exports.getCurrentOSVersion = getCurrentOSVersion;
763
816
  exports.getDeviceModel = getDeviceModel;
817
+ exports.getDspApiHostNameFromEnvironment = getDspApiHostNameFromEnvironment;
764
818
  exports.getDspExecutionEnvironment = getDspExecutionEnvironment;
819
+ exports.getDudApiHostNameFromEnvironment = getDudApiHostNameFromEnvironment;
765
820
  exports.getE2EDataIDs = getE2EDataIDs;
766
821
  exports.getEnvironmentFromHostname = getEnvironmentFromHostname;
767
822
  exports.getExt = getExt;