Role checks in client components: export them from /client, fix the docs
access.md and the 1.16.4 upgrade notes led projects to import isAdmin from
'@intecion/ipal-kit' in a client component; with `next build --webpack` that
fails ('server-only' cannot be imported from a Client Component module).
No existing entry had a client-safe one, so '@intecion/ipal-kit/client' now
exports hasMinimumRole, isAdmin, isEditor and the type Role; the main entry
keeps them for server code.
Docs: access.md (snippet with imports, server vs client, useConfig() carries
admin.user only), AGENT.md, ipal-debug, ipal-reference, ipal-upgrade, the
1.16.4 note, an Unreleased changelog entry. Tests: /client reaches no
server-only module, the predicates' answers with a client config, no
client-component example in the docs imports the main entry.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1270ebc3d1
commit
de414a81a8
@@ -1,4 +1,8 @@
|
||||
'use client'
|
||||
// Role predicates for client components (the main entry reaches 'server-only' modules and does not build
|
||||
// there with webpack). Concrete file, not the access barrel. On the server import them from the main entry.
|
||||
export { hasMinimumRole, isAdmin, isEditor } from '../modules/access/predicates.js'
|
||||
export type { Role } from '../modules/access/types.js'
|
||||
export { A11Y_DEFAULT_TEXTS, AccessibilityProvider, AccessibilityWidget, useAccessibility } from '../modules/accessibility/client.js'
|
||||
export type { A11yClassNames, A11yState, A11yTexts } from '../modules/accessibility/client.js'
|
||||
export { Analytics } from '../modules/analytics/client.js'
|
||||
|
||||
Reference in New Issue
Block a user