@tma.js/sdk 3.0.5 → 3.0.6
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +2 -2
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +110 -105
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -134,10 +134,10 @@ function Pt(s) {
|
|
|
134
134
|
var V = me, I = be, as = /* @__PURE__ */ lt(2, function(s, e) {
|
|
135
135
|
return rt(s) ? s : e(s.right);
|
|
136
136
|
}), Ot = function(s, e) {
|
|
137
|
-
return c(s,
|
|
137
|
+
return c(s, P(e));
|
|
138
138
|
}, ge = function(s, e) {
|
|
139
139
|
return c(s, ps(e));
|
|
140
|
-
}, Dt = "Either",
|
|
140
|
+
}, Dt = "Either", P = function(s) {
|
|
141
141
|
return function(e) {
|
|
142
142
|
return rt(e) ? e : I(s(e.right));
|
|
143
143
|
};
|
|
@@ -172,11 +172,11 @@ var V = me, I = be, as = /* @__PURE__ */ lt(2, function(s, e) {
|
|
|
172
172
|
return V(e(r));
|
|
173
173
|
}
|
|
174
174
|
}, ms = /* @__PURE__ */ cs(Rt), bs = /* @__PURE__ */ Pt(ds), ie = bs;
|
|
175
|
-
function
|
|
175
|
+
function O(s) {
|
|
176
176
|
return typeof s == "function" ? s() : s;
|
|
177
177
|
}
|
|
178
178
|
function z(s, e) {
|
|
179
|
-
return w(() => ot(s,
|
|
179
|
+
return w(() => ot(s, O(e)));
|
|
180
180
|
}
|
|
181
181
|
var it = ss, ht = rs, gs = function(s, e) {
|
|
182
182
|
return c(s, Cs(e));
|
|
@@ -364,7 +364,7 @@ var Ut = function(s, e) {
|
|
|
364
364
|
if (l[0] & 5) throw l[1];
|
|
365
365
|
return { value: l[0] ? l[1] : void 0, done: !0 };
|
|
366
366
|
}
|
|
367
|
-
},
|
|
367
|
+
}, L = /* @__PURE__ */ xs(Se), q = /* @__PURE__ */ Is(Se), ve = Gt, Gs = /* @__PURE__ */ Ts(Ht), js = function(s, e) {
|
|
368
368
|
return function() {
|
|
369
369
|
return Ds(void 0, void 0, void 0, function() {
|
|
370
370
|
var r;
|
|
@@ -460,7 +460,7 @@ class rr extends K(
|
|
|
460
460
|
) {
|
|
461
461
|
}
|
|
462
462
|
function A(s, e) {
|
|
463
|
-
const r = w(() =>
|
|
463
|
+
const r = w(() => O(e.version) || "100"), n = w(() => O(e.isTma)), { requires: i, returns: o } = e, u = i ? typeof i == "object" ? i : { every: [i] } : void 0, a = (f) => {
|
|
464
464
|
if (!e.supports)
|
|
465
465
|
return !0;
|
|
466
466
|
const b = e.supports[f];
|
|
@@ -470,9 +470,9 @@ function A(s, e) {
|
|
|
470
470
|
return;
|
|
471
471
|
const [f, b] = "every" in u ? ["every", u.every] : ["some", u.some];
|
|
472
472
|
for (let d = 0; d < b.length; d++) {
|
|
473
|
-
const x = b[d],
|
|
474
|
-
if (
|
|
475
|
-
return
|
|
473
|
+
const x = b[d], $ = typeof x == "function" ? x() : ot(x, r()) ? void 0 : `it is unsupported in Mini Apps version ${r()}`;
|
|
474
|
+
if ($ && (f === "every" || d === b.length - 1))
|
|
475
|
+
return $;
|
|
476
476
|
}
|
|
477
477
|
}, l = (...f) => {
|
|
478
478
|
for (const b in e.supports)
|
|
@@ -482,11 +482,11 @@ function A(s, e) {
|
|
|
482
482
|
() => n() && _() && m() && g()
|
|
483
483
|
), y = (f) => {
|
|
484
484
|
const b = new Xs(f);
|
|
485
|
-
return ["task", "promise"].includes(e.returns) ?
|
|
485
|
+
return ["task", "promise"].includes(e.returns) ? L(b) : V(b);
|
|
486
486
|
}, S = (...f) => o === "plain" ? _s(() => s(...f), (b) => b) : o === "promise" ? js(() => s(...f), (b) => b) : s(...f);
|
|
487
487
|
return Object.assign(
|
|
488
488
|
(...f) => {
|
|
489
|
-
var
|
|
489
|
+
var $;
|
|
490
490
|
const b = "Unable to call function:";
|
|
491
491
|
if (!n())
|
|
492
492
|
return y(`${b} it can't be called outside Mini Apps`);
|
|
@@ -499,7 +499,7 @@ function A(s, e) {
|
|
|
499
499
|
if (x)
|
|
500
500
|
return y(`${b} ${x}`);
|
|
501
501
|
if (!g()) {
|
|
502
|
-
const T = (
|
|
502
|
+
const T = ($ = e.isMounting) != null && $.call(e) ? "mounting. Wait for the mount completion" : "unmounted. Use the mount() method";
|
|
503
503
|
return y(`${b} the component is ${T}`);
|
|
504
504
|
}
|
|
505
505
|
return S(...f);
|
|
@@ -602,8 +602,8 @@ class dt {
|
|
|
602
602
|
this.mount = () => {
|
|
603
603
|
if (this.isMounted())
|
|
604
604
|
return I(void 0);
|
|
605
|
-
const u =
|
|
606
|
-
return c(a,
|
|
605
|
+
const u = O(o) ? r() : void 0, a = u ? I(u) : typeof n == "function" ? n() : I(n);
|
|
606
|
+
return c(a, P((p) => {
|
|
607
607
|
Ct(() => {
|
|
608
608
|
this._isMounted.set(!0), e == null || e(p);
|
|
609
609
|
});
|
|
@@ -729,7 +729,7 @@ class kt {
|
|
|
729
729
|
const b = { ...this.state(), ...Mt(f) };
|
|
730
730
|
return _.hasDiff(b) ? c(
|
|
731
731
|
a(l, p(b)),
|
|
732
|
-
|
|
732
|
+
P(() => {
|
|
733
733
|
_.setState(b);
|
|
734
734
|
})
|
|
735
735
|
) : I(void 0);
|
|
@@ -867,7 +867,7 @@ function ar() {
|
|
|
867
867
|
return !!s && s.type === "reload";
|
|
868
868
|
}
|
|
869
869
|
function ft(s) {
|
|
870
|
-
return (e) => ({ ...e, ...
|
|
870
|
+
return (e) => ({ ...e, ...O(s) });
|
|
871
871
|
}
|
|
872
872
|
function et(s) {
|
|
873
873
|
return ft({
|
|
@@ -879,14 +879,14 @@ function et(s) {
|
|
|
879
879
|
function _t(s, e) {
|
|
880
880
|
return j(s, e);
|
|
881
881
|
}
|
|
882
|
-
const ke = /* @__PURE__ */ _t(Pe), mt = (...s) => ke()(...s), ur = (...s) => ce(mt(...s)),
|
|
882
|
+
const ke = /* @__PURE__ */ _t(Pe), mt = (...s) => ke()(...s), ur = (...s) => ce(mt(...s)), R = ft({
|
|
883
883
|
postEvent: mt
|
|
884
884
|
}), Vt = /* @__PURE__ */ _t("0.0"), v = ft({ version: Vt });
|
|
885
885
|
function Nt(s, e) {
|
|
886
886
|
return {
|
|
887
887
|
...c(
|
|
888
888
|
F(),
|
|
889
|
-
|
|
889
|
+
R,
|
|
890
890
|
v,
|
|
891
891
|
et(s)
|
|
892
892
|
),
|
|
@@ -924,7 +924,7 @@ class Jt {
|
|
|
924
924
|
this.mount = (u) => {
|
|
925
925
|
if (this._isMounted())
|
|
926
926
|
return q(void 0);
|
|
927
|
-
const a =
|
|
927
|
+
const a = O(o) ? n() : void 0;
|
|
928
928
|
return c(
|
|
929
929
|
a ? q(a) : e(u),
|
|
930
930
|
B((p) => {
|
|
@@ -1087,14 +1087,14 @@ class cr {
|
|
|
1087
1087
|
params: { reason: ((f || {}).reason || "").trim() }
|
|
1088
1088
|
}),
|
|
1089
1089
|
B((b) => (m.setState({ token: b.token }), b))
|
|
1090
|
-
) :
|
|
1090
|
+
) : L(ue)), this.openSettingsFp = C(() => n("web_app_biometry_open_settings")), this.requestAccessFp = S((f) => c(
|
|
1091
1091
|
r("web_app_biometry_request_access", "biometry_info_received", {
|
|
1092
1092
|
...f,
|
|
1093
1093
|
params: { reason: ((f || {}).reason || "").trim() }
|
|
1094
1094
|
}),
|
|
1095
1095
|
Z((b) => {
|
|
1096
1096
|
const d = It(b);
|
|
1097
|
-
return d.available ? (m.setState(d), q(d.accessRequested)) :
|
|
1097
|
+
return d.available ? (m.setState(d), q(d.accessRequested)) : L(ue);
|
|
1098
1098
|
})
|
|
1099
1099
|
)), this.updateTokenFp = S((f = {}) => {
|
|
1100
1100
|
var b;
|
|
@@ -1111,14 +1111,14 @@ class cr {
|
|
|
1111
1111
|
const Ee = (s, e, r) => Oe(s, e, {
|
|
1112
1112
|
postEvent: mt,
|
|
1113
1113
|
...r
|
|
1114
|
-
}), kn = (...s) => Ke.fn(() => Ee(...s)()),
|
|
1114
|
+
}), kn = (...s) => Ke.fn(() => Ee(...s)()), G = ft({
|
|
1115
1115
|
request: Ee
|
|
1116
1116
|
}), En = new cr({
|
|
1117
1117
|
...c(
|
|
1118
1118
|
F(),
|
|
1119
|
-
|
|
1119
|
+
R,
|
|
1120
1120
|
v,
|
|
1121
|
-
|
|
1121
|
+
G,
|
|
1122
1122
|
et("biometry")
|
|
1123
1123
|
),
|
|
1124
1124
|
offInfoReceived(s) {
|
|
@@ -1196,7 +1196,7 @@ class lr {
|
|
|
1196
1196
|
const An = new lr(c(
|
|
1197
1197
|
F(),
|
|
1198
1198
|
et("closingBehavior"),
|
|
1199
|
-
|
|
1199
|
+
R
|
|
1200
1200
|
));
|
|
1201
1201
|
class pr {
|
|
1202
1202
|
constructor({ version: e, isTma: r, invokeCustomMethod: n }) {
|
|
@@ -1328,7 +1328,7 @@ function dr({ request: s, ...e }) {
|
|
|
1328
1328
|
const fr = dr(c(
|
|
1329
1329
|
F(),
|
|
1330
1330
|
v,
|
|
1331
|
-
|
|
1331
|
+
G
|
|
1332
1332
|
)), xn = h(fr);
|
|
1333
1333
|
function _r({ request: s, ...e }) {
|
|
1334
1334
|
return A((r, n) => c(
|
|
@@ -1339,7 +1339,7 @@ function _r({ request: s, ...e }) {
|
|
|
1339
1339
|
},
|
|
1340
1340
|
...n
|
|
1341
1341
|
}),
|
|
1342
|
-
at((i) => i && "error" in i ?
|
|
1342
|
+
at((i) => i && "error" in i ? L(new tr(i.error)) : q(void 0))
|
|
1343
1343
|
), {
|
|
1344
1344
|
...e,
|
|
1345
1345
|
requires: "web_app_set_emoji_status",
|
|
@@ -1348,7 +1348,7 @@ function _r({ request: s, ...e }) {
|
|
|
1348
1348
|
}
|
|
1349
1349
|
const mr = _r(c(
|
|
1350
1350
|
F(),
|
|
1351
|
-
|
|
1351
|
+
G,
|
|
1352
1352
|
v
|
|
1353
1353
|
)), Bn = h(mr);
|
|
1354
1354
|
class br {
|
|
@@ -1404,7 +1404,7 @@ class br {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
const qn = new br(c(
|
|
1406
1406
|
F(),
|
|
1407
|
-
|
|
1407
|
+
R,
|
|
1408
1408
|
v
|
|
1409
1409
|
));
|
|
1410
1410
|
function gr({ postEvent: s, ...e }) {
|
|
@@ -1413,7 +1413,7 @@ function gr({ postEvent: s, ...e }) {
|
|
|
1413
1413
|
const wr = gr(c(
|
|
1414
1414
|
F(),
|
|
1415
1415
|
v,
|
|
1416
|
-
|
|
1416
|
+
R
|
|
1417
1417
|
)), Mn = h(wr);
|
|
1418
1418
|
function Fr({ request: s, ...e }) {
|
|
1419
1419
|
return A((r) => c(
|
|
@@ -1424,7 +1424,7 @@ function Fr({ request: s, ...e }) {
|
|
|
1424
1424
|
const Cr = Fr(c(
|
|
1425
1425
|
F(),
|
|
1426
1426
|
v,
|
|
1427
|
-
|
|
1427
|
+
G
|
|
1428
1428
|
)), Vn = h(Cr);
|
|
1429
1429
|
class Sr {
|
|
1430
1430
|
constructor({ retrieveInitData: e }) {
|
|
@@ -1500,7 +1500,7 @@ class Sr {
|
|
|
1500
1500
|
t(this, "restore");
|
|
1501
1501
|
this.restoreFp = () => c(
|
|
1502
1502
|
e(),
|
|
1503
|
-
|
|
1503
|
+
P(Fe(() => {
|
|
1504
1504
|
}, ({ raw: r, obj: n }) => {
|
|
1505
1505
|
this._state.set(n), this._raw.set(r);
|
|
1506
1506
|
}))
|
|
@@ -1519,10 +1519,10 @@ const Tn = new Sr({
|
|
|
1519
1519
|
ms,
|
|
1520
1520
|
ie("obj", () => c(
|
|
1521
1521
|
St(),
|
|
1522
|
-
|
|
1522
|
+
P(({ tgWebAppData: s }) => s ? ht(s) : it)
|
|
1523
1523
|
)),
|
|
1524
1524
|
ie("raw", Ue),
|
|
1525
|
-
|
|
1525
|
+
P(({ obj: s, raw: e }) => c(
|
|
1526
1526
|
As,
|
|
1527
1527
|
ae("obj", () => s),
|
|
1528
1528
|
ae("raw", () => e)
|
|
@@ -1575,7 +1575,7 @@ class vr {
|
|
|
1575
1575
|
o.set(!1);
|
|
1576
1576
|
};
|
|
1577
1577
|
this.isSupported = z("web_app_open_invoice", e), this.isOpened = w(o), this.openSlugFp = i((a, p) => c(
|
|
1578
|
-
this.isOpened() ?
|
|
1578
|
+
this.isOpened() ? L(new zt("Invoice is already opened")) : q(void 0),
|
|
1579
1579
|
Z(() => (o.set(!0), r("web_app_open_invoice", "invoice_closed", {
|
|
1580
1580
|
...p,
|
|
1581
1581
|
params: { slug: a },
|
|
@@ -1585,15 +1585,15 @@ class vr {
|
|
|
1585
1585
|
)), this.openUrlFp = i((a, p) => {
|
|
1586
1586
|
const { hostname: l, pathname: m } = new URL(a, window.location.href);
|
|
1587
1587
|
if (l !== "t.me")
|
|
1588
|
-
return
|
|
1588
|
+
return L(new Q(`Link has unexpected hostname: ${l}`));
|
|
1589
1589
|
const _ = m.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
|
|
1590
|
-
return _ ? this.openSlugFp(_[2], p) :
|
|
1590
|
+
return _ ? this.openSlugFp(_[2], p) : L(new Q(
|
|
1591
1591
|
'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'
|
|
1592
1592
|
));
|
|
1593
1593
|
}), this.openUrl = h(this.openUrlFp), this.openSlug = h(this.openSlugFp);
|
|
1594
1594
|
}
|
|
1595
1595
|
}
|
|
1596
|
-
const $n = new vr(c(F(),
|
|
1596
|
+
const $n = new vr(c(F(), G, v));
|
|
1597
1597
|
function yr({ postEvent: s, ...e }) {
|
|
1598
1598
|
return A((r, n = {}) => {
|
|
1599
1599
|
if (typeof r == "string")
|
|
@@ -1611,17 +1611,17 @@ function yr({ postEvent: s, ...e }) {
|
|
|
1611
1611
|
}
|
|
1612
1612
|
const kr = yr(c(
|
|
1613
1613
|
F(),
|
|
1614
|
-
|
|
1614
|
+
R
|
|
1615
1615
|
)), Ln = h(kr);
|
|
1616
1616
|
function Er({ postEvent: s, version: e, ...r }) {
|
|
1617
1617
|
return A((n) => {
|
|
1618
1618
|
const i = n.toString();
|
|
1619
|
-
return i.match(/^https:\/\/t.me\/.+/) ? ot("web_app_open_tg_link",
|
|
1619
|
+
return i.match(/^https:\/\/t.me\/.+/) ? ot("web_app_open_tg_link", O(e)) ? (n = new URL(n), s("web_app_open_tg_link", { path_full: n.pathname + n.search })) : (window.location.href = i, I(void 0)) : V(new Q(`"${i}" is invalid URL`));
|
|
1620
1620
|
}, { ...r, returns: "either" });
|
|
1621
1621
|
}
|
|
1622
1622
|
const Ie = Er(c(
|
|
1623
1623
|
F(),
|
|
1624
|
-
|
|
1624
|
+
R,
|
|
1625
1625
|
v
|
|
1626
1626
|
)), Rn = h(Ie);
|
|
1627
1627
|
function Ar({ openTelegramLink: s, ...e }) {
|
|
@@ -1751,9 +1751,9 @@ class Br {
|
|
|
1751
1751
|
}
|
|
1752
1752
|
const On = new Br(c(
|
|
1753
1753
|
F(),
|
|
1754
|
-
|
|
1754
|
+
R,
|
|
1755
1755
|
v,
|
|
1756
|
-
|
|
1756
|
+
G,
|
|
1757
1757
|
et("locationManager")
|
|
1758
1758
|
));
|
|
1759
1759
|
class qr {
|
|
@@ -1967,7 +1967,7 @@ class qr {
|
|
|
1967
1967
|
})
|
|
1968
1968
|
}), i = (o, u) => {
|
|
1969
1969
|
const a = n.stateGetter(o);
|
|
1970
|
-
return w(() => a() ||
|
|
1970
|
+
return w(() => a() || O(u));
|
|
1971
1971
|
};
|
|
1972
1972
|
this.bgColor = i("bgColor", e.bgColor), this.textColor = i("textColor", e.textColor), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
|
|
1973
1973
|
[this.disableShineEffect, this.disableShineEffectFp],
|
|
@@ -1998,7 +1998,7 @@ function Xt(s) {
|
|
|
1998
1998
|
function Mr(s) {
|
|
1999
1999
|
return c(
|
|
2000
2000
|
Qe(s),
|
|
2001
|
-
|
|
2001
|
+
P((e) => Math.sqrt(
|
|
2002
2002
|
[0.299, 0.587, 0.114].reduce((r, n, i) => {
|
|
2003
2003
|
const o = parseInt(e.slice(1 + i * 2, 1 + (i + 1) * 2), 16);
|
|
2004
2004
|
return r + o * o * n;
|
|
@@ -2122,7 +2122,7 @@ class Vr {
|
|
|
2122
2122
|
}), p = (C) => {
|
|
2123
2123
|
a.setState(C.theme_params);
|
|
2124
2124
|
}, l = new dt({
|
|
2125
|
-
initialState: () => I(
|
|
2125
|
+
initialState: () => I(O(e)),
|
|
2126
2126
|
isPageReload: u,
|
|
2127
2127
|
onMounted(C) {
|
|
2128
2128
|
a.setState(C), r(p);
|
|
@@ -2359,11 +2359,11 @@ class Tr {
|
|
|
2359
2359
|
[this.headerColor, "web_app_set_header_color"],
|
|
2360
2360
|
[this.bgColor, "web_app_set_background_color"],
|
|
2361
2361
|
[this.bottomBarColor, "web_app_set_bottom_bar_color"]
|
|
2362
|
-
].forEach(([x,
|
|
2362
|
+
].forEach(([x, $]) => {
|
|
2363
2363
|
const T = x();
|
|
2364
|
-
if (!Et(T) && (
|
|
2365
|
-
const
|
|
2366
|
-
|
|
2364
|
+
if (console.log(T, $), !Et(T) && ($ !== "web_app_set_header_color" || !["bg_color", "secondary_bg_color"].includes(T))) {
|
|
2365
|
+
const D = d[T];
|
|
2366
|
+
D && i($, { color: D });
|
|
2367
2367
|
}
|
|
2368
2368
|
});
|
|
2369
2369
|
}, _ = new dt({
|
|
@@ -2399,41 +2399,46 @@ class Tr {
|
|
|
2399
2399
|
onChange: e.set
|
|
2400
2400
|
});
|
|
2401
2401
|
this.state = g.state;
|
|
2402
|
-
const C = (d) => Et(d) ? d :
|
|
2402
|
+
const C = (d) => Et(d) ? d : O(u)[d], y = (d) => w(() => C(d()));
|
|
2403
2403
|
this.isActive = g.getter("isActive"), this.isSupported = w(() => [
|
|
2404
2404
|
"web_app_set_header_color",
|
|
2405
2405
|
"web_app_set_background_color",
|
|
2406
2406
|
"web_app_set_bottom_bar_color"
|
|
2407
|
-
].some((d) => ot(d,
|
|
2407
|
+
].some((d) => ot(d, O(n))));
|
|
2408
2408
|
const S = j(!1);
|
|
2409
2409
|
this.isCssVarsBound = w(S), this.bindCssVarsFp = A((d) => {
|
|
2410
2410
|
if (S())
|
|
2411
2411
|
return V(new Qt());
|
|
2412
|
-
const [x,
|
|
2412
|
+
const [x, $] = Lt(() => {
|
|
2413
2413
|
S.set(!1);
|
|
2414
|
-
}), T = (
|
|
2414
|
+
}), T = (D, U) => {
|
|
2415
2415
|
const H = () => {
|
|
2416
|
-
Zt(
|
|
2416
|
+
Zt(D, U() || null);
|
|
2417
2417
|
};
|
|
2418
|
-
H(), x(
|
|
2418
|
+
H(), x(U.sub(H), Xt.bind(null, D));
|
|
2419
2419
|
};
|
|
2420
|
-
return d || (d = (
|
|
2420
|
+
return d || (d = (D) => `--tg-${le(D)}`), T(d("bgColor"), this.bgColorRgb), T(d("bottomBarColor"), this.bottomBarColorRgb), T(d("headerColor"), this.headerColorRgb), S.set(!0), I($);
|
|
2421
2421
|
}, { isTma: o, returns: "either", isMounted: this.isMounted }), this.bindCssVars = h(this.bindCssVarsFp);
|
|
2422
2422
|
const f = (d) => {
|
|
2423
|
-
const x = g.getter(d),
|
|
2423
|
+
const x = g.getter(d), $ = y(x), T = {
|
|
2424
2424
|
headerColor: "web_app_set_header_color",
|
|
2425
2425
|
bgColor: "web_app_set_background_color",
|
|
2426
2426
|
bottomBarColor: "web_app_set_bottom_bar_color"
|
|
2427
|
-
}[d],
|
|
2428
|
-
(
|
|
2429
|
-
if (
|
|
2427
|
+
}[d], D = A(
|
|
2428
|
+
(U) => {
|
|
2429
|
+
if (U === x())
|
|
2430
2430
|
return I(void 0);
|
|
2431
|
-
if (T === "web_app_set_header_color" && (
|
|
2432
|
-
return
|
|
2433
|
-
|
|
2431
|
+
if (T === "web_app_set_header_color" && (U === "bg_color" || U === "secondary_bg_color"))
|
|
2432
|
+
return c(
|
|
2433
|
+
i("web_app_set_header_color", { color_key: U }),
|
|
2434
|
+
P(() => {
|
|
2435
|
+
g.setState({ [d]: U });
|
|
2436
|
+
})
|
|
2437
|
+
);
|
|
2438
|
+
const H = C(U);
|
|
2434
2439
|
return c(
|
|
2435
|
-
H ? i(T, { color: H }) : V(new rr(
|
|
2436
|
-
|
|
2440
|
+
H ? i(T, { color: H }) : V(new rr(U)),
|
|
2441
|
+
P(() => {
|
|
2437
2442
|
g.setState({ [d]: H });
|
|
2438
2443
|
})
|
|
2439
2444
|
);
|
|
@@ -2453,7 +2458,7 @@ class Tr {
|
|
|
2453
2458
|
} : void 0
|
|
2454
2459
|
}
|
|
2455
2460
|
);
|
|
2456
|
-
return [x,
|
|
2461
|
+
return [x, $, h(D), D];
|
|
2457
2462
|
};
|
|
2458
2463
|
[
|
|
2459
2464
|
this.bgColor,
|
|
@@ -2479,7 +2484,7 @@ class Tr {
|
|
|
2479
2484
|
const $r = new Tr({
|
|
2480
2485
|
...c(
|
|
2481
2486
|
F(),
|
|
2482
|
-
|
|
2487
|
+
R,
|
|
2483
2488
|
v,
|
|
2484
2489
|
et("miniApp")
|
|
2485
2490
|
),
|
|
@@ -2566,7 +2571,7 @@ class Rr {
|
|
|
2566
2571
|
returns: "task"
|
|
2567
2572
|
});
|
|
2568
2573
|
this.isSupported = z("web_app_open_popup", e), this.isOpened = w(i), this.showFp = u((a) => c(
|
|
2569
|
-
this.isOpened() ?
|
|
2574
|
+
this.isOpened() ? L(new zt("A popup is already opened")) : q(void 0),
|
|
2570
2575
|
at(() => ve(Lr(a))),
|
|
2571
2576
|
Z((p) => (i.set(!0), n("web_app_open_popup", "popup_closed", {
|
|
2572
2577
|
...a,
|
|
@@ -2579,7 +2584,7 @@ class Rr {
|
|
|
2579
2584
|
)), this.show = h(this.showFp);
|
|
2580
2585
|
}
|
|
2581
2586
|
}
|
|
2582
|
-
const Un = new Rr(c(F(),
|
|
2587
|
+
const Un = new Rr(c(F(), G, v));
|
|
2583
2588
|
function Pr({ request: s, ...e }) {
|
|
2584
2589
|
return A((r) => c(
|
|
2585
2590
|
s("web_app_request_phone", "phone_requested", r),
|
|
@@ -2589,7 +2594,7 @@ function Pr({ request: s, ...e }) {
|
|
|
2589
2594
|
const qe = Pr(c(
|
|
2590
2595
|
F(),
|
|
2591
2596
|
v,
|
|
2592
|
-
|
|
2597
|
+
G
|
|
2593
2598
|
)), Gn = h(qe);
|
|
2594
2599
|
function Or({
|
|
2595
2600
|
invokeCustomMethod: s,
|
|
@@ -2604,7 +2609,7 @@ function Or({
|
|
|
2604
2609
|
at((a) => {
|
|
2605
2610
|
const p = qt(J(), a);
|
|
2606
2611
|
if (!p.success)
|
|
2607
|
-
return
|
|
2612
|
+
return L(new Ft(a, p.issues));
|
|
2608
2613
|
if (!p.output)
|
|
2609
2614
|
return q(void 0);
|
|
2610
2615
|
const l = qt(
|
|
@@ -2626,7 +2631,7 @@ function Or({
|
|
|
2626
2631
|
),
|
|
2627
2632
|
p.output
|
|
2628
2633
|
);
|
|
2629
|
-
return l.success ? q({ raw: p.output, parsed: l.output }) :
|
|
2634
|
+
return l.success ? q({ raw: p.output, parsed: l.output }) : L(new Ft(p.output, l.issues));
|
|
2630
2635
|
})
|
|
2631
2636
|
), i = (u) => c(
|
|
2632
2637
|
n(u),
|
|
@@ -2656,7 +2661,7 @@ function Or({
|
|
|
2656
2661
|
i(a),
|
|
2657
2662
|
Z((p) => p ? q(p) : c(
|
|
2658
2663
|
e(a),
|
|
2659
|
-
at((l) => l === "sent" ? o(a) :
|
|
2664
|
+
at((l) => l === "sent" ? o(a) : L(new ye("User denied access")))
|
|
2660
2665
|
))
|
|
2661
2666
|
), u), { ...r, returns: "task", requires: "web_app_request_phone" });
|
|
2662
2667
|
}
|
|
@@ -2687,7 +2692,7 @@ function Gr({ request: s, ...e }) {
|
|
|
2687
2692
|
const jr = Gr(c(
|
|
2688
2693
|
F(),
|
|
2689
2694
|
v,
|
|
2690
|
-
|
|
2695
|
+
G
|
|
2691
2696
|
)), Wn = h(jr);
|
|
2692
2697
|
class Hr {
|
|
2693
2698
|
constructor({
|
|
@@ -2790,8 +2795,8 @@ class Hr {
|
|
|
2790
2795
|
}),
|
|
2791
2796
|
B(() => g)
|
|
2792
2797
|
);
|
|
2793
|
-
}), this.closeFp = a(() => c(o("web_app_close_scan_qr_popup"),
|
|
2794
|
-
this.isOpened() ?
|
|
2798
|
+
}), this.closeFp = a(() => c(o("web_app_close_scan_qr_popup"), P(m))), this.openFp = p((_) => c(
|
|
2799
|
+
this.isOpened() ? L(new zt("The QR Scanner is already opened")) : async () => o("web_app_open_scan_qr_popup", { text: _.text }),
|
|
2795
2800
|
at(() => {
|
|
2796
2801
|
const [g, C] = Lt(), y = (S) => (C(), S);
|
|
2797
2802
|
return c(
|
|
@@ -2805,7 +2810,7 @@ class Hr {
|
|
|
2805
2810
|
}
|
|
2806
2811
|
}
|
|
2807
2812
|
const Kn = new Hr({
|
|
2808
|
-
...c(F(),
|
|
2813
|
+
...c(F(), R, v),
|
|
2809
2814
|
onClosed(s) {
|
|
2810
2815
|
return Y("scan_qr_popup_closed", s);
|
|
2811
2816
|
},
|
|
@@ -3062,7 +3067,7 @@ class Wr {
|
|
|
3062
3067
|
})
|
|
3063
3068
|
}), i = (o, u) => {
|
|
3064
3069
|
const a = n.stateGetter(o);
|
|
3065
|
-
return w(() => a() ||
|
|
3070
|
+
return w(() => a() || O(u));
|
|
3066
3071
|
};
|
|
3067
3072
|
this.isSupported = z("web_app_setup_secondary_button", r.version), this.bgColor = i("bgColor", e.bgColor), this.textColor = i("textColor", e.textColor), this.position = n.stateGetter("position"), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setPosition, this.setPositionFp] = n.stateSetters("position"), [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
|
|
3068
3073
|
[this.disableShineEffect, this.disableShineEffectFp],
|
|
@@ -3244,7 +3249,7 @@ class Qr {
|
|
|
3244
3249
|
const C = { isVerticalEnabled: g };
|
|
3245
3250
|
return u.hasDiff(C) ? c(
|
|
3246
3251
|
e("web_app_setup_swipe_behavior", { allow_vertical_swipe: g }),
|
|
3247
|
-
|
|
3252
|
+
P(() => {
|
|
3248
3253
|
u.setState(C);
|
|
3249
3254
|
})
|
|
3250
3255
|
) : I(void 0);
|
|
@@ -3258,7 +3263,7 @@ class Qr {
|
|
|
3258
3263
|
}
|
|
3259
3264
|
const Nn = new Qr(c(
|
|
3260
3265
|
F(),
|
|
3261
|
-
|
|
3266
|
+
R,
|
|
3262
3267
|
v,
|
|
3263
3268
|
et("swipeBehavior")
|
|
3264
3269
|
));
|
|
@@ -3284,12 +3289,12 @@ function zr({ request: s, ...e }) {
|
|
|
3284
3289
|
"file_download_requested",
|
|
3285
3290
|
{ ...i, params: { url: r, file_name: n } }
|
|
3286
3291
|
),
|
|
3287
|
-
Z((o) => o.status === "downloading" ? q(void 0) :
|
|
3292
|
+
Z((o) => o.status === "downloading" ? q(void 0) : L(new ye("User denied the action")))
|
|
3288
3293
|
), { ...e, requires: "web_app_request_file_download", returns: "task" });
|
|
3289
3294
|
}
|
|
3290
3295
|
const Nr = zr(c(
|
|
3291
3296
|
F(),
|
|
3292
|
-
|
|
3297
|
+
G,
|
|
3293
3298
|
v
|
|
3294
3299
|
)), Yn = h(Nr);
|
|
3295
3300
|
function Jr({ invokeCustomMethod: s, ...e }) {
|
|
@@ -3300,7 +3305,7 @@ function Jr({ invokeCustomMethod: s, ...e }) {
|
|
|
3300
3305
|
pe(fe(), ts(), he((o) => new Date(o * 1e3)), de()),
|
|
3301
3306
|
n
|
|
3302
3307
|
);
|
|
3303
|
-
return i.success ? q(i.output) :
|
|
3308
|
+
return i.success ? q(i.output) : L(new Ft(n, i.issues));
|
|
3304
3309
|
})
|
|
3305
3310
|
), { ...e, requires: "web_app_invoke_custom_method", returns: "task" });
|
|
3306
3311
|
}
|
|
@@ -3314,7 +3319,7 @@ function Zr({ postEvent: s, ...e }) {
|
|
|
3314
3319
|
}
|
|
3315
3320
|
const Xr = Zr(c(
|
|
3316
3321
|
F(),
|
|
3317
|
-
|
|
3322
|
+
R,
|
|
3318
3323
|
v
|
|
3319
3324
|
)), Xn = h(Xr);
|
|
3320
3325
|
function tn({ request: s, createRequestId: e, ...r }) {
|
|
@@ -3334,7 +3339,7 @@ const en = tn({
|
|
|
3334
3339
|
...c(
|
|
3335
3340
|
F(),
|
|
3336
3341
|
v,
|
|
3337
|
-
|
|
3342
|
+
G
|
|
3338
3343
|
),
|
|
3339
3344
|
createRequestId: Ae
|
|
3340
3345
|
}), to = h(en);
|
|
@@ -3365,7 +3370,7 @@ function rn({ postEvent: s, ...e }) {
|
|
|
3365
3370
|
) : s("web_app_data_send", { data: r });
|
|
3366
3371
|
}, { ...e, returns: "either" });
|
|
3367
3372
|
}
|
|
3368
|
-
const nn = rn(c(F(),
|
|
3373
|
+
const nn = rn(c(F(), R)), so = h(nn);
|
|
3369
3374
|
function on({ request: s, ...e }) {
|
|
3370
3375
|
return A((r, n) => c(
|
|
3371
3376
|
s(
|
|
@@ -3376,12 +3381,12 @@ function on({ request: s, ...e }) {
|
|
|
3376
3381
|
params: { id: r }
|
|
3377
3382
|
}
|
|
3378
3383
|
),
|
|
3379
|
-
Z((i) => i && "error" in i ?
|
|
3384
|
+
Z((i) => i && "error" in i ? L(new sr(i.error)) : q(void 0))
|
|
3380
3385
|
), { ...e, requires: "web_app_send_prepared_message", returns: "task" });
|
|
3381
3386
|
}
|
|
3382
3387
|
const an = on(c(
|
|
3383
3388
|
F(),
|
|
3384
|
-
|
|
3389
|
+
G,
|
|
3385
3390
|
v
|
|
3386
3391
|
)), ro = h(an);
|
|
3387
3392
|
function un({ postEvent: s, ...e }) {
|
|
@@ -3393,7 +3398,7 @@ function un({ postEvent: s, ...e }) {
|
|
|
3393
3398
|
}
|
|
3394
3399
|
const cn = un(c(
|
|
3395
3400
|
F(),
|
|
3396
|
-
|
|
3401
|
+
R,
|
|
3397
3402
|
v
|
|
3398
3403
|
)), no = h(cn), $t = /* @__PURE__ */ _t(!1);
|
|
3399
3404
|
function ln({ isInlineMode: s, postEvent: e, ...r }) {
|
|
@@ -3403,7 +3408,7 @@ function ln({ isInlineMode: s, postEvent: e, ...r }) {
|
|
|
3403
3408
|
}), {
|
|
3404
3409
|
...r,
|
|
3405
3410
|
requires: {
|
|
3406
|
-
every: ["web_app_switch_inline_query", () =>
|
|
3411
|
+
every: ["web_app_switch_inline_query", () => O(s) ? void 0 : "The application must be launched in the inline mode"]
|
|
3407
3412
|
},
|
|
3408
3413
|
returns: "either"
|
|
3409
3414
|
});
|
|
@@ -3411,7 +3416,7 @@ function ln({ isInlineMode: s, postEvent: e, ...r }) {
|
|
|
3411
3416
|
const pn = ln({
|
|
3412
3417
|
...c(
|
|
3413
3418
|
F(),
|
|
3414
|
-
|
|
3419
|
+
R,
|
|
3415
3420
|
v
|
|
3416
3421
|
),
|
|
3417
3422
|
isInlineMode: $t
|
|
@@ -3640,17 +3645,17 @@ class hn {
|
|
|
3640
3645
|
width: k.width,
|
|
3641
3646
|
stableHeight: k.is_state_stable ? k.height : void 0
|
|
3642
3647
|
});
|
|
3643
|
-
},
|
|
3648
|
+
}, $ = (k) => {
|
|
3644
3649
|
d.setState({ isFullscreen: k.is_fullscreen });
|
|
3645
3650
|
}, T = (k) => {
|
|
3646
3651
|
d.setState({ safeAreaInsets: k });
|
|
3647
|
-
},
|
|
3652
|
+
}, D = (k) => {
|
|
3648
3653
|
d.setState({ contentSafeAreaInsets: k });
|
|
3649
|
-
},
|
|
3654
|
+
}, U = new Jt({
|
|
3650
3655
|
initialState(k) {
|
|
3651
3656
|
const st = (N) => () => {
|
|
3652
3657
|
const [X, W] = N === "safe-area" ? ["web_app_request_safe_area", "safe_area_changed"] : ["web_app_request_content_safe_area", "content_safe_area_changed"];
|
|
3653
|
-
return ot(X,
|
|
3658
|
+
return ot(X, O(S)) ? _(X, W, k) : q({ top: 0, left: 0, right: 0, bottom: 0 });
|
|
3654
3659
|
}, M = (N) => () => typeof N == "boolean" ? q(N) : ve(N());
|
|
3655
3660
|
return c(
|
|
3656
3661
|
Js,
|
|
@@ -3678,10 +3683,10 @@ class hn {
|
|
|
3678
3683
|
},
|
|
3679
3684
|
isPageReload: r,
|
|
3680
3685
|
onMounted(k) {
|
|
3681
|
-
o(x), u(
|
|
3686
|
+
o(x), u($), i(T), n(D), d.setState(k);
|
|
3682
3687
|
},
|
|
3683
3688
|
onUnmounted() {
|
|
3684
|
-
m(x), p(
|
|
3689
|
+
m(x), p($), l(T), a(D);
|
|
3685
3690
|
},
|
|
3686
3691
|
restoreState: e.get
|
|
3687
3692
|
}), H = (k) => w(() => this.safeAreaInsets()[k]), bt = (k) => w(() => this.contentSafeAreaInsets()[k]);
|
|
@@ -3700,9 +3705,9 @@ class hn {
|
|
|
3700
3705
|
["fullscreen_changed", "fullscreen_failed"],
|
|
3701
3706
|
st
|
|
3702
3707
|
),
|
|
3703
|
-
Z((M) => "error" in M && M.error !== "ALREADY_FULLSCREEN" ?
|
|
3708
|
+
Z((M) => "error" in M && M.error !== "ALREADY_FULLSCREEN" ? L(new er(M.error)) : (d.setState({ isFullscreen: "is_fullscreen" in M ? M.is_fullscreen : !0 }), q(void 0)))
|
|
3704
3709
|
));
|
|
3705
|
-
this.isMounted =
|
|
3710
|
+
this.isMounted = U.isMounted, this.mountFp = Ve(U.mount), this.mount = h(this.mountFp), this.isFullscreen = d.getter("isFullscreen"), this.requestFullscreenFp = ee(!0), this.requestFullscreen = h(this.requestFullscreenFp), this.exitFullscreenFp = ee(!1), this.exitFullscreen = h(this.exitFullscreenFp);
|
|
3706
3711
|
const gt = j(!1);
|
|
3707
3712
|
this.isCssVarsBound = w(gt), this.bindCssVarsFp = te(
|
|
3708
3713
|
(k) => {
|
|
@@ -3757,14 +3762,14 @@ function dn() {
|
|
|
3757
3762
|
F(),
|
|
3758
3763
|
et("viewport"),
|
|
3759
3764
|
v,
|
|
3760
|
-
|
|
3761
|
-
|
|
3765
|
+
R,
|
|
3766
|
+
G
|
|
3762
3767
|
),
|
|
3763
3768
|
isFullscreen() {
|
|
3764
|
-
return c(St(),
|
|
3769
|
+
return c(St(), P((o) => !!o.tgWebAppFullscreen));
|
|
3765
3770
|
},
|
|
3766
3771
|
isViewportStable() {
|
|
3767
|
-
return c(St(),
|
|
3772
|
+
return c(St(), P((o) => ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(o.tgWebAppPlatform)));
|
|
3768
3773
|
},
|
|
3769
3774
|
offContentSafeAreaInsetsChanged: i.off,
|
|
3770
3775
|
offFullscreenChanged: r.off,
|
|
@@ -3814,7 +3819,7 @@ function fn(s = {}) {
|
|
|
3814
3819
|
}
|
|
3815
3820
|
return c(
|
|
3816
3821
|
mt("iframe_ready", { reload_supported: !0 }),
|
|
3817
|
-
|
|
3822
|
+
P(() => (re().log("The package was initialized"), o))
|
|
3818
3823
|
);
|
|
3819
3824
|
}
|
|
3820
3825
|
const ao = yt(fn);
|