sales-frontend-bridge 0.0.31 → 0.0.32
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 +44 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -57
- package/dist/index.d.ts +58 -57
- package/dist/index.js +44 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2105,22 +2105,7 @@ var Bridge = {
|
|
|
2105
2105
|
iframeCore: new IframeBridgeCore()
|
|
2106
2106
|
};
|
|
2107
2107
|
|
|
2108
|
-
// src/oz/
|
|
2109
|
-
var OZViewerEvent = /* @__PURE__ */ ((OZViewerEvent2) => {
|
|
2110
|
-
OZViewerEvent2["OZProgressCommand"] = "OZProgressCommand";
|
|
2111
|
-
OZViewerEvent2["OZErrorCommand"] = "OZErrorCommand";
|
|
2112
|
-
OZViewerEvent2["OZPageChangeCommand"] = "OZPageChangeCommand";
|
|
2113
|
-
OZViewerEvent2["OZReportChangeCommand"] = "OZReportChangeCommand";
|
|
2114
|
-
OZViewerEvent2["OZUserEvent"] = "OZUserEvent";
|
|
2115
|
-
OZViewerEvent2["OZPageBindCommand"] = "OZPageBindCommand";
|
|
2116
|
-
OZViewerEvent2["OZEFormInputEventCommand"] = "OZEFormInputEventCommand";
|
|
2117
|
-
OZViewerEvent2["OZExportCommand"] = "OZExportCommand";
|
|
2118
|
-
OZViewerEvent2["OZBtnTouchEvent"] = "btnTouchEvent";
|
|
2119
|
-
OZViewerEvent2["OZReportCreated"] = "OZReportCreated";
|
|
2120
|
-
return OZViewerEvent2;
|
|
2121
|
-
})(OZViewerEvent || {});
|
|
2122
|
-
|
|
2123
|
-
// src/oz/constant.ts
|
|
2108
|
+
// src/oz/constant/index.ts
|
|
2124
2109
|
var commonOzParam = [
|
|
2125
2110
|
`information.debug = true`,
|
|
2126
2111
|
`global.inheritparameter=true`,
|
|
@@ -2244,19 +2229,25 @@ var commentPenEraser = [`comment.selectedpen=eraser`];
|
|
|
2244
2229
|
var wrapperStyle = { display: "flex", flexFlow: "column", gap: "10px" };
|
|
2245
2230
|
var btnStyle = { border: "1px solid red", minHeight: "40px" };
|
|
2246
2231
|
|
|
2247
|
-
// src/oz/use-create-report.ts
|
|
2232
|
+
// src/oz/hooks/use-create-report.ts
|
|
2248
2233
|
var import_react = __toESM(require_react());
|
|
2249
2234
|
|
|
2250
|
-
// src/oz/
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2235
|
+
// src/oz/types/oz-event.types.ts
|
|
2236
|
+
var OZViewerEvent = /* @__PURE__ */ ((OZViewerEvent2) => {
|
|
2237
|
+
OZViewerEvent2["OZProgressCommand"] = "OZProgressCommand";
|
|
2238
|
+
OZViewerEvent2["OZErrorCommand"] = "OZErrorCommand";
|
|
2239
|
+
OZViewerEvent2["OZPageChangeCommand"] = "OZPageChangeCommand";
|
|
2240
|
+
OZViewerEvent2["OZReportChangeCommand"] = "OZReportChangeCommand";
|
|
2241
|
+
OZViewerEvent2["OZUserEvent"] = "OZUserEvent";
|
|
2242
|
+
OZViewerEvent2["OZPageBindCommand"] = "OZPageBindCommand";
|
|
2243
|
+
OZViewerEvent2["OZEFormInputEventCommand"] = "OZEFormInputEventCommand";
|
|
2244
|
+
OZViewerEvent2["OZExportCommand"] = "OZExportCommand";
|
|
2245
|
+
OZViewerEvent2["OZBtnTouchEvent"] = "btnTouchEvent";
|
|
2246
|
+
OZViewerEvent2["OZReportCreated"] = "OZReportCreated";
|
|
2247
|
+
return OZViewerEvent2;
|
|
2248
|
+
})(OZViewerEvent || {});
|
|
2249
|
+
|
|
2250
|
+
// src/oz/utils/common-util.ts
|
|
2260
2251
|
function categorizeByPageRange(data, pageCounts) {
|
|
2261
2252
|
let pageStart = 1;
|
|
2262
2253
|
const result = [];
|
|
@@ -2300,6 +2291,29 @@ function getFileListByGlobalIndex(index, data) {
|
|
|
2300
2291
|
}
|
|
2301
2292
|
return null;
|
|
2302
2293
|
}
|
|
2294
|
+
async function sleep(ms = 10) {
|
|
2295
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2296
|
+
}
|
|
2297
|
+
function PromiseWithResolvers() {
|
|
2298
|
+
let resolve;
|
|
2299
|
+
let reject;
|
|
2300
|
+
const promise = new Promise((res, rej) => {
|
|
2301
|
+
resolve = res;
|
|
2302
|
+
reject = rej;
|
|
2303
|
+
});
|
|
2304
|
+
return { promise, resolve, reject };
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
// src/oz/utils/bridge-util.ts
|
|
2308
|
+
async function fetchDocument(options) {
|
|
2309
|
+
const { data } = await Bridge.native.downloadDocument({ data: options });
|
|
2310
|
+
return data.map((i) => ({ ...i, startPage: 0, endPage: 0 }));
|
|
2311
|
+
}
|
|
2312
|
+
async function fetchFont() {
|
|
2313
|
+
const { data: fontMap } = await Bridge.native.getOzFontParam();
|
|
2314
|
+
const fontParms = Object.keys(fontMap).map((i) => `font.${i}=${fontMap[i]}`);
|
|
2315
|
+
return fontParms;
|
|
2316
|
+
}
|
|
2303
2317
|
async function getReportCount() {
|
|
2304
2318
|
const { data } = await Bridge.nativeOz.getInformation({ command: "REPORT_COUNT" });
|
|
2305
2319
|
return Number(data);
|
|
@@ -2323,9 +2337,6 @@ async function disableFocusOnValidation(reportCount) {
|
|
|
2323
2337
|
}
|
|
2324
2338
|
return;
|
|
2325
2339
|
}
|
|
2326
|
-
async function sleep(ms = 10) {
|
|
2327
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2328
|
-
}
|
|
2329
2340
|
async function triggerClickOnAllDocuments(reportCount) {
|
|
2330
2341
|
const count = reportCount ?? await getReportCount();
|
|
2331
2342
|
for (let i = 0; i < count; i++) {
|
|
@@ -2493,15 +2504,6 @@ async function PdfHandler({ type, btnID }) {
|
|
|
2493
2504
|
await Bridge.native.hideOZViewer();
|
|
2494
2505
|
}
|
|
2495
2506
|
}
|
|
2496
|
-
function PromiseWithResolvers() {
|
|
2497
|
-
let resolve;
|
|
2498
|
-
let reject;
|
|
2499
|
-
const promise = new Promise((res, rej) => {
|
|
2500
|
-
resolve = res;
|
|
2501
|
-
reject = rej;
|
|
2502
|
-
});
|
|
2503
|
-
return { promise, resolve, reject };
|
|
2504
|
-
}
|
|
2505
2507
|
async function SaveTotalPdf() {
|
|
2506
2508
|
const { promise, resolve } = PromiseWithResolvers();
|
|
2507
2509
|
window.addEventListener(
|
|
@@ -2526,7 +2528,7 @@ async function SaveTotalPdf() {
|
|
|
2526
2528
|
return filepath;
|
|
2527
2529
|
}
|
|
2528
2530
|
|
|
2529
|
-
// src/oz/use-create-report.ts
|
|
2531
|
+
// src/oz/hooks/use-create-report.ts
|
|
2530
2532
|
function useCreateReport({ documentList, extraData = {} }) {
|
|
2531
2533
|
const CreateReport = (0, import_react.useCallback)(async () => {
|
|
2532
2534
|
if (documentList.length === 0) {
|
|
@@ -2562,7 +2564,7 @@ function useCreateReport({ documentList, extraData = {} }) {
|
|
|
2562
2564
|
return { CreateReport };
|
|
2563
2565
|
}
|
|
2564
2566
|
|
|
2565
|
-
// src/oz/use-document-info.tsx
|
|
2567
|
+
// src/oz/hooks/use-document-info.tsx
|
|
2566
2568
|
var import_react2 = __toESM(require_react());
|
|
2567
2569
|
function useDocumentInfo(initialValue) {
|
|
2568
2570
|
const [documentInfo, setDocumentInfo] = (0, import_react2.useState)([...initialValue]);
|
|
@@ -2606,7 +2608,7 @@ function useDocumentInfo(initialValue) {
|
|
|
2606
2608
|
};
|
|
2607
2609
|
}
|
|
2608
2610
|
|
|
2609
|
-
// src/oz/use-oz-event-listener.tsx
|
|
2611
|
+
// src/oz/hooks/use-oz-event-listener.tsx
|
|
2610
2612
|
var import_react3 = __toESM(require_react());
|
|
2611
2613
|
function useOzEventListener({ event, handler }) {
|
|
2612
2614
|
const handleEvent = (0, import_react3.useCallback)(
|