@wowlabtech/mini-app-adapter 0.2.8 → 0.2.81
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.cjs +62 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -16
- package/dist/index.d.ts +9 -16
- package/dist/index.js +62 -86
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -664,10 +664,9 @@ var BaseMiniAppAdapter = class {
|
|
|
664
664
|
return void 0;
|
|
665
665
|
}
|
|
666
666
|
getLaunchParams() {
|
|
667
|
-
return
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
return { customLaunchParams: {} };
|
|
667
|
+
return {
|
|
668
|
+
customLaunchParams: this.readCustomUrlParams()
|
|
669
|
+
};
|
|
671
670
|
}
|
|
672
671
|
decodeStartParam(_param) {
|
|
673
672
|
return void 0;
|
|
@@ -808,6 +807,34 @@ var BaseMiniAppAdapter = class {
|
|
|
808
807
|
registerDisposable(disposable) {
|
|
809
808
|
return this.disposables.add(disposable);
|
|
810
809
|
}
|
|
810
|
+
readCustomUrlParams(isServiceParam) {
|
|
811
|
+
if (typeof window === "undefined") {
|
|
812
|
+
return {};
|
|
813
|
+
}
|
|
814
|
+
const result = {};
|
|
815
|
+
const append = (source) => {
|
|
816
|
+
const keys = /* @__PURE__ */ new Set();
|
|
817
|
+
for (const [key] of source.entries()) {
|
|
818
|
+
keys.add(key);
|
|
819
|
+
}
|
|
820
|
+
for (const key of keys) {
|
|
821
|
+
if (isServiceParam?.(key)) {
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
const values = source.getAll(key);
|
|
825
|
+
if (!values.length) {
|
|
826
|
+
continue;
|
|
827
|
+
}
|
|
828
|
+
result[key] = values.length === 1 ? values[0] : values;
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
append(new URLSearchParams(window.location.search));
|
|
832
|
+
const hash = window.location.hash.startsWith("#") ? window.location.hash.slice(1) : window.location.hash;
|
|
833
|
+
if (hash && hash.includes("=")) {
|
|
834
|
+
append(new URLSearchParams(hash));
|
|
835
|
+
}
|
|
836
|
+
return result;
|
|
837
|
+
}
|
|
811
838
|
applyScrollGuards() {
|
|
812
839
|
if (typeof document === "undefined") {
|
|
813
840
|
return void 0;
|
|
@@ -892,7 +919,10 @@ var MaxMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
892
919
|
return this.initData;
|
|
893
920
|
}
|
|
894
921
|
getLaunchParams() {
|
|
895
|
-
return
|
|
922
|
+
return {
|
|
923
|
+
launchParams: this.initDataUnsafe,
|
|
924
|
+
customLaunchParams: this.readCustomUrlParams()
|
|
925
|
+
};
|
|
896
926
|
}
|
|
897
927
|
onBackButton(callback) {
|
|
898
928
|
const bridge2 = getMaxBridge();
|
|
@@ -1446,13 +1476,6 @@ var TelegramMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
1446
1476
|
}
|
|
1447
1477
|
}
|
|
1448
1478
|
getLaunchParams() {
|
|
1449
|
-
try {
|
|
1450
|
-
return (0, import_sdk_react.retrieveLaunchParams)();
|
|
1451
|
-
} catch {
|
|
1452
|
-
return void 0;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
getCustomLaunchParams() {
|
|
1456
1479
|
const customFromUrl = this.readCustomUrlParams((key) => key.toLowerCase().startsWith("tgwebapp"));
|
|
1457
1480
|
let customFromStartParam = {};
|
|
1458
1481
|
try {
|
|
@@ -1461,14 +1484,21 @@ var TelegramMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
1461
1484
|
if (typeof startParam === "string" && startParam) {
|
|
1462
1485
|
customFromStartParam = this.normalizeDecodedStartParam(startParam);
|
|
1463
1486
|
}
|
|
1487
|
+
return {
|
|
1488
|
+
launchParams,
|
|
1489
|
+
customLaunchParams: {
|
|
1490
|
+
...customFromUrl,
|
|
1491
|
+
...customFromStartParam
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1464
1494
|
} catch {
|
|
1495
|
+
return {
|
|
1496
|
+
customLaunchParams: {
|
|
1497
|
+
...customFromUrl,
|
|
1498
|
+
...customFromStartParam
|
|
1499
|
+
}
|
|
1500
|
+
};
|
|
1465
1501
|
}
|
|
1466
|
-
return {
|
|
1467
|
-
customLaunchParams: {
|
|
1468
|
-
...customFromUrl,
|
|
1469
|
-
...customFromStartParam
|
|
1470
|
-
}
|
|
1471
|
-
};
|
|
1472
1502
|
}
|
|
1473
1503
|
decodeStartParam(param) {
|
|
1474
1504
|
try {
|
|
@@ -1835,34 +1865,6 @@ var TelegramMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
1835
1865
|
}
|
|
1836
1866
|
return {};
|
|
1837
1867
|
}
|
|
1838
|
-
readCustomUrlParams(isServiceParam) {
|
|
1839
|
-
if (typeof window === "undefined") {
|
|
1840
|
-
return {};
|
|
1841
|
-
}
|
|
1842
|
-
const result = {};
|
|
1843
|
-
const append = (source) => {
|
|
1844
|
-
const keys = /* @__PURE__ */ new Set();
|
|
1845
|
-
for (const [key] of source.entries()) {
|
|
1846
|
-
keys.add(key);
|
|
1847
|
-
}
|
|
1848
|
-
for (const key of keys) {
|
|
1849
|
-
if (isServiceParam(key)) {
|
|
1850
|
-
continue;
|
|
1851
|
-
}
|
|
1852
|
-
const values = source.getAll(key);
|
|
1853
|
-
if (!values.length) {
|
|
1854
|
-
continue;
|
|
1855
|
-
}
|
|
1856
|
-
result[key] = values.length === 1 ? values[0] : values;
|
|
1857
|
-
}
|
|
1858
|
-
};
|
|
1859
|
-
append(new URLSearchParams(window.location.search));
|
|
1860
|
-
const hash = window.location.hash.startsWith("#") ? window.location.hash.slice(1) : window.location.hash;
|
|
1861
|
-
if (hash && hash.includes("=")) {
|
|
1862
|
-
append(new URLSearchParams(hash));
|
|
1863
|
-
}
|
|
1864
|
-
return result;
|
|
1865
|
-
}
|
|
1866
1868
|
parseQueryString(value) {
|
|
1867
1869
|
const normalized = value.startsWith("?") ? value.slice(1) : value;
|
|
1868
1870
|
const params = new URLSearchParams(normalized);
|
|
@@ -2043,16 +2045,22 @@ var VKMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
2043
2045
|
}
|
|
2044
2046
|
getLaunchParams() {
|
|
2045
2047
|
if (!this.launchParams) {
|
|
2046
|
-
return
|
|
2048
|
+
return {
|
|
2049
|
+
customLaunchParams: this.readCustomUrlParams((key) => {
|
|
2050
|
+
const normalized = key.toLowerCase();
|
|
2051
|
+
return normalized.startsWith("vk_") || normalized === "sign";
|
|
2052
|
+
})
|
|
2053
|
+
};
|
|
2047
2054
|
}
|
|
2048
2055
|
return {
|
|
2049
|
-
launchParams:
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
+
launchParams: {
|
|
2057
|
+
bridge: this.launchParams,
|
|
2058
|
+
query: this.queryParams
|
|
2059
|
+
},
|
|
2060
|
+
customLaunchParams: this.readCustomUrlParams((key) => {
|
|
2061
|
+
const normalized = key.toLowerCase();
|
|
2062
|
+
return normalized.startsWith("vk_") || normalized === "sign";
|
|
2063
|
+
})
|
|
2056
2064
|
};
|
|
2057
2065
|
}
|
|
2058
2066
|
async openExternalLink(url) {
|
|
@@ -2065,38 +2073,6 @@ var VKMiniAppAdapter = class extends BaseMiniAppAdapter {
|
|
|
2065
2073
|
a.click();
|
|
2066
2074
|
a.remove();
|
|
2067
2075
|
}
|
|
2068
|
-
readCustomUrlParams() {
|
|
2069
|
-
if (typeof window === "undefined") {
|
|
2070
|
-
return {};
|
|
2071
|
-
}
|
|
2072
|
-
const result = {};
|
|
2073
|
-
const isServiceParam = (key) => {
|
|
2074
|
-
const normalized = key.toLowerCase();
|
|
2075
|
-
return normalized.startsWith("vk_") || normalized === "sign";
|
|
2076
|
-
};
|
|
2077
|
-
const append = (source) => {
|
|
2078
|
-
const keys = /* @__PURE__ */ new Set();
|
|
2079
|
-
for (const [key] of source.entries()) {
|
|
2080
|
-
keys.add(key);
|
|
2081
|
-
}
|
|
2082
|
-
for (const key of keys) {
|
|
2083
|
-
if (isServiceParam(key)) {
|
|
2084
|
-
continue;
|
|
2085
|
-
}
|
|
2086
|
-
const values = source.getAll(key);
|
|
2087
|
-
if (!values.length) {
|
|
2088
|
-
continue;
|
|
2089
|
-
}
|
|
2090
|
-
result[key] = values.length === 1 ? values[0] : values;
|
|
2091
|
-
}
|
|
2092
|
-
};
|
|
2093
|
-
append(new URLSearchParams(window.location.search));
|
|
2094
|
-
const hash = window.location.hash.startsWith("#") ? window.location.hash.slice(1) : window.location.hash;
|
|
2095
|
-
if (hash && hash.includes("=")) {
|
|
2096
|
-
append(new URLSearchParams(hash));
|
|
2097
|
-
}
|
|
2098
|
-
return result;
|
|
2099
|
-
}
|
|
2100
2076
|
async supports(capability) {
|
|
2101
2077
|
switch (capability) {
|
|
2102
2078
|
case "haptics": {
|