@prefabs.tech/vue3-user 0.32.0 → 0.33.1

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.
Files changed (138) hide show
  1. package/README.md +133 -0
  2. package/dist/PrefabsTechVue3User.es.js +23680 -24702
  3. package/dist/PrefabsTechVue3User.umd.js +8 -8
  4. package/dist/src/api/axios.d.ts.map +1 -1
  5. package/dist/src/api/roles.d.ts.map +1 -1
  6. package/dist/src/api/user/index.d.ts.map +1 -1
  7. package/dist/src/auth-provider.d.ts +4 -4
  8. package/dist/src/auth-provider.d.ts.map +1 -1
  9. package/dist/src/components/AuthSocialLoginCallback.vue.d.ts +2 -1
  10. package/dist/src/components/AuthSocialLoginCallback.vue.d.ts.map +1 -1
  11. package/dist/src/components/ChangePasswordForm.vue.d.ts +16 -13
  12. package/dist/src/components/ChangePasswordForm.vue.d.ts.map +1 -1
  13. package/dist/src/components/DropdownUserMenu.vue.d.ts +10 -6
  14. package/dist/src/components/DropdownUserMenu.vue.d.ts.map +1 -1
  15. package/dist/src/components/FacebookLogin.vue.d.ts +5 -2
  16. package/dist/src/components/FacebookLogin.vue.d.ts.map +1 -1
  17. package/dist/src/components/GoogleLogin.vue.d.ts +5 -2
  18. package/dist/src/components/GoogleLogin.vue.d.ts.map +1 -1
  19. package/dist/src/components/LoginForm.vue.d.ts +8 -5
  20. package/dist/src/components/LoginForm.vue.d.ts.map +1 -1
  21. package/dist/src/components/PasswordResetForm.vue.d.ts +6 -3
  22. package/dist/src/components/PasswordResetForm.vue.d.ts.map +1 -1
  23. package/dist/src/components/PasswordResetRequestAcknowledge.vue.d.ts +6 -3
  24. package/dist/src/components/PasswordResetRequestAcknowledge.vue.d.ts.map +1 -1
  25. package/dist/src/components/PasswordResetRequestForm.vue.d.ts +6 -3
  26. package/dist/src/components/PasswordResetRequestForm.vue.d.ts.map +1 -1
  27. package/dist/src/components/ResetPasswordModal.vue.d.ts +7 -3
  28. package/dist/src/components/ResetPasswordModal.vue.d.ts.map +1 -1
  29. package/dist/src/components/SignInUpMenu.vue.d.ts +4 -3
  30. package/dist/src/components/SignInUpMenu.vue.d.ts.map +1 -1
  31. package/dist/src/components/SignupForm.vue.d.ts +6 -3
  32. package/dist/src/components/SignupForm.vue.d.ts.map +1 -1
  33. package/dist/src/components/TermsAndConditions.vue.d.ts +8 -5
  34. package/dist/src/components/TermsAndConditions.vue.d.ts.map +1 -1
  35. package/dist/src/components/TermsAndServices.vue.d.ts +5 -4
  36. package/dist/src/components/TermsAndServices.vue.d.ts.map +1 -1
  37. package/dist/src/components/UserMenu.vue.d.ts +11 -8
  38. package/dist/src/components/UserMenu.vue.d.ts.map +1 -1
  39. package/dist/src/components/index.d.ts +3 -3
  40. package/dist/src/components/index.d.ts.map +1 -1
  41. package/dist/src/components/invitation/InvitationForm.vue.d.ts +16 -12
  42. package/dist/src/components/invitation/InvitationForm.vue.d.ts.map +1 -1
  43. package/dist/src/components/invitation/InvitationModal.vue.d.ts +16 -12
  44. package/dist/src/components/invitation/InvitationModal.vue.d.ts.map +1 -1
  45. package/dist/src/components/invitation/InvitationTable.vue.d.ts +243 -10
  46. package/dist/src/components/invitation/InvitationTable.vue.d.ts.map +1 -1
  47. package/dist/src/components/profile/AccountInfo.vue.d.ts +2 -1
  48. package/dist/src/components/profile/AccountInfo.vue.d.ts.map +1 -1
  49. package/dist/src/components/profile/ChangePassword.vue.d.ts +5 -4
  50. package/dist/src/components/profile/ChangePassword.vue.d.ts.map +1 -1
  51. package/dist/src/components/profile/ProfileForm.vue.d.ts +5 -4
  52. package/dist/src/components/profile/ProfileForm.vue.d.ts.map +1 -1
  53. package/dist/src/components/profile/UpdateEmailForm.vue.d.ts +6 -3
  54. package/dist/src/components/profile/UpdateEmailForm.vue.d.ts.map +1 -1
  55. package/dist/src/components/profile/UpdateEmailModal.vue.d.ts +6 -3
  56. package/dist/src/components/profile/UpdateEmailModal.vue.d.ts.map +1 -1
  57. package/dist/src/components/usersTable/Index.vue.d.ts +242 -10
  58. package/dist/src/components/usersTable/Index.vue.d.ts.map +1 -1
  59. package/dist/src/constant.d.ts +1 -1
  60. package/dist/src/constant.d.ts.map +1 -1
  61. package/dist/src/index.d.ts +4 -4
  62. package/dist/src/index.d.ts.map +1 -1
  63. package/dist/src/laravel-passport/change-email.d.ts +1 -1
  64. package/dist/src/laravel-passport/change-email.d.ts.map +1 -1
  65. package/dist/src/laravel-passport/change-password.d.ts +1 -1
  66. package/dist/src/laravel-passport/change-password.d.ts.map +1 -1
  67. package/dist/src/laravel-passport/login.d.ts +1 -1
  68. package/dist/src/laravel-passport/login.d.ts.map +1 -1
  69. package/dist/src/laravel-passport/logout.d.ts.map +1 -1
  70. package/dist/src/laravel-passport/request-password-reset.d.ts.map +1 -1
  71. package/dist/src/laravel-passport/reset-password.d.ts.map +1 -1
  72. package/dist/src/laravel-passport/signup.d.ts +1 -1
  73. package/dist/src/laravel-passport/signup.d.ts.map +1 -1
  74. package/dist/src/laravel-passport/verify-email.d.ts +1 -1
  75. package/dist/src/laravel-passport/verify-email.d.ts.map +1 -1
  76. package/dist/src/layouts/BasicLayout.vue.d.ts +11 -6
  77. package/dist/src/layouts/BasicLayout.vue.d.ts.map +1 -1
  78. package/dist/src/layouts/SidebarHeaderLayout.vue.d.ts +17 -13
  79. package/dist/src/layouts/SidebarHeaderLayout.vue.d.ts.map +1 -1
  80. package/dist/src/layouts/SidebarOnlyLayout.vue.d.ts +13 -8
  81. package/dist/src/layouts/SidebarOnlyLayout.vue.d.ts.map +1 -1
  82. package/dist/src/router.d.ts.map +1 -1
  83. package/dist/src/store.d.ts +20 -181
  84. package/dist/src/store.d.ts.map +1 -1
  85. package/dist/src/stores/roles.d.ts +2 -14
  86. package/dist/src/stores/roles.d.ts.map +1 -1
  87. package/dist/src/supertokens/change-email.d.ts.map +1 -1
  88. package/dist/src/supertokens/change-password.d.ts.map +1 -1
  89. package/dist/src/supertokens/index.d.ts +4 -4
  90. package/dist/src/supertokens/index.d.ts.map +1 -1
  91. package/dist/src/supertokens/login.d.ts +1 -1
  92. package/dist/src/supertokens/login.d.ts.map +1 -1
  93. package/dist/src/supertokens/request-password-reset.d.ts.map +1 -1
  94. package/dist/src/supertokens/resend-email-verification.d.ts +1 -1
  95. package/dist/src/supertokens/resend-email-verification.d.ts.map +1 -1
  96. package/dist/src/supertokens/reset-password.d.ts.map +1 -1
  97. package/dist/src/supertokens/signup.d.ts +1 -1
  98. package/dist/src/supertokens/signup.d.ts.map +1 -1
  99. package/dist/src/types/auth.d.ts +18 -18
  100. package/dist/src/types/auth.d.ts.map +1 -1
  101. package/dist/src/types/config.d.ts +4 -4
  102. package/dist/src/types/config.d.ts.map +1 -1
  103. package/dist/src/types/invitation.d.ts +6 -6
  104. package/dist/src/types/invitation.d.ts.map +1 -1
  105. package/dist/src/types/plugin.d.ts +2 -2
  106. package/dist/src/types/plugin.d.ts.map +1 -1
  107. package/dist/src/types/roles.d.ts +2 -2
  108. package/dist/src/types/roles.d.ts.map +1 -1
  109. package/dist/src/types/router.d.ts +5 -5
  110. package/dist/src/types/router.d.ts.map +1 -1
  111. package/dist/src/views/AcceptInvitation.vue.d.ts +5 -4
  112. package/dist/src/views/AcceptInvitation.vue.d.ts.map +1 -1
  113. package/dist/src/views/ChangePassword.vue.d.ts +5 -4
  114. package/dist/src/views/ChangePassword.vue.d.ts.map +1 -1
  115. package/dist/src/views/EmailVerificationReminder.vue.d.ts +2 -1
  116. package/dist/src/views/EmailVerificationReminder.vue.d.ts.map +1 -1
  117. package/dist/src/views/Login.vue.d.ts +5 -4
  118. package/dist/src/views/Login.vue.d.ts.map +1 -1
  119. package/dist/src/views/PasswordReset.vue.d.ts +5 -4
  120. package/dist/src/views/PasswordReset.vue.d.ts.map +1 -1
  121. package/dist/src/views/PasswordResetRequest.vue.d.ts +5 -4
  122. package/dist/src/views/PasswordResetRequest.vue.d.ts.map +1 -1
  123. package/dist/src/views/Profile/ProfilePage.vue.d.ts +5 -4
  124. package/dist/src/views/Profile/ProfilePage.vue.d.ts.map +1 -1
  125. package/dist/src/views/Profile/ProfileTabsPage.vue.d.ts +11 -7
  126. package/dist/src/views/Profile/ProfileTabsPage.vue.d.ts.map +1 -1
  127. package/dist/src/views/Roles/Index.vue.d.ts +3 -2
  128. package/dist/src/views/Roles/Index.vue.d.ts.map +1 -1
  129. package/dist/src/views/Roles/RoleForm.vue.d.ts +9 -5
  130. package/dist/src/views/Roles/RoleForm.vue.d.ts.map +1 -1
  131. package/dist/src/views/Signup.vue.d.ts +5 -4
  132. package/dist/src/views/Signup.vue.d.ts.map +1 -1
  133. package/dist/src/views/SignupFirstUser.vue.d.ts +2 -1
  134. package/dist/src/views/SignupFirstUser.vue.d.ts.map +1 -1
  135. package/dist/src/views/VerifyEmail.vue.d.ts +2 -1
  136. package/dist/src/views/VerifyEmail.vue.d.ts.map +1 -1
  137. package/dist/vue3-user.css +2 -1
  138. 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
+ ```