onairos 0.1.355 → 0.1.359

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.
@@ -5,33 +5,30 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = TestTelegramButton;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _sdk = require("@telegram-apps/sdk");
9
8
  var _jsxRuntime = require("react/jsx-runtime");
10
9
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
10
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
11
  function TestTelegramButton() {
13
12
  const [error, setError] = (0, _react.useState)(null);
14
- const [debug, setDebug] = (0, _react.useState)(null);
15
- const handleClick = async () => {
13
+ const [logs, setLogs] = (0, _react.useState)([]);
14
+ const addLog = message => {
15
+ setLogs(prevLogs => [...prevLogs, message]);
16
+ };
17
+ const handleClick = () => {
16
18
  try {
17
- setDebug('Checking if running in Telegram...');
18
- if (!_sdk.miniApp.mount.isAvailable()) {
19
- setError('Not running in Telegram Mini App');
20
- return;
21
- }
22
- setDebug('Mounting Telegram Mini App...');
23
- _sdk.miniApp.mount();
24
- setDebug('Opening external browser...');
25
- const testUrl = 'https://onairos.uk/test-page';
19
+ addLog('Opening external browser...');
20
+ const data = {
21
+ key: 'value'
22
+ }; // Example data
23
+ const queryString = new URLSearchParams(data).toString();
24
+ const testUrl = `https://internship.onairos.uk/?${queryString}`;
26
25
 
27
- // Use openLink with try_instant_view: false to force external browser
28
- _sdk.miniApp.openLink(testUrl, {
29
- try_instant_view: false,
30
- open_in_browser: true
31
- });
26
+ // Use standard JavaScript to open the link in a new tab
27
+ window.open(testUrl, '_blank');
32
28
  } catch (error) {
33
- console.error('Telegram test failed:', error);
34
- setError(`Test failed: ${error.message}`);
29
+ console.error('Failed to open link:', error);
30
+ addLog(`Failed to open link: ${error.message}`);
31
+ setError(`Failed to open link: ${error.message}`);
35
32
  }
36
33
  };
37
34
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -39,13 +36,39 @@ function TestTelegramButton() {
39
36
  children: [error && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
40
37
  className: "bg-red-100 border border-red-400 text-red-700 px-4 py-2 rounded mb-4",
41
38
  children: error
42
- }), debug && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
43
- className: "bg-blue-100 border border-blue-400 text-blue-700 px-4 py-2 rounded mb-4",
44
- children: debug
45
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
39
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
46
40
  onClick: handleClick,
47
- className: "bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600",
48
- children: "Test Telegram Browser"
41
+ className: "flex flex-col items-center justify-center px-4 py-2 border border-gray-300 rounded-full shadow-sm bg-white hover:bg-gray-50",
42
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
43
+ className: "relative",
44
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
45
+ src: "google-icon.png",
46
+ alt: "Google",
47
+ className: "w-10 h-10 rounded-full"
48
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
49
+ className: "absolute bottom-0 right-0 w-4 h-4",
50
+ fill: "currentColor",
51
+ viewBox: "0 0 20 20",
52
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
53
+ d: "M10 3a1 1 0 011 1v6h6a1 1 0 110 2h-6v6a1 1 0 11-2 0v-6H3a1 1 0 110-2h6V4a1 1 0 011-1z"
54
+ })
55
+ })]
56
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
57
+ className: "text-gray-700 mt-2",
58
+ children: "Open Window"
59
+ })]
60
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
61
+ className: "mt-4 w-full max-w-md",
62
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
63
+ className: "text-lg font-semibold mb-2",
64
+ children: "Logs:"
65
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
66
+ className: "bg-gray-100 border border-gray-300 text-gray-800 px-4 py-2 rounded overflow-y-auto max-h-40",
67
+ children: logs.map((log, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
68
+ className: "text-sm",
69
+ children: log
70
+ }, index))
71
+ })]
49
72
  })]
50
73
  });
51
74
  }