Skip to content

Add provideFingerprint() for standalone Angular apps and Angular 21 demo #99

Open
ilfa wants to merge 7 commits into
mainfrom
INTER-2147-add-environment-provider
Open

Add provideFingerprint() for standalone Angular apps and Angular 21 demo #99
ilfa wants to merge 7 commits into
mainfrom
INTER-2147-add-environment-provider

Conversation

@ilfa
Copy link
Copy Markdown
Member

@ilfa ilfa commented May 26, 2026

Summary

  • Adds provideFingerprint() — a new EnvironmentProviders-based function for configuring Fingerprint in standalone Angular applications (Angular 14+) via bootstrapApplication / ApplicationConfig
  • FingerprintModule.forRoot() remains fully supported for NgModule-based apps (backward compatible)
  • Adds demo-angular21 — a demo application built with Angular 21, showcasing modern Angular patterns: standalone components, inject(), signals, and new control flow syntax (@if)
  • Fixes dual Angular instance issue in the monorepo caused by pnpm resolving @angular/core to two different store entries

Comment thread src/environments/environment.prod.ts Outdated
@ilfa ilfa force-pushed the INTER-2147-add-environment-provider branch from 9821707 to 022c790 Compare May 26, 2026 18:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75% (+0.71% 🔼)
30/40
🟡 Branches 60% 3/5
🟢 Functions
83.33% (+3.33% 🔼)
5/6
🟡 Lines
72.97% (+1.1% 🔼)
27/37
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / fingerprint.providers.ts
100% 100% 100% 100%

Test suite run success

10 tests passing in 2 suites.

Report generated by 🧪jest coverage report action from 9f3f1d8

Show full coverage report
St File % Stmts % Branch % Funcs % Lines Uncovered Line #s
🟡 All files 75 60 83.33 72.97
🔴  src 0 100 100 0
🔴   public-api.ts 0 100 100 0 5-13
🟢  src/lib 93.33 60 100 92.59
🟢   fingerprint.module.ts 100 100 100 100
🟢   fingerprint.providers.ts 100 100 100 100
🟢   fingerprint.service.ts 89.47 60 100 88.88 57,64
🟢   version.ts 100 100 100 100
🟡  src/lib/tokens 66.66 100 0 66.66
🟡   fingerprint-angular-settings-token.ts 66.66 100 0 66.66 7

@ilfa ilfa force-pushed the INTER-2147-add-environment-provider branch from 916ef88 to eb2a04c Compare May 26, 2026 18:48
Comment thread .changeset/add-provide-fingerprint.md Outdated
'@fingerprint/angular': minor
---

Add `provideFingerprint` function for standalone Angular applications (Angular 14+).
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.

It seems package.json required Angular 15+ ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's right, I also added a link to the Angular docs

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adds first-class standalone-app configuration support for the Fingerprint Angular SDK via a new provideFingerprint() API, and introduces a new Angular 21 demo app to showcase modern Angular patterns alongside the existing NgModule-based demo.

Changes:

  • Added provideFingerprint(settings) (EnvironmentProviders) and exported it from the library public API, with Jest unit tests.
  • Updated demo config naming (fingerprintPublicKey) and test TS configs to include Node types.
  • Added a new projects/demo-angular21 standalone Angular 21 demo app and adjusted workspace/pnpm settings for the monorepo.

Reviewed changes

Copilot reviewed 41 out of 44 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tsconfig.spec.json Adds node types for Jest specs.
src/environments/environment.ts Renames demo env key to fingerprintPublicKey.
src/environments/environment.prod.ts Adds fingerprintPublicKey to prod env.
src/app/app.module.ts Updates demo module config to use renamed env key.
README.md Updates demo instructions to match new env placeholder text.
projects/fingerprintjs-pro-angular/tsconfig.spec.json Adds node types for library Jest specs.
projects/fingerprintjs-pro-angular/src/public-api.ts Exports the new standalone providers entrypoint.
projects/fingerprintjs-pro-angular/src/lib/fingerprint.providers.ts Implements provideFingerprint() via makeEnvironmentProviders.
projects/fingerprintjs-pro-angular/src/lib/fingerprint.providers.spec.ts Adds unit tests validating standalone provider configuration.
projects/demo-angular21/tsconfig.spec.json Adds Vitest globals typing for demo tests.
projects/demo-angular21/tsconfig.json Sets strict TS + local path mapping to workspace library sources.
projects/demo-angular21/tsconfig.app.json App TS config for demo build.
projects/demo-angular21/src/styles.css Adds global styles placeholder.
projects/demo-angular21/src/main.ts Bootstraps the demo using bootstrapApplication.
projects/demo-angular21/src/index.html Adds demo HTML host page.
projects/demo-angular21/src/environments/environment.ts Adds dev env with fingerprintPublicKey.
projects/demo-angular21/src/environments/environment.prod.ts Adds prod env with fingerprintPublicKey.
projects/demo-angular21/src/app/preloaded/preloaded.ts Adds preloaded demo component using inject() + signals.
projects/demo-angular21/src/app/preloaded/preloaded.html Adds preloaded component template.
projects/demo-angular21/src/app/preloaded/preloaded.css Adds preloaded component styles.
projects/demo-angular21/src/app/home/home.ts Adds home demo component showing getVisitorData() usage.
projects/demo-angular21/src/app/home/home.html Adds home component template using @if control flow.
projects/demo-angular21/src/app/home/home.css Adds home component styles.
projects/demo-angular21/src/app/app.ts Adds standalone root component wiring the demo pages.
projects/demo-angular21/src/app/app.spec.ts Adds demo unit tests (currently inconsistent with app code/template).
projects/demo-angular21/src/app/app.html Adds root template (currently uses self-closing custom elements).
projects/demo-angular21/src/app/app.css Adds root component styles.
projects/demo-angular21/src/app/app.config.ts Configures providers, including provideFingerprint() usage.
projects/demo-angular21/README.md Adds generated Angular CLI README for demo project.
projects/demo-angular21/package.json Adds demo dependencies/devDependencies (currently mismatched eslint tooling versions).
projects/demo-angular21/angular.json Adds Angular 21 project config (currently references missing env.dev replacement).
projects/demo-angular21/.vscode/tasks.json Adds VS Code tasks for running/attaching to demo.
projects/demo-angular21/.vscode/mcp.json Adds Angular CLI MCP server config for VS Code.
projects/demo-angular21/.vscode/launch.json Adds VS Code launch configs for serve/test.
projects/demo-angular21/.vscode/extensions.json Recommends Angular extension.
projects/demo-angular21/.prettierrc Adds demo-local Prettier config.
projects/demo-angular21/.gitignore Ignores demo build output and env.dev keys file.
projects/demo-angular21/.eslintrc.json Adds demo-local ESLint config.
projects/demo-angular21/.editorconfig Adds demo-local editor settings.
package.json Adds pnpm config/overrides for workspace dependency behavior.
.gitignore Ignores per-project build outputs in workspace.
.changeset/add-provide-fingerprint.md Adds changeset entry for the new provideFingerprint() API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread projects/demo-angular21/src/app/app.ts
Comment thread projects/demo-angular21/src/app/home/home.ts
Comment thread projects/demo-angular21/src/app/preloaded/preloaded.ts
Comment thread projects/demo-angular21/src/app/app.spec.ts Outdated
Comment thread projects/demo-angular21/src/app/app.spec.ts Outdated
Comment thread projects/demo-angular21/src/app/app.html
Comment thread projects/demo-angular21/angular.json
Comment thread projects/demo-angular21/package.json
@github-actions
Copy link
Copy Markdown
Contributor

🚀 Following releases will be created using changesets from this PR:

@fingerprint/angular@3.0.0-test.4

Minor Changes

  • Add provideFingerprint function for standalone Angular applications (Angular 15+).

    This allows configuring the SDK without NgModule in bootstrapApplication or ApplicationConfig:

    import { provideFingerprint } from '@fingerprint/angular'
    
    export const appConfig: ApplicationConfig = {
      providers: [provideFingerprint({ startOptions: { apiKey: 'your-api-key' } })],
    }

    FingerprintModule.forRoot() remains available for NgModule-based applications. (fbf3eb8)

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