@poly-x/react 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -41,11 +41,42 @@ function Dashboard() {
41
41
  Add a callback route (`/auth/callback`) that renders `<AuthCallback />` to
42
42
  complete sign-in.
43
43
 
44
+ ## Profile self-service
45
+
46
+ `<UserProfile>` gives a signed-in person a dialog to correct their own details —
47
+ first name, last name, phone number, national ID, gender and photo. You write no
48
+ form, no validation rules and no upload handling:
49
+
50
+ ```tsx
51
+ import { UserProfile } from "@poly-x/react";
52
+
53
+ <UserProfile onSaved={() => router.refresh()} />;
54
+ ```
55
+
56
+ Most apps want it on the account menu instead of as its own button:
57
+
58
+ ```tsx
59
+ <UserButton showUserProfile />
60
+ ```
61
+
62
+ That turns the existing **Manage account** entry into one that opens the dialog.
63
+ It is opt-in, and `manageAccountUrl` always wins — so an app already linking that
64
+ entry to its own page keeps exactly what it has.
65
+
66
+ Requires `@poly-x/next`'s route handler to be mounted (the platform call is made
67
+ server-side; the browser never holds a credential). Validation mirrors the
68
+ platform's own rules, so a value the dialog accepts is one the platform accepts.
69
+
70
+ Editing anybody **else's** profile is not offered here — that is administration,
71
+ and it lives in the PolyX console with the permission model and audit trail.
72
+ Email, username and password are likewise excluded: each has its own verification
73
+ path that a profile form must not route around.
74
+
44
75
  ## API
45
76
 
46
77
  `PolyXProvider` · `useAuth` (`isLoaded`, `isSignedIn`, `signIn`, `signOut`,
47
78
  `getToken`) · `useUser` · `useSession` · `<SignIn>` · `<Protected>` ·
48
- `<AuthCallback>`. Sign-in defaults to a popup; pass `mode="redirect"` for a
49
- full-page flow.
79
+ `<UserButton>` · `<UserProfile>` · `<AuthCallback>`. Sign-in defaults to a popup;
80
+ pass `mode="redirect"` for a full-page flow.
50
81
 
51
82
  MIT licensed.