sales-frontend-utils 0.0.60 → 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.cjs CHANGED
@@ -881,73 +881,47 @@ function addE2EObject(el, e2e_type) {
881
881
  function hasAstx2() {
882
882
  return !!window.$ASTX2;
883
883
  }
884
- var loadScript = (callback) => {
885
- if (!window.$ASTX2) {
886
- console.log("dynamic load");
884
+ var loadScript = (params) => {
885
+ const { forceLoad, callback } = params || {};
886
+ if (!window.$ASTX2 || forceLoad) {
887
+ console.log("dynamic load : astx2 script");
887
888
  const script = document.createElement("script");
888
889
  script.innerHTML = `
889
890
  ${astx2_min_default}
890
891
  ${astx2_custom_default}
891
892
  `;
892
893
  document.head.appendChild(script);
893
- script.onload = () => {
894
- callback && callback();
895
- };
894
+ script.onload = () => callback?.();
896
895
  }
897
896
  };
898
- var init = ({
899
- initSuccess = () => {
900
- },
901
- initFailure = () => {
902
- },
903
- checkServerSuccess = () => {
904
- },
905
- checkServerFailure = () => {
906
- }
907
- } = {}) => {
908
- window.$ASTX2.init(
909
- () => {
910
- window.$ASTX2.initE2E();
911
- window.$ASTX2.checkServer(
912
- () => {
913
- checkServerSuccess();
914
- },
915
- () => {
916
- checkServerFailure();
917
- console.error(`ASTX.checkServer() onFailure: errno=${window.$ASTX2.getLastError()}`);
897
+ function initASTX2(astx2Init) {
898
+ const { initSuccess, initFailure, checkServerSuccess, checkServerFailure } = astx2Init || {};
899
+ if (window.$ASTX2) {
900
+ window.$ASTX2.init(
901
+ () => {
902
+ window.$ASTX2.initE2E();
903
+ window.$ASTX2.checkServer(
904
+ () => {
905
+ checkServerSuccess?.();
906
+ },
907
+ () => {
908
+ checkServerFailure?.();
909
+ console.error(`ASTX.checkServer() onFailure: errno=${window.$ASTX2.getLastError()}`);
910
+ }
911
+ );
912
+ initSuccess?.();
913
+ },
914
+ () => {
915
+ initFailure?.();
916
+ if (window.$ASTX2.getLastError() === 103) {
917
+ console.error("AhnLab Safe Transaction \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uC124\uCE58\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.");
918
+ } else {
919
+ console.error(`$ASTX2.init() onFailure: errno=${window.$ASTX2.getLastError()}`);
918
920
  }
919
- );
920
- initSuccess();
921
- },
922
- () => {
923
- initFailure();
924
- if (window.$ASTX2.getLastError() === 103) {
925
- console.error("AhnLab Safe Transaction \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uC124\uCE58\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.");
926
- } else {
927
- console.error(`$ASTX2.init() onFailure: errno=${window.$ASTX2.getLastError()}`);
928
921
  }
929
- }
930
- );
931
- };
932
- var initASTX2 = ({
933
- initSuccess = () => {
934
- },
935
- initFailure = () => {
936
- },
937
- checkServerSuccess = () => {
938
- },
939
- checkServerFailure = () => {
940
- }
941
- } = {}) => {
942
- if (window.$ASTX2) {
943
- init({
944
- initSuccess,
945
- initFailure,
946
- checkServerSuccess,
947
- checkServerFailure
948
- });
922
+ );
949
923
  }
950
- };
924
+ }
951
925
  function getE2EDataIDs(ids, onSuccess, onFailure = () => {
952
926
  }) {
953
927
  if (window.$ASTX2) {