@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/README.md CHANGED
@@ -52,7 +52,7 @@ bootstrap();
52
52
  import { createAdapter } from '@wowlabtech/mini-app-adapter';
53
53
 
54
54
  const adapter = createAdapter('telegram');
55
- await adapter.init({ eruda: true });
55
+ await adapter.init({ eruda: true }); // сработает, только если host заранее положил eruda в window.eruda
56
56
 
57
57
  adapter.setColors({ header: '#0a0a0a', background: '#ffffff' });
58
58
  adapter.onBackButton(() => adapter.closeApp());
package/dist/index.cjs CHANGED
@@ -1219,11 +1219,9 @@ var TelegramMiniAppAdapter = class extends BaseMiniAppAdapter {
1219
1219
  if (!import_sdk_react.miniApp.isSupported()) {
1220
1220
  console.warn("[tvm-app-adapter] miniApp feature is not supported; falling back to limited mode.");
1221
1221
  }
1222
- if (eruda) {
1223
- void import("eruda").then(({ default: erudaInstance }) => {
1224
- erudaInstance.init();
1225
- erudaInstance.position({ x: window.innerWidth - 150, y: window.innerHeight - 150 });
1226
- });
1222
+ if (eruda && typeof window !== "undefined" && window.eruda) {
1223
+ window.eruda.init();
1224
+ window.eruda.position({ x: window.innerWidth - 150, y: window.innerHeight - 150 });
1227
1225
  }
1228
1226
  if (mockForMacOS) {
1229
1227
  let firstThemeSent = false;
@@ -2053,10 +2051,7 @@ var VKMiniAppAdapter = class extends BaseMiniAppAdapter {
2053
2051
  };
2054
2052
  }
2055
2053
  return {
2056
- launchParams: {
2057
- bridge: this.launchParams,
2058
- query: this.queryParams
2059
- },
2054
+ launchParams: this.launchParams,
2060
2055
  customLaunchParams: this.readCustomUrlParams((key) => {
2061
2056
  const normalized = key.toLowerCase();
2062
2057
  return normalized.startsWith("vk_") || normalized === "sign";
@@ -2683,6 +2678,9 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
2683
2678
  overlay.style.flexDirection = "column";
2684
2679
  overlay.style.alignItems = "center";
2685
2680
  overlay.style.justifyContent = "center";
2681
+ overlay.style.gap = "20px";
2682
+ overlay.style.padding = "24px";
2683
+ overlay.style.boxSizing = "border-box";
2686
2684
  overlay.style.overflow = "hidden";
2687
2685
  overlay.style.backdropFilter = "blur(3px)";
2688
2686
  document.body.appendChild(overlay);
@@ -2756,10 +2754,23 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
2756
2754
  const hint = document.createElement("div");
2757
2755
  hint.innerText = "\u041D\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u0430\u043C\u0435\u0440\u0443 \u043D\u0430 QR-\u043A\u043E\u0434";
2758
2756
  hint.style.color = "white";
2759
- hint.style.marginTop = "30px";
2760
2757
  hint.style.fontSize = "17px";
2761
2758
  hint.style.opacity = "0.9";
2762
2759
  overlay.appendChild(hint);
2760
+ const bottomCloseBtn = document.createElement("button");
2761
+ bottomCloseBtn.innerText = "\u0417\u0430\u043A\u0440\u044B\u0442\u044C";
2762
+ bottomCloseBtn.style.minWidth = `${Math.min(scanSize, 220)}px`;
2763
+ bottomCloseBtn.style.height = "48px";
2764
+ bottomCloseBtn.style.padding = "0 20px";
2765
+ bottomCloseBtn.style.border = "1px solid rgba(255,255,255,0.24)";
2766
+ bottomCloseBtn.style.borderRadius = "14px";
2767
+ bottomCloseBtn.style.background = "rgba(255,255,255,0.12)";
2768
+ bottomCloseBtn.style.color = "white";
2769
+ bottomCloseBtn.style.fontSize = "16px";
2770
+ bottomCloseBtn.style.fontWeight = "600";
2771
+ bottomCloseBtn.style.cursor = "pointer";
2772
+ bottomCloseBtn.style.backdropFilter = "blur(8px)";
2773
+ overlay.appendChild(bottomCloseBtn);
2763
2774
  const canvas = document.createElement("canvas");
2764
2775
  const context = canvas.getContext("2d", { willReadFrequently: true });
2765
2776
  let stream = null;
@@ -2797,10 +2808,26 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
2797
2808
  removeFromBag();
2798
2809
  };
2799
2810
  closeBtn.onclick = () => closeScanner(null);
2811
+ bottomCloseBtn.onclick = () => closeScanner(null);
2800
2812
  try {
2801
2813
  const constraints = [
2802
- { video: { facingMode: { ideal: "environment" } }, audio: false },
2803
- { video: { facingMode: "environment" }, audio: false },
2814
+ {
2815
+ video: {
2816
+ facingMode: { ideal: "environment" },
2817
+ width: { ideal: 1920 },
2818
+ height: { ideal: 1080 },
2819
+ aspectRatio: { ideal: 1.7777777778 }
2820
+ },
2821
+ audio: false
2822
+ },
2823
+ {
2824
+ video: {
2825
+ facingMode: "environment",
2826
+ width: { ideal: 1280 },
2827
+ height: { ideal: 720 }
2828
+ },
2829
+ audio: false
2830
+ },
2804
2831
  { video: true, audio: false }
2805
2832
  ];
2806
2833
  let lastError = null;
@@ -2815,13 +2842,27 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
2815
2842
  if (!stream) {
2816
2843
  throw lastError instanceof Error ? lastError : new Error("Unable to access camera");
2817
2844
  }
2845
+ const [videoTrack] = stream.getVideoTracks();
2846
+ if (videoTrack) {
2847
+ try {
2848
+ const advancedConstraints = [
2849
+ { focusMode: "continuous" },
2850
+ { exposureMode: "continuous" },
2851
+ { whiteBalanceMode: "continuous" }
2852
+ ];
2853
+ await videoTrack.applyConstraints({
2854
+ advanced: advancedConstraints
2855
+ });
2856
+ } catch {
2857
+ }
2858
+ }
2818
2859
  video.srcObject = stream;
2819
2860
  await video.play();
2820
2861
  const scanFrame = (now) => {
2821
2862
  if (closed) {
2822
2863
  return;
2823
2864
  }
2824
- if (now - lastScanAt >= 100 && context && video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
2865
+ if (now - lastScanAt >= 80 && context && video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
2825
2866
  const width = video.videoWidth;
2826
2867
  const height = video.videoHeight;
2827
2868
  if (width > 0 && height > 0) {