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.
- package/dist/components/TestTelegramButton.js +48 -25
- package/dist/onairos.bundle.js +1 -1
- package/dist/onairos.bundle.js.map +1 -1
- package/dist/onairos.js +6 -10
- package/dist/onairosButton.js +6 -10
- package/package.json +1 -1
- package/src/components/TestTelegramButton.js +42 -32
- package/src/onairos.jsx +7 -9
- package/src/onairosButton.jsx +8 -10
- package/src/backButton.js +0 -22
|
@@ -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 [
|
|
15
|
-
const
|
|
13
|
+
const [logs, setLogs] = (0, _react.useState)([]);
|
|
14
|
+
const addLog = message => {
|
|
15
|
+
setLogs(prevLogs => [...prevLogs, message]);
|
|
16
|
+
};
|
|
17
|
+
const handleClick = () => {
|
|
16
18
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
28
|
-
|
|
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('
|
|
34
|
-
|
|
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
|
-
}),
|
|
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: "
|
|
48
|
-
children: "
|
|
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
|
}
|