@plasius/profile
v1.0.33
Published
User Profile component for Plasius projects
Readme
@plasius/profile
Public package containing user/profile state and settings providers for Plasius React applications.
Install
npm install @plasius/profileModule formats
This package publishes dual ESM and CJS artifacts.
When CJS output is emitted under dist-cjs/*.js with type: module, dist-cjs/package.json is generated with { "type": "commonjs" } to ensure Node require(...) compatibility.
Usage
import {
ProfileRouteStatusPanel,
SettingsProvider,
UserProvider,
} from "@plasius/profile";UserProvider loads and persists the active profile by the user entity id. Applications should treat partitionKey as storage metadata, not as the profile route identifier.
Both providers also support transport injection so host applications can keep site-specific data access outside the shared package:
import {
SettingsProvider,
UserProvider,
type SettingsDataClient,
type UserProfileClient,
} from "@plasius/profile";
const userClient: UserProfileClient = {
load: async (userId) => graphBackedUserClient.load(userId),
create: async (userId) => graphBackedUserClient.create(userId),
save: async (user) => graphBackedUserClient.save(user),
};
const settingsClient: SettingsDataClient = {
load: async (configUrl) => graphBackedSettingsClient.load(configUrl),
save: async (configUrl, state) => graphBackedSettingsClient.save(configUrl, state),
};
<UserProvider client={userClient}>
<SettingsProvider configUrl="/settings" client={settingsClient}>
<App />
</SettingsProvider>
</UserProvider>;If client is omitted, the package keeps its legacy HTTP behavior via @plasius/auth/useAuthorizedFetch.
Profile-specific route shells are also exported so host applications can keep route state locally while reusing package-owned copy and composition:
<ProfileRouteStatusPanel variant="loading" />
<ProfileRouteStatusPanel variant="provisioning" requestId="profile-route-123" />
<ProfileRouteStatusPanel
variant="error"
attempts={3}
requestId="profile-route-123"
onRetry={() => refetchProfile()}
/>Development
npm ci
npm run build
npm testGovernance
- Security policy: SECURITY.md
- Code of conduct: CODE_OF_CONDUCT.md
- ADRs: docs/adrs
- Legal docs: legal
License
MIT
