scandoc-ai-components 0.0.43 → 0.0.44

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11328,7 +11328,8 @@ class ExtractorVideo {
11328
11328
  async startVideo() {
11329
11329
  try {
11330
11330
  const serviceConfig = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getScanDocAIConfig)();
11331
- await serviceConfig.getAccessToken(true);
11331
+ await serviceConfig.getAccessToken(true); // this will throw if 401
11332
+
11332
11333
  const videoElem = document.getElementById("ScanDocAIVideoElement");
11333
11334
  if (!videoElem) {
11334
11335
  throw new Error("Video element not found.");
@@ -11361,12 +11362,13 @@ class ExtractorVideo {
11361
11362
  this.showMessage("Starting scanning");
11362
11363
  return true;
11363
11364
  } catch (error) {
11365
+ console.error("startVideo failed:", error);
11364
11366
  this.isRunning = false;
11365
11367
  this.stopVideo();
11366
11368
  this.onExtractedResults({
11367
11369
  success: false,
11368
11370
  code: error.status === 401 ? "004" : "005",
11369
- info: error.status === 401 ? "Authentication failed." : error.message || "Error"
11371
+ info: error.status === 401 ? "Authentication failed: Invalid API key." : "Startup failed: " + (error.message || "Unknown error")
11370
11372
  });
11371
11373
  return false;
11372
11374
  }
@@ -11631,11 +11633,13 @@ class ServiceConfig {
11631
11633
  this.refreshToken = data["refresh_token"];
11632
11634
  return this.accessToken;
11633
11635
  } else {
11636
+ console.error("Could not authenticate! Check your static key!");
11634
11637
  const error = new Error("Authentication failed");
11635
11638
  error.status = 401;
11636
11639
  throw error;
11637
11640
  }
11638
11641
  }
11642
+ return this.accessToken;
11639
11643
  }
11640
11644
  async refreshTokens() {
11641
11645
  if (this.refreshToken !== undefined) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "scandoc-ai-components",
3
3
  "author": "ScanDoc-AI",
4
- "version": "0.0.43",
4
+ "version": "0.0.44",
5
5
  "private": false,
6
6
  "description": "Pure JavaScript package for integrating ScanDoc-AI services.",
7
7
  "keywords": [