diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9ab276f..46ac7b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,8 +99,8 @@ importers: sdk-playground/packages/client: dependencies: '@discord/embedded-app-sdk': - specifier: ^1.7.0 - version: 1.7.0 + specifier: ^1.8.1 + version: 1.8.1 '@radix-ui/colors': specifier: ^3.0.0 version: 3.0.0 @@ -398,6 +398,9 @@ packages: '@discord/embedded-app-sdk@1.7.0': resolution: {integrity: sha512-lHoDTtNzJlrajlmXhbjQukl07GwUKH91CqVqr8lEYyOPu8uiAZJZ3E7yx6EX53kert2z8w7ksYVnE9TZzbvb2Q==} + '@discord/embedded-app-sdk@1.8.1': + resolution: {integrity: sha512-Mb24qGDNeynmg6mt1pCayMhUzS16jpo3v/iWMeyq01C5gTfEqhoJ8XrHlDywExxMBDAS7s1SYW6nBoidSYL74w==} + '@esbuild-plugins/node-globals-polyfill@0.2.3': resolution: {integrity: sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==} peerDependencies: @@ -2851,6 +2854,17 @@ snapshots: uuid: 10.0.0 zod: 3.23.8 + '@discord/embedded-app-sdk@1.8.1': + dependencies: + '@types/lodash.transform': 4.6.9 + '@types/uuid': 10.0.0 + big-integer: 1.6.52 + decimal.js-light: 2.5.1 + eventemitter3: 5.0.1 + lodash.transform: 4.6.0 + uuid: 10.0.0 + zod: 3.23.8 + '@esbuild-plugins/node-globals-polyfill@0.2.3(esbuild@0.17.19)': dependencies: esbuild: 0.17.19 diff --git a/sdk-playground/packages/client/package.json b/sdk-playground/packages/client/package.json index 5643f2b..661b137 100644 --- a/sdk-playground/packages/client/package.json +++ b/sdk-playground/packages/client/package.json @@ -13,7 +13,7 @@ "tsc": "tsc" }, "dependencies": { - "@discord/embedded-app-sdk": "^1.7.0", + "@discord/embedded-app-sdk": "^1.8.1", "@radix-ui/colors": "^3.0.0", "@radix-ui/react-scroll-area": "^1.0.1", "@stitches/react": "^1.2.1", diff --git a/sdk-playground/packages/client/src/App.tsx b/sdk-playground/packages/client/src/App.tsx index a8dc24a..3dd8bd1 100755 --- a/sdk-playground/packages/client/src/App.tsx +++ b/sdk-playground/packages/client/src/App.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {BrowserRouter as Router, Routes, Route, Link, useLocation} from 'react-router-dom'; +import {BrowserRouter as Router, Routes, Route, Link, useLocation, useNavigate} from 'react-router-dom'; import * as Scrollable from './components/Scrollable'; import {AuthProvider} from './components/AuthProvider'; @@ -43,6 +43,8 @@ import {useState} from 'react'; import GetActivityInstance from "./pages/GetActivityInstance"; import CloseActivity from "./pages/CloseActivity"; +import discordSdk from './discordSdk'; + // Add contexts here export default function App(): React.ReactElement { return ( @@ -230,9 +232,19 @@ const routes: Record = { }, }; +let navigateOnInit = true; + function RootedApp(): React.ReactElement { const location = useLocation(); const [query, setQuery] = useState(''); + const navigate = useNavigate(); + + React.useEffect(() => { + if (navigateOnInit && discordSdk.customId === 'PAGE_GET_SKUS') { + navigate('/get-skus'); + navigateOnInit = false; + } + }, [navigate]); return ( diff --git a/sdk-playground/packages/client/src/pages/Home.tsx b/sdk-playground/packages/client/src/pages/Home.tsx index 45adf13..7651ff8 100644 --- a/sdk-playground/packages/client/src/pages/Home.tsx +++ b/sdk-playground/packages/client/src/pages/Home.tsx @@ -17,7 +17,9 @@ export default function Home() {



Basic Activity Info

+

Custom ID: {discordSdk.customId}

Instance ID: {instanceId}

+

Referrer ID: {discordSdk.referrerId}

Client ID: {clientId}

Channel ID: {channelId}

{ guildId != null ? (

Guild ID: {guildId}

) : null }