sales-frontend-bridge 0.0.26 → 0.0.27

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
@@ -2260,6 +2260,81 @@ function getFileListByGlobalIndex(index, data) {
2260
2260
  }
2261
2261
  return null;
2262
2262
  }
2263
+ async function getReportCount() {
2264
+ const { data } = await Bridge.nativeOz.getInformation({ command: "REPORT_COUNT" });
2265
+ return Number(data);
2266
+ }
2267
+ async function enableFocusOnValidation(reportCount) {
2268
+ const count = reportCount ?? await getReportCount();
2269
+ for (let i = 0; i < count; i++) {
2270
+ await sleep();
2271
+ await Bridge.nativeOz.setGlobal({ key: "chkFlag", value: "1", docIndex: i });
2272
+ }
2273
+ return;
2274
+ }
2275
+ async function disableFocusOnValidation(reportCount) {
2276
+ const count = reportCount ?? await getReportCount();
2277
+ for (let i = 0; i < count; i++) {
2278
+ await sleep();
2279
+ await Bridge.nativeOz.setGlobal({ key: "chkFlag", value: "0", docIndex: i });
2280
+ }
2281
+ return;
2282
+ }
2283
+ async function sleep(ms = 10) {
2284
+ return new Promise((resolve) => setTimeout(resolve, ms));
2285
+ }
2286
+ async function triggerClickOnAllDocuments(reportCount) {
2287
+ const count = reportCount ?? await getReportCount();
2288
+ for (let i = 0; i < count; i++) {
2289
+ await sleep();
2290
+ const command = `INPUT_TRIGGER_CLICK_AT=${i}`;
2291
+ await Bridge.nativeOz.getInformation({ command });
2292
+ }
2293
+ }
2294
+ async function triggerCropImageOnAllDocuments(reportCount) {
2295
+ const count = reportCount ?? await getReportCount();
2296
+ for (let i = 0; i < count; i++) {
2297
+ await sleep();
2298
+ await Bridge.nativeOz.triggerExternalEventByDocIndex({ docIndex: Number(i), param1: "cropimage" });
2299
+ }
2300
+ }
2301
+ async function getTotalPageOnAllDocuments(reportCount) {
2302
+ const count = reportCount ?? await getReportCount();
2303
+ const totalPages = [];
2304
+ for (let i = 0; i < count; i++) {
2305
+ await sleep();
2306
+ const command = `TOTAL_PAGE_OF_REPORT_FILE_AT=${i}`;
2307
+ const { data } = await Bridge.nativeOz.getInformation({ command });
2308
+ totalPages.push(Number(data));
2309
+ }
2310
+ return totalPages;
2311
+ }
2312
+ async function checkDocumentsValidityByIndex(indexList) {
2313
+ const result = [];
2314
+ for (let i = 0; i < indexList.length; i++) {
2315
+ await sleep();
2316
+ const command = `INVALID_INFO_JSON_AT=${indexList[i]}`;
2317
+ const { data } = await Bridge.nativeOz.getInformation({ command });
2318
+ result.push(data === "");
2319
+ }
2320
+ return result.every((i) => i);
2321
+ }
2322
+ async function validateAllDocuments(reportCount) {
2323
+ const count = reportCount ?? await getReportCount();
2324
+ for (let i = 0; i < count; i++) {
2325
+ await sleep();
2326
+ const command = `INPUT_CHECK_VALIDITY_AT=${i}`;
2327
+ const { data } = await Bridge.nativeOz.getInformation({ command });
2328
+ if (data !== "valid") {
2329
+ return false;
2330
+ }
2331
+ }
2332
+ return true;
2333
+ }
2334
+ async function getTotalPage() {
2335
+ const { data } = await Bridge.nativeOz.getInformation({ command: "TOTAL_PAGE" });
2336
+ return Number(data);
2337
+ }
2263
2338
 
2264
2339
  // src/oz/use-create-report.ts
2265
2340
  function useCreateReport({ documentList, extraData = {} }) {
@@ -2385,15 +2460,25 @@ exports.Bridge = Bridge;
2385
2460
  exports.OZViewerEvent = OZViewerEvent;
2386
2461
  exports.btnStyle = btnStyle;
2387
2462
  exports.categorizeByPageRange = categorizeByPageRange;
2463
+ exports.checkDocumentsValidityByIndex = checkDocumentsValidityByIndex;
2388
2464
  exports.commonOzParam = commonOzParam;
2389
2465
  exports.commonPdfExportParam = commonPdfExportParam;
2466
+ exports.disableFocusOnValidation = disableFocusOnValidation;
2467
+ exports.enableFocusOnValidation = enableFocusOnValidation;
2390
2468
  exports.extractFileName = extractFileName;
2391
2469
  exports.fetchDocument = fetchDocument;
2392
2470
  exports.fetchFont = fetchFont;
2393
2471
  exports.getFileListByGlobalIndex = getFileListByGlobalIndex;
2472
+ exports.getReportCount = getReportCount;
2473
+ exports.getTotalPage = getTotalPage;
2474
+ exports.getTotalPageOnAllDocuments = getTotalPageOnAllDocuments;
2475
+ exports.sleep = sleep;
2476
+ exports.triggerClickOnAllDocuments = triggerClickOnAllDocuments;
2477
+ exports.triggerCropImageOnAllDocuments = triggerCropImageOnAllDocuments;
2394
2478
  exports.useCreateReport = useCreateReport;
2395
2479
  exports.useDocumentInfo = useDocumentInfo;
2396
2480
  exports.useOzEventListener = useOzEventListener;
2481
+ exports.validateAllDocuments = validateAllDocuments;
2397
2482
  exports.wrapperStyle = wrapperStyle;
2398
2483
  //# sourceMappingURL=index.cjs.map
2399
2484
  //# sourceMappingURL=index.cjs.map