sales-frontend-bridge 0.0.21 → 0.0.22

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.d.cts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as react from 'react';
1
2
  import { CSSProperties } from 'react';
2
3
 
3
4
  interface ICommonBridge {
@@ -300,8 +301,8 @@ interface INativeBridge {
300
301
  dismissPopup<T>(option: any): Promise<T>;
301
302
  showWebPopup<T>(options: ShowWebPopupOptions): Promise<T>;
302
303
  jumpSafari<T>(options: ShowWebPopupOptions): Promise<T>;
303
- createReportEx<T>(options: CreateReportExOptions): Promise<CommonOzBridgetResponseType<T>>;
304
- hideViewer<T>(): Promise<CommonOzBridgetResponseType<T>>;
304
+ createOZViewer<T>(options: CreateReportExOptions): Promise<CommonOzBridgetResponseType<T>>;
305
+ hideOZViewer<T>(): Promise<CommonOzBridgetResponseType<T>>;
305
306
  getInformation<T>(options: GetInformationOptions): Promise<CommonOzBridgetResponseType<T>>;
306
307
  getGlobal<T>(options: GetGlobalOptions): Promise<CommonOzBridgetResponseType<T>>;
307
308
  setGlobal<T>(options: SetGlobalOptions): Promise<CommonOzBridgetResponseType<T>>;
@@ -317,6 +318,8 @@ interface INativeBridge {
317
318
  createOzPdfViewer<T>(options: createOzPdfViewerOptions): Promise<CommonOzBridgetResponseType<T>>;
318
319
  hideOzPdfViewer<T>(): Promise<CommonOzBridgetResponseType<T>>;
319
320
  onAuthenticationResult(options: OnAuthenticationResultRequest): Promise<OnAuthenticationResultResponse>;
321
+ showLoader<T>(): Promise<CommonOzBridgetResponseType<T>>;
322
+ hideLoader<T>(): Promise<CommonOzBridgetResponseType<T>>;
320
323
  }
321
324
 
322
325
  /**
@@ -356,7 +359,7 @@ declare class NativeBridge extends CommonBridge implements INativeBridge {
356
359
  * Bridge.native.createReportEx({ param: "connection.openfile=sample.ozd" });
357
360
  * ```
358
361
  */
359
- createReportEx<T = any>(options: CreateReportExOptions): Promise<CommonOzBridgetResponseType<T>>;
362
+ createOZViewer<T = any>(options: CreateReportExOptions): Promise<CommonOzBridgetResponseType<T>>;
360
363
  /**
361
364
  * ### Bridge for Oz
362
365
  * OZ 뷰어를 닫습니다
@@ -366,7 +369,7 @@ declare class NativeBridge extends CommonBridge implements INativeBridge {
366
369
  * Bridge.native.hideViewer();
367
370
  * ```
368
371
  */
369
- hideViewer<T = any>(): Promise<CommonOzBridgetResponseType<T>>;
372
+ hideOZViewer<T = any>(): Promise<CommonOzBridgetResponseType<T>>;
370
373
  /**
371
374
  * ### Bridge for Oz
372
375
  * 오즈 뷰어의 정보를 가져옵니다
@@ -542,6 +545,24 @@ declare class NativeBridge extends CommonBridge implements INativeBridge {
542
545
  * @returns
543
546
  */
544
547
  onAuthenticationResult(options: OnAuthenticationResultRequest): Promise<OnAuthenticationResultResponse>;
548
+ /**
549
+ * 로더 컴포넌트 show
550
+ * @example
551
+ * ```tsx
552
+ * // 사용 예시
553
+ * await Bridge.native.showLoader()
554
+ * ```
555
+ */
556
+ showLoader<T>(): Promise<CommonOzBridgetResponseType<T>>;
557
+ /**
558
+ * 로더 컴포넌트 hide
559
+ * @example
560
+ * ```tsx
561
+ * // 사용 예시
562
+ * await Bridge.native.hideLoader()
563
+ * ```
564
+ */
565
+ hideLoader<T>(): Promise<CommonOzBridgetResponseType<T>>;
545
566
  }
546
567
 
547
568
  type NativeAction = keyof INativeBridge;
@@ -832,14 +853,23 @@ type ExtraDataType = Record<string, {
832
853
  extraParam?: string[];
833
854
  }>;
834
855
  type Props$1 = {
835
- documentInfo: DocumentInfo[];
856
+ documentList: string[];
836
857
  extraData?: ExtraDataType;
837
858
  };
838
- declare function useCreateReport({ documentInfo, extraData }: Props$1): {
839
- documentList: string[];
859
+ declare function useCreateReport({ documentList, extraData }: Props$1): {
840
860
  CreateReport: () => Promise<void>;
841
861
  };
842
862
 
863
+ declare function useDocumentInfo(initialValue: DocumentInfo[]): {
864
+ setDocumentInfo: react.Dispatch<react.SetStateAction<DocumentInfo[]>>;
865
+ documentInfo: DocumentInfo[];
866
+ documentList: string[];
867
+ documentTemplateMap: Record<string, DocumentInfo>;
868
+ documentIndexMap: Record<string, number>;
869
+ nameTemplateMap: Record<string, DocumentInfo>;
870
+ groupIndexes: number[][];
871
+ };
872
+
843
873
  type Props<T, R = void> = {
844
874
  event: OZViewerEvent;
845
875
  handler: (e: CustomEvent<T>) => Promise<R>;
@@ -868,4 +898,4 @@ declare function categorizeByPageRange(data: DocumentInfo[], pageCounts: number[
868
898
  declare function extractFileName(filePath: string): string;
869
899
  declare function getFileListByGlobalIndex(index: number, data: DocumentInfo[]): DocumentInfo | null;
870
900
 
871
- export { Bridge, type ExtraDataType, type OZBtnTouchEvent, type OZEFormInputEvent, type OZExportEvent, type OZViewerChangeEvent, type OZViewerErrorEvent, OZViewerEvent, type OZViewerPageBindEvent, type OZViewerProgressEvent, type OZViewerUserEvent, btnStyle, categorizeByPageRange, commonOzParam, commonPdfExportParam, extractFileName, fetchDocument, fetchFont, getFileListByGlobalIndex, useCreateReport, useOzEventListener, wrapperStyle };
901
+ export { Bridge, type ExtraDataType, type OZBtnTouchEvent, type OZEFormInputEvent, type OZExportEvent, type OZViewerChangeEvent, type OZViewerErrorEvent, OZViewerEvent, type OZViewerPageBindEvent, type OZViewerProgressEvent, type OZViewerUserEvent, btnStyle, categorizeByPageRange, commonOzParam, commonPdfExportParam, extractFileName, fetchDocument, fetchFont, getFileListByGlobalIndex, useCreateReport, useDocumentInfo, useOzEventListener, wrapperStyle };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as react from 'react';
1
2
  import { CSSProperties } from 'react';
2
3
 
3
4
  interface ICommonBridge {
@@ -300,8 +301,8 @@ interface INativeBridge {
300
301
  dismissPopup<T>(option: any): Promise<T>;
301
302
  showWebPopup<T>(options: ShowWebPopupOptions): Promise<T>;
302
303
  jumpSafari<T>(options: ShowWebPopupOptions): Promise<T>;
303
- createReportEx<T>(options: CreateReportExOptions): Promise<CommonOzBridgetResponseType<T>>;
304
- hideViewer<T>(): Promise<CommonOzBridgetResponseType<T>>;
304
+ createOZViewer<T>(options: CreateReportExOptions): Promise<CommonOzBridgetResponseType<T>>;
305
+ hideOZViewer<T>(): Promise<CommonOzBridgetResponseType<T>>;
305
306
  getInformation<T>(options: GetInformationOptions): Promise<CommonOzBridgetResponseType<T>>;
306
307
  getGlobal<T>(options: GetGlobalOptions): Promise<CommonOzBridgetResponseType<T>>;
307
308
  setGlobal<T>(options: SetGlobalOptions): Promise<CommonOzBridgetResponseType<T>>;
@@ -317,6 +318,8 @@ interface INativeBridge {
317
318
  createOzPdfViewer<T>(options: createOzPdfViewerOptions): Promise<CommonOzBridgetResponseType<T>>;
318
319
  hideOzPdfViewer<T>(): Promise<CommonOzBridgetResponseType<T>>;
319
320
  onAuthenticationResult(options: OnAuthenticationResultRequest): Promise<OnAuthenticationResultResponse>;
321
+ showLoader<T>(): Promise<CommonOzBridgetResponseType<T>>;
322
+ hideLoader<T>(): Promise<CommonOzBridgetResponseType<T>>;
320
323
  }
321
324
 
322
325
  /**
@@ -356,7 +359,7 @@ declare class NativeBridge extends CommonBridge implements INativeBridge {
356
359
  * Bridge.native.createReportEx({ param: "connection.openfile=sample.ozd" });
357
360
  * ```
358
361
  */
359
- createReportEx<T = any>(options: CreateReportExOptions): Promise<CommonOzBridgetResponseType<T>>;
362
+ createOZViewer<T = any>(options: CreateReportExOptions): Promise<CommonOzBridgetResponseType<T>>;
360
363
  /**
361
364
  * ### Bridge for Oz
362
365
  * OZ 뷰어를 닫습니다
@@ -366,7 +369,7 @@ declare class NativeBridge extends CommonBridge implements INativeBridge {
366
369
  * Bridge.native.hideViewer();
367
370
  * ```
368
371
  */
369
- hideViewer<T = any>(): Promise<CommonOzBridgetResponseType<T>>;
372
+ hideOZViewer<T = any>(): Promise<CommonOzBridgetResponseType<T>>;
370
373
  /**
371
374
  * ### Bridge for Oz
372
375
  * 오즈 뷰어의 정보를 가져옵니다
@@ -542,6 +545,24 @@ declare class NativeBridge extends CommonBridge implements INativeBridge {
542
545
  * @returns
543
546
  */
544
547
  onAuthenticationResult(options: OnAuthenticationResultRequest): Promise<OnAuthenticationResultResponse>;
548
+ /**
549
+ * 로더 컴포넌트 show
550
+ * @example
551
+ * ```tsx
552
+ * // 사용 예시
553
+ * await Bridge.native.showLoader()
554
+ * ```
555
+ */
556
+ showLoader<T>(): Promise<CommonOzBridgetResponseType<T>>;
557
+ /**
558
+ * 로더 컴포넌트 hide
559
+ * @example
560
+ * ```tsx
561
+ * // 사용 예시
562
+ * await Bridge.native.hideLoader()
563
+ * ```
564
+ */
565
+ hideLoader<T>(): Promise<CommonOzBridgetResponseType<T>>;
545
566
  }
546
567
 
547
568
  type NativeAction = keyof INativeBridge;
@@ -832,14 +853,23 @@ type ExtraDataType = Record<string, {
832
853
  extraParam?: string[];
833
854
  }>;
834
855
  type Props$1 = {
835
- documentInfo: DocumentInfo[];
856
+ documentList: string[];
836
857
  extraData?: ExtraDataType;
837
858
  };
838
- declare function useCreateReport({ documentInfo, extraData }: Props$1): {
839
- documentList: string[];
859
+ declare function useCreateReport({ documentList, extraData }: Props$1): {
840
860
  CreateReport: () => Promise<void>;
841
861
  };
842
862
 
863
+ declare function useDocumentInfo(initialValue: DocumentInfo[]): {
864
+ setDocumentInfo: react.Dispatch<react.SetStateAction<DocumentInfo[]>>;
865
+ documentInfo: DocumentInfo[];
866
+ documentList: string[];
867
+ documentTemplateMap: Record<string, DocumentInfo>;
868
+ documentIndexMap: Record<string, number>;
869
+ nameTemplateMap: Record<string, DocumentInfo>;
870
+ groupIndexes: number[][];
871
+ };
872
+
843
873
  type Props<T, R = void> = {
844
874
  event: OZViewerEvent;
845
875
  handler: (e: CustomEvent<T>) => Promise<R>;
@@ -868,4 +898,4 @@ declare function categorizeByPageRange(data: DocumentInfo[], pageCounts: number[
868
898
  declare function extractFileName(filePath: string): string;
869
899
  declare function getFileListByGlobalIndex(index: number, data: DocumentInfo[]): DocumentInfo | null;
870
900
 
871
- export { Bridge, type ExtraDataType, type OZBtnTouchEvent, type OZEFormInputEvent, type OZExportEvent, type OZViewerChangeEvent, type OZViewerErrorEvent, OZViewerEvent, type OZViewerPageBindEvent, type OZViewerProgressEvent, type OZViewerUserEvent, btnStyle, categorizeByPageRange, commonOzParam, commonPdfExportParam, extractFileName, fetchDocument, fetchFont, getFileListByGlobalIndex, useCreateReport, useOzEventListener, wrapperStyle };
901
+ export { Bridge, type ExtraDataType, type OZBtnTouchEvent, type OZEFormInputEvent, type OZExportEvent, type OZViewerChangeEvent, type OZViewerErrorEvent, OZViewerEvent, type OZViewerPageBindEvent, type OZViewerProgressEvent, type OZViewerUserEvent, btnStyle, categorizeByPageRange, commonOzParam, commonPdfExportParam, extractFileName, fetchDocument, fetchFont, getFileListByGlobalIndex, useCreateReport, useDocumentInfo, useOzEventListener, wrapperStyle };
package/dist/index.js CHANGED
@@ -1782,9 +1782,9 @@ var NativeBridge = class extends CommonBridge {
1782
1782
  * Bridge.native.createReportEx({ param: "connection.openfile=sample.ozd" });
1783
1783
  * ```
1784
1784
  */
1785
- createReportEx(options) {
1785
+ createOZViewer(options) {
1786
1786
  return this.core.callToTarget(
1787
- "createReportEx",
1787
+ "createOZViewer",
1788
1788
  Object.assign({ delimiter: "\n" }, options)
1789
1789
  );
1790
1790
  }
@@ -1797,8 +1797,8 @@ var NativeBridge = class extends CommonBridge {
1797
1797
  * Bridge.native.hideViewer();
1798
1798
  * ```
1799
1799
  */
1800
- hideViewer() {
1801
- return this.core.callToTarget("hideViewer");
1800
+ hideOZViewer() {
1801
+ return this.core.callToTarget("hideOZViewer");
1802
1802
  }
1803
1803
  /**
1804
1804
  * ### Bridge for Oz
@@ -2017,6 +2017,28 @@ var NativeBridge = class extends CommonBridge {
2017
2017
  async onAuthenticationResult(options) {
2018
2018
  return this.core.callToTarget("onAuthenticationResult", options);
2019
2019
  }
2020
+ /**
2021
+ * 로더 컴포넌트 show
2022
+ * @example
2023
+ * ```tsx
2024
+ * // 사용 예시
2025
+ * await Bridge.native.showLoader()
2026
+ * ```
2027
+ */
2028
+ async showLoader() {
2029
+ return this.core.callToTarget("showLoader");
2030
+ }
2031
+ /**
2032
+ * 로더 컴포넌트 hide
2033
+ * @example
2034
+ * ```tsx
2035
+ * // 사용 예시
2036
+ * await Bridge.native.hideLoader()
2037
+ * ```
2038
+ */
2039
+ async hideLoader() {
2040
+ return this.core.callToTarget("hideLoader");
2041
+ }
2020
2042
  // TODO: 필요 플러그인들 추가
2021
2043
  };
2022
2044
 
@@ -2051,10 +2073,22 @@ var commonOzParam = [
2051
2073
  `eform.signpad_type=embedded`,
2052
2074
  // `eform.signpad_type=keypad`,
2053
2075
  `eform.show_prev_next_input=true`,
2054
- `eform.signpad_prev_next_iconposition=sign_top_left`,
2076
+ // `eform.signpad_prev_next_iconposition=sign_top_left`,
2077
+ `eform.signpad_prev_next_iconposition=sign_top`,
2078
+ `eform.inputcomponent_toolbar_button_json=${JSON.stringify({
2079
+ // 서명패드 버튼 배열 수정
2080
+ "all": {
2081
+ // 왼쪽에 이전, 확인 버튼
2082
+ "left_align": "prev,ok",
2083
+ // 오른쪽에 성명,서명 불러오기, 초가화, 다음
2084
+ "right_align": "reusablesign,clear,next"
2085
+ }
2086
+ })}`,
2055
2087
  `eform.signpad_show_draw_erase_button=false`,
2088
+ `eform.signpad_viewtype=keepratioandfittoframe`,
2056
2089
  `eform.radiobutton_type=ensurevisible_at_prev_next`,
2057
2090
  `eform.checkbox_type=ensurevisible_at_prev_next`,
2091
+ // `eform.prev_next_constraint_rule=empty_only`,
2058
2092
  `eform.imagepicker_id_info=${JSON.stringify({
2059
2093
  ids: [
2060
2094
  {
@@ -2200,8 +2234,7 @@ function getFileListByGlobalIndex(index, data) {
2200
2234
  }
2201
2235
 
2202
2236
  // src/oz/use-create-report.ts
2203
- function useCreateReport({ documentInfo, extraData = {} }) {
2204
- const documentList = (0, import_react.useMemo)(() => documentInfo.map((i) => i.file).flat(1), [documentInfo]);
2237
+ function useCreateReport({ documentList, extraData = {} }) {
2205
2238
  const CreateReport = (0, import_react.useCallback)(async () => {
2206
2239
  if (documentList.length === 0) {
2207
2240
  throw new Error("\uBB38\uC11C\uBAA9\uB85D\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4");
@@ -2231,25 +2264,64 @@ function useCreateReport({ documentInfo, extraData = {} }) {
2231
2264
  ...fontParms,
2232
2265
  ...extraParams.flat(1)
2233
2266
  ];
2234
- Bridge.native.createReportEx({ param: params.join("\n") });
2267
+ Bridge.native.createOZViewer({ param: params.join("\n") });
2235
2268
  }, [documentList, extraData]);
2269
+ return { CreateReport };
2270
+ }
2271
+
2272
+ // src/oz/use-document-info.tsx
2273
+ var import_react2 = __toESM(require_react());
2274
+ function useDocumentInfo(initialValue) {
2275
+ const [documentInfo, setDocumentInfo] = (0, import_react2.useState)([...initialValue]);
2276
+ const documentList = (0, import_react2.useMemo)(() => documentInfo.map((i) => i.file).flat(1), [documentInfo]);
2277
+ const documentIndexMap = documentList.reduce((acc, cur, index) => {
2278
+ acc[cur] = index;
2279
+ return acc;
2280
+ }, {});
2281
+ const documentTemplateMap = (0, import_react2.useMemo)(() => documentInfo.reduce((map, doc) => {
2282
+ doc.file.forEach((file) => {
2283
+ map[file] = { ...doc };
2284
+ });
2285
+ return map;
2286
+ }, {}), [documentInfo]);
2287
+ const nameTemplateMap = documentInfo.reduce((acc, doc) => {
2288
+ acc[doc.name] = doc;
2289
+ return acc;
2290
+ }, {});
2291
+ const groupIndexes = (0, import_react2.useMemo)(() => documentInfo.reduce((acc, item) => {
2292
+ item.file.forEach((file) => {
2293
+ const currentIndex = documentIndexMap[file];
2294
+ if (!acc[currentIndex]) {
2295
+ acc[currentIndex] = [];
2296
+ }
2297
+ item.file.forEach((groupFile) => {
2298
+ acc[currentIndex].push(documentIndexMap[groupFile]);
2299
+ });
2300
+ });
2301
+ return acc;
2302
+ }, []), [documentIndexMap, documentInfo]);
2236
2303
  return {
2304
+ setDocumentInfo,
2305
+ documentInfo,
2237
2306
  documentList,
2238
- CreateReport
2307
+ documentTemplateMap,
2308
+ documentIndexMap,
2309
+ nameTemplateMap,
2310
+ groupIndexes
2239
2311
  };
2240
2312
  }
2241
2313
 
2242
2314
  // src/oz/use-oz-event-listener.tsx
2243
- var import_react2 = __toESM(require_react());
2315
+ var import_react3 = __toESM(require_react());
2244
2316
  function useOzEventListener({ event, handler }) {
2245
- const handleEvent = (0, import_react2.useCallback)(
2317
+ const handleEvent = (0, import_react3.useCallback)(
2246
2318
  async (e) => {
2247
2319
  const customEvent = e;
2248
2320
  return await handler(customEvent);
2249
2321
  },
2250
2322
  [handler]
2251
2323
  );
2252
- (0, import_react2.useEffect)(() => {
2324
+ (0, import_react3.useEffect)(() => {
2253
2325
  window.addEventListener(event, handleEvent);
2254
2326
  return () => {
2255
2327
  window.removeEventListener(event, handleEvent);
@@ -2281,6 +2353,6 @@ react/cjs/react.development.js:
2281
2353
  *)
2282
2354
  */
2283
2355
 
2284
- export { Bridge, OZViewerEvent, btnStyle, categorizeByPageRange, commonOzParam, commonPdfExportParam, extractFileName, fetchDocument, fetchFont, getFileListByGlobalIndex, useCreateReport, useOzEventListener, wrapperStyle };
2356
+ export { Bridge, OZViewerEvent, btnStyle, categorizeByPageRange, commonOzParam, commonPdfExportParam, extractFileName, fetchDocument, fetchFont, getFileListByGlobalIndex, useCreateReport, useDocumentInfo, useOzEventListener, wrapperStyle };
2285
2357
  //# sourceMappingURL=index.js.map
2286
2358
  //# sourceMappingURL=index.js.map