sales-frontend-utils 0.0.51 → 0.0.53

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
  */
@@ -619,7 +618,7 @@ var convertTextToImg = ({
619
618
  fontColor,
620
619
  fontSize,
621
620
  fontWeight,
622
- fontFamily = `'Malgun Gothic', '\uB9D1\uC740 \uACE0\uB515', 'sans-serif', 'Arial'`
621
+ fontFamily = `'system-ui', 'sans-serif'`
623
622
  }) => {
624
623
  const canvas = document.createElement("canvas");
625
624
  const ctx = canvas.getContext("2d");
@@ -636,8 +635,8 @@ var convertTextToImg = ({
636
635
  }
637
636
  ctx.fillStyle = fontColor ?? "black";
638
637
  ctx.textAlign = "center";
639
- ctx.font = `${fontWeight ?? "bold"} ${fontSize ?? 75}px ${fontFamily}`;
640
- console.log("font", `${fontWeight ?? "bold"} ${fontSize ?? 75}px ${fontFamily}`);
638
+ ctx.font = `${fontWeight ?? "normal"} ${fontSize ?? 75}px ${fontFamily}`;
639
+ console.log("font", `${fontWeight ?? "normal"} ${fontSize ?? 75}px ${fontFamily}`);
641
640
  ctx.textBaseline = "middle";
642
641
  ctx.fillText(targetStr, canvas.width / 2, canvas.height / 2);
643
642
  return canvas.toDataURL();