Skip to content

Move DefaultAppKitProvider into @goodwidget/embed and expose as subpath export#83

Open
sirpy with Copilot wants to merge 8 commits into
mainfrom
copilot/feat-add-default-reown-appkit-provider
Open

Move DefaultAppKitProvider into @goodwidget/embed and expose as subpath export#83
sirpy with Copilot wants to merge 8 commits into
mainfrom
copilot/feat-add-default-reown-appkit-provider

Conversation

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

DefaultAppKitProvider lived in the ai-credits app, but is also consumed by Storybook runtime fixtures. This PR relocates it to packages/embed so provider wiring is owned by the embedding layer and reused through a package export.

  • Provider ownership and location

    • Moved DefaultAppKitProvider from apps/ai-credits-web to packages/embed/src/DefaultAppKitProvider.tsx.
    • Added embed-local ImportMetaEnv typing for VITE_REOWN_PROJECT_ID.
  • Public API surface

    • Added @goodwidget/embed/appkit-provider subpath export (src/appkitProvider.ts + package exports).
    • Kept package-level export available from packages/embed/src/index.ts.
    • Updated embed build entries so the subpath is emitted in dist.
  • Consumer updates

    • Updated ai-credits web app and ai-credits Storybook QA stories to import from @goodwidget/embed/appkit-provider.
    • Added required workspace/dependency wiring for @goodwidget/embed and @reown/appkit in affected package manifests.
// before
import { DefaultAppKitProvider } from './DefaultAppKitProvider'
// or deep app path imports from Storybook

// after
import { DefaultAppKitProvider } from '@goodwidget/embed/appkit-provider'

Copilot AI linked an issue Jul 15, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits July 15, 2026 08:29
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add default reown appkit provider with environment variable support feat(ai-credits-web): add default Reown AppKit provider and wire ai-credits app to it Jul 15, 2026
Copilot AI requested a review from sirpy July 15, 2026 08:39
Copilot finished work on behalf of sirpy July 15, 2026 08:39
Copilot AI and others added 2 commits July 15, 2026 08:47
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Copilot AI changed the title feat(ai-credits-web): add default Reown AppKit provider and wire ai-credits app to it Move DefaultAppKitProvider into @goodwidget/embed and expose as subpath export Jul 15, 2026
Copilot finished work on behalf of sirpy July 15, 2026 08:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR relocates DefaultAppKitProvider into @goodwidget/embed and exposes it via a new @goodwidget/embed/appkit-provider subpath export, then updates Ai Credits consumers (web app + Storybook + Playwright) to use the shared embedding-layer provider wiring.

Changes:

  • Added @goodwidget/embed/appkit-provider subpath export (plus tsup entry + package exports) and re-exported DefaultAppKitProvider from @goodwidget/embed.
  • Introduced an optional connectOverride hook-up from widget props → GoodWidgetProvider → connect logic to support AppKit modal-driven connect flows.
  • Updated Ai Credits Storybook stories and Playwright state tests to cover AppKit “connect wallet” behavior (including a “no config” fallback path).

Reviewed changes

Copilot reviewed 17 out of 117 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/widgets/ai-credits-widget/states.spec.ts Adds new Playwright states/tests for AppKit provider/connect flows and screenshots.
packages/embed/tsup.config.ts Emits an additional build entry for the new subpath export.
packages/embed/src/index.ts Re-exports DefaultAppKitProvider at the package root.
packages/embed/src/importMeta.d.ts Adds embed-local ImportMetaEnv typing for VITE_REOWN_PROJECT_ID.
packages/embed/src/DefaultAppKitProvider.tsx New shared AppKit provider component (moved from app).
packages/embed/src/appkitProvider.ts New subpath module re-exporting provider + AppKit hooks/helpers.
packages/embed/package.json Adds subpath export map and new AppKit/Wagmi-related dependencies.
packages/core/src/types.ts Adds connectOverride to GoodWidgetProviderProps.
packages/core/src/provider.tsx Uses connectOverride to customize connect behavior.
packages/ai-credits-widget/src/widgetRuntimeContract.ts Adds connectOverride to widget runtime contract.
packages/ai-credits-widget/src/AiCreditsWidget.tsx Threads connectOverride through to GoodWidgetProvider.
packages/ai-credits-widget/src/adapter.ts Improves connect cancellation handling; formatting/refactors.
examples/storybook/src/stories/helpers/aiCreditsWidgetStories.tsx Adds AppKit story wiring using shared embed provider.
examples/storybook/src/stories/ai-credits-widget/AiCreditsWidgetShowcase.stories.tsx Adds WalletConnect/AppKit story to showcase.
examples/storybook/src/stories/ai-credits-widget/AiCreditsWidgetQA.stories.tsx Adds QA play interaction to open the AppKit modal.
examples/storybook/src/globals.d.ts Adds Storybook env typings for Ai Credits + AppKit vars.
examples/storybook/package.json Adds @goodwidget/embed dependency for Storybook usage.
apps/ai-credits-web/src/globals.d.ts Adds VITE_REOWN_PROJECT_ID typing.
apps/ai-credits-web/src/App.tsx Migrates app to AppKit-based connect flow via embed provider + connectOverride.
apps/ai-credits-web/package.json Adds @goodwidget/embed and AppKit dependency wiring.

Comment thread packages/embed/src/DefaultAppKitProvider.tsx Outdated
Comment thread examples/storybook/src/stories/helpers/aiCreditsWidgetStories.tsx
Comment thread apps/ai-credits-web/src/App.tsx
Comment thread tests/widgets/ai-credits-widget/states.spec.ts Outdated
Comment thread packages/embed/src/DefaultAppKitProvider.tsx Outdated
Comment thread packages/embed/src/DefaultAppKitProvider.tsx Outdated
Comment thread examples/storybook/src/stories/helpers/aiCreditsWidgetStories.tsx Outdated
@blueogin

Copy link
Copy Markdown
Contributor

@copilot
Address comments in my last review

@L03TJ3

L03TJ3 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@blueogin we need to provide the reown project id, copilot cannot provide one for us afaik.
can it not be included in the env handling you have for ai-credits?

…ect ID, add no-config fallback, fix comment

Co-authored-by: blueogin <43612769+blueogin@users.noreply.github.com>

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot
Address comments in my last review

All review comments addressed in commit fix: address PR review comments:

  • DefaultAppKitProvider.tsx: Removed unused createAppKit import; moved wagmiAdapter creation inside the component via useMemo so it uses the real VITE_REOWN_PROJECT_ID (or the projectId prop) instead of the hard-coded placeholder.
  • Storybook story: Removed the hard-coded fallback project ID (?? 'f21d11c79300d20c1e27975b31eb1643') so the "not configured" placeholder actually renders when the env var is absent; changed the YStack wrapper in AppKitConnectShell to a plain div to avoid Tamagui theme hooks running outside a provider context.
  • App.tsx: Added an explicit early-return fallback that renders a "not configured" message when VITE_REOWN_PROJECT_ID is missing, so AiCreditsWidgetApp (which calls AppKit hooks) is never mounted without a provider.
  • states.spec.ts: Corrected the comment on line 202 from <appkit-modal> to <w3m-modal> to match the actual locator being asserted.

Copilot AI requested a review from blueogin July 15, 2026 15:27
@L03TJ3
L03TJ3 marked this pull request as ready for review July 15, 2026 16:22
@L03TJ3
L03TJ3 requested a review from a team July 15, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: add default reown appkit provider

5 participants