sales-frontend-bridge 0.0.45 → 0.0.47

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
@@ -1493,6 +1493,7 @@ var IframeBridgeCore = class extends CommonBridgeCore {
1493
1493
  * @param event
1494
1494
  */
1495
1495
  handleMessageEventResponse(event) {
1496
+ console.log("[IframeBridgeCore] \uBD80\uBAA8 \uC751\uB2F5:: ", event);
1496
1497
  const { promiseId, isSuccess, data } = event.data;
1497
1498
  if (this.responseHandler) {
1498
1499
  this.responseHandler({ promiseId, isSuccess, data });
@@ -1504,22 +1505,24 @@ var IframeBridgeCore = class extends CommonBridgeCore {
1504
1505
  /**
1505
1506
  * Iframe 통신
1506
1507
  * @param eventName
1507
- * @param option
1508
+ * @param data
1508
1509
  * @returns
1509
1510
  */
1510
- async callToTarget(eventName, option) {
1511
+ async callToTarget(eventName, data) {
1511
1512
  return new Promise((resolve, reject) => {
1512
1513
  const promiseId = `${eventName}_${this.generatePromiseId()}`;
1513
1514
  this.pendingPromises.set(promiseId, { resolve, reject });
1514
1515
  try {
1515
1516
  const command = {
1517
+ service: "native",
1516
1518
  eventName,
1517
1519
  promiseId,
1518
- option
1520
+ data
1519
1521
  };
1520
1522
  console.log("[IframeBridgeCore callToIframe] command::", command);
1521
1523
  const platform = salesFrontendUtils.getDspExecutionEnvironment();
1522
1524
  if (platform === "iframe") {
1525
+ console.log("[IframeBridgeCore callToIframe] \uBD80\uBAA8 \uD638\uCD9C \uC9C1\uC804");
1523
1526
  window.parent.postMessage(command, "*");
1524
1527
  const promise = this.pendingPromises.get(promiseId);
1525
1528
  if (promise) {
@@ -1569,11 +1572,34 @@ var IframeBridge = class extends CommonBridge {
1569
1572
  }
1570
1573
  /**
1571
1574
  * 영업포탈 tab open
1572
- * @param options
1575
+ * @param option
1576
+ * @returns
1577
+ */
1578
+ async openMdi(option) {
1579
+ return this.core.callToTarget("openMdi", option);
1580
+ }
1581
+ /**
1582
+ * 영업포털 부모의 세션연장, 오픈되어 있는 타 시스템 세션타임 연장
1583
+ * @returns
1584
+ */
1585
+ async dspKeepCallerSession() {
1586
+ return this.core.callToTarget("dspKeepCallerSession");
1587
+ }
1588
+ /**
1589
+ * 영업포털 메뉴정보에 있는 메뉴 오픈(새탭 생성)
1590
+ * @param option
1591
+ * @returns
1592
+ */
1593
+ async dspMenuWindowOpen(option) {
1594
+ return this.core.callToTarget("dspMenuWindowOpen", option);
1595
+ }
1596
+ /**
1597
+ * 영업포털 메뉴정보에 없는 메뉴를 오픈(새탭 생성 & 약속된 타켓 메뉴정보를 해당 시스템에 전달)
1598
+ * @param option
1573
1599
  * @returns
1574
1600
  */
1575
- async openMdi(options) {
1576
- return this.core.callToTarget("openMdi", options);
1601
+ async dspSimpleWindowOpen(option) {
1602
+ return this.core.callToTarget("dspSimpleWindowOpen", option);
1577
1603
  }
1578
1604
  // TODO: 필요 플러그인들 추가
1579
1605
  };
@@ -1998,7 +2024,7 @@ var NativeBridge = class extends CommonBridge {
1998
2024
  * @example
1999
2025
  * ```tsx
2000
2026
  * // 사용 예시
2001
- * Bridge.native.closeWeb()
2027
+ * Bridge.native.exitApp()
2002
2028
  * ```
2003
2029
  */
2004
2030
  exitApp() {
@@ -2009,7 +2035,7 @@ var NativeBridge = class extends CommonBridge {
2009
2035
  * @example
2010
2036
  * ```tsx
2011
2037
  * // 사용 예시
2012
- * Bridge.native.closeWeb()
2038
+ * Bridge.native.getAppInfo()
2013
2039
  * ```
2014
2040
  */
2015
2041
  getAppInfo() {
@@ -2470,7 +2496,7 @@ var xdudheaders = `Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJXNWRtc1g1MkVWZGV0YThJR
2470
2496
  // src/oz/hooks/use-document-info.tsx
2471
2497
  var import_react = __toESM(require_react());
2472
2498
  function useDocumentInfo(initialValue) {
2473
- const [documentInfo, setDocumentInfo] = (0, import_react.useState)([...initialValue]);
2499
+ const documentInfo = initialValue;
2474
2500
  const documentList = (0, import_react.useMemo)(() => documentInfo.map((i) => i.doc).flat(1), [documentInfo]);
2475
2501
  const documentIndexMap = documentList.reduce((acc, cur, index) => {
2476
2502
  acc[cur.docCode] = index;
@@ -2500,8 +2526,6 @@ function useDocumentInfo(initialValue) {
2500
2526
  }, []), [documentIndexMap, documentInfo]);
2501
2527
  const isAllComplete = (0, import_react.useMemo)(() => documentInfo.every((i) => i.complete), [documentInfo]);
2502
2528
  return {
2503
- setDocumentInfo,
2504
- documentInfo,
2505
2529
  documentList,
2506
2530
  documentTemplateMap,
2507
2531
  documentIndexMap,
@@ -2606,18 +2630,49 @@ function DeepCopy(arg) {
2606
2630
  return JSON.parse(JSON.stringify(arg));
2607
2631
  }
2608
2632
 
2633
+ // src/oz/utils/bridge-util/alert-util.ts
2634
+ async function AlertTemporaryError() {
2635
+ return await Bridge.nativeOz.showAlert({
2636
+ title: "\uC77C\uC2DC\uC801\uC778 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",
2637
+ message: "\uBB38\uC81C\uAC00 \uC9C0\uC18D\uB420 \uACBD\uC6B0 IT\uCF5C\uC13C\uD130(1522-6379)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694.",
2638
+ buttons: { close: false, main: "\uD655\uC778" }
2639
+ });
2640
+ }
2641
+ async function AlertDocumentLoadError() {
2642
+ return await Bridge.nativeOz.showAlert({
2643
+ title: "\uCCAD\uC57D\uBB38\uC11C\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
2644
+ message: "\uBB38\uC81C\uAC00 \uC9C0\uC18D\uB420 \uACBD\uC6B0 IT\uCF5C\uC13C\uD130(1522-6379)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694.",
2645
+ buttons: { close: false, main: "\uD655\uC778" }
2646
+ });
2647
+ }
2648
+
2609
2649
  // src/oz/utils/bridge-util/oz-wrapper-util.ts
2610
2650
  async function CreateOzViewer(ozParam) {
2611
- const { promise, resolve } = PromiseWithResolvers();
2651
+ const { promise, resolve, reject } = PromiseWithResolvers();
2652
+ const handleTimeout = () => {
2653
+ window.removeEventListener("OZReportCreated" /* OZReportCreated */, handleOZCreated);
2654
+ reject(new Error("createOZViewer TimeOut"));
2655
+ };
2656
+ const timeout = setTimeout(handleTimeout, 1e3 * 60 * 3);
2657
+ const handleOZCreated = (e) => {
2658
+ clearTimeout(timeout);
2659
+ resolve(e);
2660
+ };
2612
2661
  window.addEventListener(
2613
2662
  "OZReportCreated" /* OZReportCreated */,
2614
2663
  // OZReportCreated가 트리거되면 promise resolve 처리
2615
- (e) => resolve(e),
2664
+ handleOZCreated,
2616
2665
  // 이벤트 리스너는 한 번만 실행되도록 설정
2617
2666
  { once: true }
2618
2667
  );
2619
- await Bridge.native.createOZViewer({ param: ozParam.join("\n") });
2620
- return await promise;
2668
+ try {
2669
+ await Bridge.native.createOZViewer({ param: ozParam.join("\n") });
2670
+ return await promise;
2671
+ } catch (e) {
2672
+ clearTimeout(timeout);
2673
+ await AlertTemporaryError();
2674
+ await Bridge.native.hideOZViewer();
2675
+ }
2621
2676
  }
2622
2677
  async function MovePage(page) {
2623
2678
  return await Bridge.nativeOz.script({ command: `movepage=${page}` });
@@ -3147,6 +3202,8 @@ react/cjs/react.development.js:
3147
3202
  *)
3148
3203
  */
3149
3204
 
3205
+ exports.AlertDocumentLoadError = AlertDocumentLoadError;
3206
+ exports.AlertTemporaryError = AlertTemporaryError;
3150
3207
  exports.Bridge = Bridge;
3151
3208
  exports.CategoryHandler = CategoryHandler;
3152
3209
  exports.CommentHandler = CommentHandler;