You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preserve the React host contract: an injected EIP-1193 provider and optional themeOverrides must reach AiCreditsWidget without selecting window.ethereum.
Give the Custom Element the equivalent provider and theming handoff, including its existing events, while keeping all AI Credits configuration, transaction, success, and error UI widget-owned.
Keep production backend, RPC, and contract defaults internal to AI Credits. Development/test overrides remain optional only.
If required production configuration is unavailable, display a clear disabled/error state; never fall back to mock backend or chain clients.
Make @goodwidget/ai-credits-widget/register a no-op during Node/Next.js module evaluation and register the element normally in browsers.
Publish typed ESM and CommonJS entries for ., ./element, and ./register; the packed tarball must include their built artifacts.
Document the exact EIP-1193 request methods used by the widget so GoodWallet can grant only the required capabilities.
Do not add GoodWallet repository changes, release automation, integration manifests, or publishing work.
Trace AiCreditsWidget.tsx, widgetRuntimeContract.ts, element.ts, and createMiniAppElement.tsx to map the React and Custom Element provider/theme handoffs and identify the smallest bridge changes needed.
Audit backendClient.ts and chainClient.ts configuration selection so production defaults remain widget-owned and unavailable production configuration fails closed rather than choosing mock clients.
Update the guarded register.ts, package export map, tsup build entries, and package files configuration only as required for SSR-safe React, element, and register consumer imports.
Add focused AI Credits unit/integration coverage for provider and theme propagation, element events, SSR registration behavior, production configuration failures, EIP-1193 requests, package artifacts, and a clean packed-package Next.js production build.
Update AI Credits documentation with the minimum EIP-1193 methods used and any consumer-facing installation/import expectations.
Run the issue-required build, lint, SSR import check, and relevant AI Credits tests; capture Storybook/Playwright evidence where the widget behavior changes.
Acceptance criteria
React and Custom Element integrations pass injected provider and optional theme overrides to AiCreditsWidget without accessing GoodWallet signer or session internals.
AI Credits owns production backend, RPC, and contract defaults; missing production configuration produces a clear disabled/error state and never chooses mock clients.
Server evaluation of @goodwidget/ai-credits-widget/register is harmless, and browser evaluation registers the Custom Element.
Typed ESM and CommonJS exports exist for ., ./element, and ./register, and their built consumer entries are included in the packed tarball.
A clean Next.js consumer can install the tarball and complete a production build.
Tests cover configuration/provider/theming handoff, Custom Element events, missing production configuration, and the exact EIP-1193 request methods.
pnpm build, pnpm lint, an SSR import check, and relevant AI Credits tests pass.
No GoodWallet repository changes, release automation, integration manifests, or publishing changes are included.
[PLAN] Prepare AI Credits Widget for GoodWallet integration
Parent: #132
Required states, flows, and behaviors
providerand optionalthemeOverridesmust reachAiCreditsWidgetwithout selectingwindow.ethereum.@goodwidget/ai-credits-widget/registera no-op during Node/Next.js module evaluation and register the element normally in browsers..,./element, and./register; the packed tarball must include their built artifacts.Execution plan
AiCreditsWidget.tsx,widgetRuntimeContract.ts,element.ts, andcreateMiniAppElement.tsxto map the React and Custom Element provider/theme handoffs and identify the smallest bridge changes needed.backendClient.tsandchainClient.tsconfiguration selection so production defaults remain widget-owned and unavailable production configuration fails closed rather than choosing mock clients.register.ts, package export map, tsup build entries, and package files configuration only as required for SSR-safe React, element, and register consumer imports.Acceptance criteria
AiCreditsWidgetwithout accessing GoodWallet signer or session internals.@goodwidget/ai-credits-widget/registeris harmless, and browser evaluation registers the Custom Element..,./element, and./register, and their built consumer entries are included in the packed tarball.pnpm build,pnpm lint, an SSR import check, and relevant AI Credits tests pass.Human-reviewer checklist