From 358a2a3de8126f4923ce53e6a75b1b82c71e3356 Mon Sep 17 00:00:00 2001 From: morizon Date: Tue, 14 Jan 2025 15:07:46 +0800 Subject: [PATCH] fix: webembed settings --- apps/web-embed/pages/AppProvider.tsx | 9 ++++++++- .../web-embed/pages/PageWebEmbedPrimePurchase.tsx | 8 ++------ apps/web-embed/utils/webEmbedAppSettings.ts | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 apps/web-embed/utils/webEmbedAppSettings.ts diff --git a/apps/web-embed/pages/AppProvider.tsx b/apps/web-embed/pages/AppProvider.tsx index ac844cf6f90..ab58ab65560 100644 --- a/apps/web-embed/pages/AppProvider.tsx +++ b/apps/web-embed/pages/AppProvider.tsx @@ -1,13 +1,20 @@ import { ConfigProvider } from '@onekeyhq/components'; +import webEmbedAppSettings from '../utils/webEmbedAppSettings'; + export default function AppProvider({ children, }: { children: React.ReactNode; }) { + const settings = webEmbedAppSettings.getSettings(); + // TODO Toast support return ( - + {children} ); diff --git a/apps/web-embed/pages/PageWebEmbedPrimePurchase.tsx b/apps/web-embed/pages/PageWebEmbedPrimePurchase.tsx index 4a3d38df7cb..f9ce3224615 100644 --- a/apps/web-embed/pages/PageWebEmbedPrimePurchase.tsx +++ b/apps/web-embed/pages/PageWebEmbedPrimePurchase.tsx @@ -9,6 +9,7 @@ import purchasesSdk from '@onekeyhq/kit/src/views/Prime/purchasesSdk/purchasesSd import errorToastUtils from '@onekeyhq/shared/src/errors/utils/errorToastUtils'; import type { Package } from '@revenuecat/purchases-js'; +import webEmbedAppSettings from '../utils/webEmbedAppSettings'; export default function PageWebEmbedPrimePurchase() { const [packages, setPackages] = useState([]); @@ -16,16 +17,11 @@ export default function PageWebEmbedPrimePurchase() { null, ); - // 使用 useSearchParams 获取查询参数 const [searchParams] = useSearchParams(); const primeUserId = searchParams.get('primeUserId') || ''; const primeUserEmail = searchParams.get('primeUserEmail') || ''; - // @ts-ignore - const settings = window.WEB_EMBED_ONEKEY_APP_SETTINGS as { - themeVariant: string; - localeVariant: string; - }; + const settings = webEmbedAppSettings.getSettings(); return (