@wowlabtech/mini-app-adapter 0.2.82 → 0.2.84

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.js CHANGED
@@ -1192,11 +1192,9 @@ var TelegramMiniAppAdapter = class extends BaseMiniAppAdapter {
1192
1192
  if (!miniApp.isSupported()) {
1193
1193
  console.warn("[tvm-app-adapter] miniApp feature is not supported; falling back to limited mode.");
1194
1194
  }
1195
- if (eruda) {
1196
- void import("eruda").then(({ default: erudaInstance }) => {
1197
- erudaInstance.init();
1198
- erudaInstance.position({ x: window.innerWidth - 150, y: window.innerHeight - 150 });
1199
- });
1195
+ if (eruda && typeof window !== "undefined" && window.eruda) {
1196
+ window.eruda.init();
1197
+ window.eruda.position({ x: window.innerWidth - 150, y: window.innerHeight - 150 });
1200
1198
  }
1201
1199
  if (mockForMacOS) {
1202
1200
  let firstThemeSent = false;
@@ -2028,10 +2026,7 @@ var VKMiniAppAdapter = class extends BaseMiniAppAdapter {
2028
2026
  };
2029
2027
  }
2030
2028
  return {
2031
- launchParams: {
2032
- bridge: this.launchParams,
2033
- query: this.queryParams
2034
- },
2029
+ launchParams: this.launchParams,
2035
2030
  customLaunchParams: this.readCustomUrlParams((key) => {
2036
2031
  const normalized = key.toLowerCase();
2037
2032
  return normalized.startsWith("vk_") || normalized === "sign";
@@ -2658,6 +2653,9 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
2658
2653
  overlay.style.flexDirection = "column";
2659
2654
  overlay.style.alignItems = "center";
2660
2655
  overlay.style.justifyContent = "center";
2656
+ overlay.style.gap = "20px";
2657
+ overlay.style.padding = "24px";
2658
+ overlay.style.boxSizing = "border-box";
2661
2659
  overlay.style.overflow = "hidden";
2662
2660
  overlay.style.backdropFilter = "blur(3px)";
2663
2661
  document.body.appendChild(overlay);
@@ -2731,10 +2729,23 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
2731
2729
  const hint = document.createElement("div");
2732
2730
  hint.innerText = "\u041D\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u0430\u043C\u0435\u0440\u0443 \u043D\u0430 QR-\u043A\u043E\u0434";
2733
2731
  hint.style.color = "white";
2734
- hint.style.marginTop = "30px";
2735
2732
  hint.style.fontSize = "17px";
2736
2733
  hint.style.opacity = "0.9";
2737
2734
  overlay.appendChild(hint);
2735
+ const bottomCloseBtn = document.createElement("button");
2736
+ bottomCloseBtn.innerText = "\u0417\u0430\u043A\u0440\u044B\u0442\u044C";
2737
+ bottomCloseBtn.style.minWidth = `${Math.min(scanSize, 220)}px`;
2738
+ bottomCloseBtn.style.height = "48px";
2739
+ bottomCloseBtn.style.padding = "0 20px";
2740
+ bottomCloseBtn.style.border = "1px solid rgba(255,255,255,0.24)";
2741
+ bottomCloseBtn.style.borderRadius = "14px";
2742
+ bottomCloseBtn.style.background = "rgba(255,255,255,0.12)";
2743
+ bottomCloseBtn.style.color = "white";
2744
+ bottomCloseBtn.style.fontSize = "16px";
2745
+ bottomCloseBtn.style.fontWeight = "600";
2746
+ bottomCloseBtn.style.cursor = "pointer";
2747
+ bottomCloseBtn.style.backdropFilter = "blur(8px)";
2748
+ overlay.appendChild(bottomCloseBtn);
2738
2749
  const canvas = document.createElement("canvas");
2739
2750
  const context = canvas.getContext("2d", { willReadFrequently: true });
2740
2751
  let stream = null;
@@ -2772,10 +2783,26 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
2772
2783
  removeFromBag();
2773
2784
  };
2774
2785
  closeBtn.onclick = () => closeScanner(null);
2786
+ bottomCloseBtn.onclick = () => closeScanner(null);
2775
2787
  try {
2776
2788
  const constraints = [
2777
- { video: { facingMode: { ideal: "environment" } }, audio: false },
2778
- { video: { facingMode: "environment" }, audio: false },
2789
+ {
2790
+ video: {
2791
+ facingMode: { ideal: "environment" },
2792
+ width: { ideal: 1920 },
2793
+ height: { ideal: 1080 },
2794
+ aspectRatio: { ideal: 1.7777777778 }
2795
+ },
2796
+ audio: false
2797
+ },
2798
+ {
2799
+ video: {
2800
+ facingMode: "environment",
2801
+ width: { ideal: 1280 },
2802
+ height: { ideal: 720 }
2803
+ },
2804
+ audio: false
2805
+ },
2779
2806
  { video: true, audio: false }
2780
2807
  ];
2781
2808
  let lastError = null;
@@ -2790,13 +2817,27 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
2790
2817
  if (!stream) {
2791
2818
  throw lastError instanceof Error ? lastError : new Error("Unable to access camera");
2792
2819
  }
2820
+ const [videoTrack] = stream.getVideoTracks();
2821
+ if (videoTrack) {
2822
+ try {
2823
+ const advancedConstraints = [
2824
+ { focusMode: "continuous" },
2825
+ { exposureMode: "continuous" },
2826
+ { whiteBalanceMode: "continuous" }
2827
+ ];
2828
+ await videoTrack.applyConstraints({
2829
+ advanced: advancedConstraints
2830
+ });
2831
+ } catch {
2832
+ }
2833
+ }
2793
2834
  video.srcObject = stream;
2794
2835
  await video.play();
2795
2836
  const scanFrame = (now) => {
2796
2837
  if (closed) {
2797
2838
  return;
2798
2839
  }
2799
- if (now - lastScanAt >= 100 && context && video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
2840
+ if (now - lastScanAt >= 80 && context && video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
2800
2841
  const width = video.videoWidth;
2801
2842
  const height = video.videoHeight;
2802
2843
  if (width > 0 && height > 0) {