@wowlabtech/mini-app-adapter 0.2.83 → 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 +1 -1
- package/dist/index.cjs +53 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +53 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
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
|
-
|
|
1197
|
-
|
|
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;
|
|
@@ -2655,6 +2653,9 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
2655
2653
|
overlay.style.flexDirection = "column";
|
|
2656
2654
|
overlay.style.alignItems = "center";
|
|
2657
2655
|
overlay.style.justifyContent = "center";
|
|
2656
|
+
overlay.style.gap = "20px";
|
|
2657
|
+
overlay.style.padding = "24px";
|
|
2658
|
+
overlay.style.boxSizing = "border-box";
|
|
2658
2659
|
overlay.style.overflow = "hidden";
|
|
2659
2660
|
overlay.style.backdropFilter = "blur(3px)";
|
|
2660
2661
|
document.body.appendChild(overlay);
|
|
@@ -2728,10 +2729,23 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
2728
2729
|
const hint = document.createElement("div");
|
|
2729
2730
|
hint.innerText = "\u041D\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u0430\u043C\u0435\u0440\u0443 \u043D\u0430 QR-\u043A\u043E\u0434";
|
|
2730
2731
|
hint.style.color = "white";
|
|
2731
|
-
hint.style.marginTop = "30px";
|
|
2732
2732
|
hint.style.fontSize = "17px";
|
|
2733
2733
|
hint.style.opacity = "0.9";
|
|
2734
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);
|
|
2735
2749
|
const canvas = document.createElement("canvas");
|
|
2736
2750
|
const context = canvas.getContext("2d", { willReadFrequently: true });
|
|
2737
2751
|
let stream = null;
|
|
@@ -2769,10 +2783,26 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
2769
2783
|
removeFromBag();
|
|
2770
2784
|
};
|
|
2771
2785
|
closeBtn.onclick = () => closeScanner(null);
|
|
2786
|
+
bottomCloseBtn.onclick = () => closeScanner(null);
|
|
2772
2787
|
try {
|
|
2773
2788
|
const constraints = [
|
|
2774
|
-
{
|
|
2775
|
-
|
|
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
|
+
},
|
|
2776
2806
|
{ video: true, audio: false }
|
|
2777
2807
|
];
|
|
2778
2808
|
let lastError = null;
|
|
@@ -2787,13 +2817,27 @@ var WebMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
2787
2817
|
if (!stream) {
|
|
2788
2818
|
throw lastError instanceof Error ? lastError : new Error("Unable to access camera");
|
|
2789
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
|
+
}
|
|
2790
2834
|
video.srcObject = stream;
|
|
2791
2835
|
await video.play();
|
|
2792
2836
|
const scanFrame = (now) => {
|
|
2793
2837
|
if (closed) {
|
|
2794
2838
|
return;
|
|
2795
2839
|
}
|
|
2796
|
-
if (now - lastScanAt >=
|
|
2840
|
+
if (now - lastScanAt >= 80 && context && video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
|
|
2797
2841
|
const width = video.videoWidth;
|
|
2798
2842
|
const height = video.videoHeight;
|
|
2799
2843
|
if (width > 0 && height > 0) {
|