feat(clerk-js,localizations,types): Last authentication strategy#6722
feat(clerk-js,localizations,types): Last authentication strategy#6722
Conversation
🦋 Changeset detectedLatest commit: 925e686 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds "Last used" support: new LastAuthenticationStrategy types and client field, UI badge component and wiring into SignIn/Social buttons, distribution util change, many localization entries, integration tests, appearance key, spacing token, and small tooling/changeset updates. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant B as Browser UI
participant C as ClerkJS Client
participant API as /v1/client
U->>B: Open Sign In/Sign Up
B->>C: Initialize client
C->>API: GET /v1/client
API-->>C: { ..., last_authentication_strategy }
C-->>B: client.lastAuthenticationStrategy set
rect #f0f8ff
note right of B: Render logic uses lastAuthenticationStrategy
B->>B: SignInStart checks validLastAuthenticationStrategies
B->>B: SocialButtons calls distributeStrategiesIntoRows(..., lastAuth)
B->>B: Render LastAuthenticationStrategyBadge overlay on matching provider/input
end
sequenceDiagram
autonumber
participant B as Browser UI
participant Util as distributeStrategiesIntoRows
B->>Util: (strategies, maxPerRow, lastAuthStrategy)
alt lastAuthStrategy present
Util-->>B: { strategyRows: [[last], ...rest], lastAuthenticationStrategyPresent: true }
else
Util-->>B: { strategyRows: [...computed], lastAuthenticationStrategyPresent: false }
end
B->>B: Compute row lengths and render UI accordingly
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Poem
✨ Finishing Touches
🧪 Generate unit tests
Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
5a6730a to
2c2e6bd
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/localizations/src/nl-BE.ts (1)
16-16: Switch to nl-BE—also update date/time formattersLocale id looks good. Align the dates block to 'nl-BE' for consistent CLDR formatting.
- lastDay: "Gisteren om {{ date | timeString('nl-NL') }}", - next6Days: "{{ date | weekday('nl-NL','long') }} om {{ date | timeString('nl-NL') }}", - nextDay: "Morgen om {{ date | timeString('nl-NL') }}", - numeric: "{{ date | numeric('nl-NL') }}", - previous6Days: "Vorige {{ date | weekday('nl-NL','long') }} om {{ date | timeString('nl-NL') }}", - sameDay: "Vandaag om {{ date | timeString('nl-NL') }}", + lastDay: "Gisteren om {{ date | timeString('nl-BE') }}", + next6Days: "{{ date | weekday('nl-BE','long') }} om {{ date | timeString('nl-BE') }}", + nextDay: "Morgen om {{ date | timeString('nl-BE') }}", + numeric: "{{ date | numeric('nl-BE') }}", + previous6Days: "Vorige {{ date | weekday('nl-BE','long') }} om {{ date | timeString('nl-BE') }}", + sameDay: "Vandaag om {{ date | timeString('nl-BE') }}",Also applies to: 183-189
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
packages/localizations/src/hu-HU.ts(1 hunks)packages/localizations/src/nl-BE.ts(2 hunks)packages/localizations/src/tr-TR.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/localizations/src/hu-HU.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
packages/localizations/src/tr-TR.tspackages/localizations/src/nl-BE.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/localizations/src/tr-TR.tspackages/localizations/src/nl-BE.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/localizations/src/tr-TR.tspackages/localizations/src/nl-BE.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
packages/localizations/src/tr-TR.tspackages/localizations/src/nl-BE.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Preferreadonlyfor properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertionsfor literal types:as const
Usesatisfiesoperator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noanytypes without justification
Proper error handling with typed errors
Consistent use ofreadonlyfor immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
packages/localizations/src/tr-TR.tspackages/localizations/src/nl-BE.ts
packages/localizations/**/*
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Localization files must be placed in 'packages/localizations/'.
Files:
packages/localizations/src/tr-TR.tspackages/localizations/src/nl-BE.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
packages/localizations/src/tr-TR.tspackages/localizations/src/nl-BE.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build Packages
- GitHub Check: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
packages/localizations/src/tr-TR.ts (1)
252-252: LGTM — Turkish phrasing fixed correctly.“Son kullanılan” reads natural for the badge and aligns with prior feedback. No further changes needed.
packages/localizations/src/nl-BE.ts (1)
252-252: Cross-locale coverage and UI wiring verified
All 53 locale files definelastAuthenticationStrategy, and UI components/tests reference it.
Description
Introduces "Last used" to the AIO components:
By default, everything will act as it does now.
Once opted-in, the API will supply the value resulting in last used social providers being pulled to the top and marked as such. If email/phone/username will also be marked appropriately, with the exception of the toggleable email/phone inputs.
USER-3395
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
New Features
Localization
Tests
Chores