@tma.js/sdk 3.0.6 → 3.0.7

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
@@ -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
- }, L = /* @__PURE__ */ xs(Se), q = /* @__PURE__ */ Is(Se), ve = Gt, Gs = /* @__PURE__ */ Ts(Ht), js = function(s, e) {
367
+ }, $ = /* @__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;
@@ -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], $ = 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 $;
473
+ const x = b[d], R = typeof x == "function" ? x() : ot(x, r()) ? void 0 : `it is unsupported in Mini Apps version ${r()}`;
474
+ if (R && (f === "every" || d === b.length - 1))
475
+ return R;
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) ? L(b) : V(b);
485
+ return ["task", "promise"].includes(e.returns) ? $(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 R;
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 = ($ = e.isMounting) != null && $.call(e) ? "mounting. Wait for the mount completion" : "unmounted. Use the mount() method";
502
+ const T = (R = e.isMounting) != null && R.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);
@@ -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)), R = ft({
882
+ const ke = /* @__PURE__ */ _t(Pe), mt = (...s) => ke()(...s), ur = (...s) => ce(mt(...s)), L = 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
- R,
889
+ L,
890
890
  v,
891
891
  et(s)
892
892
  ),
@@ -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
- ) : L(ue)), this.openSettingsFp = C(() => n("web_app_biometry_open_settings")), this.requestAccessFp = S((f) => c(
1090
+ ) : $(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)) : L(ue);
1097
+ return d.available ? (m.setState(d), q(d.accessRequested)) : $(ue);
1098
1098
  })
1099
1099
  )), this.updateTokenFp = S((f = {}) => {
1100
1100
  var b;
@@ -1116,7 +1116,7 @@ const Ee = (s, e, r) => Oe(s, e, {
1116
1116
  }), En = new cr({
1117
1117
  ...c(
1118
1118
  F(),
1119
- R,
1119
+ L,
1120
1120
  v,
1121
1121
  G,
1122
1122
  et("biometry")
@@ -1196,7 +1196,7 @@ class lr {
1196
1196
  const An = new lr(c(
1197
1197
  F(),
1198
1198
  et("closingBehavior"),
1199
- R
1199
+ L
1200
1200
  ));
1201
1201
  class pr {
1202
1202
  constructor({ version: e, isTma: r, invokeCustomMethod: n }) {
@@ -1339,7 +1339,7 @@ function _r({ request: s, ...e }) {
1339
1339
  },
1340
1340
  ...n
1341
1341
  }),
1342
- at((i) => i && "error" in i ? L(new tr(i.error)) : q(void 0))
1342
+ at((i) => i && "error" in i ? $(new tr(i.error)) : q(void 0))
1343
1343
  ), {
1344
1344
  ...e,
1345
1345
  requires: "web_app_set_emoji_status",
@@ -1404,7 +1404,7 @@ class br {
1404
1404
  }
1405
1405
  const qn = new br(c(
1406
1406
  F(),
1407
- R,
1407
+ L,
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
- R
1416
+ L
1417
1417
  )), Mn = h(wr);
1418
1418
  function Fr({ request: s, ...e }) {
1419
1419
  return A((r) => c(
@@ -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() ? L(new zt("Invoice is already opened")) : q(void 0),
1578
+ this.isOpened() ? $(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,9 +1585,9 @@ 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 L(new Q(`Link has unexpected hostname: ${l}`));
1588
+ return $(new Q(`Link has unexpected hostname: ${l}`));
1589
1589
  const _ = m.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
1590
- return _ ? this.openSlugFp(_[2], p) : L(new Q(
1590
+ return _ ? this.openSlugFp(_[2], p) : $(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);
@@ -1611,7 +1611,7 @@ function yr({ postEvent: s, ...e }) {
1611
1611
  }
1612
1612
  const kr = yr(c(
1613
1613
  F(),
1614
- R
1614
+ L
1615
1615
  )), Ln = h(kr);
1616
1616
  function Er({ postEvent: s, version: e, ...r }) {
1617
1617
  return A((n) => {
@@ -1621,7 +1621,7 @@ function Er({ postEvent: s, version: e, ...r }) {
1621
1621
  }
1622
1622
  const Ie = Er(c(
1623
1623
  F(),
1624
- R,
1624
+ L,
1625
1625
  v
1626
1626
  )), Rn = h(Ie);
1627
1627
  function Ar({ openTelegramLink: s, ...e }) {
@@ -1751,7 +1751,7 @@ class Br {
1751
1751
  }
1752
1752
  const On = new Br(c(
1753
1753
  F(),
1754
- R,
1754
+ L,
1755
1755
  v,
1756
1756
  G,
1757
1757
  et("locationManager")
@@ -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, R]) => {
2363
2363
  const T = x();
2364
- if (console.log(T, $), !Et(T) && ($ !== "web_app_set_header_color" || !["bg_color", "secondary_bg_color"].includes(T))) {
2364
+ if (!Et(T) && (R !== "web_app_set_header_color" || !["bg_color", "secondary_bg_color"].includes(T))) {
2365
2365
  const D = d[T];
2366
- D && i($, { color: D });
2366
+ D && i(R, { color: D });
2367
2367
  }
2368
2368
  });
2369
2369
  }, _ = new dt({
@@ -2409,7 +2409,7 @@ class Tr {
2409
2409
  this.isCssVarsBound = w(S), this.bindCssVarsFp = A((d) => {
2410
2410
  if (S())
2411
2411
  return V(new Qt());
2412
- const [x, $] = Lt(() => {
2412
+ const [x, R] = Lt(() => {
2413
2413
  S.set(!1);
2414
2414
  }), T = (D, U) => {
2415
2415
  const H = () => {
@@ -2417,10 +2417,10 @@ class Tr {
2417
2417
  };
2418
2418
  H(), x(U.sub(H), Xt.bind(null, D));
2419
2419
  };
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($);
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(R);
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), $ = y(x), T = {
2423
+ const x = g.getter(d), R = 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"
@@ -2458,7 +2458,7 @@ class Tr {
2458
2458
  } : void 0
2459
2459
  }
2460
2460
  );
2461
- return [x, $, h(D), D];
2461
+ return [x, R, h(D), D];
2462
2462
  };
2463
2463
  [
2464
2464
  this.bgColor,
@@ -2484,7 +2484,7 @@ class Tr {
2484
2484
  const $r = new Tr({
2485
2485
  ...c(
2486
2486
  F(),
2487
- R,
2487
+ L,
2488
2488
  v,
2489
2489
  et("miniApp")
2490
2490
  ),
@@ -2571,7 +2571,7 @@ class Rr {
2571
2571
  returns: "task"
2572
2572
  });
2573
2573
  this.isSupported = z("web_app_open_popup", e), this.isOpened = w(i), this.showFp = u((a) => c(
2574
- this.isOpened() ? L(new zt("A popup is already opened")) : q(void 0),
2574
+ this.isOpened() ? $(new zt("A popup is already opened")) : q(void 0),
2575
2575
  at(() => ve(Lr(a))),
2576
2576
  Z((p) => (i.set(!0), n("web_app_open_popup", "popup_closed", {
2577
2577
  ...a,
@@ -2609,7 +2609,7 @@ function Or({
2609
2609
  at((a) => {
2610
2610
  const p = qt(J(), a);
2611
2611
  if (!p.success)
2612
- return L(new Ft(a, p.issues));
2612
+ return $(new Ft(a, p.issues));
2613
2613
  if (!p.output)
2614
2614
  return q(void 0);
2615
2615
  const l = qt(
@@ -2631,7 +2631,7 @@ function Or({
2631
2631
  ),
2632
2632
  p.output
2633
2633
  );
2634
- return l.success ? q({ raw: p.output, parsed: l.output }) : L(new Ft(p.output, l.issues));
2634
+ return l.success ? q({ raw: p.output, parsed: l.output }) : $(new Ft(p.output, l.issues));
2635
2635
  })
2636
2636
  ), i = (u) => c(
2637
2637
  n(u),
@@ -2661,7 +2661,7 @@ function Or({
2661
2661
  i(a),
2662
2662
  Z((p) => p ? q(p) : c(
2663
2663
  e(a),
2664
- at((l) => l === "sent" ? o(a) : L(new ye("User denied access")))
2664
+ at((l) => l === "sent" ? o(a) : $(new ye("User denied access")))
2665
2665
  ))
2666
2666
  ), u), { ...r, returns: "task", requires: "web_app_request_phone" });
2667
2667
  }
@@ -2796,7 +2796,7 @@ class Hr {
2796
2796
  B(() => g)
2797
2797
  );
2798
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 }),
2799
+ this.isOpened() ? $(new zt("The QR Scanner is already opened")) : async () => o("web_app_open_scan_qr_popup", { text: _.text }),
2800
2800
  at(() => {
2801
2801
  const [g, C] = Lt(), y = (S) => (C(), S);
2802
2802
  return c(
@@ -2810,7 +2810,7 @@ class Hr {
2810
2810
  }
2811
2811
  }
2812
2812
  const Kn = new Hr({
2813
- ...c(F(), R, v),
2813
+ ...c(F(), L, v),
2814
2814
  onClosed(s) {
2815
2815
  return Y("scan_qr_popup_closed", s);
2816
2816
  },
@@ -3263,7 +3263,7 @@ class Qr {
3263
3263
  }
3264
3264
  const Nn = new Qr(c(
3265
3265
  F(),
3266
- R,
3266
+ L,
3267
3267
  v,
3268
3268
  et("swipeBehavior")
3269
3269
  ));
@@ -3289,7 +3289,7 @@ function zr({ request: s, ...e }) {
3289
3289
  "file_download_requested",
3290
3290
  { ...i, params: { url: r, file_name: n } }
3291
3291
  ),
3292
- Z((o) => o.status === "downloading" ? q(void 0) : L(new ye("User denied the action")))
3292
+ Z((o) => o.status === "downloading" ? q(void 0) : $(new ye("User denied the action")))
3293
3293
  ), { ...e, requires: "web_app_request_file_download", returns: "task" });
3294
3294
  }
3295
3295
  const Nr = zr(c(
@@ -3305,7 +3305,7 @@ function Jr({ invokeCustomMethod: s, ...e }) {
3305
3305
  pe(fe(), ts(), he((o) => new Date(o * 1e3)), de()),
3306
3306
  n
3307
3307
  );
3308
- return i.success ? q(i.output) : L(new Ft(n, i.issues));
3308
+ return i.success ? q(i.output) : $(new Ft(n, i.issues));
3309
3309
  })
3310
3310
  ), { ...e, requires: "web_app_invoke_custom_method", returns: "task" });
3311
3311
  }
@@ -3319,7 +3319,7 @@ function Zr({ postEvent: s, ...e }) {
3319
3319
  }
3320
3320
  const Xr = Zr(c(
3321
3321
  F(),
3322
- R,
3322
+ L,
3323
3323
  v
3324
3324
  )), Xn = h(Xr);
3325
3325
  function tn({ request: s, createRequestId: e, ...r }) {
@@ -3370,7 +3370,7 @@ function rn({ postEvent: s, ...e }) {
3370
3370
  ) : s("web_app_data_send", { data: r });
3371
3371
  }, { ...e, returns: "either" });
3372
3372
  }
3373
- const nn = rn(c(F(), R)), so = h(nn);
3373
+ const nn = rn(c(F(), L)), so = h(nn);
3374
3374
  function on({ request: s, ...e }) {
3375
3375
  return A((r, n) => c(
3376
3376
  s(
@@ -3381,7 +3381,7 @@ function on({ request: s, ...e }) {
3381
3381
  params: { id: r }
3382
3382
  }
3383
3383
  ),
3384
- Z((i) => i && "error" in i ? L(new sr(i.error)) : q(void 0))
3384
+ Z((i) => i && "error" in i ? $(new sr(i.error)) : q(void 0))
3385
3385
  ), { ...e, requires: "web_app_send_prepared_message", returns: "task" });
3386
3386
  }
3387
3387
  const an = on(c(
@@ -3398,7 +3398,7 @@ function un({ postEvent: s, ...e }) {
3398
3398
  }
3399
3399
  const cn = un(c(
3400
3400
  F(),
3401
- R,
3401
+ L,
3402
3402
  v
3403
3403
  )), no = h(cn), $t = /* @__PURE__ */ _t(!1);
3404
3404
  function ln({ isInlineMode: s, postEvent: e, ...r }) {
@@ -3416,7 +3416,7 @@ function ln({ isInlineMode: s, postEvent: e, ...r }) {
3416
3416
  const pn = ln({
3417
3417
  ...c(
3418
3418
  F(),
3419
- R,
3419
+ L,
3420
3420
  v
3421
3421
  ),
3422
3422
  isInlineMode: $t
@@ -3645,7 +3645,7 @@ class hn {
3645
3645
  width: k.width,
3646
3646
  stableHeight: k.is_state_stable ? k.height : void 0
3647
3647
  });
3648
- }, $ = (k) => {
3648
+ }, R = (k) => {
3649
3649
  d.setState({ isFullscreen: k.is_fullscreen });
3650
3650
  }, T = (k) => {
3651
3651
  d.setState({ safeAreaInsets: k });
@@ -3683,10 +3683,10 @@ class hn {
3683
3683
  },
3684
3684
  isPageReload: r,
3685
3685
  onMounted(k) {
3686
- o(x), u($), i(T), n(D), d.setState(k);
3686
+ o(x), u(R), i(T), n(D), d.setState(k);
3687
3687
  },
3688
3688
  onUnmounted() {
3689
- m(x), p($), l(T), a(D);
3689
+ m(x), p(R), l(T), a(D);
3690
3690
  },
3691
3691
  restoreState: e.get
3692
3692
  }), H = (k) => w(() => this.safeAreaInsets()[k]), bt = (k) => w(() => this.contentSafeAreaInsets()[k]);
@@ -3705,7 +3705,7 @@ class hn {
3705
3705
  ["fullscreen_changed", "fullscreen_failed"],
3706
3706
  st
3707
3707
  ),
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)))
3708
+ Z((M) => "error" in M && M.error !== "ALREADY_FULLSCREEN" ? $(new er(M.error)) : (d.setState({ isFullscreen: "is_fullscreen" in M ? M.is_fullscreen : !0 }), q(void 0)))
3709
3709
  ));
3710
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);
3711
3711
  const gt = j(!1);
@@ -3762,7 +3762,7 @@ function dn() {
3762
3762
  F(),
3763
3763
  et("viewport"),
3764
3764
  v,
3765
- R,
3765
+ L,
3766
3766
  G
3767
3767
  ),
3768
3768
  isFullscreen() {