sales-frontend-utils 0.0.22 → 0.0.24

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.d.cts CHANGED
@@ -182,6 +182,12 @@ declare const isClient: () => boolean;
182
182
  * ```
183
183
  */
184
184
  declare const isStorybookEnv: () => boolean;
185
+ /**
186
+ * 현재 업무구분 코드 구하기
187
+ * 원칙: pathname의 첫 번째가 업무구분코드를 사용할 경우 해당 값을 반환
188
+ * @returns
189
+ */
190
+ declare const getBusinessWorkDivisionCode: () => string;
185
191
 
186
192
  /**
187
193
  * Message 이벤트 헨들러를 관리하는 클래스입니다. (싱글턴)
@@ -226,13 +232,15 @@ interface ConvertTextToImgParams {
226
232
  fontColor?: string;
227
233
  /** 폰트 두께 (지정하지 않으면 기본값 bold) */
228
234
  fontWeight?: string;
235
+ /** 폰트 패밀리 (지정하지 않으면 기본값 ) */
236
+ fontFamily?: string;
229
237
  }
230
238
  /**
231
239
  * 텍스트를 이미지(Base64)로 변환하는 함수
232
240
  * @param params - 변환에 필요한 파라미터 객체
233
241
  * @returns Base64로 인코딩된 이미지 데이터 URL
234
242
  */
235
- declare const convertTextToImg: ({ targetStr, canvasWidth, canvasHeight, backgroundColor, fontColor, fontSize, fontWeight }: ConvertTextToImgParams) => string;
243
+ declare const convertTextToImg: ({ targetStr, canvasWidth, canvasHeight, backgroundColor, fontColor, fontSize, fontWeight, fontFamily }: ConvertTextToImgParams) => string;
236
244
  declare function drawImageResizeCentered(base64: string, size: {
237
245
  canvasWidth: number;
238
246
  canvasHeight: number;
@@ -289,4 +297,4 @@ declare const initASTX2: ({ initSuccess, initFailure, checkServerSuccess, checkS
289
297
  */
290
298
  declare function getE2EDataIDs(ids: string[], onSuccess: (astx_data: any) => void, onFailure?: () => void): void;
291
299
 
292
- export { type BrowserName, type ExecutionEnvironment, MessageEventManager, type OSName, addE2EObject, base64ToBlob, base64ToFile, blobToFile, checkUserAgentDspApp, convertTextToImg, debounce, deleteCookie, drawImageResizeCentered, fileToBase64, getApiHostNameFromEnvironment, getBrowserName, getBrowserVersion, getCdnHostNameFromEnvironment, getCookie, getCurrentBrowserName, getCurrentBrowserVersion, getCurrentOSName, getCurrentOSVersion, getDeviceModel, getDspExecutionEnvironment, getE2EDataIDs, getEnvironmentFromHostname, getExt, getFormFactorFromUserAgent, getOSName, getOSVersion, getOrCreateDeviceId, getSubdomain, hasAstx2, initASTX2, isClient, isDspApp, isFpPlannerApp, isPc, isPhone, isSalesPortal, isStorybookEnv, isTablet, isWebView, loadScript, objectUrlToBase64, objectUrlToBlob, setCookie, throttle };
300
+ export { type BrowserName, type ExecutionEnvironment, MessageEventManager, type OSName, addE2EObject, base64ToBlob, base64ToFile, blobToFile, checkUserAgentDspApp, convertTextToImg, debounce, deleteCookie, drawImageResizeCentered, fileToBase64, getApiHostNameFromEnvironment, getBrowserName, getBrowserVersion, getBusinessWorkDivisionCode, getCdnHostNameFromEnvironment, getCookie, getCurrentBrowserName, getCurrentBrowserVersion, getCurrentOSName, getCurrentOSVersion, getDeviceModel, getDspExecutionEnvironment, getE2EDataIDs, getEnvironmentFromHostname, getExt, getFormFactorFromUserAgent, getOSName, getOSVersion, getOrCreateDeviceId, getSubdomain, hasAstx2, initASTX2, isClient, isDspApp, isFpPlannerApp, isPc, isPhone, isSalesPortal, isStorybookEnv, isTablet, isWebView, loadScript, objectUrlToBase64, objectUrlToBlob, setCookie, throttle };
package/dist/index.d.ts CHANGED
@@ -182,6 +182,12 @@ declare const isClient: () => boolean;
182
182
  * ```
183
183
  */
184
184
  declare const isStorybookEnv: () => boolean;
185
+ /**
186
+ * 현재 업무구분 코드 구하기
187
+ * 원칙: pathname의 첫 번째가 업무구분코드를 사용할 경우 해당 값을 반환
188
+ * @returns
189
+ */
190
+ declare const getBusinessWorkDivisionCode: () => string;
185
191
 
186
192
  /**
187
193
  * Message 이벤트 헨들러를 관리하는 클래스입니다. (싱글턴)
@@ -226,13 +232,15 @@ interface ConvertTextToImgParams {
226
232
  fontColor?: string;
227
233
  /** 폰트 두께 (지정하지 않으면 기본값 bold) */
228
234
  fontWeight?: string;
235
+ /** 폰트 패밀리 (지정하지 않으면 기본값 ) */
236
+ fontFamily?: string;
229
237
  }
230
238
  /**
231
239
  * 텍스트를 이미지(Base64)로 변환하는 함수
232
240
  * @param params - 변환에 필요한 파라미터 객체
233
241
  * @returns Base64로 인코딩된 이미지 데이터 URL
234
242
  */
235
- declare const convertTextToImg: ({ targetStr, canvasWidth, canvasHeight, backgroundColor, fontColor, fontSize, fontWeight }: ConvertTextToImgParams) => string;
243
+ declare const convertTextToImg: ({ targetStr, canvasWidth, canvasHeight, backgroundColor, fontColor, fontSize, fontWeight, fontFamily }: ConvertTextToImgParams) => string;
236
244
  declare function drawImageResizeCentered(base64: string, size: {
237
245
  canvasWidth: number;
238
246
  canvasHeight: number;
@@ -289,4 +297,4 @@ declare const initASTX2: ({ initSuccess, initFailure, checkServerSuccess, checkS
289
297
  */
290
298
  declare function getE2EDataIDs(ids: string[], onSuccess: (astx_data: any) => void, onFailure?: () => void): void;
291
299
 
292
- export { type BrowserName, type ExecutionEnvironment, MessageEventManager, type OSName, addE2EObject, base64ToBlob, base64ToFile, blobToFile, checkUserAgentDspApp, convertTextToImg, debounce, deleteCookie, drawImageResizeCentered, fileToBase64, getApiHostNameFromEnvironment, getBrowserName, getBrowserVersion, getCdnHostNameFromEnvironment, getCookie, getCurrentBrowserName, getCurrentBrowserVersion, getCurrentOSName, getCurrentOSVersion, getDeviceModel, getDspExecutionEnvironment, getE2EDataIDs, getEnvironmentFromHostname, getExt, getFormFactorFromUserAgent, getOSName, getOSVersion, getOrCreateDeviceId, getSubdomain, hasAstx2, initASTX2, isClient, isDspApp, isFpPlannerApp, isPc, isPhone, isSalesPortal, isStorybookEnv, isTablet, isWebView, loadScript, objectUrlToBase64, objectUrlToBlob, setCookie, throttle };
300
+ export { type BrowserName, type ExecutionEnvironment, MessageEventManager, type OSName, addE2EObject, base64ToBlob, base64ToFile, blobToFile, checkUserAgentDspApp, convertTextToImg, debounce, deleteCookie, drawImageResizeCentered, fileToBase64, getApiHostNameFromEnvironment, getBrowserName, getBrowserVersion, getBusinessWorkDivisionCode, getCdnHostNameFromEnvironment, getCookie, getCurrentBrowserName, getCurrentBrowserVersion, getCurrentOSName, getCurrentOSVersion, getDeviceModel, getDspExecutionEnvironment, getE2EDataIDs, getEnvironmentFromHostname, getExt, getFormFactorFromUserAgent, getOSName, getOSVersion, getOrCreateDeviceId, getSubdomain, hasAstx2, initASTX2, isClient, isDspApp, isFpPlannerApp, isPc, isPhone, isSalesPortal, isStorybookEnv, isTablet, isWebView, loadScript, objectUrlToBase64, objectUrlToBlob, setCookie, throttle };
package/dist/index.js CHANGED
@@ -103,6 +103,9 @@ var isStorybookEnv = () => {
103
103
  return false;
104
104
  }
105
105
  };
106
+ var getBusinessWorkDivisionCode = () => {
107
+ return location.pathname.split("/")[1] ?? "";
108
+ };
106
109
 
107
110
  // src/utils/user-agent-utils.ts
108
111
  var getDspExecutionEnvironment = () => {
@@ -449,7 +452,8 @@ var convertTextToImg = ({
449
452
  backgroundColor,
450
453
  fontColor,
451
454
  fontSize,
452
- fontWeight
455
+ fontWeight,
456
+ fontFamily = `'Malgun Gothic', '\uB9D1\uC740 \uACE0\uB515', 'sans-serif', 'Arial'`
453
457
  }) => {
454
458
  const canvas = document.createElement("canvas");
455
459
  const ctx = canvas.getContext("2d");
@@ -465,8 +469,9 @@ var convertTextToImg = ({
465
469
  ctx.fillRect(0, 0, canvas.width, canvas.height);
466
470
  }
467
471
  ctx.fillStyle = fontColor ?? "black";
468
- ctx.font = `${fontSize ?? 75}px ${fontWeight ?? "bold"}`;
469
472
  ctx.textAlign = "center";
473
+ ctx.font = `${fontWeight ?? "bold"} ${fontSize ?? 75}px ${fontFamily}`;
474
+ console.log("font", `${fontWeight ?? "bold"} ${fontSize ?? 75}px ${fontFamily}`);
470
475
  ctx.textBaseline = "middle";
471
476
  ctx.fillText(targetStr, canvas.width / 2, canvas.height / 2);
472
477
  return canvas.toDataURL();
@@ -720,6 +725,6 @@ function getE2EDataIDs(ids, onSuccess, onFailure = () => {
720
725
  }
721
726
  }
722
727
 
723
- export { MessageEventManager, addE2EObject, base64ToBlob, base64ToFile, blobToFile, checkUserAgentDspApp, convertTextToImg, debounce, deleteCookie, drawImageResizeCentered, fileToBase64, getApiHostNameFromEnvironment, getBrowserName, getBrowserVersion, getCdnHostNameFromEnvironment, getCookie, getCurrentBrowserName, getCurrentBrowserVersion, getCurrentOSName, getCurrentOSVersion, getDeviceModel, getDspExecutionEnvironment, getE2EDataIDs, getEnvironmentFromHostname, getExt, getFormFactorFromUserAgent, getOSName, getOSVersion, getOrCreateDeviceId, getSubdomain, hasAstx2, initASTX2, isClient, isDspApp, isFpPlannerApp, isPc, isPhone, isSalesPortal, isStorybookEnv, isTablet, isWebView, loadScript, objectUrlToBase64, objectUrlToBlob, setCookie, throttle };
728
+ export { MessageEventManager, addE2EObject, base64ToBlob, base64ToFile, blobToFile, checkUserAgentDspApp, convertTextToImg, debounce, deleteCookie, drawImageResizeCentered, fileToBase64, getApiHostNameFromEnvironment, getBrowserName, getBrowserVersion, getBusinessWorkDivisionCode, getCdnHostNameFromEnvironment, getCookie, getCurrentBrowserName, getCurrentBrowserVersion, getCurrentOSName, getCurrentOSVersion, getDeviceModel, getDspExecutionEnvironment, getE2EDataIDs, getEnvironmentFromHostname, getExt, getFormFactorFromUserAgent, getOSName, getOSVersion, getOrCreateDeviceId, getSubdomain, hasAstx2, initASTX2, isClient, isDspApp, isFpPlannerApp, isPc, isPhone, isSalesPortal, isStorybookEnv, isTablet, isWebView, loadScript, objectUrlToBase64, objectUrlToBlob, setCookie, throttle };
724
729
  //# sourceMappingURL=index.js.map
725
730
  //# sourceMappingURL=index.js.map