Skip to content

P-2202: Examples: Add Angular example for the Formo Web SDK#78

Merged
keiloktql merged 1 commit into
mainfrom
keilok/add-angular-docs-and-example-links
May 20, 2026
Merged

P-2202: Examples: Add Angular example for the Formo Web SDK#78
keiloktql merged 1 commit into
mainfrom
keilok/add-angular-docs-and-example-links

Conversation

@keiloktql

@keiloktql keiloktql commented May 20, 2026

Copy link
Copy Markdown
Member
export-1779247736242.mp4

Summary

Adds an Angular install path to the Web SDK install instructions on both /install and /sdks/web, plus three new "Code examples" cards (with-crossmint, with-openfort, with-angular). Angular gets its own section because FormoAnalyticsProvider / useFormo() and wagmi are React-only — Angular apps install Formo via the framework-agnostic FormoAnalytics.init() core, which carries a couple of esbuild-specific gotchas (Buffer polyfill, allowedCommonJsDependencies) worth surfacing inline rather than only in the example app.

Key Changes

sdks/web.mdx:

  • New ### Angular section under ## Installation — install command, src/polyfills.ts + angular.json (Buffer polyfill + allowedCommonJsDependencies for the SDK's React re-exports), FormoAnalyticsService wrapping FormoAnalytics.init(), provideAppInitializer wiring, and a one-line note that Angular Router pushState page events are autocaptured (don't subscribe to NavigationEnd)
  • New <Tab title="Angular"> in the ## Identify users Tabs block — minimal WalletService.connect() showing identify-on-connect
  • Three new cards in ## Code examples: Crossmint (Next.js + Crossmint embedded smart wallets, manual instrumentation — no EIP-1193), Openfort (Vite + React + Shield encryption sessions + Aave demo), Angular (Angular 21 + bare EIP-1193 + viem)

install.mdx:

  • New <Tab icon="angular" title="Angular"> in the main install Tabs block — same numbered structure as the Wagmi/React/Next.js tabs (install → polyfill → service → app initializer → identify → track)

Heads up:

  • The Angular card and inline section link to https://github.com/getformo/examples/tree/main/with-angular, which is still on PR branch keilok/angular-example-with-formo-web-sdk (getformo/examples#27) — those links 404 until that PR merges.

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

@keiloktql keiloktql requested a review from yosriady May 20, 2026 03:30
@keiloktql keiloktql self-assigned this May 20, 2026
@linear-code

linear-code Bot commented May 20, 2026

Copy link
Copy Markdown

P-2202

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds detailed documentation and code examples for integrating the Formo SDK with Angular, including installation steps, polyfill setup, and usage examples for identifying users and tracking events. The review feedback suggests standardizing package manager commands to npm for consistency, adding null checks for window.ethereum to prevent potential runtime crashes, and correcting a version number typo from Angular 21 to 19.

Comment thread install.mdx
Comment on lines +653 to +654
pnpm add @formo/analytics buffer viem
pnpm add -D @ngx-env/builder

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency with the rest of the documentation which primarily uses npm, it's better to use npm commands here as well.

    npm install @formo/analytics buffer viem --save
    npm install @ngx-env/builder --save-dev

Comment thread install.mdx
Comment on lines +750 to +754
async connect(): Promise<void> {
const [account] = await window.ethereum!.request({ method: 'eth_requestAccounts' });
this.address.set(account);
this.formo.identify(account);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using a non-null assertion (!) on window.ethereum can lead to runtime errors if the user does not have a wallet extension installed. It is safer to check for its existence before attempting to use it.

      async connect(): Promise<void> {
        if (!window.ethereum) return;
        const [account] = await window.ethereum.request({ method: 'eth_requestAccounts' });
        this.address.set(account);
        this.formo.identify(account);
      }

Comment thread sdks/web.mdx
Comment on lines +317 to +321
async connect(): Promise<void> {
const [account] = await window.ethereum!.request({ method: 'eth_requestAccounts' });
this.address.set(account);
this.formo.identify(account);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using a non-null assertion (!) on window.ethereum can lead to runtime errors if the user does not have a wallet extension installed. It is safer to check for its existence before attempting to use it.

      async connect(): Promise<void> {
        if (!window.ethereum) return;
        const [account] = await window.ethereum.request({ method: 'eth_requestAccounts' });
        this.address.set(account);
        this.formo.identify(account);
      }

Comment thread sdks/web.mdx
icon="file-code"
href="https://github.com/getformo/examples/tree/main/with-angular"
>
Angular 21 + bare EIP-1193 + viem. Uses the framework-agnostic SDK core.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

"Angular 21" appears to be a typo, as the current stable version is 19 and version 21 is not yet released.

    Angular 19 + bare EIP-1193 + viem. Uses the framework-agnostic SDK core.

@keiloktql keiloktql merged commit 6f3cebb into main May 20, 2026
4 checks passed
@keiloktql keiloktql deleted the keilok/add-angular-docs-and-example-links branch May 20, 2026 03:38
@Ducksss

Ducksss commented Jun 17, 2026

Copy link
Copy Markdown

Cursor size is huge 🆙

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.

3 participants