@unvired/turboforms-embed-sdk 2.0.67 → 2.0.71

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.
@@ -26881,7 +26881,7 @@ function injectBarcodeModalStyles() {
26881
26881
  top: 0; left: 0;
26882
26882
  width: 100%;
26883
26883
  height: 100%;
26884
- pointer-events: none;
26884
+ pointer-events: auto;
26885
26885
  }
26886
26886
 
26887
26887
  .barcode-close-btn {
@@ -26899,7 +26899,7 @@ function injectBarcodeModalStyles() {
26899
26899
  align-items: center;
26900
26900
  justify-content: center;
26901
26901
  transition: background 0.2s;
26902
- pointer-events: all;
26902
+ pointer-events: auto;
26903
26903
  z-index: 10003;
26904
26904
  }
26905
26905
  .barcode-close-btn:hover {
@@ -26977,7 +26977,7 @@ function injectBarcodeModalStyles() {
26977
26977
  font-size: 16px;
26978
26978
  text-align: center;
26979
26979
  opacity: 0.8;
26980
- pointer-events: all;
26980
+ pointer-events: auto;
26981
26981
  }
26982
26982
 
26983
26983
  #scannedResult {
@@ -27289,11 +27289,11 @@ function openCameraModal() {
27289
27289
  <option value="" disabled selected>Select Camera</option>
27290
27290
  </select>
27291
27291
  </div>
27292
- <div id="captureButton" style="opacity: 0; pointer-events: none;">
27292
+ <button id="captureButton" type="button" style="opacity: 0; pointer-events: none;">
27293
27293
  <div class="capture-ring">
27294
27294
  <div class="capture-inner"></div>
27295
27295
  </div>
27296
- </div>
27296
+ </button>
27297
27297
  </div>
27298
27298
  </div>
27299
27299
  </div>
@@ -27382,17 +27382,6 @@ async function startCameraStream(deviceId = null) {
27382
27382
  // Mute video to prevent audio feedback and allow autoplay in restrictive policies
27383
27383
  video.muted = true;
27384
27384
 
27385
- // Assign stream
27386
- video.srcObject = videoStream;
27387
-
27388
- // Ensure video doesn't stay paused if it somehow exits fullscreen or gets interrupted
27389
- video.onpause = () => {
27390
- if (cameraStarted && video.srcObject) {
27391
- // Only try to resume if we expect it to be playing
27392
- video.play().catch(e => logger.info("[TF_SDK:234] ✅ Resume error", e));
27393
- }
27394
- };
27395
-
27396
27385
  // Wait for video to start playing, then hide loader
27397
27386
  video.onloadedmetadata = () => {
27398
27387
  // Once permission is granted and stream starts, listing devices will return labels
@@ -27411,7 +27400,7 @@ async function startCameraStream(deviceId = null) {
27411
27400
 
27412
27401
  if (captureBtn) {
27413
27402
  captureBtn.style.opacity = "1";
27414
- captureBtn.style.pointerEvents = "all";
27403
+ captureBtn.style.pointerEvents = "auto";
27415
27404
  }
27416
27405
  };
27417
27406
 
@@ -27432,6 +27421,17 @@ async function startCameraStream(deviceId = null) {
27432
27421
  });
27433
27422
  };
27434
27423
 
27424
+ // Ensure video doesn't stay paused if it somehow exits fullscreen or gets interrupted
27425
+ video.onpause = () => {
27426
+ if (cameraStarted && video.srcObject) {
27427
+ // Only try to resume if we expect it to be playing
27428
+ video.play().catch(e => logger.info("[TF_SDK:234] ✅ Resume error", e));
27429
+ }
27430
+ };
27431
+
27432
+ // Assign stream
27433
+ video.srcObject = videoStream;
27434
+
27435
27435
  } catch (err) {
27436
27436
  logger.error("[TF_SDK:238] ❌ Camera start error:", err);
27437
27437
  let errorMessage = err.message || "Failed to start camera";
@@ -27498,57 +27498,68 @@ async function populateCameraDevices() {
27498
27498
  }
27499
27499
 
27500
27500
  function captureImage() {
27501
- const video = document.getElementById("cameraVideo");
27502
- if (!video || !cameraStarted) {
27503
- logger.warn("[TF_SDK:240] ⚠️ Camera not ready for capture");
27504
- return;
27505
- }
27506
-
27507
- // Add capture animation
27508
- const captureBtn = document.getElementById("captureButton");
27509
- captureBtn.classList.add("capturing");
27501
+ try {
27502
+ const video = document.getElementById("cameraVideo");
27503
+ if (!video || !cameraStarted) {
27504
+ logger.warn("[TF_SDK:240] ⚠️ Camera not ready for capture");
27505
+ return;
27506
+ }
27510
27507
 
27511
- const canvas = document.createElement("canvas");
27512
- canvas.width = video.videoWidth || 640;
27513
- canvas.height = video.videoHeight || 480;
27508
+ // Add capture animation
27509
+ const captureBtn = document.getElementById("captureButton");
27510
+ if (captureBtn) {
27511
+ captureBtn.classList.add("capturing");
27512
+ }
27514
27513
 
27515
- const ctx = canvas.getContext("2d");
27516
- ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
27514
+ const canvas = document.createElement("canvas");
27515
+ canvas.width = video.videoWidth || 640;
27516
+ canvas.height = video.videoHeight || 480;
27517
27517
 
27518
- capturedImageData = canvas.toDataURL("image/jpeg", 0.8);
27519
- logger.info('[TF_SDK:241] ✅ Image captured, dispatching capureImageData event', { controlId: window.compId });
27518
+ const ctx = canvas.getContext("2d");
27519
+ if (!ctx) {
27520
+ throw new Error("Could not get 2D context from canvas");
27521
+ }
27522
+ ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
27520
27523
 
27521
- // Stop camera stream
27522
- if (videoStream) {
27523
- videoStream.getTracks().forEach(track => track.stop());
27524
- cameraStarted = false;
27525
- }
27524
+ capturedImageData = canvas.toDataURL("image/jpeg", 0.8);
27525
+ logger.info('[TF_SDK:241] ✅ Image captured, dispatching capureImageData event', { controlId: window.compId });
27526
27526
 
27527
- // Auto-save and close modal after capture
27528
- setTimeout(() => {
27529
- if (window.compId && capturedImageData) {
27530
- // Send image data to file component using the correct event name
27531
- const event = new CustomEvent("capureImageData", {
27532
- detail: {
27533
- imageData: capturedImageData,
27534
- controlId: window.compId,
27535
- fileName: `photo-${Date.now()}.jpg`
27536
- }
27537
- });
27538
- document.dispatchEvent(event);
27539
- logger.info('[TF_SDK:242] ✅ capureImageData dispatched to SmartFile');
27527
+ // Stop camera stream
27528
+ if (videoStream) {
27529
+ videoStream.getTracks().forEach(track => track.stop());
27530
+ cameraStarted = false;
27531
+ }
27540
27532
 
27541
- // Send success event
27542
- if (window.sendEventCallback) {
27543
- window.sendEventCallback({
27544
- type: window.FORM_EVENTS.OPEN_CAMERA,
27545
- message: "Photo captured successfully",
27546
- data: { controlId: window.compId, fileName: `photo-${Date.now()}.jpg` }
27533
+ // Auto-save and close modal after capture
27534
+ setTimeout(() => {
27535
+ if (window.compId && capturedImageData) {
27536
+ // Send image data to file component using the correct event name
27537
+ const event = new CustomEvent("capureImageData", {
27538
+ detail: {
27539
+ imageData: capturedImageData,
27540
+ controlId: window.compId,
27541
+ fileName: `photo-${Date.now()}.jpg`
27542
+ }
27547
27543
  });
27544
+ document.dispatchEvent(event);
27545
+ logger.info('[TF_SDK:242] ✅ capureImageData dispatched to SmartFile');
27546
+
27547
+ // Send success event
27548
+ if (window.sendEventCallback) {
27549
+ window.sendEventCallback({
27550
+ type: window.FORM_EVENTS.OPEN_CAMERA,
27551
+ message: "Photo captured successfully",
27552
+ data: { controlId: window.compId, fileName: `photo-${Date.now()}.jpg` }
27553
+ });
27554
+ }
27548
27555
  }
27549
- }
27556
+ closeCameraModal();
27557
+ }, 300); // Small delay for capture animation
27558
+ } catch (err) {
27559
+ logger.error("[TF_SDK:241_err] ❌ Error during captureImage:", err);
27560
+ alert("Error taking photo: " + (err.message || err));
27550
27561
  closeCameraModal();
27551
- }, 300); // Small delay for capture animation
27562
+ }
27552
27563
  }
27553
27564
 
27554
27565
  function showCameraError(message) {
@@ -27665,7 +27676,7 @@ function injectCameraModalStyles() {
27665
27676
  top: 0; left: 0;
27666
27677
  width: 100%;
27667
27678
  height: 100%;
27668
- pointer-events: none;
27679
+ pointer-events: auto;
27669
27680
  }
27670
27681
 
27671
27682
  .camera-close-btn {
@@ -27683,7 +27694,7 @@ function injectCameraModalStyles() {
27683
27694
  align-items: center;
27684
27695
  justify-content: center;
27685
27696
  transition: background 0.2s;
27686
- pointer-events: all;
27697
+ pointer-events: auto;
27687
27698
  z-index: 10001;
27688
27699
  }
27689
27700
  .camera-close-btn:hover {
@@ -27695,7 +27706,7 @@ function injectCameraModalStyles() {
27695
27706
  top: 20px;
27696
27707
  right: 20px;
27697
27708
  z-index: 10001;
27698
- pointer-events: all;
27709
+ pointer-events: auto;
27699
27710
  display: none; /* Hidden by default until devices found */
27700
27711
  }
27701
27712
 
@@ -27729,9 +27740,14 @@ function injectCameraModalStyles() {
27729
27740
  left: 50%;
27730
27741
  transform: translateX(-50%);
27731
27742
  cursor: pointer;
27732
- pointer-events: all;
27743
+ pointer-events: auto;
27733
27744
  z-index: 10001;
27734
27745
  transition: opacity 0.3s ease;
27746
+ background: transparent;
27747
+ border: none;
27748
+ padding: 0;
27749
+ outline: none;
27750
+ -webkit-tap-highlight-color: transparent;
27735
27751
  }
27736
27752
 
27737
27753
  .capture-ring {
@@ -30124,7 +30140,7 @@ class SmartFileComponent extends FieldComponent {
30124
30140
  correctOrientation: false,
30125
30141
  });
30126
30142
  } else {
30127
- let id = this.component.id;
30143
+ let id = this.id;
30128
30144
  isfileBrowse = false;
30129
30145
  window.isListenerSet = false;
30130
30146
  let eventCustom = new CustomEvent("openCamera", {
@@ -30160,7 +30176,7 @@ class SmartFileComponent extends FieldComponent {
30160
30176
  if (this.refs.toggleCameraMode) {
30161
30177
  this.addEventListener(this.refs.toggleCameraMode, 'click', (event) => {
30162
30178
  event.preventDefault();
30163
- let id = this.component.id;
30179
+ let id = this.id;
30164
30180
  isfileBrowse = false;
30165
30181
  window.isListenerSet = false;
30166
30182
  let eventCustom = new CustomEvent("openCamera", {
@@ -30229,9 +30245,9 @@ class SmartFileComponent extends FieldComponent {
30229
30245
  }
30230
30246
  }
30231
30247
  let that = this;
30232
- document.addEventListener('capureImageData', function (event) {
30248
+ this.addEventListener(document, 'capureImageData', function (event) {
30233
30249
  logger.info("[TF_SDK:84] ✅ event.detail.controlId =" + event.detail.controlId)
30234
- if (that.component.id == event.detail.controlId) {
30250
+ if (that.id == event.detail.controlId) {
30235
30251
  if (!window.isListenerSet) {
30236
30252
  const isBase64 = typeof event.detail.imageData === 'string' && event.detail.imageData.startsWith('data:');
30237
30253
  if (isBase64 || typeof window.resolveLocalFileSystemURL !== 'function') {
@@ -30279,9 +30295,9 @@ class SmartFileComponent extends FieldComponent {
30279
30295
  }, false);
30280
30296
 
30281
30297
 
30282
- document.addEventListener('capureImageDataForAndroidBrowser', function (event) {
30298
+ this.addEventListener(document, 'capureImageDataForAndroidBrowser', function (event) {
30283
30299
  logger.info("[TF_SDK:89] ✅ event.detail.controlId capureImageDataForAndroidBrowser =" + event.detail.controlId)
30284
- if (that.component.id == event.detail.controlId) {
30300
+ if (that.id == event.detail.controlId) {
30285
30301
  if (!window.isListenerSet) {
30286
30302
  that.compressFile([event.detail.imageData])
30287
30303
  // window.resolveLocalFileSystemURL(event.detail.imageData, (fileEntry) => {
@@ -41729,7 +41745,7 @@ initThemeHook();
41729
41745
  </div>
41730
41746
 
41731
41747
  <div id="sticky-footer">
41732
- <div class="build-version">SDK v2.0.67</div>
41748
+ <div class="build-version">SDK v2.0.71</div>
41733
41749
 
41734
41750
  <button class="footer-btn footer-btn-secondary" id="prevBtn" style="display:none" onclick="FormOnPrevious()">
41735
41751
  <i class="bi bi-chevron-left"></i> Previous