hazo_auth 1.6.7 → 3.0.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 +114 -14
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/hooks/use_email_verification.js +5 -3
- package/dist/components/layouts/email_verification/index.d.ts +2 -1
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +3 -1
- package/dist/components/layouts/forgot_password/index.d.ts +2 -1
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.js +3 -1
- package/dist/components/layouts/login/index.d.ts +2 -1
- package/dist/components/layouts/login/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +3 -1
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +4 -2
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/hooks/use_my_settings.js +7 -5
- package/dist/components/layouts/my_settings/index.d.ts +2 -1
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/index.js +3 -2
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.js +3 -1
- package/dist/components/layouts/register/index.d.ts +2 -1
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +4 -2
- package/dist/components/layouts/reset_password/index.d.ts +2 -1
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts +2 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/logout_button.js +3 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.js +8 -4
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +2 -1
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/visual_panel.d.ts +2 -1
- package/dist/components/layouts/shared/components/visual_panel.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/visual_panel.js +2 -1
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts.map +1 -1
- package/dist/components/layouts/shared/hooks/use_auth_status.js +4 -2
- package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts.map +1 -1
- package/dist/components/layouts/shared/hooks/use_hazo_auth.js +4 -2
- package/dist/components/layouts/shared/index.d.ts +0 -2
- package/dist/components/layouts/shared/index.d.ts.map +1 -1
- package/dist/components/layouts/shared/index.js +2 -2
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/roles_matrix.js +8 -6
- package/dist/components/layouts/user_management/index.d.ts.map +1 -1
- package/dist/components/layouts/user_management/index.js +15 -13
- package/dist/contexts/hazo_auth_config.d.ts +18 -0
- package/dist/contexts/hazo_auth_config.d.ts.map +1 -0
- package/dist/contexts/hazo_auth_config.js +10 -0
- package/dist/contexts/hazo_auth_provider.d.ts +73 -0
- package/dist/contexts/hazo_auth_provider.d.ts.map +1 -0
- package/dist/contexts/hazo_auth_provider.js +82 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/lib/config/default_config.d.ts +237 -0
- package/dist/lib/config/default_config.d.ts.map +1 -0
- package/dist/lib/config/default_config.js +159 -0
- package/dist/lib/email_verification_config.server.d.ts +4 -0
- package/dist/lib/email_verification_config.server.d.ts.map +1 -1
- package/dist/lib/email_verification_config.server.js +12 -0
- package/dist/lib/forgot_password_config.server.d.ts +4 -0
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
- package/dist/lib/forgot_password_config.server.js +12 -0
- package/dist/lib/login_config.server.d.ts +4 -0
- package/dist/lib/login_config.server.d.ts.map +1 -1
- package/dist/lib/login_config.server.js +10 -0
- package/dist/lib/password_requirements_config.server.d.ts +1 -1
- package/dist/lib/password_requirements_config.server.d.ts.map +1 -1
- package/dist/lib/password_requirements_config.server.js +8 -7
- package/dist/lib/register_config.server.d.ts +4 -0
- package/dist/lib/register_config.server.d.ts.map +1 -1
- package/dist/lib/register_config.server.js +10 -0
- package/dist/lib/reset_password_config.server.d.ts +4 -0
- package/dist/lib/reset_password_config.server.d.ts.map +1 -1
- package/dist/lib/reset_password_config.server.js +10 -0
- package/dist/page_components/forgot_password.d.ts.map +1 -1
- package/dist/page_components/forgot_password.js +14 -0
- package/dist/page_components/login.d.ts +4 -0
- package/dist/page_components/login.d.ts.map +1 -1
- package/dist/page_components/login.js +14 -0
- package/dist/page_components/register.d.ts.map +1 -1
- package/dist/page_components/register.js +14 -0
- package/dist/page_components/reset_password.d.ts.map +1 -1
- package/dist/page_components/reset_password.js +14 -0
- package/dist/page_components/verify_email.d.ts.map +1 -1
- package/dist/page_components/verify_email.js +14 -0
- package/dist/pages/forgot_password.d.ts +52 -0
- package/dist/pages/forgot_password.d.ts.map +1 -0
- package/dist/pages/forgot_password.js +41 -0
- package/dist/pages/index.d.ts +33 -0
- package/dist/pages/index.d.ts.map +1 -0
- package/dist/pages/index.js +28 -0
- package/dist/pages/login.d.ts +43 -0
- package/dist/pages/login.d.ts.map +1 -0
- package/dist/pages/login.js +45 -0
- package/dist/pages/my_settings.d.ts +54 -0
- package/dist/pages/my_settings.d.ts.map +1 -0
- package/dist/pages/my_settings.js +57 -0
- package/dist/pages/register.d.ts +44 -0
- package/dist/pages/register.d.ts.map +1 -0
- package/dist/pages/register.js +46 -0
- package/dist/pages/reset_password.d.ts +43 -0
- package/dist/pages/reset_password.d.ts.map +1 -0
- package/dist/pages/reset_password.js +42 -0
- package/dist/pages/verify_email.d.ts +52 -0
- package/dist/pages/verify_email.d.ts.map +1 -0
- package/dist/pages/verify_email.js +41 -0
- package/dist/server_pages/forgot_password.d.ts +53 -0
- package/dist/server_pages/forgot_password.d.ts.map +1 -0
- package/dist/server_pages/forgot_password.js +40 -0
- package/dist/server_pages/forgot_password_client_wrapper.d.ts +15 -0
- package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/forgot_password_client_wrapper.js +27 -0
- package/dist/server_pages/index.d.ts +13 -0
- package/dist/server_pages/index.d.ts.map +1 -0
- package/dist/server_pages/index.js +7 -0
- package/dist/server_pages/login.d.ts +43 -0
- package/dist/server_pages/login.d.ts.map +1 -0
- package/dist/server_pages/login.js +39 -0
- package/dist/server_pages/login_client_wrapper.d.ts +13 -0
- package/dist/server_pages/login_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/login_client_wrapper.js +29 -0
- package/dist/server_pages/my_settings.d.ts +53 -0
- package/dist/server_pages/my_settings.d.ts.map +1 -0
- package/dist/server_pages/my_settings.js +57 -0
- package/dist/server_pages/register.d.ts +45 -0
- package/dist/server_pages/register.d.ts.map +1 -0
- package/dist/server_pages/register.js +41 -0
- package/dist/server_pages/register_client_wrapper.d.ts +13 -0
- package/dist/server_pages/register_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/register_client_wrapper.js +27 -0
- package/dist/server_pages/reset_password.d.ts +44 -0
- package/dist/server_pages/reset_password.d.ts.map +1 -0
- package/dist/server_pages/reset_password.js +40 -0
- package/dist/server_pages/reset_password_client_wrapper.d.ts +13 -0
- package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/reset_password_client_wrapper.js +27 -0
- package/dist/server_pages/verify_email.d.ts +53 -0
- package/dist/server_pages/verify_email.d.ts.map +1 -0
- package/dist/server_pages/verify_email.js +40 -0
- package/dist/server_pages/verify_email_client_wrapper.d.ts +15 -0
- package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/verify_email_client_wrapper.js +27 -0
- package/package.json +34 -10
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type ButtonPaletteOverrides, type LayoutFieldMapOverrides, type LayoutLabelOverrides, type PasswordRequirementOverrides } from "../shared/config/layout_customization";
|
|
2
2
|
import { type LayoutDataClient } from "../shared/data/layout_data_client";
|
|
3
|
+
import type { StaticImageData } from "next/image";
|
|
3
4
|
export type RegisterLayoutProps<TClient = unknown> = {
|
|
4
|
-
image_src: string;
|
|
5
|
+
image_src: string | StaticImageData;
|
|
5
6
|
image_alt: string;
|
|
6
7
|
image_background_color?: string;
|
|
7
8
|
field_overrides?: LayoutFieldMapOverrides;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/register/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAClC,MAAM,uCAAuC,CAAC;AAY/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/register/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAClC,MAAM,uCAAuC,CAAC;AAY/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,MAAM,mBAAmB,CAAC,OAAO,GAAG,OAAO,IAAI;IACnD,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,qBAAqB,CAAC,EAAE,4BAA4B,CAAC;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAYF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,EAC/C,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,eAAsB,EACtB,WAAW,EACX,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,UAA+B,EAC/B,WAAuB,EACvB,UAAU,GACX,EAAE,mBAAmB,CAAC,OAAO,CAAC,2CA+I9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_reset_password_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/reset_password/hooks/use_reset_password_form.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAA4B,KAAK,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"use_reset_password_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/reset_password/hooks/use_reset_password_form.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAA4B,KAAK,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAW5G,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAC3E,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;AAC/F,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,OAAO,CAAC,oBAAoB,EAAE,UAAU,GAAG,kBAAkB,CAAC,EAC9D,OAAO,CACR,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,OAAO,GAAG,OAAO,IAAI;IAC1D,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,uBAAuB,CAAC;IAChC,MAAM,EAAE,uBAAuB,CAAC;IAChC,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,wBAAwB,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,kBAAkB,KAAK,IAAI,CAAC;IAC7E,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAChE,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AASF,eAAO,MAAM,uBAAuB,GAAI,OAAO,EAAG,kDAI/C,0BAA0B,CAAC,OAAO,CAAC,KAAG,0BA0NxC,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { useSearchParams, useRouter } from "next/navigation";
|
|
|
5
5
|
import { toast } from "sonner";
|
|
6
6
|
import { RESET_PASSWORD_FIELD_IDS } from "../config/reset_password_field_config";
|
|
7
7
|
import { validatePassword } from "../../shared/utils/validation";
|
|
8
|
+
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider";
|
|
8
9
|
// section: constants
|
|
9
10
|
const PASSWORD_FIELDS = [
|
|
10
11
|
RESET_PASSWORD_FIELD_IDS.PASSWORD,
|
|
@@ -17,6 +18,7 @@ const buildInitialValues = () => ({
|
|
|
17
18
|
});
|
|
18
19
|
// section: hook
|
|
19
20
|
export const use_reset_password_form = ({ passwordRequirements, dataClient, loginPath = "/hazo_auth/login", }) => {
|
|
21
|
+
const { apiBasePath } = useHazoAuthConfig();
|
|
20
22
|
const router = useRouter();
|
|
21
23
|
const searchParams = useSearchParams();
|
|
22
24
|
const tokenParam = searchParams.get("token");
|
|
@@ -42,7 +44,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
42
44
|
setIsValidatingToken(true);
|
|
43
45
|
setTokenError(null);
|
|
44
46
|
try {
|
|
45
|
-
const response = await fetch(
|
|
47
|
+
const response = await fetch(`${apiBasePath}/validate_reset_token?token=${encodeURIComponent(tokenParam)}`, {
|
|
46
48
|
method: "GET",
|
|
47
49
|
});
|
|
48
50
|
const data = await response.json();
|
|
@@ -148,7 +150,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
148
150
|
}
|
|
149
151
|
setIsSubmitting(true);
|
|
150
152
|
try {
|
|
151
|
-
const response = await fetch(
|
|
153
|
+
const response = await fetch(`${apiBasePath}/reset_password`, {
|
|
152
154
|
method: "POST",
|
|
153
155
|
headers: {
|
|
154
156
|
"Content-Type": "application/json",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { StaticImageData } from "next/image";
|
|
1
2
|
import { type ButtonPaletteOverrides, type LayoutFieldMapOverrides, type LayoutLabelOverrides, type PasswordRequirementOverrides } from "../shared/config/layout_customization";
|
|
2
3
|
import { type LayoutDataClient } from "../shared/data/layout_data_client";
|
|
3
4
|
export type ResetPasswordLayoutProps<TClient = unknown> = {
|
|
4
|
-
image_src: string;
|
|
5
|
+
image_src: string | StaticImageData;
|
|
5
6
|
image_alt: string;
|
|
6
7
|
image_background_color?: string;
|
|
7
8
|
field_overrides?: LayoutFieldMapOverrides;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/reset_password/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/reset_password/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAClC,MAAM,uCAAuC,CAAC;AAY/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAI1E,MAAM,MAAM,wBAAwB,CAAC,OAAO,GAAG,OAAO,IAAI;IACxD,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,qBAAqB,CAAC,EAAE,4BAA4B,CAAC;IACrD,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAUF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,OAAO,EAAE,EACrD,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,YAAgH,EAChH,cAAuE,EACvE,SAA8B,EAC9B,kBAAiD,GAClD,EAAE,wBAAwB,CAAC,OAAO,CAAC,2CAqNnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"already_logged_in_guard.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/already_logged_in_guard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"already_logged_in_guard.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/already_logged_in_guard.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,OAAqC,EACrC,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,oBAA4B,EAC5B,QAAQ,GACT,EAAE,yBAAyB,2CAiD3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/logout_button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logout_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/logout_button.tsx"],"names":[],"mappings":"AAcA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IACjF,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;CACzC,CAAC;AAGF,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,OAAmB,EACnB,IAAgB,GACjB,EAAE,iBAAiB,2CAmDnB"}
|
|
@@ -9,14 +9,16 @@ import { Button } from "../../../ui/button";
|
|
|
9
9
|
import { LogOut } from "lucide-react";
|
|
10
10
|
import { toast } from "sonner";
|
|
11
11
|
import { trigger_auth_status_refresh } from "../hooks/use_auth_status";
|
|
12
|
+
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider";
|
|
12
13
|
// section: component
|
|
13
14
|
export function LogoutButton({ className, variant = "outline", size = "default", }) {
|
|
15
|
+
const { apiBasePath } = useHazoAuthConfig();
|
|
14
16
|
const router = useRouter();
|
|
15
17
|
const [isLoggingOut, setIsLoggingOut] = useState(false);
|
|
16
18
|
const handleLogout = async () => {
|
|
17
19
|
setIsLoggingOut(true);
|
|
18
20
|
try {
|
|
19
|
-
const response = await fetch(
|
|
21
|
+
const response = await fetch(`${apiBasePath}/logout`, {
|
|
20
22
|
method: "POST",
|
|
21
23
|
headers: {
|
|
22
24
|
"Content-Type": "application/json",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile_pic_menu.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/profile_pic_menu.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"profile_pic_menu.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/profile_pic_menu.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAI7F,MAAM,MAAM,mBAAmB,GAAG;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAC7B,kBAA0B,EAC1B,aAAyB,EACzB,aAAyB,EACzB,aAAqC,EACrC,UAA+B,EAC/B,aAAwC,EACxC,WAAW,EACX,iBAAsB,EACtB,SAAS,EACT,WAAuB,EACvB,OAAoB,EACpB,mBAA+B,GAChC,EAAE,mBAAmB,2CAuarB"}
|
|
@@ -14,6 +14,7 @@ import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuItem, SidebarM
|
|
|
14
14
|
import { Settings, LogOut } from "lucide-react";
|
|
15
15
|
import { toast } from "sonner";
|
|
16
16
|
import { use_auth_status, trigger_auth_status_refresh } from "../hooks/use_auth_status";
|
|
17
|
+
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider";
|
|
17
18
|
// section: component
|
|
18
19
|
/**
|
|
19
20
|
* Profile picture menu component
|
|
@@ -24,10 +25,13 @@ import { use_auth_status, trigger_auth_status_refresh } from "../hooks/use_auth_
|
|
|
24
25
|
* @param props - Component props including configuration options
|
|
25
26
|
* @returns Profile picture menu component
|
|
26
27
|
*/
|
|
27
|
-
export function ProfilePicMenu({ show_single_button = false, sign_up_label = "Sign Up", sign_in_label = "Sign In", register_path = "/hazo_auth/register", login_path = "/hazo_auth/login", settings_path = "/hazo_auth/my_settings", logout_path
|
|
28
|
+
export function ProfilePicMenu({ show_single_button = false, sign_up_label = "Sign Up", sign_in_label = "Sign In", register_path = "/hazo_auth/register", login_path = "/hazo_auth/login", settings_path = "/hazo_auth/my_settings", logout_path, custom_menu_items = [], className, avatar_size = "default", variant = "dropdown", sidebar_group_label = "Account", }) {
|
|
29
|
+
const { apiBasePath } = useHazoAuthConfig();
|
|
28
30
|
const router = useRouter();
|
|
29
31
|
const authStatus = use_auth_status();
|
|
30
32
|
const [isLoggingOut, setIsLoggingOut] = useState(false);
|
|
33
|
+
// Use provided logout_path or default to context-based path
|
|
34
|
+
const effectiveLogoutPath = logout_path || `${apiBasePath}/logout`;
|
|
31
35
|
// Get initials from name or email
|
|
32
36
|
const getInitials = () => {
|
|
33
37
|
var _a, _b;
|
|
@@ -47,7 +51,7 @@ export function ProfilePicMenu({ show_single_button = false, sign_up_label = "Si
|
|
|
47
51
|
const handleLogout = async () => {
|
|
48
52
|
setIsLoggingOut(true);
|
|
49
53
|
try {
|
|
50
|
-
const response = await fetch(
|
|
54
|
+
const response = await fetch(effectiveLogoutPath, {
|
|
51
55
|
method: "POST",
|
|
52
56
|
headers: {
|
|
53
57
|
"Content-Type": "application/json",
|
|
@@ -112,7 +116,7 @@ export function ProfilePicMenu({ show_single_button = false, sign_up_label = "Si
|
|
|
112
116
|
items.push({
|
|
113
117
|
type: "link",
|
|
114
118
|
label: "Logout",
|
|
115
|
-
href:
|
|
119
|
+
href: effectiveLogoutPath,
|
|
116
120
|
order: 2,
|
|
117
121
|
id: "default_logout",
|
|
118
122
|
});
|
|
@@ -133,7 +137,7 @@ export function ProfilePicMenu({ show_single_button = false, sign_up_label = "Si
|
|
|
133
137
|
return a.order - b.order;
|
|
134
138
|
});
|
|
135
139
|
return items;
|
|
136
|
-
}, [authStatus.authenticated, authStatus.name, authStatus.email, settings_path,
|
|
140
|
+
}, [authStatus.authenticated, authStatus.name, authStatus.email, settings_path, effectiveLogoutPath, custom_menu_items]);
|
|
137
141
|
// Avatar size classes
|
|
138
142
|
const avatarSizeClasses = {
|
|
139
143
|
sm: "h-8 w-8",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"two_column_auth_layout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/two_column_auth_layout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"two_column_auth_layout.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/two_column_auth_layout.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAGF,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,sBAAsB,GACvB,EAAE,wBAAwB,2CAkB1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual_panel.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/visual_panel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"visual_panel.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/visual_panel.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAGzD,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,QAAQ,EACR,eAA2B,EAC3B,SAAS,GACV,EAAE,gBAAgB,2CAqBlB"}
|
|
@@ -6,5 +6,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
import Image from "next/image";
|
|
7
7
|
// section: component
|
|
8
8
|
export function VisualPanel({ imageSrc, imageAlt, backgroundColor = "#f1f5f9", className, }) {
|
|
9
|
-
|
|
9
|
+
const isJpgString = typeof imageSrc === 'string' && (imageSrc.toLowerCase().endsWith('.jpg') || imageSrc.toLowerCase().endsWith('.jpeg'));
|
|
10
|
+
return (_jsx("div", { className: `cls_visual_panel relative hidden h-full w-full items-center justify-center md:flex ${className !== null && className !== void 0 ? className : ""}`, style: { backgroundColor }, children: _jsx("div", { className: "cls_visual_panel_image_wrapper relative h-full w-full", children: _jsx(Image, { src: imageSrc, alt: imageAlt, fill: true, sizes: "(min-width: 768px) 50vw, 100vw", className: "cls_visual_panel_image object-cover", priority: true, unoptimized: isJpgString }) }) }));
|
|
10
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_auth_status.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/hooks/use_auth_status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_auth_status.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/hooks/use_auth_status.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC9D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAMF;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAIlD;AAGD,wBAAgB,eAAe,IAAI,UAAU,CAmE5C"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
// section: imports
|
|
5
5
|
import { useState, useEffect, useCallback } from "react";
|
|
6
|
+
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider";
|
|
6
7
|
// section: constants
|
|
7
8
|
const AUTH_STATUS_CHANGE_EVENT = "hazo_auth_status_change";
|
|
8
9
|
// section: helpers
|
|
@@ -16,6 +17,7 @@ export function trigger_auth_status_refresh() {
|
|
|
16
17
|
}
|
|
17
18
|
// section: hook
|
|
18
19
|
export function use_auth_status() {
|
|
20
|
+
const { apiBasePath } = useHazoAuthConfig();
|
|
19
21
|
const [authStatus, setAuthStatus] = useState({
|
|
20
22
|
authenticated: false,
|
|
21
23
|
loading: true,
|
|
@@ -24,7 +26,7 @@ export function use_auth_status() {
|
|
|
24
26
|
var _a;
|
|
25
27
|
setAuthStatus((prev) => (Object.assign(Object.assign({}, prev), { loading: true })));
|
|
26
28
|
try {
|
|
27
|
-
const response = await fetch(
|
|
29
|
+
const response = await fetch(`${apiBasePath}/me`, {
|
|
28
30
|
method: "GET",
|
|
29
31
|
credentials: "include",
|
|
30
32
|
});
|
|
@@ -58,7 +60,7 @@ export function use_auth_status() {
|
|
|
58
60
|
loading: false,
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
|
-
}, []);
|
|
63
|
+
}, [apiBasePath]);
|
|
62
64
|
useEffect(() => {
|
|
63
65
|
// Check auth status on mount
|
|
64
66
|
void checkAuth();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_hazo_auth.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/hooks/use_hazo_auth.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"use_hazo_auth.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/hooks/use_hazo_auth.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAKtE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG;IAC/C;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAOF;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAMhD;AAID;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,iBAAiB,CAoFnB"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
// section: imports
|
|
5
5
|
import { useState, useEffect, useCallback } from "react";
|
|
6
|
+
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider";
|
|
6
7
|
// section: constants
|
|
7
8
|
const AUTH_STATUS_CHANGE_EVENT = "hazo_auth_status_change";
|
|
8
9
|
// section: helpers
|
|
@@ -23,6 +24,7 @@ export function trigger_hazo_auth_refresh() {
|
|
|
23
24
|
* @returns UseHazoAuthResult with auth data, loading state, and refetch function
|
|
24
25
|
*/
|
|
25
26
|
export function use_hazo_auth(options) {
|
|
27
|
+
const { apiBasePath } = useHazoAuthConfig();
|
|
26
28
|
const [authResult, setAuthResult] = useState({
|
|
27
29
|
authenticated: false,
|
|
28
30
|
user: null,
|
|
@@ -39,7 +41,7 @@ export function use_hazo_auth(options) {
|
|
|
39
41
|
setLoading(true);
|
|
40
42
|
setError(null);
|
|
41
43
|
try {
|
|
42
|
-
const response = await fetch(
|
|
44
|
+
const response = await fetch(`${apiBasePath}/get_auth`, {
|
|
43
45
|
method: "POST",
|
|
44
46
|
headers: {
|
|
45
47
|
"Content-Type": "application/json",
|
|
@@ -72,7 +74,7 @@ export function use_hazo_auth(options) {
|
|
|
72
74
|
finally {
|
|
73
75
|
setLoading(false);
|
|
74
76
|
}
|
|
75
|
-
}, [options === null || options === void 0 ? void 0 : options.required_permissions, options === null || options === void 0 ? void 0 : options.strict, options === null || options === void 0 ? void 0 : options.skip]);
|
|
77
|
+
}, [apiBasePath, options === null || options === void 0 ? void 0 : options.required_permissions, options === null || options === void 0 ? void 0 : options.strict, options === null || options === void 0 ? void 0 : options.skip]);
|
|
76
78
|
useEffect(() => {
|
|
77
79
|
// Fetch auth status on mount
|
|
78
80
|
void fetchAuth();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { AlreadyLoggedInGuard } from "./components/already_logged_in_guard";
|
|
2
|
-
export { AuthPageShell } from "./components/auth_page_shell";
|
|
3
2
|
export { FieldErrorMessage } from "./components/field_error_message";
|
|
4
3
|
export { FormActionButtons } from "./components/form_action_buttons";
|
|
5
4
|
export { FormFieldWrapper } from "./components/form_field_wrapper";
|
|
@@ -8,7 +7,6 @@ export { LogoutButton } from "./components/logout_button";
|
|
|
8
7
|
export { PasswordField } from "./components/password_field";
|
|
9
8
|
export { ProfilePicMenuWrapper } from "./components/profile_pic_menu_wrapper";
|
|
10
9
|
export { ProfilePicMenu } from "./components/profile_pic_menu";
|
|
11
|
-
export { SidebarLayoutWrapper } from "./components/sidebar_layout_wrapper";
|
|
12
10
|
export { StandaloneLayoutWrapper } from "./components/standalone_layout_wrapper";
|
|
13
11
|
export { TwoColumnAuthLayout } from "./components/two_column_auth_layout";
|
|
14
12
|
export { UnauthorizedGuard } from "./components/unauthorized_guard";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/shared/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/shared/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACjF,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGnF,cAAc,+BAA+B,CAAC;AAG9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// file_description: barrel export for shared layout components, hooks, and utilities
|
|
2
2
|
// section: component_exports
|
|
3
3
|
export { AlreadyLoggedInGuard } from "./components/already_logged_in_guard";
|
|
4
|
-
|
|
4
|
+
// AuthPageShell - NOT exported (test workspace component only)
|
|
5
5
|
export { FieldErrorMessage } from "./components/field_error_message";
|
|
6
6
|
export { FormActionButtons } from "./components/form_action_buttons";
|
|
7
7
|
export { FormFieldWrapper } from "./components/form_field_wrapper";
|
|
@@ -10,7 +10,7 @@ export { LogoutButton } from "./components/logout_button";
|
|
|
10
10
|
export { PasswordField } from "./components/password_field";
|
|
11
11
|
export { ProfilePicMenuWrapper } from "./components/profile_pic_menu_wrapper";
|
|
12
12
|
export { ProfilePicMenu } from "./components/profile_pic_menu";
|
|
13
|
-
|
|
13
|
+
// SidebarLayoutWrapper - NOT exported (test workspace component only)
|
|
14
14
|
export { StandaloneLayoutWrapper } from "./components/standalone_layout_wrapper";
|
|
15
15
|
export { TwoColumnAuthLayout } from "./components/two_column_auth_layout";
|
|
16
16
|
export { UnauthorizedGuard } from "./components/unauthorized_guard";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roles_matrix.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/user_management/components/roles_matrix.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"roles_matrix.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/user_management/components/roles_matrix.tsx"],"names":[],"mappings":"AAgCA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,KAAK,CAAC;QACX,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC,CAAC;CACJ,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,kBAAyB,EACzB,2BAAkC,EAClC,qBAA6B,EAC7B,gBAAuB,EACvB,OAAO,EACP,MAAM,EACN,QAAQ,EACR,eAAe,EACf,SAAS,GACV,EAAE,gBAAgB,2CAwhBlB"}
|
|
@@ -13,6 +13,7 @@ import { Label } from "../../../ui/label";
|
|
|
13
13
|
import { Plus, Loader2, CircleCheck, CircleX } from "lucide-react";
|
|
14
14
|
import { toast } from "sonner";
|
|
15
15
|
import { Avatar, AvatarImage, AvatarFallback } from "../../../ui/avatar";
|
|
16
|
+
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider";
|
|
16
17
|
// section: component
|
|
17
18
|
/**
|
|
18
19
|
* Roles matrix component - reusable internal component for roles-permissions matrix
|
|
@@ -23,6 +24,7 @@ import { Avatar, AvatarImage, AvatarFallback } from "../../../ui/avatar";
|
|
|
23
24
|
* @returns Roles matrix component
|
|
24
25
|
*/
|
|
25
26
|
export function RolesMatrix({ add_button_enabled = true, role_name_selection_enabled = true, permissions_read_only = false, show_save_cancel = true, user_id, onSave, onCancel, onRoleSelection, className, }) {
|
|
27
|
+
const { apiBasePath } = useHazoAuthConfig();
|
|
26
28
|
const [roles, setRoles] = useState([]);
|
|
27
29
|
const [originalRoles, setOriginalRoles] = useState([]);
|
|
28
30
|
const [permissions, setPermissions] = useState([]);
|
|
@@ -38,7 +40,7 @@ export function RolesMatrix({ add_button_enabled = true, role_name_selection_ena
|
|
|
38
40
|
setLoading(true);
|
|
39
41
|
try {
|
|
40
42
|
// Load roles and permissions
|
|
41
|
-
const roles_response = await fetch(
|
|
43
|
+
const roles_response = await fetch(`${apiBasePath}/user_management/roles`);
|
|
42
44
|
const roles_data = await roles_response.json();
|
|
43
45
|
if (!roles_data.success) {
|
|
44
46
|
toast.error("Failed to load roles and permissions");
|
|
@@ -63,7 +65,7 @@ export function RolesMatrix({ add_button_enabled = true, role_name_selection_ena
|
|
|
63
65
|
// If user_id is provided, load user info and user roles
|
|
64
66
|
if (user_id) {
|
|
65
67
|
// Load user info
|
|
66
|
-
const user_response = await fetch(
|
|
68
|
+
const user_response = await fetch(`${apiBasePath}/user_management/users?id=${user_id}`);
|
|
67
69
|
const user_data = await user_response.json();
|
|
68
70
|
if (user_data.success && Array.isArray(user_data.users) && user_data.users.length > 0) {
|
|
69
71
|
const user = user_data.users[0];
|
|
@@ -74,7 +76,7 @@ export function RolesMatrix({ add_button_enabled = true, role_name_selection_ena
|
|
|
74
76
|
});
|
|
75
77
|
}
|
|
76
78
|
// Load user roles
|
|
77
|
-
const user_roles_response = await fetch(
|
|
79
|
+
const user_roles_response = await fetch(`${apiBasePath}/user_management/users/roles?user_id=${user_id}`);
|
|
78
80
|
const user_roles_data = await user_roles_response.json();
|
|
79
81
|
if (user_roles_data.success && Array.isArray(user_roles_data.role_ids)) {
|
|
80
82
|
setUserRoleIds(user_roles_data.role_ids);
|
|
@@ -191,7 +193,7 @@ export function RolesMatrix({ add_button_enabled = true, role_name_selection_ena
|
|
|
191
193
|
.filter((role) => role.selected && role.role_id !== undefined)
|
|
192
194
|
.map((role) => role.role_id);
|
|
193
195
|
// Update user roles via API
|
|
194
|
-
const response = await fetch(
|
|
196
|
+
const response = await fetch(`${apiBasePath}/user_management/users/roles`, {
|
|
195
197
|
method: "PUT",
|
|
196
198
|
headers: {
|
|
197
199
|
"Content-Type": "application/json",
|
|
@@ -220,7 +222,7 @@ export function RolesMatrix({ add_button_enabled = true, role_name_selection_ena
|
|
|
220
222
|
onSave(roles_data);
|
|
221
223
|
}
|
|
222
224
|
// Save to API
|
|
223
|
-
const response = await fetch(
|
|
225
|
+
const response = await fetch(`${apiBasePath}/user_management/roles`, {
|
|
224
226
|
method: "PUT",
|
|
225
227
|
headers: {
|
|
226
228
|
"Content-Type": "application/json",
|
|
@@ -231,7 +233,7 @@ export function RolesMatrix({ add_button_enabled = true, role_name_selection_ena
|
|
|
231
233
|
if (data.success) {
|
|
232
234
|
toast.success("Roles and permissions saved successfully");
|
|
233
235
|
// Reload data to get updated role IDs
|
|
234
|
-
const reload_response = await fetch(
|
|
236
|
+
const reload_response = await fetch(`${apiBasePath}/user_management/roles`);
|
|
235
237
|
const reload_data = await reload_response.json();
|
|
236
238
|
if (reload_data.success) {
|
|
237
239
|
const updated_roles = reload_data.roles.map((role) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/user_management/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/user_management/index.tsx"],"names":[],"mappings":"AA6CA,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsBF;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,EAAE,yBAAyB,2CAmsC5E"}
|
|
@@ -17,6 +17,7 @@ import { RolesMatrix } from "./components/roles_matrix";
|
|
|
17
17
|
import { UserX, KeyRound, Edit, Trash2, Loader2, CircleCheck, CircleX, Plus, UserPlus } from "lucide-react";
|
|
18
18
|
import { toast } from "sonner";
|
|
19
19
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip";
|
|
20
|
+
import { useHazoAuthConfig } from "../../../contexts/hazo_auth_provider";
|
|
20
21
|
// section: component
|
|
21
22
|
/**
|
|
22
23
|
* User Management layout component with three tabs
|
|
@@ -27,6 +28,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../
|
|
|
27
28
|
* @returns User Management layout component
|
|
28
29
|
*/
|
|
29
30
|
export function UserManagementLayout({ className }) {
|
|
31
|
+
const { apiBasePath } = useHazoAuthConfig();
|
|
30
32
|
// Permission checks
|
|
31
33
|
const authResult = use_hazo_auth();
|
|
32
34
|
const hasUserManagementPermission = authResult.authenticated &&
|
|
@@ -64,7 +66,7 @@ export function UserManagementLayout({ className }) {
|
|
|
64
66
|
const loadUsers = useCallback(async () => {
|
|
65
67
|
setUsersLoading(true);
|
|
66
68
|
try {
|
|
67
|
-
const response = await fetch(
|
|
69
|
+
const response = await fetch(`${apiBasePath}/user_management/users`);
|
|
68
70
|
const data = await response.json();
|
|
69
71
|
if (data.success) {
|
|
70
72
|
setUsers(data.users);
|
|
@@ -97,7 +99,7 @@ export function UserManagementLayout({ className }) {
|
|
|
97
99
|
const loadPermissions = async () => {
|
|
98
100
|
setPermissionsLoading(true);
|
|
99
101
|
try {
|
|
100
|
-
const response = await fetch(
|
|
102
|
+
const response = await fetch(`${apiBasePath}/user_management/permissions`);
|
|
101
103
|
const data = await response.json();
|
|
102
104
|
if (data.success) {
|
|
103
105
|
const db_perms = data.db_permissions.map((p) => ({
|
|
@@ -133,7 +135,7 @@ export function UserManagementLayout({ className }) {
|
|
|
133
135
|
return;
|
|
134
136
|
setUsersActionLoading(true);
|
|
135
137
|
try {
|
|
136
|
-
const response = await fetch(
|
|
138
|
+
const response = await fetch(`${apiBasePath}/user_management/users`, {
|
|
137
139
|
method: "PATCH",
|
|
138
140
|
headers: {
|
|
139
141
|
"Content-Type": "application/json",
|
|
@@ -149,7 +151,7 @@ export function UserManagementLayout({ className }) {
|
|
|
149
151
|
setDeactivateDialogOpen(false);
|
|
150
152
|
setSelectedUser(null);
|
|
151
153
|
// Reload users
|
|
152
|
-
const reload_response = await fetch(
|
|
154
|
+
const reload_response = await fetch(`${apiBasePath}/user_management/users`);
|
|
153
155
|
const reload_data = await reload_response.json();
|
|
154
156
|
if (reload_data.success) {
|
|
155
157
|
setUsers(reload_data.users);
|
|
@@ -172,7 +174,7 @@ export function UserManagementLayout({ className }) {
|
|
|
172
174
|
return;
|
|
173
175
|
setUsersActionLoading(true);
|
|
174
176
|
try {
|
|
175
|
-
const response = await fetch(
|
|
177
|
+
const response = await fetch(`${apiBasePath}/user_management/users`, {
|
|
176
178
|
method: "POST",
|
|
177
179
|
headers: {
|
|
178
180
|
"Content-Type": "application/json",
|
|
@@ -203,7 +205,7 @@ export function UserManagementLayout({ className }) {
|
|
|
203
205
|
var _a, _b;
|
|
204
206
|
setMigrateLoading(true);
|
|
205
207
|
try {
|
|
206
|
-
const response = await fetch(
|
|
208
|
+
const response = await fetch(`${apiBasePath}/user_management/permissions?action=migrate`, {
|
|
207
209
|
method: "POST",
|
|
208
210
|
});
|
|
209
211
|
const data = await response.json();
|
|
@@ -224,7 +226,7 @@ export function UserManagementLayout({ className }) {
|
|
|
224
226
|
toast.info(`Skipped: ${data.skipped.join(", ")}`);
|
|
225
227
|
}
|
|
226
228
|
// Reload permissions
|
|
227
|
-
const reload_response = await fetch(
|
|
229
|
+
const reload_response = await fetch(`${apiBasePath}/user_management/permissions`);
|
|
228
230
|
const reload_data = await reload_response.json();
|
|
229
231
|
if (reload_data.success) {
|
|
230
232
|
const db_perms = reload_data.db_permissions.map((p) => ({
|
|
@@ -259,7 +261,7 @@ export function UserManagementLayout({ className }) {
|
|
|
259
261
|
return;
|
|
260
262
|
setPermissionsActionLoading(true);
|
|
261
263
|
try {
|
|
262
|
-
const response = await fetch(
|
|
264
|
+
const response = await fetch(`${apiBasePath}/user_management/permissions`, {
|
|
263
265
|
method: "PUT",
|
|
264
266
|
headers: {
|
|
265
267
|
"Content-Type": "application/json",
|
|
@@ -276,7 +278,7 @@ export function UserManagementLayout({ className }) {
|
|
|
276
278
|
setEditingPermission(null);
|
|
277
279
|
setEditDescription("");
|
|
278
280
|
// Reload permissions
|
|
279
|
-
const reload_response = await fetch(
|
|
281
|
+
const reload_response = await fetch(`${apiBasePath}/user_management/permissions`);
|
|
280
282
|
const reload_data = await reload_response.json();
|
|
281
283
|
if (reload_data.success) {
|
|
282
284
|
const db_perms = reload_data.db_permissions.map((p) => ({
|
|
@@ -313,7 +315,7 @@ export function UserManagementLayout({ className }) {
|
|
|
313
315
|
}
|
|
314
316
|
setPermissionsActionLoading(true);
|
|
315
317
|
try {
|
|
316
|
-
const response = await fetch(
|
|
318
|
+
const response = await fetch(`${apiBasePath}/user_management/permissions`, {
|
|
317
319
|
method: "POST",
|
|
318
320
|
headers: {
|
|
319
321
|
"Content-Type": "application/json",
|
|
@@ -330,7 +332,7 @@ export function UserManagementLayout({ className }) {
|
|
|
330
332
|
setNewPermissionName("");
|
|
331
333
|
setNewPermissionDescription("");
|
|
332
334
|
// Reload permissions
|
|
333
|
-
const reload_response = await fetch(
|
|
335
|
+
const reload_response = await fetch(`${apiBasePath}/user_management/permissions`);
|
|
334
336
|
const reload_data = await reload_response.json();
|
|
335
337
|
if (reload_data.success) {
|
|
336
338
|
const db_perms = reload_data.db_permissions.map((p) => ({
|
|
@@ -365,14 +367,14 @@ export function UserManagementLayout({ className }) {
|
|
|
365
367
|
return;
|
|
366
368
|
setPermissionsActionLoading(true);
|
|
367
369
|
try {
|
|
368
|
-
const response = await fetch(
|
|
370
|
+
const response = await fetch(`${apiBasePath}/user_management/permissions?permission_id=${permission.id}`, {
|
|
369
371
|
method: "DELETE",
|
|
370
372
|
});
|
|
371
373
|
const data = await response.json();
|
|
372
374
|
if (data.success) {
|
|
373
375
|
toast.success("Permission deleted successfully");
|
|
374
376
|
// Reload permissions
|
|
375
|
-
const reload_response = await fetch(
|
|
377
|
+
const reload_response = await fetch(`${apiBasePath}/user_management/permissions`);
|
|
376
378
|
const reload_data = await reload_response.json();
|
|
377
379
|
if (reload_data.success) {
|
|
378
380
|
const db_perms = reload_data.db_permissions.map((p) => ({
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime configuration for hazo_auth components
|
|
3
|
+
* Controls API paths and other runtime settings
|
|
4
|
+
*/
|
|
5
|
+
export type HazoAuthConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* Base path for all hazo_auth API endpoints
|
|
8
|
+
* @default "/api/hazo_auth"
|
|
9
|
+
* @example "/api/v1/auth"
|
|
10
|
+
*/
|
|
11
|
+
apiBasePath: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Default configuration values
|
|
15
|
+
* Used when no provider is present or when values are not specified
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_HAZO_AUTH_CONFIG: HazoAuthConfig;
|
|
18
|
+
//# sourceMappingURL=hazo_auth_config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hazo_auth_config.d.ts","sourceRoot":"","sources":["../../src/contexts/hazo_auth_config.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,cAEtC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// file_description: Type definitions for HazoAuth runtime configuration
|
|
2
|
+
// This file defines the configuration structure for the HazoAuthProvider context
|
|
3
|
+
// section: types
|
|
4
|
+
/**
|
|
5
|
+
* Default configuration values
|
|
6
|
+
* Used when no provider is present or when values are not specified
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_HAZO_AUTH_CONFIG = {
|
|
9
|
+
apiBasePath: "/api/hazo_auth",
|
|
10
|
+
};
|