sales-frontend-bridge 0.0.47 → 0.0.48
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 +34 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -119
- package/dist/index.d.ts +71 -119
- package/dist/index.js +33 -31
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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:
|
|
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: {
|
|
@@ -3002,6 +2990,20 @@ function base64ToBlob(base64) {
|
|
|
3002
2990
|
const bytes = Uint8Array.from(atob(data || base64), (c) => c.charCodeAt(0));
|
|
3003
2991
|
return new Blob([bytes], { type: mime });
|
|
3004
2992
|
}
|
|
2993
|
+
async function blobToBase64(blob) {
|
|
2994
|
+
return new Promise((resolve, reject) => {
|
|
2995
|
+
const reader = new FileReader();
|
|
2996
|
+
reader.onloadend = () => {
|
|
2997
|
+
if (typeof reader.result === "string") {
|
|
2998
|
+
resolve(reader.result);
|
|
2999
|
+
} else {
|
|
3000
|
+
reject(new Error("Failed to convert Blob to Base64 string"));
|
|
3001
|
+
}
|
|
3002
|
+
};
|
|
3003
|
+
reader.onerror = () => reject(reader.error);
|
|
3004
|
+
reader.readAsDataURL(blob);
|
|
3005
|
+
});
|
|
3006
|
+
}
|
|
3005
3007
|
async function postFiletoDud(imageStr) {
|
|
3006
3008
|
const formData = new FormData();
|
|
3007
3009
|
formData.append("data", base64ToBlob(imageStr), "test.png");
|
|
@@ -3053,17 +3055,12 @@ async function getFileFromDud(fileMgmtId) {
|
|
|
3053
3055
|
body: JSON.stringify({ fileMgmtId, outputType })
|
|
3054
3056
|
});
|
|
3055
3057
|
const blob = await response.blob();
|
|
3056
|
-
const base64String = await
|
|
3057
|
-
const reader = new FileReader();
|
|
3058
|
-
reader.onloadend = () => resolve(reader.result);
|
|
3059
|
-
reader.onerror = reject;
|
|
3060
|
-
reader.readAsDataURL(blob);
|
|
3061
|
-
});
|
|
3058
|
+
const base64String = await blobToBase64(blob);
|
|
3062
3059
|
return base64String;
|
|
3063
3060
|
}
|
|
3064
3061
|
|
|
3065
3062
|
// src/oz/utils/bridge-util/create-report-util.ts
|
|
3066
|
-
async function CreateOzParam({ documentList, extraData = {}, roleCd }) {
|
|
3063
|
+
async function CreateOzParam({ documentList, extraData = {}, roleCd, jijungInfo = "" }) {
|
|
3067
3064
|
if (documentList.length === 0) {
|
|
3068
3065
|
throw new Error("\uBB38\uC11C\uBAA9\uB85D\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4");
|
|
3069
3066
|
}
|
|
@@ -3083,8 +3080,10 @@ async function CreateOzParam({ documentList, extraData = {}, roleCd }) {
|
|
|
3083
3080
|
const args = [
|
|
3084
3081
|
// 모든서식에 공통으로 필요한 docCd param 추가
|
|
3085
3082
|
`docCd=${docCode}`,
|
|
3086
|
-
//
|
|
3087
|
-
|
|
3083
|
+
// 모든서식에 공통으로 필요한 roleCode 정보 추가
|
|
3084
|
+
`roleCd=${roleCd}`,
|
|
3085
|
+
// 모든서식에 공통으로 필요한 지정대리인 정보 추가
|
|
3086
|
+
`jijungInfo=${jijungInfo}`,
|
|
3088
3087
|
...ensureArray(data.args)
|
|
3089
3088
|
];
|
|
3090
3089
|
args.forEach((arg, idx2) => result.push(`${prefix}connection.args${idx2 + 1}=${arg}`));
|
|
@@ -3148,6 +3147,9 @@ async function getDraftDataHandler(rawOzRequest, documentIndexMap) {
|
|
|
3148
3147
|
throw new Error(`Invalid document code: ${docCd}`);
|
|
3149
3148
|
}
|
|
3150
3149
|
const { data } = await Bridge.nativeOz.getInformation({ command: `INPUT_JSON_AT=${documentIndex}` });
|
|
3150
|
+
if (data === null) {
|
|
3151
|
+
throw new Error(`Bridge returned null for document: ${docCd} (command=INPUT_JSON_AT=${documentIndex})`);
|
|
3152
|
+
}
|
|
3151
3153
|
const documentJson = JSON.parse(data);
|
|
3152
3154
|
const signDataMap = Object.keys(signKeyMap).reduce((acc, key) => {
|
|
3153
3155
|
acc[key] = documentJson[key];
|
|
@@ -3219,6 +3221,8 @@ exports.PromiseWithResolvers = PromiseWithResolvers;
|
|
|
3219
3221
|
exports.SaveTotalPdf = SaveTotalPdf;
|
|
3220
3222
|
exports.SignatureHandler = SignatureHandler;
|
|
3221
3223
|
exports.TopHandler = TopHandler;
|
|
3224
|
+
exports.base64ToBlob = base64ToBlob;
|
|
3225
|
+
exports.blobToBase64 = blobToBase64;
|
|
3222
3226
|
exports.btnStyle = btnStyle;
|
|
3223
3227
|
exports.categorizeByPageRange = categorizeByPageRange;
|
|
3224
3228
|
exports.checkDocumentsValidityByIndex = checkDocumentsValidityByIndex;
|