scandoc-ai-components 0.0.80 → 0.0.82

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 +156 -81
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11190,6 +11190,7 @@ class ExtractorVideo {
11190
11190
  this.scanStartTime = null;
11191
11191
  this.unsupportedDocCount = 0;
11192
11192
  this.video = null;
11193
+ this.lastMessage = null;
11193
11194
  }
11194
11195
  reset() {
11195
11196
  this.stopVideo();
@@ -11202,6 +11203,7 @@ class ExtractorVideo {
11202
11203
  this.unsupportedDocStartTime = null;
11203
11204
  this.unsupportedDocCount = 0;
11204
11205
  this.video = null;
11206
+ this.lastMessage = null;
11205
11207
  }
11206
11208
  async analyzeVideoStream() {
11207
11209
  if (!this.isRunning) {
@@ -11269,9 +11271,11 @@ class ExtractorVideo {
11269
11271
  const imageId = response["Index"];
11270
11272
  const imageSide = response["Side"];
11271
11273
  //
11272
- if (this.extractionImages[imageSide] === undefined) {
11273
- this.extractionImages[imageSide] = images[imageId]["fullImg"];
11274
+ if (this.extractionImages[imageSide] !== undefined) {
11275
+ this.candidateImages = [];
11276
+ return;
11274
11277
  }
11278
+ this.extractionImages[imageSide] = images[imageId]["fullImg"];
11275
11279
  const extractionImages = {
11276
11280
  ...this.extractionImages
11277
11281
  };
@@ -11310,6 +11314,7 @@ class ExtractorVideo {
11310
11314
  onExtraction(isExtractionOk, extractionData) {
11311
11315
  this.candidateImages = [];
11312
11316
  this.extractionImages = {};
11317
+ this.lastMessage = null;
11313
11318
  this.stopVideo();
11314
11319
  if (isExtractionOk) {
11315
11320
  this.showMessage("Success - data extracted", "success");
@@ -11386,6 +11391,7 @@ class ExtractorVideo {
11386
11391
  }
11387
11392
  stopVideo() {
11388
11393
  this.isRunning = false;
11394
+ this.lastMessage = null;
11389
11395
  if (this.video) {
11390
11396
  this.video.pause();
11391
11397
  if (this.video.srcObject !== undefined && this.video.srcObject !== null) {
@@ -11395,6 +11401,8 @@ class ExtractorVideo {
11395
11401
  }
11396
11402
  }
11397
11403
  showMessage(message) {
11404
+ if (this.lastMessage === message) return;
11405
+ this.lastMessage = message;
11398
11406
  const messageElement = document.getElementById("ScanDocAIMessage");
11399
11407
  if (messageElement) {
11400
11408
  messageElement.innerText = message;
@@ -11427,85 +11435,152 @@ class ExtractorVideo {
11427
11435
  const cfgValues = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getScanDocAIConfigValues)();
11428
11436
  const borderColor = cfgValues.VIDEO_COLORS?.borderColor;
11429
11437
  const messageColor = cfgValues.VIDEO_COLORS?.messageColor;
11430
- return `
11431
- <div class="desktopFeedback" id="ScanDocAIMessage"></div>
11432
- <div class="desktopVideoArea">
11433
- <div class="desktopVideoHolder">
11434
- <video id="ScanDocAIVideoElement" class="desktopVideo" autoPlay muted playsInline></video>
11435
- <div class="backgroundOverlay"></div>
11436
- <div class="centerGuideDot"></div>
11437
- </div>
11438
- </div>
11439
-
11440
- <style>
11441
- .desktopVideoArea {
11442
- display: flex;
11443
- flex-direction: column;
11444
- gap: 8px;
11445
- padding: 16px;
11446
- background-color: rgba(255, 255, 255, 0.05);
11447
- border: 1px solid ${borderColor};
11448
- border-radius: 15px;
11449
- margin-left: 20%;
11450
- margin-right: 20%;
11451
- }
11452
-
11453
- .desktopVideoHolder {
11454
- position: relative;
11455
- width: 100%;
11456
- overflow: hidden;
11457
- }
11458
-
11459
- .desktopVideo {
11460
- width: 100%;
11461
- height: auto;
11462
- margin-left: auto;
11463
- margin-right: auto;
11464
- max-width: 100vw;
11465
- max-height: 100vh;
11466
- }
11467
-
11468
- .centerGuideDot {
11469
- position: absolute;
11470
- width: 16px;
11471
- height: 16px;
11472
- background-color: #00ff55;
11473
- border-radius: 50%;
11474
- box-shadow: 0 0 8px 2px rgba(0, 255, 100, 0.8);
11475
- z-index: 4;
11476
- animation: flicker 1s infinite;
11477
- pointer-events: none;
11478
- display: none; /* Hidden until video is ready */
11479
- }
11480
-
11481
- @keyframes flicker {
11482
- 0%, 100% { opacity: 1; }
11483
- 50% { opacity: 0.3; }
11484
- }
11485
-
11486
- .backgroundOverlay {
11487
- position: absolute;
11488
- top: 0;
11489
- left: 0;
11490
- width: 100%;
11491
- height: 100%;
11492
- background-color: rgba(0, 0, 0, 0.051);
11493
- z-index: 2;
11494
- pointer-events: none;
11495
- }
11496
-
11497
- .desktopFeedback {
11498
- position: relative;
11499
- display: flex;
11500
- font-size: 22px;
11501
- font-weight: 600;
11502
- min-height: 36px;
11503
- justify-content: center;
11504
- align-items: center;
11505
- color: ${messageColor};
11506
- }
11507
- </style>
11508
- `;
11438
+ const isMobile = window.innerWidth < 768 || window.innerHeight > window.innerWidth;
11439
+ window.innerWidth < 768 || window.innerHeight > window.innerWidth && window.innerWidth < 1024;
11440
+ if (isMobile) {
11441
+ // ✅ Mobile version with overlay feedback
11442
+ return `
11443
+ <div class="mobileVideoArea">
11444
+ <video id="ScanDocAIVideoElement" class="mobileVideo" autoplay muted playsinline></video>
11445
+ <div class="mobileOverlay">
11446
+ <div class="mobileFeedback" id="ScanDocAIMessage"></div>
11447
+ <div class="centerGuideDot"></div>
11448
+ </div>
11449
+ </div>
11450
+
11451
+ <style>
11452
+ .mobileVideoArea {
11453
+ position: relative;
11454
+ width: 100vw;
11455
+ height: 100vh;
11456
+ overflow: hidden;
11457
+ }
11458
+ .mobileVideo {
11459
+ width: 100%;
11460
+ height: 100%;
11461
+ object-fit: cover;
11462
+ pointer-events: none;
11463
+ }
11464
+ .mobileOverlay {
11465
+ position: absolute;
11466
+ inset: 0;
11467
+ display: flex;
11468
+ flex-direction: column;
11469
+ justify-content: flex-start;
11470
+ align-items: center;
11471
+ pointer-events: none;
11472
+ z-index: 10;
11473
+ }
11474
+ .mobileFeedback {
11475
+ margin-top: 16px;
11476
+ padding: 8px 16px;
11477
+ border-radius: 8px;
11478
+ background: rgba(15, 33, 63, 0.75);
11479
+ color: ${messageColor};
11480
+ font-weight: 600;
11481
+ font-size: 16px;
11482
+ text-align: center;
11483
+ max-width: 90%;
11484
+ }
11485
+ .centerGuideDot {
11486
+ width: 16px;
11487
+ height: 16px;
11488
+ border-radius: 50%;
11489
+ background-color: #00ff55;
11490
+ box-shadow: 0 0 8px 2px rgba(0, 255, 100, 0.8);
11491
+ animation: flicker 1s infinite;
11492
+ position: absolute;
11493
+ top: 50%;
11494
+ left: 50%;
11495
+ transform: translate(-50%, -50%);
11496
+ }
11497
+ @keyframes flicker {
11498
+ 0%, 100% { opacity: 1; }
11499
+ 50% { opacity: 0.3; }
11500
+ }
11501
+ </style>
11502
+ `;
11503
+ } else {
11504
+ return `
11505
+ <div class="desktopFeedback" id="ScanDocAIMessage"></div>
11506
+ <div class="desktopVideoArea">
11507
+ <div class="desktopVideoHolder">
11508
+ <video id="ScanDocAIVideoElement" class="desktopVideo" autoPlay muted playsInline></video>
11509
+ <div class="backgroundOverlay"></div>
11510
+ <div class="centerGuideDot"></div>
11511
+ </div>
11512
+ </div>
11513
+
11514
+ <style>
11515
+ .desktopVideoArea {
11516
+ display: flex;
11517
+ flex-direction: column;
11518
+ gap: 8px;
11519
+ padding: 16px;
11520
+ background-color: rgba(255, 255, 255, 0.05);
11521
+ border: 1px solid ${borderColor};
11522
+ border-radius: 15px;
11523
+ margin-left: 20%;
11524
+ margin-right: 20%;
11525
+ }
11526
+
11527
+ .desktopVideoHolder {
11528
+ position: relative;
11529
+ width: 100%;
11530
+ overflow: hidden;
11531
+ }
11532
+
11533
+ .desktopVideo {
11534
+ width: 100%;
11535
+ height: auto;
11536
+ margin-left: auto;
11537
+ margin-right: auto;
11538
+ max-width: 100vw;
11539
+ max-height: 100vh;
11540
+ }
11541
+
11542
+ .centerGuideDot {
11543
+ position: absolute;
11544
+ width: 16px;
11545
+ height: 16px;
11546
+ background-color: #00ff55;
11547
+ border-radius: 50%;
11548
+ box-shadow: 0 0 8px 2px rgba(0, 255, 100, 0.8);
11549
+ z-index: 4;
11550
+ animation: flicker 1s infinite;
11551
+ pointer-events: none;
11552
+ display: none; /* Hidden until video is ready */
11553
+ }
11554
+
11555
+ @keyframes flicker {
11556
+ 0%, 100% { opacity: 1; }
11557
+ 50% { opacity: 0.3; }
11558
+ }
11559
+
11560
+ .backgroundOverlay {
11561
+ position: absolute;
11562
+ top: 0;
11563
+ left: 0;
11564
+ width: 100%;
11565
+ height: 100%;
11566
+ background-color: rgba(0, 0, 0, 0.051);
11567
+ z-index: 2;
11568
+ pointer-events: none;
11569
+ }
11570
+
11571
+ .desktopFeedback {
11572
+ position: relative;
11573
+ display: flex;
11574
+ font-size: 22px;
11575
+ font-weight: 600;
11576
+ min-height: 36px;
11577
+ justify-content: center;
11578
+ align-items: center;
11579
+ color: ${messageColor};
11580
+ }
11581
+ </style>
11582
+ `;
11583
+ }
11509
11584
  }
11510
11585
  }
11511
11586
  let EXTRACTION_VIDEO = 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.80",
4
+ "version": "0.0.82",
5
5
  "private": false,
6
6
  "description": "Pure JavaScript package for integrating ScanDoc-AI services.",
7
7
  "keywords": [