@metagptx/web-sdk 0.0.26 → 0.0.27
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.d.ts +1 -0
- package/dist/index.js +15 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -183,6 +183,7 @@ interface PluginOptions {
|
|
|
183
183
|
*/
|
|
184
184
|
declare function viteDefaultRoutes(options?: PluginOptions): {
|
|
185
185
|
name: string;
|
|
186
|
+
enforce: string;
|
|
186
187
|
resolveId(id: string): string | null;
|
|
187
188
|
load(id: string): string | null;
|
|
188
189
|
transform(code: string, id: string): {
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,11 @@ import e from"axios";import t from"qs";const n=e=>{let t=e.response?.status;if(t
|
|
|
2
2
|
import { createClient } from '@metagptx/web-sdk';
|
|
3
3
|
|
|
4
4
|
// Create client instance
|
|
5
|
-
|
|
5
|
+
const client = createClient();
|
|
6
6
|
|
|
7
7
|
export default function NotFoundPage() {
|
|
8
|
+
const isInMGXIframe =
|
|
9
|
+
window.self !== window.top && window.name?.includes('devIframe');
|
|
8
10
|
return (
|
|
9
11
|
<div className="min-h-screen flex flex-col items-center justify-center bg-gradient-to-br from-gray-50 to-blue-50 p-6 text-center">
|
|
10
12
|
<div className="space-y-6 max-w-md">
|
|
@@ -22,17 +24,23 @@ export default function NotFoundPage() {
|
|
|
22
24
|
<Button asChild>
|
|
23
25
|
<a href="/">Return Home</a>
|
|
24
26
|
</Button>
|
|
25
|
-
|
|
26
|
-
client.frame.createPage()
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
{isInMGXIframe ? (
|
|
28
|
+
<Button variant="outline" onClick={() => client.frame.createPage()}>
|
|
29
|
+
Create page
|
|
30
|
+
</Button>
|
|
31
|
+
) : (
|
|
32
|
+
<Button
|
|
33
|
+
variant="outline"
|
|
34
|
+
onClick={() => (window.location.href = 'https://mgx.dev')}
|
|
35
|
+
>
|
|
36
|
+
Go to MGX
|
|
37
|
+
</Button>
|
|
38
|
+
)}
|
|
30
39
|
</div>
|
|
31
40
|
</div>
|
|
32
41
|
</div>
|
|
33
42
|
);
|
|
34
43
|
}
|
|
35
|
-
|
|
36
44
|
`,m=[{path:`*`,componentName:`NotFoundPage`,componentCode:p}];function h(e={}){let t=e.routes||m,n=new Map;return t.forEach(e=>{let t=`\0virtual:${e.componentName.toLowerCase()}.tsx`;n.set(t,e.componentCode)}),{name:`vite-default-routes`,enforce:`pre`,resolveId(e){for(let n of t){let t=`virtual:${n.componentName.toLowerCase()}`;if(e===t)return`\0${t}.tsx`}return null},load(e){return n.get(e)||null},transform(e,n){if(!n.includes(`App.tsx`)||n.includes(`node_modules`))return null;let r=t.every(t=>e.includes(`import ${t.componentName}`)&&e.includes(t.path));if(r)return null;let i=e,a=[];if(t.forEach(t=>{if(!e.includes(`import ${t.componentName}`)){let e=`virtual:${t.componentName.toLowerCase()}`;a.push(`import ${t.componentName} from '${e}';`)}}),a.length>0){let n=e.match(/(import AuthError from[^;]+;)/);n&&(i=i.replace(n[0],`${n[0]}\n${a.join(`
|
|
37
45
|
`)}`));let r=t,o=r.map(e=>` <Route path="${e.path}" element={<${e.componentName} />} />`).join(`
|
|
38
46
|
`),s=i.match(/(\s+)(<\/Routes>)/i);s&&(i=i.replace(s[0],`${s[1]}${o}\n${s[0]}`))}return i===e?null:{code:i,map:null}}}}export{f as createClient,h as viteDefaultRoutes};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metagptx/web-sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.27",
|
|
5
5
|
"packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b",
|
|
6
6
|
"description": "TypeScript SDK for interacting with FuncSea API",
|
|
7
7
|
"author": "MetaGPTX",
|