sales-frontend-bridge 0.0.45 → 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
@@ -2470,7 +2470,7 @@ var xdudheaders = `Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJXNWRtc1g1MkVWZGV0YThJR
2470
2470
  // src/oz/hooks/use-document-info.tsx
2471
2471
  var import_react = __toESM(require_react());
2472
2472
  function useDocumentInfo(initialValue) {
2473
- const [documentInfo, setDocumentInfo] = (0, import_react.useState)([...initialValue]);
2473
+ const documentInfo = initialValue;
2474
2474
  const documentList = (0, import_react.useMemo)(() => documentInfo.map((i) => i.doc).flat(1), [documentInfo]);
2475
2475
  const documentIndexMap = documentList.reduce((acc, cur, index) => {
2476
2476
  acc[cur.docCode] = index;
@@ -2500,8 +2500,6 @@ function useDocumentInfo(initialValue) {
2500
2500
  }, []), [documentIndexMap, documentInfo]);
2501
2501
  const isAllComplete = (0, import_react.useMemo)(() => documentInfo.every((i) => i.complete), [documentInfo]);
2502
2502
  return {
2503
- setDocumentInfo,
2504
- documentInfo,
2505
2503
  documentList,
2506
2504
  documentTemplateMap,
2507
2505
  documentIndexMap,
@@ -2606,18 +2604,49 @@ function DeepCopy(arg) {
2606
2604
  return JSON.parse(JSON.stringify(arg));
2607
2605
  }
2608
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
+
2609
2623
  // src/oz/utils/bridge-util/oz-wrapper-util.ts
2610
2624
  async function CreateOzViewer(ozParam) {
2611
- 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
+ };
2612
2635
  window.addEventListener(
2613
2636
  "OZReportCreated" /* OZReportCreated */,
2614
2637
  // OZReportCreated가 트리거되면 promise resolve 처리
2615
- (e) => resolve(e),
2638
+ handleOZCreated,
2616
2639
  // 이벤트 리스너는 한 번만 실행되도록 설정
2617
2640
  { once: true }
2618
2641
  );
2619
- await Bridge.native.createOZViewer({ param: ozParam.join("\n") });
2620
- 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
+ }
2621
2650
  }
2622
2651
  async function MovePage(page) {
2623
2652
  return await Bridge.nativeOz.script({ command: `movepage=${page}` });
@@ -3147,6 +3176,8 @@ react/cjs/react.development.js:
3147
3176
  *)
3148
3177
  */
3149
3178
 
3179
+ exports.AlertDocumentLoadError = AlertDocumentLoadError;
3180
+ exports.AlertTemporaryError = AlertTemporaryError;
3150
3181
  exports.Bridge = Bridge;
3151
3182
  exports.CategoryHandler = CategoryHandler;
3152
3183
  exports.CommentHandler = CommentHandler;