@prefabs.tech/vue3-user 0.31.0 → 0.33.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 +133 -0
- package/dist/PrefabsTechVue3User.es.js +23673 -24681
- package/dist/PrefabsTechVue3User.umd.js +8 -8
- package/dist/src/api/axios.d.ts.map +1 -1
- package/dist/src/api/roles.d.ts.map +1 -1
- package/dist/src/api/user/index.d.ts.map +1 -1
- package/dist/src/auth-provider.d.ts +4 -4
- package/dist/src/auth-provider.d.ts.map +1 -1
- package/dist/src/components/AuthSocialLoginCallback.vue.d.ts +2 -1
- package/dist/src/components/AuthSocialLoginCallback.vue.d.ts.map +1 -1
- package/dist/src/components/ChangePasswordForm.vue.d.ts +16 -13
- package/dist/src/components/ChangePasswordForm.vue.d.ts.map +1 -1
- package/dist/src/components/DropdownUserMenu.vue.d.ts +10 -6
- package/dist/src/components/DropdownUserMenu.vue.d.ts.map +1 -1
- package/dist/src/components/FacebookLogin.vue.d.ts +5 -2
- package/dist/src/components/FacebookLogin.vue.d.ts.map +1 -1
- package/dist/src/components/GoogleLogin.vue.d.ts +5 -2
- package/dist/src/components/GoogleLogin.vue.d.ts.map +1 -1
- package/dist/src/components/LoginForm.vue.d.ts +8 -5
- package/dist/src/components/LoginForm.vue.d.ts.map +1 -1
- package/dist/src/components/PasswordResetForm.vue.d.ts +6 -3
- package/dist/src/components/PasswordResetForm.vue.d.ts.map +1 -1
- package/dist/src/components/PasswordResetRequestAcknowledge.vue.d.ts +6 -3
- package/dist/src/components/PasswordResetRequestAcknowledge.vue.d.ts.map +1 -1
- package/dist/src/components/PasswordResetRequestForm.vue.d.ts +6 -3
- package/dist/src/components/PasswordResetRequestForm.vue.d.ts.map +1 -1
- package/dist/src/components/ResetPasswordModal.vue.d.ts +7 -3
- package/dist/src/components/ResetPasswordModal.vue.d.ts.map +1 -1
- package/dist/src/components/SignInUpMenu.vue.d.ts +4 -3
- package/dist/src/components/SignInUpMenu.vue.d.ts.map +1 -1
- package/dist/src/components/SignupForm.vue.d.ts +6 -3
- package/dist/src/components/SignupForm.vue.d.ts.map +1 -1
- package/dist/src/components/TermsAndConditions.vue.d.ts +8 -5
- package/dist/src/components/TermsAndConditions.vue.d.ts.map +1 -1
- package/dist/src/components/TermsAndServices.vue.d.ts +5 -4
- package/dist/src/components/TermsAndServices.vue.d.ts.map +1 -1
- package/dist/src/components/UserMenu.vue.d.ts +11 -8
- package/dist/src/components/UserMenu.vue.d.ts.map +1 -1
- package/dist/src/components/index.d.ts +3 -3
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/invitation/InvitationForm.vue.d.ts +16 -12
- package/dist/src/components/invitation/InvitationForm.vue.d.ts.map +1 -1
- package/dist/src/components/invitation/InvitationModal.vue.d.ts +16 -12
- package/dist/src/components/invitation/InvitationModal.vue.d.ts.map +1 -1
- package/dist/src/components/invitation/InvitationTable.vue.d.ts +244 -11
- package/dist/src/components/invitation/InvitationTable.vue.d.ts.map +1 -1
- package/dist/src/components/profile/AccountInfo.vue.d.ts +2 -1
- package/dist/src/components/profile/AccountInfo.vue.d.ts.map +1 -1
- package/dist/src/components/profile/ChangePassword.vue.d.ts +5 -4
- package/dist/src/components/profile/ChangePassword.vue.d.ts.map +1 -1
- package/dist/src/components/profile/ProfileForm.vue.d.ts +5 -4
- package/dist/src/components/profile/ProfileForm.vue.d.ts.map +1 -1
- package/dist/src/components/profile/UpdateEmailForm.vue.d.ts +6 -3
- package/dist/src/components/profile/UpdateEmailForm.vue.d.ts.map +1 -1
- package/dist/src/components/profile/UpdateEmailModal.vue.d.ts +6 -3
- package/dist/src/components/profile/UpdateEmailModal.vue.d.ts.map +1 -1
- package/dist/src/components/usersTable/Index.vue.d.ts +243 -11
- package/dist/src/components/usersTable/Index.vue.d.ts.map +1 -1
- package/dist/src/constant.d.ts +1 -1
- package/dist/src/constant.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/laravel-passport/change-email.d.ts +1 -1
- package/dist/src/laravel-passport/change-email.d.ts.map +1 -1
- package/dist/src/laravel-passport/change-password.d.ts +1 -1
- package/dist/src/laravel-passport/change-password.d.ts.map +1 -1
- package/dist/src/laravel-passport/login.d.ts +1 -1
- package/dist/src/laravel-passport/login.d.ts.map +1 -1
- package/dist/src/laravel-passport/logout.d.ts.map +1 -1
- package/dist/src/laravel-passport/request-password-reset.d.ts.map +1 -1
- package/dist/src/laravel-passport/reset-password.d.ts.map +1 -1
- package/dist/src/laravel-passport/signup.d.ts +1 -1
- package/dist/src/laravel-passport/signup.d.ts.map +1 -1
- package/dist/src/laravel-passport/verify-email.d.ts +1 -1
- package/dist/src/laravel-passport/verify-email.d.ts.map +1 -1
- package/dist/src/layouts/BasicLayout.vue.d.ts +9 -6
- package/dist/src/layouts/BasicLayout.vue.d.ts.map +1 -1
- package/dist/src/layouts/SidebarHeaderLayout.vue.d.ts +17 -13
- package/dist/src/layouts/SidebarHeaderLayout.vue.d.ts.map +1 -1
- package/dist/src/layouts/SidebarOnlyLayout.vue.d.ts +13 -8
- package/dist/src/layouts/SidebarOnlyLayout.vue.d.ts.map +1 -1
- package/dist/src/router.d.ts.map +1 -1
- package/dist/src/store.d.ts +20 -181
- package/dist/src/store.d.ts.map +1 -1
- package/dist/src/stores/roles.d.ts +2 -14
- package/dist/src/stores/roles.d.ts.map +1 -1
- package/dist/src/supertokens/change-email.d.ts.map +1 -1
- package/dist/src/supertokens/change-password.d.ts.map +1 -1
- package/dist/src/supertokens/index.d.ts +4 -4
- package/dist/src/supertokens/index.d.ts.map +1 -1
- package/dist/src/supertokens/login.d.ts +1 -1
- package/dist/src/supertokens/login.d.ts.map +1 -1
- package/dist/src/supertokens/request-password-reset.d.ts.map +1 -1
- package/dist/src/supertokens/resend-email-verification.d.ts +1 -1
- package/dist/src/supertokens/resend-email-verification.d.ts.map +1 -1
- package/dist/src/supertokens/reset-password.d.ts.map +1 -1
- package/dist/src/supertokens/signup.d.ts +1 -1
- package/dist/src/supertokens/signup.d.ts.map +1 -1
- package/dist/src/types/auth.d.ts +18 -18
- package/dist/src/types/auth.d.ts.map +1 -1
- package/dist/src/types/config.d.ts +4 -4
- package/dist/src/types/config.d.ts.map +1 -1
- package/dist/src/types/invitation.d.ts +6 -6
- package/dist/src/types/invitation.d.ts.map +1 -1
- package/dist/src/types/plugin.d.ts +2 -2
- package/dist/src/types/plugin.d.ts.map +1 -1
- package/dist/src/types/roles.d.ts +2 -2
- package/dist/src/types/roles.d.ts.map +1 -1
- package/dist/src/types/router.d.ts +5 -5
- package/dist/src/types/router.d.ts.map +1 -1
- package/dist/src/views/AcceptInvitation.vue.d.ts +5 -4
- package/dist/src/views/AcceptInvitation.vue.d.ts.map +1 -1
- package/dist/src/views/ChangePassword.vue.d.ts +5 -4
- package/dist/src/views/ChangePassword.vue.d.ts.map +1 -1
- package/dist/src/views/EmailVerificationReminder.vue.d.ts +2 -1
- package/dist/src/views/EmailVerificationReminder.vue.d.ts.map +1 -1
- package/dist/src/views/Login.vue.d.ts +5 -4
- package/dist/src/views/Login.vue.d.ts.map +1 -1
- package/dist/src/views/PasswordReset.vue.d.ts +5 -4
- package/dist/src/views/PasswordReset.vue.d.ts.map +1 -1
- package/dist/src/views/PasswordResetRequest.vue.d.ts +5 -4
- package/dist/src/views/PasswordResetRequest.vue.d.ts.map +1 -1
- package/dist/src/views/Profile/ProfilePage.vue.d.ts +5 -4
- package/dist/src/views/Profile/ProfilePage.vue.d.ts.map +1 -1
- package/dist/src/views/Profile/ProfileTabsPage.vue.d.ts +11 -7
- package/dist/src/views/Profile/ProfileTabsPage.vue.d.ts.map +1 -1
- package/dist/src/views/Roles/Index.vue.d.ts +3 -2
- package/dist/src/views/Roles/Index.vue.d.ts.map +1 -1
- package/dist/src/views/Roles/RoleForm.vue.d.ts +9 -5
- package/dist/src/views/Roles/RoleForm.vue.d.ts.map +1 -1
- package/dist/src/views/Signup.vue.d.ts +5 -4
- package/dist/src/views/Signup.vue.d.ts.map +1 -1
- package/dist/src/views/SignupFirstUser.vue.d.ts +2 -1
- package/dist/src/views/SignupFirstUser.vue.d.ts.map +1 -1
- package/dist/src/views/VerifyEmail.vue.d.ts +2 -1
- package/dist/src/views/VerifyEmail.vue.d.ts.map +1 -1
- package/dist/vue3-user.css +2 -1
- package/package.json +51 -44
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# @prefabs.tech/vue3-user
|
|
2
|
+
|
|
3
|
+
Authentication and user management plugin for Vue 3 applications.
|
|
4
|
+
|
|
5
|
+
## Why This Package?
|
|
6
|
+
|
|
7
|
+
Building auth from scratch means wiring together an auth provider, a router, a user store, forms, layout menus, and invitation flows — and keeping all of them in sync. This package does that wiring. Drop it into your app and get a complete, opinionated user system that you can configure and extend without forking.
|
|
8
|
+
|
|
9
|
+
## What You Get
|
|
10
|
+
|
|
11
|
+
### SuperTokens (`supertokens-web-js`) — Partial Passthrough
|
|
12
|
+
|
|
13
|
+
Default auth provider. We initialize SuperTokens with your `AppConfig` and normalize its error codes. We conditionally add the `EmailVerification` recipe, attach a session event handler for automatic token refresh, and wrap social sign-in. Everything else is direct SuperTokens behavior.
|
|
14
|
+
|
|
15
|
+
Docs: https://supertokens.com/docs/thirdpartyemailpassword/quick-setup/frontend
|
|
16
|
+
|
|
17
|
+
### Laravel Passport (custom backend) — Partial Passthrough
|
|
18
|
+
|
|
19
|
+
Alternative auth provider (`authProvider: "laravel-passport"`). All operations hit your backend REST API at configurable paths. We add a 401 → refresh → retry interceptor on the axios client. Everything else is direct backend behavior.
|
|
20
|
+
|
|
21
|
+
Docs: https://laravel.com/docs/passport
|
|
22
|
+
|
|
23
|
+
### Added by This Package
|
|
24
|
+
|
|
25
|
+
**Auth & Security**
|
|
26
|
+
|
|
27
|
+
- Auth provider abstraction — switch between SuperTokens and Laravel Passport with one config key
|
|
28
|
+
- Authentication guard — automatic redirect to login for protected routes
|
|
29
|
+
- Email verification guard — unverified users redirected to reminder page
|
|
30
|
+
- Profile completion guard — users with incomplete profiles redirected to profile page
|
|
31
|
+
- Post-login redirect restoration — stores destination before auth redirect, restores after login
|
|
32
|
+
- Role-based session validation (SuperTokens `UserRoleClaim` + custom `ProfileValidationClaim`)
|
|
33
|
+
- Social sign-in support (Google, Facebook) with role validation on callback
|
|
34
|
+
- Axios client with automatic token refresh on 401
|
|
35
|
+
|
|
36
|
+
**Router**
|
|
37
|
+
|
|
38
|
+
- Dynamic registration of all user routes on plugin install
|
|
39
|
+
- Route registration is conditional: signup, first-user signup, and email verification routes respect config flags
|
|
40
|
+
- `filterRoutes()` — removes routes with `meta.display: false` or a failing display function
|
|
41
|
+
|
|
42
|
+
**Stores (Pinia)**
|
|
43
|
+
|
|
44
|
+
- `useUserStore` — login, logout, signup, password reset, email verification, profile updates, social sign-in, invitation management
|
|
45
|
+
- `useRolesStore` — CRUD for roles and permissions
|
|
46
|
+
- User and token persistence in localStorage; full cleanup on logout
|
|
47
|
+
|
|
48
|
+
**Ready-to-use Components**
|
|
49
|
+
|
|
50
|
+
- `LoginForm` — email or username login
|
|
51
|
+
- `SignupForm` — optional username, confirm password, and terms & conditions gate
|
|
52
|
+
- `PasswordResetRequestForm` + `PasswordResetRequestAcknowledge` (with countdown timer)
|
|
53
|
+
- `PasswordResetForm` — auto-extracts token from route
|
|
54
|
+
- `ChangePasswordForm` — current + new + optional confirm password
|
|
55
|
+
- `UserMenu` — smart: shows dropdown when logged in, sign in/up links when not
|
|
56
|
+
- `DropdownUserMenu` — extensible user dropdown with outside-click close
|
|
57
|
+
- `GoogleLogin`, `FacebookLogin`, `AuthSocialLoginCallback`
|
|
58
|
+
- `ProfilePage`, `ProfileTabsPage` (extensible tabbed profile)
|
|
59
|
+
- `AccountInfo` + `UpdateEmailModal` — email change with feature-flag guard
|
|
60
|
+
- `InvitationForm`, `InvitationModal`, `InvitationTable`
|
|
61
|
+
- `UsersTable` with enable/disable user actions and customizable action menu
|
|
62
|
+
- `ResetPasswordModal` for admin password reset flows
|
|
63
|
+
|
|
64
|
+
**Layout Components**
|
|
65
|
+
|
|
66
|
+
- `BasicLayout`, `SidebarHeaderLayout`, `SidebarOnlyLayout` — all wrap `@prefabs.tech/vue3-layout` with integrated `UserMenu` and auth-aware menu filtering
|
|
67
|
+
|
|
68
|
+
**Module Augmentation**
|
|
69
|
+
|
|
70
|
+
- Extends `AppConfig` with `user?: DzangolabVueUserConfig`
|
|
71
|
+
- Extends layout config with `userMenu?: UserMenuItem[]`
|
|
72
|
+
|
|
73
|
+
→ [Full feature list](FEATURES.md) | [Developer guide](GUIDE.md)
|
|
74
|
+
|
|
75
|
+
## Requirements
|
|
76
|
+
|
|
77
|
+
**Peer dependencies:**
|
|
78
|
+
|
|
79
|
+
- `vue >= 3.2`
|
|
80
|
+
- `vue-router >= 4.0`
|
|
81
|
+
- `pinia >= 2.0`
|
|
82
|
+
- `axios >= 0.26.1`
|
|
83
|
+
- `vee-validate >= 4.7.1`
|
|
84
|
+
- `@vee-validate/rules >= 4.7.1`
|
|
85
|
+
- `@vee-validate/zod >= 4.7.1`
|
|
86
|
+
- `zod >= 3.20.6`
|
|
87
|
+
- `@vueuse/core >= 9.4.0`
|
|
88
|
+
|
|
89
|
+
**Sibling packages (required):**
|
|
90
|
+
|
|
91
|
+
- `@prefabs.tech/vue3-config`
|
|
92
|
+
- `@prefabs.tech/vue3-i18n`
|
|
93
|
+
- `@prefabs.tech/vue3-layout`
|
|
94
|
+
- `@prefabs.tech/vue3-ui`
|
|
95
|
+
|
|
96
|
+
## Quick Start
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
// main.ts
|
|
100
|
+
import userPlugin from "@prefabs.tech/vue3-user";
|
|
101
|
+
|
|
102
|
+
app.use(userPlugin, {
|
|
103
|
+
config, // AppConfig with config.user settings
|
|
104
|
+
pinia, // createPinia() result
|
|
105
|
+
router, // createRouter() result
|
|
106
|
+
notification: ({ text, type }) => myToast.show(text, type), // optional
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
// AppConfig
|
|
112
|
+
const config: AppConfig = {
|
|
113
|
+
apiBaseUrl: "https://api.example.com",
|
|
114
|
+
user: {
|
|
115
|
+
features: {
|
|
116
|
+
authProvider: "supertokens", // or "laravel-passport"
|
|
117
|
+
signUp: { emailVerification: true },
|
|
118
|
+
confirmPassword: true,
|
|
119
|
+
updateEmail: true,
|
|
120
|
+
},
|
|
121
|
+
supportedRoles: ["ADMIN", "USER"],
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Installation
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npm install @prefabs.tech/vue3-user
|
|
130
|
+
|
|
131
|
+
# pnpm
|
|
132
|
+
pnpm add @prefabs.tech/vue3-user
|
|
133
|
+
```
|