sales-frontend-oz 0.0.16 → 0.0.18

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.js CHANGED
@@ -149,48 +149,6 @@ var commonPdfExportParam = [
149
149
  // 폰트를 포함시킬때 사용하는 글자만 포함시킨다
150
150
  `pdf.fontembedding_subset=true`
151
151
  ];
152
-
153
- // src/oz/constant/test-data.ts
154
- var wrapperStyle = { display: "flex", flexFlow: "column", gap: "10px" };
155
- var btnStyle = { border: "1px solid red", minHeight: "40px" };
156
- var DownloadDocumentList = [
157
- { name: "[A0010]\uCCAD\uC57D\uC11C", doc: [{ docCode: "A0010", fileID: "548PJrCOTEbtSKkAA", imageFormatCode: "RT003000", imageDocumentTypeCode: "IT00", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
158
- { name: "[A0100]\uBE44\uAD50\uC548\uB0B4\uD655\uC778\uC11C", doc: [{ docCode: "A0100", fileID: "ADXS1CCOTEgGVKkAA", imageFormatCode: "RT003001", imageDocumentTypeCode: "IT01", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
159
- { name: "[A0900]\uC0C1\uD488\uC124\uBA85\uC11C", doc: [{ docCode: "A0900", fileID: "q7jjxECOTErDoKkAA", imageFormatCode: "RT003002", imageDocumentTypeCode: "IT02", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
160
- { name: "[A1500]\uCCAD\uC57D\uBD80\uC18D\uC815\uBCF4\uD655\uC778\uC11C", doc: [{ docCode: "A1500", fileID: "PHYuIXCOTEvSIKkAA", imageFormatCode: "RT003003", imageDocumentTypeCode: "IT03", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
161
- { name: "[A2215]\uBCF4\uD5D8\uACC4\uC57D\uB300\uCD9C\uC774\uD589\uAD00\uB9AC\uB3D9\uC758\uC11C", doc: [{ docCode: "A2215", fileID: "aCLb5eCOTEyqjKkAA", imageFormatCode: "RT003004", imageDocumentTypeCode: "IT04", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
162
- { name: "[A2800]\uACC4\uC57D\uC804\uC54C\uB9B4\uC758\uBB34", doc: [{ docCode: "A2800", fileID: "Je6ZAtCOTE4rTKkAA", imageFormatCode: "RT003005", imageDocumentTypeCode: "IT05", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
163
- { name: "[A3503]\uCCAD\uC57D\uC11C\uBCC4\uC9C0(\uBCC0\uC561\uC6A9)", doc: [{ docCode: "A3503", fileID: "ApnNTbCOTE8CjKkAA", imageFormatCode: "RT003006", imageDocumentTypeCode: "IT06", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
164
- { name: "[B0101]\uBCF4\uD5D8\uACC4\uC57D\uCCB4\uACB0\uB3D9\uC758\uC11C", doc: [{ docCode: "B0101", fileID: "756qLXCOTFDYFKkAA", imageFormatCode: "RT003007", imageDocumentTypeCode: "IT07", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
165
- { name: "[C0400]\uACC4\uC57D\uCCB4\uACB0\uC774\uD589\uB3D9\uC758\uC11C", doc: [{ docCode: "C0400", fileID: "Bg0c0HCOTFHF7KkAA", imageFormatCode: "RT003008", imageDocumentTypeCode: "IT08", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
166
- { name: "[C0401]\uC0C1\uD488\uC18C\uAC1C\uC0C1\uC138\uB3D9\uC758\uC11C", doc: [{ docCode: "C0401", fileID: "yDoJLMCOTFKKpKkAA", imageFormatCode: "RT003009", imageDocumentTypeCode: "IT09", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
167
- { name: "[C1000]\uBCF4\uD5D8\uC0C1\uD488\uD310\uB9E4\uCCB4\uD06C\uB9AC\uC2A4\uD2B8", doc: [{ docCode: "C1000", fileID: "FtAEqcCOTFOOsKkAA", imageFormatCode: "RT003010", imageDocumentTypeCode: "IT10", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
168
- { name: "[C1300]\uACC4\uC57D\uCCB4\uACB0\uACE0\uC9C0\uC758\uBB34\uD655\uC778\uC11C", doc: [{ docCode: "C1300", fileID: "TAHeCCCOTFRqrKkAA", imageFormatCode: "RT003011", imageDocumentTypeCode: "IT11", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false },
169
- { name: "[C1400]\uBCF4\uD5D8\uC0C1\uD488\uBE44\uAD50\uC124\uBA85\uD655\uC778\uC11C", doc: [{ docCode: "C1400", fileID: "3nLROXCOTFU1QKkAA", imageFormatCode: "RT003012", imageDocumentTypeCode: "IT12", filePath: "", startPage: 0, endPage: 0 }], complete: false, startPage: 0, endPage: 0, focus: false }
170
- ];
171
- var ExtraData = {
172
- // 문서코드
173
- A0010: {
174
- // connection.inputjson으로 바인딩할 데이터
175
- inputJson: {
176
- // 계약자 성명 사인정보
177
- A0010_mynm_sg: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAABDUlEQVR4nOzSMQ0CQBQEUSAnAAU0iEAAPWKQgQU04gED10z1IXlPwWay6/78HH7P+3qZnrBxmh7wT8QKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECsQKxArECtZjvaY3bNzOx+kJG54ViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgVfAMAAP//tD4Eb/yjIncAAAAASUVORK5CYII=",
178
- // 계약자 서명 사인정보
179
- A0010_mysg_sign: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAABDElEQVR4nOzSsQkCYRgEUZXDVgTtxdDIYgR7sFkTG/iTiT4P3qtgGXa7vp+H//M5PqYnLJymB+yJWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgVjBdj9fpjcsvG7f6QkLnhWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBX8AgAA//9+7gTkg4AcBQAAAABJRU5ErkJggg=="
180
- },
181
- // 기타 공통으로 사용하지 않을 파라미터
182
- extraParam: [],
183
- // aaa=bbb
184
- args: []
185
- },
186
- A0900: {
187
- args: []
188
- }
189
- };
190
- var policyNumber = "300034894";
191
- var fpInfo = { uniqNo: "2210000" };
192
- var roleCode = [`11`, `28`];
193
- var xdudheaders = `Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJXNWRtc1g1MkVWZGV0YThJRy90YmlZY281bnVCdzRZOXhGZjlWakZzdWxnbU00YnkiLCJpYXQiOjE3NjEwNDMyNjgsImV4cCI6MTc2NjI5OTI2OH0.KDnF7ZhkmnEApGCvOcItwcHnLWe5iJu64g93GACT2yo`;
194
152
  function useDocumentInfo(initialValue) {
195
153
  const documentInfo = initialValue;
196
154
  const documentList = useMemo(() => documentInfo.map((i) => i.doc).flat(1), [documentInfo]);
@@ -265,6 +223,20 @@ var OZTriggerExternalEvent = /* @__PURE__ */ ((OZTriggerExternalEvent2) => {
265
223
  OZTriggerExternalEvent2["CropImage"] = "cropimage";
266
224
  return OZTriggerExternalEvent2;
267
225
  })(OZTriggerExternalEvent || {});
226
+ async function AlertTemporaryError() {
227
+ return await Bridge.nativeOz.showAlert({
228
+ title: "\uC77C\uC2DC\uC801\uC778 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",
229
+ message: "\uBB38\uC81C\uAC00 \uC9C0\uC18D\uB420 \uACBD\uC6B0 IT\uCF5C\uC13C\uD130(1522-6379)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694.",
230
+ buttons: { close: false, main: "\uD655\uC778" }
231
+ });
232
+ }
233
+ async function AlertDocumentLoadError() {
234
+ return await Bridge.nativeOz.showAlert({
235
+ title: "\uCCAD\uC57D\uBB38\uC11C\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
236
+ message: "\uBB38\uC81C\uAC00 \uC9C0\uC18D\uB420 \uACBD\uC6B0 IT\uCF5C\uC13C\uD130(1522-6379)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694.",
237
+ buttons: { close: false, main: "\uD655\uC778" }
238
+ });
239
+ }
268
240
 
269
241
  // src/oz/utils/common-util.ts
270
242
  function categorizeByPageRange(data, pageCounts) {
@@ -322,22 +294,69 @@ function ensureArray(arg) {
322
294
  function DeepCopy(arg) {
323
295
  return JSON.parse(JSON.stringify(arg));
324
296
  }
325
- async function AlertTemporaryError() {
326
- return await Bridge.nativeOz.showAlert({
327
- title: "\uC77C\uC2DC\uC801\uC778 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",
328
- message: "\uBB38\uC81C\uAC00 \uC9C0\uC18D\uB420 \uACBD\uC6B0 IT\uCF5C\uC13C\uD130(1522-6379)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694.",
329
- buttons: { close: false, main: "\uD655\uC778" }
297
+ async function fetchDocument(args) {
298
+ const { data: result } = await Bridge.native.downloadDocument(args);
299
+ return result.data.map((i) => ({ ...i, startPage: 0, endPage: 0 }));
300
+ }
301
+ async function fetchFont() {
302
+ const { data: fontMap } = await Bridge.native.getOzFontParam();
303
+ const fontParms = Object.keys(fontMap).map((i) => `font.${i}=${fontMap[i]}`);
304
+ return fontParms;
305
+ }
306
+ async function postFiletoDud(imageStr) {
307
+ const formData = new FormData();
308
+ formData.append("data", base64ToFile(imageStr, "test.png"));
309
+ formData.append("fileIdentifierValue", "string");
310
+ formData.append("fileExtendContent1", "string");
311
+ formData.append("fileExtendContent2", "string");
312
+ formData.append("preservationTerm", "1");
313
+ formData.append("fileType", "png");
314
+ const response = await fetch("/api/v1/post/file", {
315
+ headers: {
316
+ "x-channel-appversion": "3.1",
317
+ "x-channel-carriername": "SK",
318
+ "x-channel-deviceid": "deviceid",
319
+ "x-channel-devicemodel": "iPHONE13",
320
+ "x-channel-formfactor": "Phone",
321
+ "x-channel-loginchannel": "DSP",
322
+ "x-channel-logintype": "ONPA_PIN",
323
+ "x-channel-networktype": "LTE",
324
+ "x-channel-platformversion": "15.4.1",
325
+ "x-channel-screenid": "ScreenId",
326
+ "x-dud-authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJXNWRtc1g1MkVWZGV0YThJRy90YmlZY281bnVCdzRZOXhGZjlWakZzdWxnbU00YnkiLCJpYXQiOjE3NjEwNDMyNjgsImV4cCI6MTc2NjI5OTI2OH0.KDnF7ZhkmnEApGCvOcItwcHnLWe5iJu64g93GACT2yo",
327
+ "x-x-channel-platformname": "IOS"
328
+ },
329
+ method: "POST",
330
+ body: formData
330
331
  });
332
+ const json = await response.json();
333
+ return json;
331
334
  }
332
- async function AlertDocumentLoadError() {
333
- return await Bridge.nativeOz.showAlert({
334
- title: "\uCCAD\uC57D\uBB38\uC11C\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
335
- message: "\uBB38\uC81C\uAC00 \uC9C0\uC18D\uB420 \uACBD\uC6B0 IT\uCF5C\uC13C\uD130(1522-6379)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694.",
336
- buttons: { close: false, main: "\uD655\uC778" }
335
+ async function getFileFromDud(fileMgmtId) {
336
+ const outputType = "binary";
337
+ const response = await fetch("/api/v1/get/file", {
338
+ headers: {
339
+ "content-type": "application/json",
340
+ "x-channel-appversion": "3.1",
341
+ "x-channel-carriername": "SK",
342
+ "x-channel-deviceid": "deviceid",
343
+ "x-channel-devicemodel": "iPHONE13",
344
+ "x-channel-formfactor": "Phone",
345
+ "x-channel-loginchannel": "DSP",
346
+ "x-channel-logintype": "ONPA_PIN",
347
+ "x-channel-networktype": "LTE",
348
+ "x-channel-platformversion": "15.4.1",
349
+ "x-channel-screenid": "ScreenId",
350
+ "x-dud-authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJXNWRtc1g1MkVWZGV0YThJRy90YmlZY281bnVCdzRZOXhGZjlWakZzdWxnbU00YnkiLCJpYXQiOjE3NjEwNDMyNjgsImV4cCI6MTc2NjI5OTI2OH0.KDnF7ZhkmnEApGCvOcItwcHnLWe5iJu64g93GACT2yo",
351
+ "x-x-channel-platformname": "IOS"
352
+ },
353
+ method: "POST",
354
+ body: JSON.stringify({ fileMgmtId, outputType })
337
355
  });
356
+ const blob = await response.blob();
357
+ const base64String = await fileToBase64(blob);
358
+ return base64String;
338
359
  }
339
-
340
- // src/oz/utils/bridge-util/oz-wrapper-util.ts
341
360
  async function CreateOzViewer(ozParam) {
342
361
  const { promise, resolve, reject } = PromiseWithResolvers();
343
362
  const handleTimeout = () => {
@@ -423,338 +442,6 @@ var getReportCountMemo = (() => {
423
442
  return getReportCount;
424
443
  })();
425
444
 
426
- // src/oz/utils/bridge-util/btn-touch-event-util/category-handler.ts
427
- async function CategoryHandler(documentInfo, { type, btnID }) {
428
- if (type !== "category") {
429
- throw `Unexpected Type ${type}`;
430
- }
431
- const target = documentInfo.find((i) => i.name === btnID);
432
- if (!target) {
433
- throw `Unexpected btnID ${target}`;
434
- }
435
- await MovePage(target.startPage);
436
- }
437
- async function TopHandler({ type, btnID }) {
438
- if (type !== "top") {
439
- throw `Unexpected Type ${type}`;
440
- }
441
- if (btnID === "btnExit") {
442
- await Bridge.native.hideOZViewer();
443
- } else {
444
- throw `Unexpected btnID ${btnID}`;
445
- }
446
- }
447
- async function CommentHandler({ type, btnID }) {
448
- if (type !== "comment") {
449
- throw `Unexpected Type ${type}`;
450
- }
451
- if (btnID === "yellow") {
452
- await setEnableCommentMode("yellow");
453
- } else if (btnID === "pink") {
454
- await setEnableCommentMode("pink");
455
- } else if (btnID === "green") {
456
- await setEnableCommentMode("green");
457
- } else if (btnID === "eraser") {
458
- await setEnableCommentMode("eraser");
459
- } else if (btnID === "disable") {
460
- await setDisableCommentMode();
461
- } else {
462
- throw `Unexpected btnID ${btnID}`;
463
- }
464
- }
465
- async function isCommentMode() {
466
- const { data } = await Bridge.nativeOz.getInformation({ command: `COMMENT_MODE` });
467
- return data === "comment";
468
- }
469
- async function setCommentMode(penConfig) {
470
- const command = `mode_comment_all`;
471
- const commentEnabled = await isCommentMode();
472
- const param = [
473
- ...commentEnabled ? [] : [`viewer.screentool=comment`],
474
- ...penConfig
475
- ].join("\n");
476
- await sleep();
477
- return await Bridge.nativeOz.scriptEx({ command, param });
478
- }
479
- async function setEnableCommentMode(type = "yellow") {
480
- let param;
481
- if (type === "yellow") {
482
- param = commentPenYellow;
483
- } else if (type === "pink") {
484
- param = commentPenPink;
485
- } else if (type === "green") {
486
- param = commentPenGreen;
487
- } else {
488
- param = commentPenEraser;
489
- }
490
- return await setCommentMode(param);
491
- }
492
- async function setDisableCommentMode() {
493
- const command = `mode_input_all`;
494
- return await Bridge.nativeOz.script({ command });
495
- }
496
- async function PdfHandler({ type, btnID }) {
497
- if (type !== "pdf") {
498
- throw `Unexpected Type ${type}`;
499
- }
500
- if (btnID === "modify") {
501
- await Bridge.nativeOz.hideOzPdfViewer();
502
- } else if (btnID === "submit") {
503
- await Bridge.nativeOz.hideOzPdfViewer();
504
- await Bridge.native.hideOZViewer();
505
- } else {
506
- throw `Unexpected btnID ${btnID}`;
507
- }
508
- }
509
- async function setFocusOnValidation(enable, reportCount) {
510
- const count = reportCount ?? await getReportCountMemo();
511
- const expectedValue = enable ? "1" : "0";
512
- const { data: prev } = await Bridge.nativeOz.getGlobal({ key: "chkFlag", docIndex: 0 });
513
- if (prev === expectedValue) {
514
- return;
515
- }
516
- for (let i = 0; i < count; i++) {
517
- await sleep();
518
- await Bridge.nativeOz.setGlobal({ key: "chkFlag", value: expectedValue, docIndex: i });
519
- }
520
- return;
521
- }
522
- async function enableFocusOnValidation(reportCount) {
523
- return setFocusOnValidation(true, reportCount);
524
- }
525
- async function disableFocusOnValidation(reportCount) {
526
- return setFocusOnValidation(false, reportCount);
527
- }
528
- async function checkDocumentsValidityByIndex(indexList) {
529
- const VALID = "";
530
- for (let i = 0; i < indexList.length; i++) {
531
- await sleep();
532
- const command = `INVALID_INFO_JSON_AT=${indexList[i]}`;
533
- const { data } = await Bridge.nativeOz.getInformation({ command });
534
- if (data !== VALID) {
535
- return false;
536
- }
537
- }
538
- return true;
539
- }
540
- async function validateAllPages(pageCount) {
541
- const count = pageCount ?? await getTotalPageMemo();
542
- for (let i = 1; i <= count; i++) {
543
- await sleep();
544
- const isValid = await checkValidPageMemo(i);
545
- if (!isValid) {
546
- return false;
547
- }
548
- }
549
- return true;
550
- }
551
- var checkValidPageMemo = (() => {
552
- const cache = /* @__PURE__ */ new Map();
553
- async function checkValidPage(page) {
554
- const cached = cache.get(page);
555
- if (cached) {
556
- return cached;
557
- }
558
- const VALID = "valid";
559
- const command = `INPUT_CHECK_VALIDITY_PAGE_AT=${page}`;
560
- const promise = (async () => {
561
- try {
562
- const { data } = await Bridge.nativeOz.getInformation({ command });
563
- const isValid = data === VALID;
564
- if (!isValid) {
565
- cache.delete(page);
566
- }
567
- return isValid;
568
- } catch (err) {
569
- cache.delete(page);
570
- throw err;
571
- }
572
- })();
573
- cache.set(page, promise);
574
- return promise;
575
- }
576
- checkValidPage.clearCache = () => {
577
- cache.clear();
578
- };
579
- checkValidPage.clearCacheByPage = (page) => {
580
- cache.delete(page);
581
- };
582
- return checkValidPage;
583
- })();
584
-
585
- // src/oz/utils/bridge-util/btn-touch-event-util/signature-handler.ts
586
- async function SignatureHandler({ type, btnID }) {
587
- if (type !== "signature") {
588
- throw `Unexpected Type ${type}`;
589
- }
590
- if (btnID === "signatureInProgress") {
591
- await SignatureInProgressHandler();
592
- } else if (btnID === "signatureInMissing") {
593
- await SignatureInMissingHandler();
594
- } else if (btnID === "signatureComplete") {
595
- await SignatureCompleteHandler();
596
- } else {
597
- throw `Unexpected btnID ${btnID}`;
598
- }
599
- }
600
- async function SignatureInProgressHandler() {
601
- const reportCount = await getReportCountMemo();
602
- const pageCount = await getTotalPageMemo();
603
- await enableFocusOnValidation(reportCount);
604
- await validateAllPages(pageCount);
605
- }
606
- async function SignatureInMissingHandler() {
607
- const { data: result } = await Bridge.nativeOz.showAlert({
608
- title: "\uC785\uB825\uD558\uC9C0 \uC54A\uC740 \uD56D\uBAA9\uC774 \uC788\uC2B5\uB2C8\uB2E4",
609
- message: "\uD574\uB2F9 \uD56D\uBAA9\uC73C\uB85C \uC774\uB3D9\uD558\uC5EC \uC785\uB825\uC744 \uC644\uB8CC\uD574\uC8FC\uC138\uC694.",
610
- buttons: {
611
- close: true,
612
- main: "\uBBF8\uC785\uB825 \uD56D\uBAA9 \uC785\uB825\uD558\uAE30"
613
- }
614
- });
615
- if (result === "main") {
616
- return await SignatureInProgressHandler();
617
- }
618
- return;
619
- }
620
- async function SignatureCompleteHandler() {
621
- try {
622
- await Bridge.native.showLoader();
623
- checkValidPageMemo.clearCache();
624
- getReportCountMemo.clearCache();
625
- getTotalPageMemo.clearCache();
626
- const reportCount = await getReportCountMemo();
627
- const pageCount = await getTotalPageMemo();
628
- await disableFocusOnValidation(reportCount);
629
- const isAllValid = await validateAllPages(pageCount);
630
- if (!isAllValid) {
631
- throw "MissingAlert";
632
- }
633
- const filePath = await SaveTotalPdf();
634
- await Bridge.nativeOz.createOzPdfViewer({ filePath });
635
- } catch (e) {
636
- if (e === "MissingAlert") {
637
- await SignatureInMissingHandler();
638
- } else {
639
- alert("PDF export \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD558\uC600\uC2B5\uB2C8\uB2E4");
640
- }
641
- } finally {
642
- await Bridge.native.hideLoader();
643
- }
644
- }
645
- async function SaveTotalPdf() {
646
- const { promise, resolve } = PromiseWithResolvers();
647
- window.addEventListener(
648
- "OZExportCommand" /* OZExportCommand */,
649
- // 이벤트를 CustomEvent로 타입 캐스팅하고, detail에서 파일 경로 추출
650
- (e) => resolve(e.detail.filepaths),
651
- // 이벤트 리스너는 한 번만 실행되도록 설정
652
- { once: true }
653
- );
654
- const totalPage = await getTotalPageMemo();
655
- await Bridge.nativeOz.savePdf({
656
- // PDF 저장은 증번폴더/파일이름.pdf로 생성
657
- policyNumber,
658
- param: [
659
- // 저장할 파일명 설정
660
- `pdf.filename=${"total.pdf"}`,
661
- // 1페이지부터 마지막 페이지까지 저장
662
- `export.pages=${1}-${totalPage}`,
663
- // 공통 PDF 내보내기 파라미터 추가
664
- ...commonPdfExportParam
665
- ].join("\n")
666
- });
667
- const filepath = await promise;
668
- return filepath;
669
- }
670
- async function SaveSinglePdf({ startPage, endPage, imageDocumentTypeCode }) {
671
- const { promise, resolve } = PromiseWithResolvers();
672
- window.addEventListener(
673
- "OZExportCommand" /* OZExportCommand */,
674
- // 이벤트를 CustomEvent로 타입 캐스팅하고, detail에서 파일 경로 추출
675
- (e) => resolve(e.detail.filepaths),
676
- // 이벤트 리스너는 한 번만 실행되도록 설정
677
- { once: true }
678
- );
679
- await Bridge.nativeOz.savePdf({
680
- // PDF 저장은 증번폴더/파일이름.pdf로 생성
681
- policyNumber,
682
- param: [
683
- // 저장할 파일명 설정
684
- `pdf.filename=${imageDocumentTypeCode}.pdf`,
685
- // 1페이지부터 마지막 페이지까지 저장
686
- `export.pages=${startPage}-${endPage}`,
687
- // 공통 PDF 내보내기 파라미터 추가
688
- ...commonPdfExportParam
689
- ].join("\n")
690
- });
691
- const filepath = await promise;
692
- return filepath;
693
- }
694
- async function fetchDocument(args) {
695
- const { data: result } = await Bridge.native.downloadDocument(args);
696
- return result.data.map((i) => ({ ...i, startPage: 0, endPage: 0 }));
697
- }
698
- async function fetchFont() {
699
- const { data: fontMap } = await Bridge.native.getOzFontParam();
700
- const fontParms = Object.keys(fontMap).map((i) => `font.${i}=${fontMap[i]}`);
701
- return fontParms;
702
- }
703
- async function postFiletoDud(imageStr) {
704
- const formData = new FormData();
705
- formData.append("data", base64ToFile(imageStr, "test.png"));
706
- formData.append("fileIdentifierValue", "string");
707
- formData.append("fileExtendContent1", "string");
708
- formData.append("fileExtendContent2", "string");
709
- formData.append("preservationTerm", "1");
710
- formData.append("fileType", "png");
711
- const response = await fetch("/api/v1/post/file", {
712
- headers: {
713
- "x-channel-appversion": "3.1",
714
- "x-channel-carriername": "SK",
715
- "x-channel-deviceid": "deviceid",
716
- "x-channel-devicemodel": "iPHONE13",
717
- "x-channel-formfactor": "Phone",
718
- "x-channel-loginchannel": "DSP",
719
- "x-channel-logintype": "ONPA_PIN",
720
- "x-channel-networktype": "LTE",
721
- "x-channel-platformversion": "15.4.1",
722
- "x-channel-screenid": "ScreenId",
723
- "x-dud-authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJXNWRtc1g1MkVWZGV0YThJRy90YmlZY281bnVCdzRZOXhGZjlWakZzdWxnbU00YnkiLCJpYXQiOjE3NjEwNDMyNjgsImV4cCI6MTc2NjI5OTI2OH0.KDnF7ZhkmnEApGCvOcItwcHnLWe5iJu64g93GACT2yo",
724
- "x-x-channel-platformname": "IOS"
725
- },
726
- method: "POST",
727
- body: formData
728
- });
729
- const json = await response.json();
730
- return json;
731
- }
732
- async function getFileFromDud(fileMgmtId) {
733
- const outputType = "binary";
734
- const response = await fetch("/api/v1/get/file", {
735
- headers: {
736
- "content-type": "application/json",
737
- "x-channel-appversion": "3.1",
738
- "x-channel-carriername": "SK",
739
- "x-channel-deviceid": "deviceid",
740
- "x-channel-devicemodel": "iPHONE13",
741
- "x-channel-formfactor": "Phone",
742
- "x-channel-loginchannel": "DSP",
743
- "x-channel-logintype": "ONPA_PIN",
744
- "x-channel-networktype": "LTE",
745
- "x-channel-platformversion": "15.4.1",
746
- "x-channel-screenid": "ScreenId",
747
- "x-dud-authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJXNWRtc1g1MkVWZGV0YThJRy90YmlZY281bnVCdzRZOXhGZjlWakZzdWxnbU00YnkiLCJpYXQiOjE3NjEwNDMyNjgsImV4cCI6MTc2NjI5OTI2OH0.KDnF7ZhkmnEApGCvOcItwcHnLWe5iJu64g93GACT2yo",
748
- "x-x-channel-platformname": "IOS"
749
- },
750
- method: "POST",
751
- body: JSON.stringify({ fileMgmtId, outputType })
752
- });
753
- const blob = await response.blob();
754
- const base64String = await fileToBase64(blob);
755
- return base64String;
756
- }
757
-
758
445
  // src/oz/utils/bridge-util/create-report-util.ts
759
446
  async function CreateOzParam({ documentList, extraData = {}, roleCd, jijungInfo = "" }) {
760
447
  if (documentList.length === 0) {
@@ -857,6 +544,113 @@ async function triggerDraftDataByIndexList(indexList) {
857
544
  await Bridge.nativeOz.triggerExternalEventByDocIndex({ param1: "getDraftData" /* GetDraftData */, docIndex: indexList[i] });
858
545
  }
859
546
  }
547
+ async function setFocusOnValidation(enable, reportCount) {
548
+ const count = reportCount ?? await getReportCountMemo();
549
+ const expectedValue = enable ? "1" : "0";
550
+ const { data: prev } = await Bridge.nativeOz.getGlobal({ key: "chkFlag", docIndex: 0 });
551
+ if (prev === expectedValue) {
552
+ return;
553
+ }
554
+ for (let i = 0; i < count; i++) {
555
+ await sleep();
556
+ await Bridge.nativeOz.setGlobal({ key: "chkFlag", value: expectedValue, docIndex: i });
557
+ }
558
+ return;
559
+ }
560
+ async function enableFocusOnValidation(reportCount) {
561
+ return setFocusOnValidation(true, reportCount);
562
+ }
563
+ async function disableFocusOnValidation(reportCount) {
564
+ return setFocusOnValidation(false, reportCount);
565
+ }
566
+ async function SaveTotalPdf(policyNumber, fileName) {
567
+ const startPage = 1;
568
+ const endPage = await getTotalPageMemo();
569
+ return await SavePdf({ policyNumber, fileName, startPage, endPage });
570
+ }
571
+ async function SaveSinglePdf(policyNumber, { startPage, endPage, docCode: fileName }) {
572
+ return await SavePdf({ policyNumber, fileName, startPage, endPage });
573
+ }
574
+ async function SavePdf({ policyNumber, fileName, startPage, endPage }) {
575
+ const { promise, resolve } = PromiseWithResolvers();
576
+ window.addEventListener(
577
+ "OZExportCommand" /* OZExportCommand */,
578
+ // 이벤트를 CustomEvent로 타입 캐스팅하고, detail에서 파일 경로 추출
579
+ (e) => resolve(e.detail.filepaths),
580
+ // 이벤트 리스너는 한 번만 실행되도록 설정
581
+ { once: true }
582
+ );
583
+ await Bridge.nativeOz.savePdf({
584
+ // PDF 저장은 증번폴더/파일이름.pdf로 생성
585
+ policyNumber,
586
+ param: [
587
+ // 저장할 파일명 설정
588
+ `pdf.filename=${fileName}.pdf`,
589
+ // 1페이지부터 마지막 페이지까지 저장
590
+ `export.pages=${startPage}-${endPage}`,
591
+ // 공통 PDF 내보내기 파라미터 추가
592
+ ...commonPdfExportParam
593
+ ].join("\n")
594
+ });
595
+ const filepath = await promise;
596
+ return filepath;
597
+ }
598
+ async function checkDocumentsValidityByIndex(indexList) {
599
+ const VALID = "";
600
+ for (let i = 0; i < indexList.length; i++) {
601
+ await sleep();
602
+ const command = `INVALID_INFO_JSON_AT=${indexList[i]}`;
603
+ const { data } = await Bridge.nativeOz.getInformation({ command });
604
+ if (data !== VALID) {
605
+ return false;
606
+ }
607
+ }
608
+ return true;
609
+ }
610
+ async function validateAllPages(pageCount) {
611
+ const count = pageCount ?? await getTotalPageMemo();
612
+ for (let i = 1; i <= count; i++) {
613
+ await sleep();
614
+ const isValid = await checkValidPageMemo(i);
615
+ if (!isValid) {
616
+ return false;
617
+ }
618
+ }
619
+ return true;
620
+ }
621
+ var checkValidPageMemo = (() => {
622
+ const cache = /* @__PURE__ */ new Map();
623
+ async function checkValidPage(page) {
624
+ const cached = cache.get(page);
625
+ if (cached) {
626
+ return cached;
627
+ }
628
+ const VALID = "valid";
629
+ const command = `INPUT_CHECK_VALIDITY_PAGE_AT=${page}`;
630
+ const promise = (async () => {
631
+ try {
632
+ const { data } = await Bridge.nativeOz.getInformation({ command });
633
+ const isValid = data === VALID;
634
+ if (!isValid) {
635
+ cache.delete(page);
636
+ }
637
+ return isValid;
638
+ } catch (err) {
639
+ cache.delete(page);
640
+ throw err;
641
+ }
642
+ })();
643
+ cache.set(page, promise);
644
+ return promise;
645
+ }
646
+ checkValidPage.clearCache = () => {
647
+ cache.clear();
648
+ };
649
+ checkValidPage.clearCacheByPage = (page) => {
650
+ cache.delete(page);
651
+ };
652
+ return checkValidPage;
653
+ })();
860
654
  var valueChangeDebounceMap = /* @__PURE__ */ new Map();
861
655
  function getDebouncedValueChangeHandler(docIndex, onValueChanged) {
862
656
  const DEBOUNCE_DELAY = 1e3 * 1;
@@ -874,6 +668,6 @@ function clearValueChangeDebounceHandlers() {
874
668
  valueChangeDebounceMap.clear();
875
669
  }
876
670
 
877
- export { AlertDocumentLoadError, AlertTemporaryError, CategoryHandler, CommentHandler, CreateOzParam, CreateOzViewer, DownloadDocumentList, ExtraData, MovePage, OZTriggerExternalEvent, OZViewerEvent, PdfHandler, PromiseWithResolvers, SaveSinglePdf, SaveTotalPdf, SignatureHandler, TopHandler, btnStyle, categorizeByPageRange, checkDocumentsValidityByIndex, checkValidPageMemo, clearValueChangeDebounceHandlers, commentPenEraser, commentPenGreen, commentPenPink, commentPenYellow, commonOzParam, commonPdfExportParam, disableFocusOnValidation, enableFocusOnValidation, ensureArray, extractFileName, fetchDocument, fetchFont, fpInfo, getCurrentPage, getDebouncedValueChangeHandler, getDraftDataHandler, getFileFromDud, getFileListByGlobalIndex, getReportCountMemo, getTotalPageMemo, getTotalPageOnAllDocuments, isCommentMode, policyNumber, postFiletoDud, roleCode, setCheckEform, setDisableCommentMode, setEnableCommentMode, sleep, triggerClickOnAllDocuments, triggerCropImageOnAllDocuments, triggerDraftDataByIndexList, useDocumentInfo, useOzEventListener, validateAllPages, wrapperStyle, xdudheaders };
671
+ export { AlertDocumentLoadError, AlertTemporaryError, CreateOzParam, CreateOzViewer, MovePage, OZTriggerExternalEvent, OZViewerEvent, PromiseWithResolvers, SaveSinglePdf, SaveTotalPdf, categorizeByPageRange, checkDocumentsValidityByIndex, checkValidPageMemo, clearValueChangeDebounceHandlers, commentPenEraser, commentPenGreen, commentPenPink, commentPenYellow, commonOzParam, commonPdfExportParam, disableFocusOnValidation, enableFocusOnValidation, ensureArray, extractFileName, fetchDocument, fetchFont, getCurrentPage, getDebouncedValueChangeHandler, getDraftDataHandler, getFileFromDud, getFileListByGlobalIndex, getReportCountMemo, getTotalPageMemo, getTotalPageOnAllDocuments, postFiletoDud, setCheckEform, sleep, triggerClickOnAllDocuments, triggerCropImageOnAllDocuments, triggerDraftDataByIndexList, useDocumentInfo, useOzEventListener, validateAllPages };
878
672
  //# sourceMappingURL=index.js.map
879
673
  //# sourceMappingURL=index.js.map