sales-frontend-bridge 0.0.47 → 0.0.49

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
@@ -2065,6 +2065,7 @@ var NativeBridgeOz = class extends CommonBridge {
2065
2065
  * // 사용 예시:
2066
2066
  * // OZ가 반환하는 모든 값은 문자열(string)입니다.
2067
2067
  * // 숫자도 '1', boolean도 'true' 형태로 전달됩니다.
2068
+ * // 리턴값이 null이 나올수 있음
2068
2069
  * const { data } = await Bridge.nativeOz.getInformation({ command: 'INPUT_JSON' });
2069
2070
  * ```
2070
2071
  */
@@ -2132,23 +2133,6 @@ var NativeBridgeOz = class extends CommonBridge {
2132
2133
  Object.assign({ delimiter: "\n" }, options)
2133
2134
  );
2134
2135
  }
2135
- /**
2136
- * ### Bridge for Oz
2137
- * 현재 보고서의 `OnExternalEvent` 이벤트를 실행하고, `OnExternalEvent` 이벤트에서 전달한 값을 string 형태로 리턴받습니다.
2138
- * - 서명이미지 크롭
2139
- * - 중간저장 서명이미지 추출
2140
- * @example
2141
- * ```tsx
2142
- * // 사용 예시
2143
- * await Bridge.nativeOz.triggerExternalEvent({ param1: 'signer' });
2144
- * ```
2145
- */
2146
- async triggerExternalEvent(options) {
2147
- return this.core.callToTarget(
2148
- "triggerExternalEvent",
2149
- Object.assign({ param1: "", param2: "", param3: "", param4: "" }, options)
2150
- );
2151
- }
2152
2136
  /**
2153
2137
  * ### Bridge for Oz
2154
2138
  * 지정한 보고서의 `OnExternalEvent` 이벤트를 실행하고, `OnExternalEvent` 이벤트에서 전달한 값을 string 형태로 리턴받습니다.
@@ -2679,6 +2663,9 @@ async function MovePage(page) {
2679
2663
  }
2680
2664
  async function getCurrentPage() {
2681
2665
  const { data } = await Bridge.nativeOz.getInformation({ command: `CURRENT_PAGE` });
2666
+ if (data === null) {
2667
+ throw new Error(`Bridge returned null for command: CURRENT_PAGE`);
2668
+ }
2682
2669
  return Number(data);
2683
2670
  }
2684
2671
  var getTotalPageMemo = (() => {
@@ -2712,6 +2699,9 @@ var getReportCountMemo = (() => {
2712
2699
  cache = (async () => {
2713
2700
  try {
2714
2701
  const { data } = await Bridge.nativeOz.getInformation({ command: "REPORT_COUNT" });
2702
+ if (data === null) {
2703
+ throw new Error(`Bridge returned null for command: REPORT_COUNT`);
2704
+ }
2715
2705
  return Number(data);
2716
2706
  } catch (e) {
2717
2707
  cache = null;
@@ -2770,9 +2760,7 @@ async function CommentHandler({ type, btnID }) {
2770
2760
  }
2771
2761
  }
2772
2762
  async function isCommentMode() {
2773
- const { data } = await Bridge.nativeOz.getInformation({
2774
- command: `COMMENT_MODE`
2775
- });
2763
+ const { data } = await Bridge.nativeOz.getInformation({ command: `COMMENT_MODE` });
2776
2764
  return data === "comment";
2777
2765
  }
2778
2766
  async function setCommentMode(penConfig) {
@@ -2919,7 +2907,7 @@ async function SignatureInProgressHandler() {
2919
2907
  await validateAllPages(pageCount);
2920
2908
  }
2921
2909
  async function SignatureInMissingHandler() {
2922
- const { data: { result } } = await Bridge.nativeOz.showAlert({
2910
+ const { data: result } = await Bridge.nativeOz.showAlert({
2923
2911
  title: "\uC785\uB825\uD558\uC9C0 \uC54A\uC740 \uD56D\uBAA9\uC774 \uC788\uC2B5\uB2C8\uB2E4",
2924
2912
  message: "\uD574\uB2F9 \uD56D\uBAA9\uC73C\uB85C \uC774\uB3D9\uD558\uC5EC \uC785\uB825\uC744 \uC644\uB8CC\uD574\uC8FC\uC138\uC694.",
2925
2913
  buttons: {
@@ -2982,8 +2970,6 @@ async function SaveTotalPdf() {
2982
2970
  const filepath = await promise;
2983
2971
  return filepath;
2984
2972
  }
2985
-
2986
- // src/oz/utils/bridge-util/fetch-util.ts
2987
2973
  async function fetchDocument(args) {
2988
2974
  const { data: result } = await Bridge.native.downloadDocument(args);
2989
2975
  return result.data.map((i) => ({ ...i, startPage: 0, endPage: 0 }));
@@ -2993,18 +2979,9 @@ async function fetchFont() {
2993
2979
  const fontParms = Object.keys(fontMap).map((i) => `font.${i}=${fontMap[i]}`);
2994
2980
  return fontParms;
2995
2981
  }
2996
- function base64ToBlob(base64) {
2997
- const [meta, data] = base64.split(",");
2998
- if (meta === void 0) {
2999
- throw new Error(`unexpected sing image ${base64}`);
3000
- }
3001
- const mime = meta.match(/:(.*?);/)?.[1] || "";
3002
- const bytes = Uint8Array.from(atob(data || base64), (c) => c.charCodeAt(0));
3003
- return new Blob([bytes], { type: mime });
3004
- }
3005
2982
  async function postFiletoDud(imageStr) {
3006
2983
  const formData = new FormData();
3007
- formData.append("data", base64ToBlob(imageStr), "test.png");
2984
+ formData.append("data", salesFrontendUtils.base64ToFile(imageStr, "test.png"));
3008
2985
  formData.append("fileIdentifierValue", "string");
3009
2986
  formData.append("fileExtendContent1", "string");
3010
2987
  formData.append("fileExtendContent2", "string");
@@ -3053,17 +3030,12 @@ async function getFileFromDud(fileMgmtId) {
3053
3030
  body: JSON.stringify({ fileMgmtId, outputType })
3054
3031
  });
3055
3032
  const blob = await response.blob();
3056
- const base64String = await new Promise((resolve, reject) => {
3057
- const reader = new FileReader();
3058
- reader.onloadend = () => resolve(reader.result);
3059
- reader.onerror = reject;
3060
- reader.readAsDataURL(blob);
3061
- });
3033
+ const base64String = await salesFrontendUtils.fileToBase64(blob);
3062
3034
  return base64String;
3063
3035
  }
3064
3036
 
3065
3037
  // src/oz/utils/bridge-util/create-report-util.ts
3066
- async function CreateOzParam({ documentList, extraData = {}, roleCd }) {
3038
+ async function CreateOzParam({ documentList, extraData = {}, roleCd, jijungInfo = "" }) {
3067
3039
  if (documentList.length === 0) {
3068
3040
  throw new Error("\uBB38\uC11C\uBAA9\uB85D\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4");
3069
3041
  }
@@ -3083,8 +3055,10 @@ async function CreateOzParam({ documentList, extraData = {}, roleCd }) {
3083
3055
  const args = [
3084
3056
  // 모든서식에 공통으로 필요한 docCd param 추가
3085
3057
  `docCd=${docCode}`,
3086
- // `roleCd=11,28`,
3087
- `${roleCd}`,
3058
+ // 모든서식에 공통으로 필요한 roleCode 정보 추가
3059
+ `roleCd=${roleCd}`,
3060
+ // 모든서식에 공통으로 필요한 지정대리인 정보 추가
3061
+ `jijungInfo=${jijungInfo}`,
3088
3062
  ...ensureArray(data.args)
3089
3063
  ];
3090
3064
  args.forEach((arg, idx2) => result.push(`${prefix}connection.args${idx2 + 1}=${arg}`));
@@ -3148,6 +3122,9 @@ async function getDraftDataHandler(rawOzRequest, documentIndexMap) {
3148
3122
  throw new Error(`Invalid document code: ${docCd}`);
3149
3123
  }
3150
3124
  const { data } = await Bridge.nativeOz.getInformation({ command: `INPUT_JSON_AT=${documentIndex}` });
3125
+ if (data === null) {
3126
+ throw new Error(`Bridge returned null for document: ${docCd} (command=INPUT_JSON_AT=${documentIndex})`);
3127
+ }
3151
3128
  const documentJson = JSON.parse(data);
3152
3129
  const signDataMap = Object.keys(signKeyMap).reduce((acc, key) => {
3153
3130
  acc[key] = documentJson[key];