sales-frontend-bridge 0.0.35 → 0.0.37

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
@@ -2315,9 +2315,15 @@ var ExtraData = {
2315
2315
  A0010_mysg_sign: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAABDElEQVR4nOzSsQkCYRgEUZXDVgTtxdDIYgR7sFkTG/iTiT4P3qtgGXa7vp+H//M5PqYnLJymB+yJWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgVjBdj9fpjcsvG7f6QkLnhWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBWIFYgViBX8AgAA//9+7gTkg4AcBQAAAABJRU5ErkJggg=="
2316
2316
  },
2317
2317
  // 기타 공통으로 사용하지 않을 파라미터
2318
- extraParam: [`viewer.zoom=137`]
2318
+ extraParam: [`viewer.zoom=137`],
2319
+ args: [`roleCd=11,21`, `ccc=ddd`]
2320
+ },
2321
+ A0900: {
2322
+ args: [`roleCd=11,21`, `aaa=bbb`]
2319
2323
  }
2320
2324
  };
2325
+ var policyNumber = "300034894";
2326
+ var fpInfo = { uniqNo: "2210000" };
2321
2327
 
2322
2328
  // src/oz/hooks/use-document-info.tsx
2323
2329
  var import_react = __toESM(require_react());
@@ -2452,26 +2458,8 @@ function PromiseWithResolvers() {
2452
2458
  });
2453
2459
  return { promise, resolve, reject };
2454
2460
  }
2455
-
2456
- // src/oz/utils/bridge-util/focus-util.ts
2457
- async function setFocusOnValidation(enable, reportCount) {
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
- }
2464
- for (let i = 0; i < count; i++) {
2465
- await sleep();
2466
- await Bridge.nativeOz.setGlobal({ key: "chkFlag", value: expectedValue, docIndex: i });
2467
- }
2468
- return;
2469
- }
2470
- async function enableFocusOnValidation(reportCount) {
2471
- return setFocusOnValidation(true, reportCount);
2472
- }
2473
- async function disableFocusOnValidation(reportCount) {
2474
- return setFocusOnValidation(false, reportCount);
2461
+ function ensureArray(arg) {
2462
+ return Array.isArray(arg) ? arg : [];
2475
2463
  }
2476
2464
 
2477
2465
  // src/oz/utils/bridge-util/oz-wrapper-util.ts
@@ -2487,21 +2475,170 @@ async function CreateOzViewer(ozParam) {
2487
2475
  await Bridge.native.createOZViewer({ param: ozParam.join("\n") });
2488
2476
  return await promise;
2489
2477
  }
2490
- async function getReportCount() {
2491
- const { data } = await Bridge.nativeOz.getInformation({ command: "REPORT_COUNT" });
2492
- return Number(data);
2493
- }
2494
2478
  async function MovePage(page) {
2495
2479
  return await Bridge.nativeOz.script({ command: `movepage=${page}` });
2496
2480
  }
2497
- async function getTotalPage() {
2498
- const { data } = await Bridge.nativeOz.getInformation({ command: "TOTAL_PAGE" });
2499
- return Number(data);
2500
- }
2501
2481
  async function getCurrentPage() {
2502
2482
  const { data } = await Bridge.nativeOz.getInformation({ command: `CURRENT_PAGE` });
2503
2483
  return Number(data);
2504
2484
  }
2485
+ var getTotalPageMemo = (() => {
2486
+ let cache = null;
2487
+ async function getTotalPage() {
2488
+ if (cache) {
2489
+ return cache;
2490
+ }
2491
+ cache = (async () => {
2492
+ try {
2493
+ const { data } = await Bridge.nativeOz.getInformation({ command: "TOTAL_PAGE" });
2494
+ return Number(data);
2495
+ } catch (e) {
2496
+ cache = null;
2497
+ throw e;
2498
+ }
2499
+ })();
2500
+ return await cache;
2501
+ }
2502
+ getTotalPage.clearCache = () => {
2503
+ cache = null;
2504
+ };
2505
+ return getTotalPage;
2506
+ })();
2507
+ var getReportCountMemo = (() => {
2508
+ let cache = null;
2509
+ async function getReportCount() {
2510
+ if (cache) {
2511
+ return await cache;
2512
+ }
2513
+ cache = (async () => {
2514
+ try {
2515
+ const { data } = await Bridge.nativeOz.getInformation({ command: "REPORT_COUNT" });
2516
+ return Number(data);
2517
+ } catch (e) {
2518
+ cache = null;
2519
+ throw e;
2520
+ }
2521
+ })();
2522
+ return await cache;
2523
+ }
2524
+ getReportCount.clearCache = () => {
2525
+ cache = null;
2526
+ };
2527
+ return getReportCount;
2528
+ })();
2529
+
2530
+ // src/oz/utils/bridge-util/btn-touch-event-util/category-handler.ts
2531
+ async function CategoryHandler(documentInfo, { type, btnID }) {
2532
+ if (type !== "category") {
2533
+ throw `Unexpected Type ${type}`;
2534
+ }
2535
+ const target = documentInfo.find((i) => i.name === btnID);
2536
+ if (!target) {
2537
+ throw `Unexpected btnID ${target}`;
2538
+ }
2539
+ await MovePage(target.startPage);
2540
+ }
2541
+
2542
+ // src/oz/utils/bridge-util/btn-touch-event-util/top-handler.ts
2543
+ async function TopHandler({ type, btnID }) {
2544
+ if (type !== "top") {
2545
+ throw `Unexpected Type ${type}`;
2546
+ }
2547
+ if (btnID === "btnExit") {
2548
+ await Bridge.native.hideOZViewer();
2549
+ } else {
2550
+ throw `Unexpected btnID ${btnID}`;
2551
+ }
2552
+ }
2553
+
2554
+ // src/oz/utils/bridge-util/btn-touch-event-util/comment-handler.ts
2555
+ async function CommentHandler({ type, btnID }) {
2556
+ if (type !== "comment") {
2557
+ throw `Unexpected Type ${type}`;
2558
+ }
2559
+ if (btnID === "yellow") {
2560
+ await setEnableCommentMode("yellow");
2561
+ } else if (btnID === "pink") {
2562
+ await setEnableCommentMode("pink");
2563
+ } else if (btnID === "green") {
2564
+ await setEnableCommentMode("green");
2565
+ } else if (btnID === "eraser") {
2566
+ await setEnableCommentMode("eraser");
2567
+ } else if (btnID === "disable") {
2568
+ await setDisableCommentMode();
2569
+ } else {
2570
+ throw `Unexpected btnID ${btnID}`;
2571
+ }
2572
+ }
2573
+ async function isCommentMode() {
2574
+ const { data } = await Bridge.nativeOz.getInformation({
2575
+ command: `COMMENT_MODE`
2576
+ });
2577
+ return data === "comment";
2578
+ }
2579
+ async function setCommentMode(penConfig) {
2580
+ const command = `mode_comment_all`;
2581
+ const commentEnabled = await isCommentMode();
2582
+ const param = [
2583
+ ...commentEnabled ? [] : [`viewer.screentool=comment`],
2584
+ ...penConfig
2585
+ ].join("\n");
2586
+ await sleep();
2587
+ return await Bridge.nativeOz.scriptEx({ command, param });
2588
+ }
2589
+ async function setEnableCommentMode(type = "yellow") {
2590
+ let param;
2591
+ if (type === "yellow") {
2592
+ param = commentPenYellow;
2593
+ } else if (type === "pink") {
2594
+ param = commentPenPink;
2595
+ } else if (type === "green") {
2596
+ param = commentPenGreen;
2597
+ } else {
2598
+ param = commentPenEraser;
2599
+ }
2600
+ return await setCommentMode(param);
2601
+ }
2602
+ async function setDisableCommentMode() {
2603
+ const command = `mode_input_all`;
2604
+ return await Bridge.nativeOz.script({ command });
2605
+ }
2606
+
2607
+ // src/oz/utils/bridge-util/btn-touch-event-util/pdf-handler.ts
2608
+ async function PdfHandler({ type, btnID }) {
2609
+ if (type !== "pdf") {
2610
+ throw `Unexpected Type ${type}`;
2611
+ }
2612
+ if (btnID === "modify") {
2613
+ await Bridge.nativeOz.hideOzPdfViewer();
2614
+ } else if (btnID === "submit") {
2615
+ await Bridge.nativeOz.hideOzPdfViewer();
2616
+ await Bridge.native.hideOZViewer();
2617
+ } else {
2618
+ throw `Unexpected btnID ${btnID}`;
2619
+ }
2620
+ }
2621
+
2622
+ // src/oz/utils/bridge-util/focus-util.ts
2623
+ async function setFocusOnValidation(enable, reportCount) {
2624
+ const count = reportCount ?? await getReportCountMemo();
2625
+ const expectedValue = enable ? "1" : "0";
2626
+ const { data: prev } = await Bridge.nativeOz.getGlobal({ key: "chkFlag", docIndex: 0 });
2627
+ if (prev === expectedValue) {
2628
+ return;
2629
+ }
2630
+ for (let i = 0; i < count; i++) {
2631
+ await sleep();
2632
+ await Bridge.nativeOz.setGlobal({ key: "chkFlag", value: expectedValue, docIndex: i });
2633
+ }
2634
+ return;
2635
+ }
2636
+ async function enableFocusOnValidation(reportCount) {
2637
+ return setFocusOnValidation(true, reportCount);
2638
+ }
2639
+ async function disableFocusOnValidation(reportCount) {
2640
+ return setFocusOnValidation(false, reportCount);
2641
+ }
2505
2642
 
2506
2643
  // src/oz/utils/bridge-util/validation-util.ts
2507
2644
  async function checkDocumentsValidityByIndex(indexList) {
@@ -2517,7 +2654,7 @@ async function checkDocumentsValidityByIndex(indexList) {
2517
2654
  return true;
2518
2655
  }
2519
2656
  async function validateAllPages(pageCount) {
2520
- const count = pageCount ?? await getTotalPage();
2657
+ const count = pageCount ?? await getTotalPageMemo();
2521
2658
  for (let i = 1; i <= count; i++) {
2522
2659
  await sleep();
2523
2660
  const isValid = await checkValidPageMemo(i);
@@ -2561,65 +2698,48 @@ var checkValidPageMemo = (() => {
2561
2698
  return checkValidPage;
2562
2699
  })();
2563
2700
 
2564
- // src/oz/utils/bridge-util/btn-touch-event-util.ts
2565
- async function CategoryHandler(documentInfo, { type, btnID }) {
2566
- if (type !== "category") {
2567
- throw `Unexpected Type ${type}`;
2568
- }
2569
- const target = documentInfo.find((i) => i.name === btnID);
2570
- if (!target) {
2571
- return;
2572
- }
2573
- await MovePage(target.startPage);
2574
- }
2701
+ // src/oz/utils/bridge-util/btn-touch-event-util/signature-handler.ts
2575
2702
  async function SignatureHandler({ type, btnID }) {
2576
2703
  if (type !== "signature") {
2577
2704
  throw `Unexpected Type ${type}`;
2578
2705
  }
2579
- const reportCount = await getReportCount();
2580
- const pageCount = await getTotalPage();
2581
2706
  if (btnID === "signatureInProgress") {
2582
- await enableFocusOnValidation(reportCount);
2583
- await validateAllPages(pageCount);
2707
+ await SignatureInProgressHandler();
2708
+ } else if (btnID === "signatureComplete") {
2709
+ await SignatureCompleteHandler();
2584
2710
  } else {
2585
- try {
2586
- await Bridge.native.showLoader();
2587
- await disableFocusOnValidation(reportCount);
2588
- checkValidPageMemo.clearCache();
2589
- const isAllValid = await validateAllPages(pageCount);
2590
- if (!isAllValid) {
2591
- throw "MissingAlert";
2592
- }
2593
- const filePath = await SaveTotalPdf();
2594
- await Bridge.nativeOz.createOzPdfViewer({ filePath });
2595
- } catch (e) {
2596
- if (e === "MissingAlert") {
2597
- await Bridge.nativeOz.showMissingAlert();
2598
- } else {
2599
- alert("PDF export \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD558\uC600\uC2B5\uB2C8\uB2E4");
2600
- }
2601
- } finally {
2602
- await Bridge.native.hideLoader();
2603
- }
2711
+ throw `Unexpected btnID ${btnID}`;
2604
2712
  }
2605
2713
  }
2606
- async function TopHandler({ type, btnID }) {
2607
- if (type !== "top") {
2608
- throw `Unexpected Type ${type}`;
2609
- }
2610
- if (btnID === "btnExit") {
2611
- await Bridge.native.hideOZViewer();
2612
- }
2714
+ async function SignatureInProgressHandler() {
2715
+ const reportCount = await getReportCountMemo();
2716
+ const pageCount = await getTotalPageMemo();
2717
+ await enableFocusOnValidation(reportCount);
2718
+ await validateAllPages(pageCount);
2613
2719
  }
2614
- async function PdfHandler({ type, btnID }) {
2615
- if (type !== "pdf") {
2616
- throw `Unexpected Type ${type}`;
2617
- }
2618
- if (btnID === "modify") {
2619
- await Bridge.nativeOz.hideOzPdfViewer();
2620
- } else {
2621
- await Bridge.nativeOz.hideOzPdfViewer();
2622
- await Bridge.native.hideOZViewer();
2720
+ async function SignatureCompleteHandler() {
2721
+ try {
2722
+ await Bridge.native.showLoader();
2723
+ checkValidPageMemo.clearCache();
2724
+ getReportCountMemo.clearCache();
2725
+ getTotalPageMemo.clearCache();
2726
+ const reportCount = await getReportCountMemo();
2727
+ const pageCount = await getTotalPageMemo();
2728
+ await disableFocusOnValidation(reportCount);
2729
+ const isAllValid = await validateAllPages(pageCount);
2730
+ if (!isAllValid) {
2731
+ throw "MissingAlert";
2732
+ }
2733
+ const filePath = await SaveTotalPdf();
2734
+ await Bridge.nativeOz.createOzPdfViewer({ filePath });
2735
+ } catch (e) {
2736
+ if (e === "MissingAlert") {
2737
+ await Bridge.nativeOz.showMissingAlert();
2738
+ } else {
2739
+ alert("PDF export \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD558\uC600\uC2B5\uB2C8\uB2E4");
2740
+ }
2741
+ } finally {
2742
+ await Bridge.native.hideLoader();
2623
2743
  }
2624
2744
  }
2625
2745
  async function SaveTotalPdf() {
@@ -2631,7 +2751,7 @@ async function SaveTotalPdf() {
2631
2751
  // 이벤트 리스너는 한 번만 실행되도록 설정
2632
2752
  { once: true }
2633
2753
  );
2634
- const totalPage = await getTotalPage();
2754
+ const totalPage = await getTotalPageMemo();
2635
2755
  await Bridge.nativeOz.savePdf({
2636
2756
  param: [
2637
2757
  // 저장할 파일명 설정
@@ -2645,55 +2765,6 @@ async function SaveTotalPdf() {
2645
2765
  const filepath = await promise;
2646
2766
  return filepath;
2647
2767
  }
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
- }
2696
- }
2697
2768
 
2698
2769
  // src/oz/utils/bridge-util/fetch-util.ts
2699
2770
  async function fetchDocument(options) {
@@ -2724,9 +2795,11 @@ async function CreateOzParam(documentList, extraData = {}) {
2724
2795
  if (data.inputJson) {
2725
2796
  result.push(`${prefix}connection.inputjson=${JSON.stringify(data.inputJson)}`);
2726
2797
  }
2727
- if (data.extraParam) {
2728
- result.push(data.extraParam.map((param) => `${prefix}${param}`).join("\n"));
2729
- }
2798
+ data.args = ensureArray(data.args);
2799
+ data.args.push(`docCd=${docCode}`);
2800
+ data.args.forEach((arg, idx2) => result.push(`${prefix}connection.args${idx2 + 1}=${arg}`));
2801
+ data.extraParam = ensureArray(data.extraParam);
2802
+ data.extraParam.forEach((param) => result.push(`${prefix}${param}`));
2730
2803
  return result;
2731
2804
  });
2732
2805
  const params = [
@@ -2739,14 +2812,14 @@ async function CreateOzParam(documentList, extraData = {}) {
2739
2812
  return params;
2740
2813
  }
2741
2814
  async function setCheckEform(reportCount) {
2742
- const count = reportCount ?? await getReportCount();
2815
+ const count = reportCount ?? await getReportCountMemo();
2743
2816
  for (let i = 0; i < count; i++) {
2744
2817
  await sleep();
2745
2818
  await Bridge.nativeOz.setGlobal({ key: "checkeForm", value: "Y", docIndex: i });
2746
2819
  }
2747
2820
  }
2748
2821
  async function triggerClickOnAllDocuments(reportCount) {
2749
- const count = reportCount ?? await getReportCount();
2822
+ const count = reportCount ?? await getReportCountMemo();
2750
2823
  for (let i = 0; i < count; i++) {
2751
2824
  await sleep();
2752
2825
  const command = `INPUT_TRIGGER_CLICK_AT=${i}`;
@@ -2754,14 +2827,14 @@ async function triggerClickOnAllDocuments(reportCount) {
2754
2827
  }
2755
2828
  }
2756
2829
  async function triggerCropImageOnAllDocuments(reportCount) {
2757
- const count = reportCount ?? await getReportCount();
2830
+ const count = reportCount ?? await getReportCountMemo();
2758
2831
  for (let i = 0; i < count; i++) {
2759
2832
  await sleep();
2760
2833
  await Bridge.nativeOz.triggerExternalEventByDocIndex({ docIndex: Number(i), param1: "cropimage" });
2761
2834
  }
2762
2835
  }
2763
2836
  async function getTotalPageOnAllDocuments(reportCount) {
2764
- const count = reportCount ?? await getReportCount();
2837
+ const count = reportCount ?? await getReportCountMemo();
2765
2838
  const totalPages = [];
2766
2839
  for (let i = 0; i < count; i++) {
2767
2840
  await sleep();
@@ -2822,15 +2895,18 @@ exports.commonOzParam = commonOzParam;
2822
2895
  exports.commonPdfExportParam = commonPdfExportParam;
2823
2896
  exports.disableFocusOnValidation = disableFocusOnValidation;
2824
2897
  exports.enableFocusOnValidation = enableFocusOnValidation;
2898
+ exports.ensureArray = ensureArray;
2825
2899
  exports.extractFileName = extractFileName;
2826
2900
  exports.fetchDocument = fetchDocument;
2827
2901
  exports.fetchFont = fetchFont;
2902
+ exports.fpInfo = fpInfo;
2828
2903
  exports.getCurrentPage = getCurrentPage;
2829
2904
  exports.getFileListByGlobalIndex = getFileListByGlobalIndex;
2830
- exports.getReportCount = getReportCount;
2831
- exports.getTotalPage = getTotalPage;
2905
+ exports.getReportCountMemo = getReportCountMemo;
2906
+ exports.getTotalPageMemo = getTotalPageMemo;
2832
2907
  exports.getTotalPageOnAllDocuments = getTotalPageOnAllDocuments;
2833
2908
  exports.isCommentMode = isCommentMode;
2909
+ exports.policyNumber = policyNumber;
2834
2910
  exports.setCheckEform = setCheckEform;
2835
2911
  exports.setDisableCommentMode = setDisableCommentMode;
2836
2912
  exports.setEnableCommentMode = setEnableCommentMode;