sales-frontend-utils 0.0.59 → 0.0.61

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
@@ -5,7 +5,7 @@ export { MessageEventManager } from './utils/event-handler-utils.cjs';
5
5
  export { convertTextToImg, drawImageResizeCentered, getTextWidth } from './utils/canvas-utils.cjs';
6
6
  export { deleteCookie, getCookie, setCookie } from './utils/cookie-utils.cjs';
7
7
  export { base64ToBlob, base64ToFile, blobToFile, downloadBlob, fileToBase64, getExt, imageUrlToFile, imageUrlToFileFetch, imageUrlToFileWithCanvas, imageUrlToFileWithXMLHttpRequest, objectUrlToBase64, objectUrlToBlob } from './utils/file-utils.cjs';
8
- export { addE2EObject, getE2EDataIDs, hasAstx2, initASTX2, loadScript } from './utils/astx2-utils.cjs';
8
+ export { Astx2Init, LoadScriptParams, addE2EObject, getE2EDataIDs, hasAstx2, initASTX2, loadScript } from './utils/astx2-utils.cjs';
9
9
  export { DateFormat, PeriodType, convertDateFormat, convertDateString, getDateDiff, getLastDay, getOneMonthLater, getPeriodDate, isDate, isDateAfter, isFutureDate, isValidDate, validateBirthdate } from './utils/date-utils.cjs';
10
10
  export { charFilterEng, charFilterKor, checkKeys, isArrowDown, isArrowLeft, isArrowRight, isArrowUp, isBackspace, isEnter, isEscape, isOverCharCount, isOverEngCharCount, isOverKorCharCount, isTab } from './utils/key-trigger-utils.cjs';
11
11
  export { GENDER_LABEL_MAP, getGenderName } from './utils/gender.cjs';
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { MessageEventManager } from './utils/event-handler-utils.js';
5
5
  export { convertTextToImg, drawImageResizeCentered, getTextWidth } from './utils/canvas-utils.js';
6
6
  export { deleteCookie, getCookie, setCookie } from './utils/cookie-utils.js';
7
7
  export { base64ToBlob, base64ToFile, blobToFile, downloadBlob, fileToBase64, getExt, imageUrlToFile, imageUrlToFileFetch, imageUrlToFileWithCanvas, imageUrlToFileWithXMLHttpRequest, objectUrlToBase64, objectUrlToBlob } from './utils/file-utils.js';
8
- export { addE2EObject, getE2EDataIDs, hasAstx2, initASTX2, loadScript } from './utils/astx2-utils.js';
8
+ export { Astx2Init, LoadScriptParams, addE2EObject, getE2EDataIDs, hasAstx2, initASTX2, loadScript } from './utils/astx2-utils.js';
9
9
  export { DateFormat, PeriodType, convertDateFormat, convertDateString, getDateDiff, getLastDay, getOneMonthLater, getPeriodDate, isDate, isDateAfter, isFutureDate, isValidDate, validateBirthdate } from './utils/date-utils.js';
10
10
  export { charFilterEng, charFilterKor, checkKeys, isArrowDown, isArrowLeft, isArrowRight, isArrowUp, isBackspace, isEnter, isEscape, isOverCharCount, isOverEngCharCount, isOverKorCharCount, isTab } from './utils/key-trigger-utils.js';
11
11
  export { GENDER_LABEL_MAP, getGenderName } from './utils/gender.js';
package/dist/index.js CHANGED
@@ -174,7 +174,7 @@ var getCdnHostNameFromEnvironment = (currentHostname, forceApiHostName) => {
174
174
  case "stg":
175
175
  return `https://stg-dsp-static.hanwhalife.com`;
176
176
  case "prd":
177
- return `https://dsp-static.hanwhalife.com'`;
177
+ return `https://dsp-static.hanwhalife.com`;
178
178
  default:
179
179
  console.warn("DSP environment is not defined");
180
180
  return "";
@@ -874,73 +874,47 @@ function addE2EObject(el, e2e_type) {
874
874
  function hasAstx2() {
875
875
  return !!window.$ASTX2;
876
876
  }
877
- var loadScript = (callback) => {
878
- if (!window.$ASTX2) {
879
- console.log("dynamic load");
877
+ var loadScript = (params) => {
878
+ const { forceLoad, callback } = params || {};
879
+ if (!window.$ASTX2 || forceLoad) {
880
+ console.log("dynamic load : astx2 script");
880
881
  const script = document.createElement("script");
881
882
  script.innerHTML = `
882
883
  ${astx2_min_default}
883
884
  ${astx2_custom_default}
884
885
  `;
885
886
  document.head.appendChild(script);
886
- script.onload = () => {
887
- callback && callback();
888
- };
887
+ script.onload = () => callback?.();
889
888
  }
890
889
  };
891
- var init = ({
892
- initSuccess = () => {
893
- },
894
- initFailure = () => {
895
- },
896
- checkServerSuccess = () => {
897
- },
898
- checkServerFailure = () => {
899
- }
900
- } = {}) => {
901
- window.$ASTX2.init(
902
- () => {
903
- window.$ASTX2.initE2E();
904
- window.$ASTX2.checkServer(
905
- () => {
906
- checkServerSuccess();
907
- },
908
- () => {
909
- checkServerFailure();
910
- console.error(`ASTX.checkServer() onFailure: errno=${window.$ASTX2.getLastError()}`);
890
+ function initASTX2(astx2Init) {
891
+ const { initSuccess, initFailure, checkServerSuccess, checkServerFailure } = astx2Init || {};
892
+ if (window.$ASTX2) {
893
+ window.$ASTX2.init(
894
+ () => {
895
+ window.$ASTX2.initE2E();
896
+ window.$ASTX2.checkServer(
897
+ () => {
898
+ checkServerSuccess?.();
899
+ },
900
+ () => {
901
+ checkServerFailure?.();
902
+ console.error(`ASTX.checkServer() onFailure: errno=${window.$ASTX2.getLastError()}`);
903
+ }
904
+ );
905
+ initSuccess?.();
906
+ },
907
+ () => {
908
+ initFailure?.();
909
+ if (window.$ASTX2.getLastError() === 103) {
910
+ console.error("AhnLab Safe Transaction \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uC124\uCE58\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.");
911
+ } else {
912
+ console.error(`$ASTX2.init() onFailure: errno=${window.$ASTX2.getLastError()}`);
911
913
  }
912
- );
913
- initSuccess();
914
- },
915
- () => {
916
- initFailure();
917
- if (window.$ASTX2.getLastError() === 103) {
918
- console.error("AhnLab Safe Transaction \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uC124\uCE58\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.");
919
- } else {
920
- console.error(`$ASTX2.init() onFailure: errno=${window.$ASTX2.getLastError()}`);
921
914
  }
922
- }
923
- );
924
- };
925
- var initASTX2 = ({
926
- initSuccess = () => {
927
- },
928
- initFailure = () => {
929
- },
930
- checkServerSuccess = () => {
931
- },
932
- checkServerFailure = () => {
933
- }
934
- } = {}) => {
935
- if (window.$ASTX2) {
936
- init({
937
- initSuccess,
938
- initFailure,
939
- checkServerSuccess,
940
- checkServerFailure
941
- });
915
+ );
942
916
  }
943
- };
917
+ }
944
918
  function getE2EDataIDs(ids, onSuccess, onFailure = () => {
945
919
  }) {
946
920
  if (window.$ASTX2) {