sales-frontend-bridge 0.0.44 → 0.0.46

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
@@ -2004,6 +2004,17 @@ var NativeBridge = class extends CommonBridge {
2004
2004
  exitApp() {
2005
2005
  return this.core.callToTarget("exitApp");
2006
2006
  }
2007
+ /**
2008
+ * 앱 정보 가져오기
2009
+ * @example
2010
+ * ```tsx
2011
+ * // 사용 예시
2012
+ * Bridge.native.closeWeb()
2013
+ * ```
2014
+ */
2015
+ getAppInfo() {
2016
+ return this.core.callToTarget("getAppInfo");
2017
+ }
2007
2018
  // TODO: 필요 플러그인들 추가
2008
2019
  };
2009
2020
 
@@ -2454,11 +2465,12 @@ var ExtraData = {
2454
2465
  var policyNumber = "300034894";
2455
2466
  var fpInfo = { uniqNo: "2210000" };
2456
2467
  var roleCode = [`11`, `28`];
2468
+ var xdudheaders = `Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJXNWRtc1g1MkVWZGV0YThJRy90YmlZY281bnVCdzRZOXhGZjlWakZzdWxnbU00YnkiLCJpYXQiOjE3NjEwNDMyNjgsImV4cCI6MTc2NjI5OTI2OH0.KDnF7ZhkmnEApGCvOcItwcHnLWe5iJu64g93GACT2yo`;
2457
2469
 
2458
2470
  // src/oz/hooks/use-document-info.tsx
2459
2471
  var import_react = __toESM(require_react());
2460
2472
  function useDocumentInfo(initialValue) {
2461
- const [documentInfo, setDocumentInfo] = (0, import_react.useState)([...initialValue]);
2473
+ const documentInfo = initialValue;
2462
2474
  const documentList = (0, import_react.useMemo)(() => documentInfo.map((i) => i.doc).flat(1), [documentInfo]);
2463
2475
  const documentIndexMap = documentList.reduce((acc, cur, index) => {
2464
2476
  acc[cur.docCode] = index;
@@ -2488,8 +2500,6 @@ function useDocumentInfo(initialValue) {
2488
2500
  }, []), [documentIndexMap, documentInfo]);
2489
2501
  const isAllComplete = (0, import_react.useMemo)(() => documentInfo.every((i) => i.complete), [documentInfo]);
2490
2502
  return {
2491
- setDocumentInfo,
2492
- documentInfo,
2493
2503
  documentList,
2494
2504
  documentTemplateMap,
2495
2505
  documentIndexMap,
@@ -2594,18 +2604,49 @@ function DeepCopy(arg) {
2594
2604
  return JSON.parse(JSON.stringify(arg));
2595
2605
  }
2596
2606
 
2607
+ // src/oz/utils/bridge-util/alert-util.ts
2608
+ async function AlertTemporaryError() {
2609
+ return await Bridge.nativeOz.showAlert({
2610
+ title: "\uC77C\uC2DC\uC801\uC778 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",
2611
+ message: "\uBB38\uC81C\uAC00 \uC9C0\uC18D\uB420 \uACBD\uC6B0 IT\uCF5C\uC13C\uD130(1522-6379)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694.",
2612
+ buttons: { close: false, main: "\uD655\uC778" }
2613
+ });
2614
+ }
2615
+ async function AlertDocumentLoadError() {
2616
+ return await Bridge.nativeOz.showAlert({
2617
+ title: "\uCCAD\uC57D\uBB38\uC11C\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
2618
+ message: "\uBB38\uC81C\uAC00 \uC9C0\uC18D\uB420 \uACBD\uC6B0 IT\uCF5C\uC13C\uD130(1522-6379)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694.",
2619
+ buttons: { close: false, main: "\uD655\uC778" }
2620
+ });
2621
+ }
2622
+
2597
2623
  // src/oz/utils/bridge-util/oz-wrapper-util.ts
2598
2624
  async function CreateOzViewer(ozParam) {
2599
- const { promise, resolve } = PromiseWithResolvers();
2625
+ const { promise, resolve, reject } = PromiseWithResolvers();
2626
+ const handleTimeout = () => {
2627
+ window.removeEventListener("OZReportCreated" /* OZReportCreated */, handleOZCreated);
2628
+ reject(new Error("createOZViewer TimeOut"));
2629
+ };
2630
+ const timeout = setTimeout(handleTimeout, 1e3 * 60 * 3);
2631
+ const handleOZCreated = (e) => {
2632
+ clearTimeout(timeout);
2633
+ resolve(e);
2634
+ };
2600
2635
  window.addEventListener(
2601
2636
  "OZReportCreated" /* OZReportCreated */,
2602
2637
  // OZReportCreated가 트리거되면 promise resolve 처리
2603
- (e) => resolve(e),
2638
+ handleOZCreated,
2604
2639
  // 이벤트 리스너는 한 번만 실행되도록 설정
2605
2640
  { once: true }
2606
2641
  );
2607
- await Bridge.native.createOZViewer({ param: ozParam.join("\n") });
2608
- return await promise;
2642
+ try {
2643
+ await Bridge.native.createOZViewer({ param: ozParam.join("\n") });
2644
+ return await promise;
2645
+ } catch (e) {
2646
+ clearTimeout(timeout);
2647
+ await AlertTemporaryError();
2648
+ await Bridge.native.hideOZViewer();
2649
+ }
2609
2650
  }
2610
2651
  async function MovePage(page) {
2611
2652
  return await Bridge.nativeOz.script({ command: `movepage=${page}` });
@@ -2917,8 +2958,8 @@ async function SaveTotalPdf() {
2917
2958
  }
2918
2959
 
2919
2960
  // src/oz/utils/bridge-util/fetch-util.ts
2920
- async function fetchDocument(options) {
2921
- const { data: result } = await Bridge.native.downloadDocument({ data: options, policyNumber, fpInfo });
2961
+ async function fetchDocument(args) {
2962
+ const { data: result } = await Bridge.native.downloadDocument(args);
2922
2963
  return result.data.map((i) => ({ ...i, startPage: 0, endPage: 0 }));
2923
2964
  }
2924
2965
  async function fetchFont() {
@@ -3135,6 +3176,8 @@ react/cjs/react.development.js:
3135
3176
  *)
3136
3177
  */
3137
3178
 
3179
+ exports.AlertDocumentLoadError = AlertDocumentLoadError;
3180
+ exports.AlertTemporaryError = AlertTemporaryError;
3138
3181
  exports.Bridge = Bridge;
3139
3182
  exports.CategoryHandler = CategoryHandler;
3140
3183
  exports.CommentHandler = CommentHandler;
@@ -3191,5 +3234,6 @@ exports.useDocumentInfo = useDocumentInfo;
3191
3234
  exports.useOzEventListener = useOzEventListener;
3192
3235
  exports.validateAllPages = validateAllPages;
3193
3236
  exports.wrapperStyle = wrapperStyle;
3237
+ exports.xdudheaders = xdudheaders;
3194
3238
  //# sourceMappingURL=index.cjs.map
3195
3239
  //# sourceMappingURL=index.cjs.map