sales-frontend-bridge 0.0.32 → 0.0.34
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 +362 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +242 -99
- package/dist/index.d.ts +242 -99
- package/dist/index.js +357 -211
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1889,6 +1889,61 @@ var NativeBridge = class extends CommonBridge {
|
|
|
1889
1889
|
async hideLoader() {
|
|
1890
1890
|
return this.core.callToTarget("hideLoader");
|
|
1891
1891
|
}
|
|
1892
|
+
/**
|
|
1893
|
+
* 홈 이동
|
|
1894
|
+
* @example
|
|
1895
|
+
* ```tsx
|
|
1896
|
+
* // 사용 예시
|
|
1897
|
+
* Bridge.native.goHome()
|
|
1898
|
+
* ```
|
|
1899
|
+
*/
|
|
1900
|
+
goHome() {
|
|
1901
|
+
return this.core.callToTarget("goHome");
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
* 전체메뉴 열기
|
|
1905
|
+
* @example
|
|
1906
|
+
* ```tsx
|
|
1907
|
+
* // 사용 예시
|
|
1908
|
+
* Bridge.native.showMenu()
|
|
1909
|
+
* ```
|
|
1910
|
+
*/
|
|
1911
|
+
showMenu() {
|
|
1912
|
+
return this.core.callToTarget("showMenu");
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* GA4 정보 얻기
|
|
1916
|
+
* @example
|
|
1917
|
+
* ```tsx
|
|
1918
|
+
* // 사용 예시
|
|
1919
|
+
* Bridge.native.getAnalyticsUserProperty()
|
|
1920
|
+
* ```
|
|
1921
|
+
*/
|
|
1922
|
+
getAnalyticsUserProperty() {
|
|
1923
|
+
return this.core.callToTarget("getAnalyticsUserProperty");
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
*외부 브라우저 호출
|
|
1927
|
+
* @example
|
|
1928
|
+
* ```tsx
|
|
1929
|
+
* // 사용 예시
|
|
1930
|
+
* Bridge.native.getAnalyticsUserProperty()
|
|
1931
|
+
* ```
|
|
1932
|
+
*/
|
|
1933
|
+
openBrowser(options) {
|
|
1934
|
+
return this.core.callToTarget("openBrowser", options);
|
|
1935
|
+
}
|
|
1936
|
+
/**
|
|
1937
|
+
* 웹뷰 닫기
|
|
1938
|
+
* @example
|
|
1939
|
+
* ```tsx
|
|
1940
|
+
* // 사용 예시
|
|
1941
|
+
* Bridge.native.hideWebPopup()
|
|
1942
|
+
* ```
|
|
1943
|
+
*/
|
|
1944
|
+
hideWebPopup() {
|
|
1945
|
+
return this.core.callToTarget("hideWebPopup");
|
|
1946
|
+
}
|
|
1892
1947
|
// TODO: 필요 플러그인들 추가
|
|
1893
1948
|
};
|
|
1894
1949
|
|
|
@@ -2105,7 +2160,17 @@ var Bridge = {
|
|
|
2105
2160
|
iframeCore: new IframeBridgeCore()
|
|
2106
2161
|
};
|
|
2107
2162
|
|
|
2108
|
-
// src/oz/constant/
|
|
2163
|
+
// src/oz/constant/comment-pen-param.ts
|
|
2164
|
+
var commentPenDefaultParam = [
|
|
2165
|
+
`comment.selectedpen=highlightpen`,
|
|
2166
|
+
`comment.highlightpen_thick=15`
|
|
2167
|
+
];
|
|
2168
|
+
var commentPenYellow = [...commentPenDefaultParam, `comment.highlightpen_color=ffd900`];
|
|
2169
|
+
var commentPenPink = [...commentPenDefaultParam, `comment.highlightpen_color=f48fb1`];
|
|
2170
|
+
var commentPenGreen = [...commentPenDefaultParam, `comment.highlightpen_color=81c784`];
|
|
2171
|
+
var commentPenEraser = [`comment.selectedpen=eraser`];
|
|
2172
|
+
|
|
2173
|
+
// src/oz/constant/oz-param.ts
|
|
2109
2174
|
var commonOzParam = [
|
|
2110
2175
|
`information.debug = true`,
|
|
2111
2176
|
`global.inheritparameter=true`,
|
|
@@ -2206,6 +2271,8 @@ var commonOzParam = [
|
|
|
2206
2271
|
`viewer.reportchangecommand=true`,
|
|
2207
2272
|
`viewer.pagebindcommandinterval=500`
|
|
2208
2273
|
];
|
|
2274
|
+
|
|
2275
|
+
// src/oz/constant/pdf-param.ts
|
|
2209
2276
|
var commonPdfExportParam = [
|
|
2210
2277
|
// `pdf.filename=${"test.pdf"}`,
|
|
2211
2278
|
// `export.pages=${i.startPage}-${i.endPage}`,
|
|
@@ -2218,19 +2285,101 @@ var commonPdfExportParam = [
|
|
|
2218
2285
|
// 폰트를 포함시킬때 사용하는 글자만 포함시킨다
|
|
2219
2286
|
`pdf.fontembedding_subset=true`
|
|
2220
2287
|
];
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
`comment.highlightpen_thick=15`
|
|
2224
|
-
];
|
|
2225
|
-
var commentPenYellow = [...commentPenDefaultParam, `comment.highlightpen_color=ffd900`];
|
|
2226
|
-
var commentPenPink = [...commentPenDefaultParam, `comment.highlightpen_color=f48fb1`];
|
|
2227
|
-
var commentPenGreen = [...commentPenDefaultParam, `comment.highlightpen_color=81c784`];
|
|
2228
|
-
var commentPenEraser = [`comment.selectedpen=eraser`];
|
|
2288
|
+
|
|
2289
|
+
// src/oz/constant/test-data.ts
|
|
2229
2290
|
var wrapperStyle = { display: "flex", flexFlow: "column", gap: "10px" };
|
|
2230
2291
|
var btnStyle = { border: "1px solid red", minHeight: "40px" };
|
|
2292
|
+
var DownloadDocumentList = [
|
|
2293
|
+
{ name: "[A0010]\uCCAD\uC57D\uC11C", file: ["A0010.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2294
|
+
{ name: "[A0100]\uBE44\uAD50\uC548\uB0B4\uD655\uC778\uC11C", file: ["A0100.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2295
|
+
// { name: '[A0900]상품설명서', file: ['A0900.ozd'], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2296
|
+
{ name: "[A1500]\uCCAD\uC57D\uBD80\uC18D\uC815\uBCF4\uD655\uC778\uC11C", file: ["A1500.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2297
|
+
{ name: "[A2215]\uBCF4\uD5D8\uACC4\uC57D\uB300\uCD9C\uC774\uD589\uAD00\uB9AC\uB3D9\uC758\uC11C", file: ["A2215.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2298
|
+
{ name: "[A2800]\uACC4\uC57D\uC804\uC54C\uB9B4\uC758\uBB34", file: ["A2800.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2299
|
+
{ name: "[A3503]\uCCAD\uC57D\uC11C\uBCC4\uC9C0(\uBCC0\uC561\uC6A9)", file: ["A3503.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2300
|
+
{ name: "[B0101]\uBCF4\uD5D8\uACC4\uC57D\uCCB4\uACB0\uB3D9\uC758\uC11C", file: ["B0101.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2301
|
+
{ name: "[C0400]\uACC4\uC57D\uCCB4\uACB0\uC774\uD589\uB3D9\uC758\uC11C", file: ["C0400.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2302
|
+
{ name: "[C0401]\uC0C1\uD488\uC18C\uAC1C\uC0C1\uC138\uB3D9\uC758\uC11C", file: ["C0401.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2303
|
+
{ name: "[C1000]\uBCF4\uD5D8\uC0C1\uD488\uD310\uB9E4\uCCB4\uD06C\uB9AC\uC2A4\uD2B8", file: ["C1000.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2304
|
+
{ name: "[C1300]\uACC4\uC57D\uCCB4\uACB0\uACE0\uC9C0\uC758\uBB34\uD655\uC778\uC11C", file: ["C1300.ozd"], complete: false, startPage: 0, endPage: 0, focus: false },
|
|
2305
|
+
{ name: "[C1400]\uBCF4\uD5D8\uC0C1\uD488\uBE44\uAD50\uC124\uBA85\uD655\uC778\uC11C", file: ["C1400.ozd"], complete: false, startPage: 0, endPage: 0, focus: false }
|
|
2306
|
+
];
|
|
2307
|
+
var ExtraData = {
|
|
2308
|
+
// 문서코드
|
|
2309
|
+
A0010: {
|
|
2310
|
+
// connection.inputjson으로 바인딩할 데이터
|
|
2311
|
+
inputJson: {
|
|
2312
|
+
// 계약자 성명 사인정보
|
|
2313
|
+
A0010_mynm_sg: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAABDUlEQVR4nOzSMQ0CQBQEUSAnAAU0iEAAPWKQgQU04gED10z1IXlPwWay6/78HH7P+3qZnrBxmh7wT8QKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECtZjvaY3bNzOx+kJG54ViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgVfAMAAP//tD4Eb/yjIncAAAAASUVORK5CYII=",
|
|
2314
|
+
// 계약자 서명 사인정보
|
|
2315
|
+
A0010_mysg_sign: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAABDElEQVR4nOzSsQkCYRgEUZXDVgTtxdDIYgR7sFkTG/iTiT4P3qtgGXa7vp+H//M5PqYnLJymB+yJWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgVjBdj9fpjcsvG7f6QkLnhWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBX8AgAA//9+7gTkg4AcBQAAAABJRU5ErkJggg=="
|
|
2316
|
+
},
|
|
2317
|
+
// 기타 공통으로 사용하지 않을 파라미터
|
|
2318
|
+
extraParam: [`viewer.zoom=137`]
|
|
2319
|
+
}
|
|
2320
|
+
};
|
|
2231
2321
|
|
|
2232
|
-
// src/oz/hooks/use-
|
|
2322
|
+
// src/oz/hooks/use-document-info.tsx
|
|
2233
2323
|
var import_react = __toESM(require_react());
|
|
2324
|
+
function useDocumentInfo(initialValue) {
|
|
2325
|
+
const [documentInfo, setDocumentInfo] = (0, import_react.useState)([...initialValue]);
|
|
2326
|
+
const documentList = (0, import_react.useMemo)(() => documentInfo.map((i) => i.file).flat(1), [documentInfo]);
|
|
2327
|
+
const documentIndexMap = documentList.reduce((acc, cur, index) => {
|
|
2328
|
+
acc[cur] = index;
|
|
2329
|
+
return acc;
|
|
2330
|
+
}, {});
|
|
2331
|
+
const documentTemplateMap = (0, import_react.useMemo)(() => documentInfo.reduce((map, doc) => {
|
|
2332
|
+
doc.file.forEach((file) => {
|
|
2333
|
+
map[file] = { ...doc };
|
|
2334
|
+
});
|
|
2335
|
+
return map;
|
|
2336
|
+
}, {}), [documentInfo]);
|
|
2337
|
+
const nameTemplateMap = documentInfo.reduce((acc, doc) => {
|
|
2338
|
+
acc[doc.name] = doc;
|
|
2339
|
+
return acc;
|
|
2340
|
+
}, {});
|
|
2341
|
+
const groupIndexes = (0, import_react.useMemo)(() => documentInfo.reduce((acc, item) => {
|
|
2342
|
+
item.file.forEach((file) => {
|
|
2343
|
+
const currentIndex = documentIndexMap[file];
|
|
2344
|
+
if (!acc[currentIndex]) {
|
|
2345
|
+
acc[currentIndex] = [];
|
|
2346
|
+
}
|
|
2347
|
+
item.file.forEach((groupFile) => {
|
|
2348
|
+
acc[currentIndex].push(documentIndexMap[groupFile]);
|
|
2349
|
+
});
|
|
2350
|
+
});
|
|
2351
|
+
return acc;
|
|
2352
|
+
}, []), [documentIndexMap, documentInfo]);
|
|
2353
|
+
const isAllComplete = (0, import_react.useMemo)(() => documentInfo.every((i) => i.complete), [documentInfo]);
|
|
2354
|
+
return {
|
|
2355
|
+
setDocumentInfo,
|
|
2356
|
+
documentInfo,
|
|
2357
|
+
documentList,
|
|
2358
|
+
documentTemplateMap,
|
|
2359
|
+
documentIndexMap,
|
|
2360
|
+
nameTemplateMap,
|
|
2361
|
+
groupIndexes,
|
|
2362
|
+
isAllComplete
|
|
2363
|
+
};
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
// src/oz/hooks/use-oz-event-listener.tsx
|
|
2367
|
+
var import_react2 = __toESM(require_react());
|
|
2368
|
+
function useOzEventListener({ event, handler }) {
|
|
2369
|
+
const handleEvent = (0, import_react2.useCallback)(
|
|
2370
|
+
async (e) => {
|
|
2371
|
+
const customEvent = e;
|
|
2372
|
+
return await handler(customEvent);
|
|
2373
|
+
},
|
|
2374
|
+
[handler]
|
|
2375
|
+
);
|
|
2376
|
+
(0, import_react2.useEffect)(() => {
|
|
2377
|
+
window.addEventListener(event, handleEvent);
|
|
2378
|
+
return () => {
|
|
2379
|
+
window.removeEventListener(event, handleEvent);
|
|
2380
|
+
};
|
|
2381
|
+
}, [handleEvent, event]);
|
|
2382
|
+
}
|
|
2234
2383
|
|
|
2235
2384
|
// src/oz/types/oz-event.types.ts
|
|
2236
2385
|
var OZViewerEvent = /* @__PURE__ */ ((OZViewerEvent2) => {
|
|
@@ -2304,65 +2453,57 @@ function PromiseWithResolvers() {
|
|
|
2304
2453
|
return { promise, resolve, reject };
|
|
2305
2454
|
}
|
|
2306
2455
|
|
|
2307
|
-
// src/oz/utils/bridge-util.ts
|
|
2308
|
-
async function
|
|
2309
|
-
const { data } = await Bridge.native.downloadDocument({ data: options });
|
|
2310
|
-
return data.map((i) => ({ ...i, startPage: 0, endPage: 0 }));
|
|
2311
|
-
}
|
|
2312
|
-
async function fetchFont() {
|
|
2313
|
-
const { data: fontMap } = await Bridge.native.getOzFontParam();
|
|
2314
|
-
const fontParms = Object.keys(fontMap).map((i) => `font.${i}=${fontMap[i]}`);
|
|
2315
|
-
return fontParms;
|
|
2316
|
-
}
|
|
2317
|
-
async function getReportCount() {
|
|
2318
|
-
const { data } = await Bridge.nativeOz.getInformation({ command: "REPORT_COUNT" });
|
|
2319
|
-
return Number(data);
|
|
2320
|
-
}
|
|
2321
|
-
async function MovePage(page) {
|
|
2322
|
-
return await Bridge.nativeOz.script({ command: `movepage=${page}` });
|
|
2323
|
-
}
|
|
2324
|
-
async function enableFocusOnValidation(reportCount) {
|
|
2456
|
+
// src/oz/utils/bridge-util/focus-util.ts
|
|
2457
|
+
async function setFocusOnValidation(enable, reportCount) {
|
|
2325
2458
|
const count = reportCount ?? await getReportCount();
|
|
2459
|
+
const expectedValue = enable ? "1" : "0";
|
|
2460
|
+
const { data: prev } = await Bridge.nativeOz.getGlobal({ key: "chkFlag", docIndex: 0 });
|
|
2461
|
+
if (prev === expectedValue) {
|
|
2462
|
+
return;
|
|
2463
|
+
}
|
|
2326
2464
|
for (let i = 0; i < count; i++) {
|
|
2327
2465
|
await sleep();
|
|
2328
|
-
await Bridge.nativeOz.setGlobal({ key: "chkFlag", value:
|
|
2466
|
+
await Bridge.nativeOz.setGlobal({ key: "chkFlag", value: expectedValue, docIndex: i });
|
|
2329
2467
|
}
|
|
2330
2468
|
return;
|
|
2331
2469
|
}
|
|
2470
|
+
async function enableFocusOnValidation(reportCount) {
|
|
2471
|
+
return setFocusOnValidation(true, reportCount);
|
|
2472
|
+
}
|
|
2332
2473
|
async function disableFocusOnValidation(reportCount) {
|
|
2333
|
-
|
|
2334
|
-
for (let i = 0; i < count; i++) {
|
|
2335
|
-
await sleep();
|
|
2336
|
-
await Bridge.nativeOz.setGlobal({ key: "chkFlag", value: "0", docIndex: i });
|
|
2337
|
-
}
|
|
2338
|
-
return;
|
|
2474
|
+
return setFocusOnValidation(false, reportCount);
|
|
2339
2475
|
}
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2476
|
+
|
|
2477
|
+
// src/oz/utils/bridge-util/oz-wrapper-util.ts
|
|
2478
|
+
async function CreateOzViewer(ozParam) {
|
|
2479
|
+
const { promise, resolve } = PromiseWithResolvers();
|
|
2480
|
+
window.addEventListener(
|
|
2481
|
+
"OZReportCreated" /* OZReportCreated */,
|
|
2482
|
+
// OZReportCreated가 트리거되면 promise resolve 처리
|
|
2483
|
+
(e) => resolve(e),
|
|
2484
|
+
// 이벤트 리스너는 한 번만 실행되도록 설정
|
|
2485
|
+
{ once: true }
|
|
2486
|
+
);
|
|
2487
|
+
await Bridge.native.createOZViewer({ param: ozParam.join("\n") });
|
|
2488
|
+
return await promise;
|
|
2347
2489
|
}
|
|
2348
|
-
async function
|
|
2349
|
-
const
|
|
2350
|
-
|
|
2351
|
-
await sleep();
|
|
2352
|
-
await Bridge.nativeOz.triggerExternalEventByDocIndex({ docIndex: Number(i), param1: "cropimage" });
|
|
2353
|
-
}
|
|
2490
|
+
async function getReportCount() {
|
|
2491
|
+
const { data } = await Bridge.nativeOz.getInformation({ command: "REPORT_COUNT" });
|
|
2492
|
+
return Number(data);
|
|
2354
2493
|
}
|
|
2355
|
-
async function
|
|
2356
|
-
|
|
2357
|
-
const totalPages = [];
|
|
2358
|
-
for (let i = 0; i < count; i++) {
|
|
2359
|
-
await sleep();
|
|
2360
|
-
const command = `TOTAL_PAGE_OF_REPORT_FILE_AT=${i}`;
|
|
2361
|
-
const { data } = await Bridge.nativeOz.getInformation({ command });
|
|
2362
|
-
totalPages.push(Number(data));
|
|
2363
|
-
}
|
|
2364
|
-
return totalPages;
|
|
2494
|
+
async function MovePage(page) {
|
|
2495
|
+
return await Bridge.nativeOz.script({ command: `movepage=${page}` });
|
|
2365
2496
|
}
|
|
2497
|
+
async function getTotalPage() {
|
|
2498
|
+
const { data } = await Bridge.nativeOz.getInformation({ command: "TOTAL_PAGE" });
|
|
2499
|
+
return Number(data);
|
|
2500
|
+
}
|
|
2501
|
+
async function getCurrentPage() {
|
|
2502
|
+
const { data } = await Bridge.nativeOz.getInformation({ command: `CURRENT_PAGE` });
|
|
2503
|
+
return Number(data);
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
// src/oz/utils/bridge-util/validation-util.ts
|
|
2366
2507
|
async function checkDocumentsValidityByIndex(indexList) {
|
|
2367
2508
|
const VALID = "";
|
|
2368
2509
|
for (let i = 0; i < indexList.length; i++) {
|
|
@@ -2376,75 +2517,51 @@ async function checkDocumentsValidityByIndex(indexList) {
|
|
|
2376
2517
|
return true;
|
|
2377
2518
|
}
|
|
2378
2519
|
async function validateAllPages(pageCount) {
|
|
2379
|
-
const VALID = "valid";
|
|
2380
2520
|
const count = pageCount ?? await getTotalPage();
|
|
2381
2521
|
for (let i = 1; i <= count; i++) {
|
|
2382
2522
|
await sleep();
|
|
2383
|
-
const
|
|
2384
|
-
|
|
2385
|
-
if (data !== VALID) {
|
|
2523
|
+
const isValid = await checkValidPageMemo(i);
|
|
2524
|
+
if (!isValid) {
|
|
2386
2525
|
return false;
|
|
2387
2526
|
}
|
|
2388
2527
|
}
|
|
2389
2528
|
return true;
|
|
2390
2529
|
}
|
|
2391
|
-
|
|
2392
|
-
const
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
async function setEnableCommentMode(type = "yellow") {
|
|
2416
|
-
let param;
|
|
2417
|
-
if (type === "yellow") {
|
|
2418
|
-
param = commentPenYellow;
|
|
2419
|
-
} else if (type === "pink") {
|
|
2420
|
-
param = commentPenPink;
|
|
2421
|
-
} else if (type === "green") {
|
|
2422
|
-
param = commentPenGreen;
|
|
2423
|
-
} else {
|
|
2424
|
-
param = commentPenEraser;
|
|
2425
|
-
}
|
|
2426
|
-
return await setCommentMode(param);
|
|
2427
|
-
}
|
|
2428
|
-
async function setDisableCommentMode() {
|
|
2429
|
-
const command = `mode_input_all`;
|
|
2430
|
-
return await Bridge.nativeOz.script({ command });
|
|
2431
|
-
}
|
|
2432
|
-
async function CommentHandler({ type, btnID }) {
|
|
2433
|
-
if (type !== "comment") {
|
|
2434
|
-
throw `Unexpected Type ${type}`;
|
|
2435
|
-
}
|
|
2436
|
-
if (btnID === "yellow") {
|
|
2437
|
-
await setEnableCommentMode("yellow");
|
|
2438
|
-
} else if (btnID === "pink") {
|
|
2439
|
-
await setEnableCommentMode("pink");
|
|
2440
|
-
} else if (btnID === "green") {
|
|
2441
|
-
await setEnableCommentMode("green");
|
|
2442
|
-
} else if (btnID === "eraser") {
|
|
2443
|
-
await setEnableCommentMode("eraser");
|
|
2444
|
-
} else {
|
|
2445
|
-
await setDisableCommentMode();
|
|
2530
|
+
var checkValidPageMemo = (() => {
|
|
2531
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2532
|
+
async function checkValidPage(page) {
|
|
2533
|
+
const cached = cache.get(page);
|
|
2534
|
+
if (cached) {
|
|
2535
|
+
return cached;
|
|
2536
|
+
}
|
|
2537
|
+
const VALID = "valid";
|
|
2538
|
+
const command = `INPUT_CHECK_VALIDITY_PAGE_AT=${page}`;
|
|
2539
|
+
const promise = (async () => {
|
|
2540
|
+
try {
|
|
2541
|
+
const { data } = await Bridge.nativeOz.getInformation({ command });
|
|
2542
|
+
const isValid = data === VALID;
|
|
2543
|
+
if (!isValid) {
|
|
2544
|
+
cache.delete(page);
|
|
2545
|
+
}
|
|
2546
|
+
return isValid;
|
|
2547
|
+
} catch (err) {
|
|
2548
|
+
cache.delete(page);
|
|
2549
|
+
throw err;
|
|
2550
|
+
}
|
|
2551
|
+
})();
|
|
2552
|
+
cache.set(page, promise);
|
|
2553
|
+
return promise;
|
|
2446
2554
|
}
|
|
2447
|
-
|
|
2555
|
+
checkValidPage.clearCache = () => {
|
|
2556
|
+
cache.clear();
|
|
2557
|
+
};
|
|
2558
|
+
checkValidPage.clearCacheByPage = (page) => {
|
|
2559
|
+
cache.delete(page);
|
|
2560
|
+
};
|
|
2561
|
+
return checkValidPage;
|
|
2562
|
+
})();
|
|
2563
|
+
|
|
2564
|
+
// src/oz/utils/bridge-util/btn-touch-event-util.ts
|
|
2448
2565
|
async function CategoryHandler(documentInfo, { type, btnID }) {
|
|
2449
2566
|
if (type !== "category") {
|
|
2450
2567
|
throw `Unexpected Type ${type}`;
|
|
@@ -2468,6 +2585,7 @@ async function SignatureHandler({ type, btnID }) {
|
|
|
2468
2585
|
try {
|
|
2469
2586
|
await Bridge.native.showLoader();
|
|
2470
2587
|
await disableFocusOnValidation(reportCount);
|
|
2588
|
+
checkValidPageMemo.clearCache();
|
|
2471
2589
|
const isAllValid = await validateAllPages(pageCount);
|
|
2472
2590
|
if (!isAllValid) {
|
|
2473
2591
|
throw "MissingAlert";
|
|
@@ -2527,103 +2645,131 @@ async function SaveTotalPdf() {
|
|
|
2527
2645
|
const filepath = await promise;
|
|
2528
2646
|
return filepath;
|
|
2529
2647
|
}
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2648
|
+
async function isCommentMode() {
|
|
2649
|
+
const { data } = await Bridge.nativeOz.getInformation({
|
|
2650
|
+
command: `COMMENT_MODE`
|
|
2651
|
+
});
|
|
2652
|
+
return data === "comment";
|
|
2653
|
+
}
|
|
2654
|
+
async function setCommentMode(penConfig) {
|
|
2655
|
+
const command = `mode_comment_all`;
|
|
2656
|
+
const commentEnabled = await isCommentMode();
|
|
2657
|
+
const param = [
|
|
2658
|
+
...commentEnabled ? [] : [`viewer.screentool=comment`],
|
|
2659
|
+
...penConfig
|
|
2660
|
+
].join("\n");
|
|
2661
|
+
await sleep();
|
|
2662
|
+
return await Bridge.nativeOz.scriptEx({ command, param });
|
|
2663
|
+
}
|
|
2664
|
+
async function setEnableCommentMode(type = "yellow") {
|
|
2665
|
+
let param;
|
|
2666
|
+
if (type === "yellow") {
|
|
2667
|
+
param = commentPenYellow;
|
|
2668
|
+
} else if (type === "pink") {
|
|
2669
|
+
param = commentPenPink;
|
|
2670
|
+
} else if (type === "green") {
|
|
2671
|
+
param = commentPenGreen;
|
|
2672
|
+
} else {
|
|
2673
|
+
param = commentPenEraser;
|
|
2674
|
+
}
|
|
2675
|
+
return await setCommentMode(param);
|
|
2676
|
+
}
|
|
2677
|
+
async function setDisableCommentMode() {
|
|
2678
|
+
const command = `mode_input_all`;
|
|
2679
|
+
return await Bridge.nativeOz.script({ command });
|
|
2680
|
+
}
|
|
2681
|
+
async function CommentHandler({ type, btnID }) {
|
|
2682
|
+
if (type !== "comment") {
|
|
2683
|
+
throw `Unexpected Type ${type}`;
|
|
2684
|
+
}
|
|
2685
|
+
if (btnID === "yellow") {
|
|
2686
|
+
await setEnableCommentMode("yellow");
|
|
2687
|
+
} else if (btnID === "pink") {
|
|
2688
|
+
await setEnableCommentMode("pink");
|
|
2689
|
+
} else if (btnID === "green") {
|
|
2690
|
+
await setEnableCommentMode("green");
|
|
2691
|
+
} else if (btnID === "eraser") {
|
|
2692
|
+
await setEnableCommentMode("eraser");
|
|
2693
|
+
} else {
|
|
2694
|
+
await setDisableCommentMode();
|
|
2695
|
+
}
|
|
2565
2696
|
}
|
|
2566
2697
|
|
|
2567
|
-
// src/oz/
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
const documentTemplateMap = (0, import_react2.useMemo)(() => documentInfo.reduce((map, doc) => {
|
|
2577
|
-
doc.file.forEach((file) => {
|
|
2578
|
-
map[file] = { ...doc };
|
|
2579
|
-
});
|
|
2580
|
-
return map;
|
|
2581
|
-
}, {}), [documentInfo]);
|
|
2582
|
-
const nameTemplateMap = documentInfo.reduce((acc, doc) => {
|
|
2583
|
-
acc[doc.name] = doc;
|
|
2584
|
-
return acc;
|
|
2585
|
-
}, {});
|
|
2586
|
-
const groupIndexes = (0, import_react2.useMemo)(() => documentInfo.reduce((acc, item) => {
|
|
2587
|
-
item.file.forEach((file) => {
|
|
2588
|
-
const currentIndex = documentIndexMap[file];
|
|
2589
|
-
if (!acc[currentIndex]) {
|
|
2590
|
-
acc[currentIndex] = [];
|
|
2591
|
-
}
|
|
2592
|
-
item.file.forEach((groupFile) => {
|
|
2593
|
-
acc[currentIndex].push(documentIndexMap[groupFile]);
|
|
2594
|
-
});
|
|
2595
|
-
});
|
|
2596
|
-
return acc;
|
|
2597
|
-
}, []), [documentIndexMap, documentInfo]);
|
|
2598
|
-
const isAllComplete = (0, import_react2.useMemo)(() => documentInfo.every((i) => i.complete), [documentInfo]);
|
|
2599
|
-
return {
|
|
2600
|
-
setDocumentInfo,
|
|
2601
|
-
documentInfo,
|
|
2602
|
-
documentList,
|
|
2603
|
-
documentTemplateMap,
|
|
2604
|
-
documentIndexMap,
|
|
2605
|
-
nameTemplateMap,
|
|
2606
|
-
groupIndexes,
|
|
2607
|
-
isAllComplete
|
|
2608
|
-
};
|
|
2698
|
+
// src/oz/utils/bridge-util/fetch-util.ts
|
|
2699
|
+
async function fetchDocument(options) {
|
|
2700
|
+
const { data } = await Bridge.native.downloadDocument({ data: options });
|
|
2701
|
+
return data.map((i) => ({ ...i, startPage: 0, endPage: 0 }));
|
|
2702
|
+
}
|
|
2703
|
+
async function fetchFont() {
|
|
2704
|
+
const { data: fontMap } = await Bridge.native.getOzFontParam();
|
|
2705
|
+
const fontParms = Object.keys(fontMap).map((i) => `font.${i}=${fontMap[i]}`);
|
|
2706
|
+
return fontParms;
|
|
2609
2707
|
}
|
|
2610
2708
|
|
|
2611
|
-
// src/oz/
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
}
|
|
2619
|
-
[handler]
|
|
2709
|
+
// src/oz/utils/bridge-util/create-report-util.ts
|
|
2710
|
+
async function CreateOzParam(documentList, extraData = {}) {
|
|
2711
|
+
if (documentList.length === 0) {
|
|
2712
|
+
throw new Error("\uBB38\uC11C\uBAA9\uB85D\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4");
|
|
2713
|
+
}
|
|
2714
|
+
const fontParms = await fetchFont();
|
|
2715
|
+
const connectionParams = documentList.map(
|
|
2716
|
+
(file, idx) => idx === 0 ? `connection.openfile=${file}` : `child${idx}.connection.openfile=${file}`
|
|
2620
2717
|
);
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
}
|
|
2626
|
-
|
|
2718
|
+
const childCount = documentList.length - 1;
|
|
2719
|
+
const extraParams = documentList.map((file, idx) => {
|
|
2720
|
+
const result = [];
|
|
2721
|
+
const docCode = file.replace(/^.*[\\/]|(\.[^/.]+)$/g, "");
|
|
2722
|
+
const prefix = idx === 0 ? "" : `child${idx}.`;
|
|
2723
|
+
const data = extraData[docCode] || {};
|
|
2724
|
+
if (data.inputJson) {
|
|
2725
|
+
result.push(`${prefix}connection.inputjson=${JSON.stringify(data.inputJson)}`);
|
|
2726
|
+
}
|
|
2727
|
+
if (data.extraParam) {
|
|
2728
|
+
result.push(data.extraParam.map((param) => `${prefix}${param}`).join("\n"));
|
|
2729
|
+
}
|
|
2730
|
+
return result;
|
|
2731
|
+
});
|
|
2732
|
+
const params = [
|
|
2733
|
+
...childCount > 0 ? [`viewer.childcount=${childCount}`] : [],
|
|
2734
|
+
...connectionParams,
|
|
2735
|
+
...commonOzParam,
|
|
2736
|
+
...fontParms,
|
|
2737
|
+
...extraParams.flat(1)
|
|
2738
|
+
];
|
|
2739
|
+
return params;
|
|
2740
|
+
}
|
|
2741
|
+
async function setCheckEform(reportCount) {
|
|
2742
|
+
const count = reportCount ?? await getReportCount();
|
|
2743
|
+
for (let i = 0; i < count; i++) {
|
|
2744
|
+
await sleep();
|
|
2745
|
+
await Bridge.nativeOz.setGlobal({ key: "checkeForm", value: "Y", docIndex: i });
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
async function triggerClickOnAllDocuments(reportCount) {
|
|
2749
|
+
const count = reportCount ?? await getReportCount();
|
|
2750
|
+
for (let i = 0; i < count; i++) {
|
|
2751
|
+
await sleep();
|
|
2752
|
+
const command = `INPUT_TRIGGER_CLICK_AT=${i}`;
|
|
2753
|
+
await Bridge.nativeOz.getInformation({ command });
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
async function triggerCropImageOnAllDocuments(reportCount) {
|
|
2757
|
+
const count = reportCount ?? await getReportCount();
|
|
2758
|
+
for (let i = 0; i < count; i++) {
|
|
2759
|
+
await sleep();
|
|
2760
|
+
await Bridge.nativeOz.triggerExternalEventByDocIndex({ docIndex: Number(i), param1: "cropimage" });
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
async function getTotalPageOnAllDocuments(reportCount) {
|
|
2764
|
+
const count = reportCount ?? await getReportCount();
|
|
2765
|
+
const totalPages = [];
|
|
2766
|
+
for (let i = 0; i < count; i++) {
|
|
2767
|
+
await sleep();
|
|
2768
|
+
const command = `TOTAL_PAGE_OF_REPORT_FILE_AT=${i}`;
|
|
2769
|
+
const { data } = await Bridge.nativeOz.getInformation({ command });
|
|
2770
|
+
totalPages.push(Number(data));
|
|
2771
|
+
}
|
|
2772
|
+
return totalPages;
|
|
2627
2773
|
}
|
|
2628
2774
|
/*! Bundled license information:
|
|
2629
2775
|
|
|
@@ -2653,6 +2799,10 @@ react/cjs/react.development.js:
|
|
|
2653
2799
|
exports.Bridge = Bridge;
|
|
2654
2800
|
exports.CategoryHandler = CategoryHandler;
|
|
2655
2801
|
exports.CommentHandler = CommentHandler;
|
|
2802
|
+
exports.CreateOzParam = CreateOzParam;
|
|
2803
|
+
exports.CreateOzViewer = CreateOzViewer;
|
|
2804
|
+
exports.DownloadDocumentList = DownloadDocumentList;
|
|
2805
|
+
exports.ExtraData = ExtraData;
|
|
2656
2806
|
exports.MovePage = MovePage;
|
|
2657
2807
|
exports.OZViewerEvent = OZViewerEvent;
|
|
2658
2808
|
exports.PdfHandler = PdfHandler;
|
|
@@ -2663,6 +2813,7 @@ exports.TopHandler = TopHandler;
|
|
|
2663
2813
|
exports.btnStyle = btnStyle;
|
|
2664
2814
|
exports.categorizeByPageRange = categorizeByPageRange;
|
|
2665
2815
|
exports.checkDocumentsValidityByIndex = checkDocumentsValidityByIndex;
|
|
2816
|
+
exports.checkValidPageMemo = checkValidPageMemo;
|
|
2666
2817
|
exports.commentPenEraser = commentPenEraser;
|
|
2667
2818
|
exports.commentPenGreen = commentPenGreen;
|
|
2668
2819
|
exports.commentPenPink = commentPenPink;
|
|
@@ -2680,12 +2831,12 @@ exports.getReportCount = getReportCount;
|
|
|
2680
2831
|
exports.getTotalPage = getTotalPage;
|
|
2681
2832
|
exports.getTotalPageOnAllDocuments = getTotalPageOnAllDocuments;
|
|
2682
2833
|
exports.isCommentMode = isCommentMode;
|
|
2834
|
+
exports.setCheckEform = setCheckEform;
|
|
2683
2835
|
exports.setDisableCommentMode = setDisableCommentMode;
|
|
2684
2836
|
exports.setEnableCommentMode = setEnableCommentMode;
|
|
2685
2837
|
exports.sleep = sleep;
|
|
2686
2838
|
exports.triggerClickOnAllDocuments = triggerClickOnAllDocuments;
|
|
2687
2839
|
exports.triggerCropImageOnAllDocuments = triggerCropImageOnAllDocuments;
|
|
2688
|
-
exports.useCreateReport = useCreateReport;
|
|
2689
2840
|
exports.useDocumentInfo = useDocumentInfo;
|
|
2690
2841
|
exports.useOzEventListener = useOzEventListener;
|
|
2691
2842
|
exports.validateAllPages = validateAllPages;
|