@thetechfossil/auth2 1.2.16 → 1.2.18
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/dist/index.components.js +120 -5
- package/dist/index.components.js.map +1 -1
- package/dist/index.components.mjs +120 -5
- package/dist/index.components.mjs.map +1 -1
- package/dist/index.js +120 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -5
- package/dist/index.mjs.map +1 -1
- package/dist/index.next.js +120 -5
- package/dist/index.next.js.map +1 -1
- package/dist/index.next.mjs +120 -5
- package/dist/index.next.mjs.map +1 -1
- package/dist/index.next.server.d.mts +15 -3
- package/dist/index.next.server.d.ts +15 -3
- package/dist/index.next.server.js +16 -5
- package/dist/index.next.server.js.map +1 -1
- package/dist/index.next.server.mjs +13 -2
- package/dist/index.next.server.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.next.js
CHANGED
|
@@ -4466,6 +4466,96 @@ var ChangePassword = ({ onSuccess, appearance }) => {
|
|
|
4466
4466
|
)
|
|
4467
4467
|
] }) });
|
|
4468
4468
|
};
|
|
4469
|
+
|
|
4470
|
+
// src/react/components/utils/injectModalStyles.ts
|
|
4471
|
+
var injectModalStyles = () => {
|
|
4472
|
+
if (document.getElementById("ttf-auth-modal-styles")) {
|
|
4473
|
+
return;
|
|
4474
|
+
}
|
|
4475
|
+
const styleElement = document.createElement("style");
|
|
4476
|
+
styleElement.id = "ttf-auth-modal-styles";
|
|
4477
|
+
styleElement.textContent = `
|
|
4478
|
+
/* ImageManager Modal Styles - Critical for proper modal display */
|
|
4479
|
+
/* Radix UI Dialog styles - Force visibility */
|
|
4480
|
+
[data-radix-portal] {
|
|
4481
|
+
z-index: 99999 !important;
|
|
4482
|
+
position: fixed !important;
|
|
4483
|
+
inset: 0 !important;
|
|
4484
|
+
pointer-events: none !important;
|
|
4485
|
+
}
|
|
4486
|
+
|
|
4487
|
+
[data-radix-portal] > * {
|
|
4488
|
+
pointer-events: auto !important;
|
|
4489
|
+
}
|
|
4490
|
+
|
|
4491
|
+
/* Dialog Overlay */
|
|
4492
|
+
[data-state="open"][data-radix-dialog-overlay],
|
|
4493
|
+
[role="dialog"] + [data-radix-dialog-overlay] {
|
|
4494
|
+
position: fixed !important;
|
|
4495
|
+
inset: 0 !important;
|
|
4496
|
+
z-index: 99998 !important;
|
|
4497
|
+
background-color: rgba(0, 0, 0, 0.6) !important;
|
|
4498
|
+
pointer-events: auto !important;
|
|
4499
|
+
}
|
|
4500
|
+
|
|
4501
|
+
/* Dialog Content - Center the modal properly */
|
|
4502
|
+
[data-state="open"][data-radix-dialog-content],
|
|
4503
|
+
[role="dialog"][data-radix-dialog-content] {
|
|
4504
|
+
position: fixed !important;
|
|
4505
|
+
left: 50% !important;
|
|
4506
|
+
top: 50% !important;
|
|
4507
|
+
transform: translate(-50%, -50%) !important;
|
|
4508
|
+
z-index: 99999 !important;
|
|
4509
|
+
background: white !important;
|
|
4510
|
+
border-radius: 16px !important;
|
|
4511
|
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
|
|
4512
|
+
pointer-events: auto !important;
|
|
4513
|
+
width: 95vw !important;
|
|
4514
|
+
max-width: 1280px !important;
|
|
4515
|
+
height: 90vh !important;
|
|
4516
|
+
max-height: 90vh !important;
|
|
4517
|
+
min-width: 800px !important;
|
|
4518
|
+
min-height: 600px !important;
|
|
4519
|
+
overflow: hidden !important;
|
|
4520
|
+
}
|
|
4521
|
+
|
|
4522
|
+
/* Dark mode support */
|
|
4523
|
+
.dark [data-state="open"][data-radix-dialog-content],
|
|
4524
|
+
.dark [role="dialog"][data-radix-dialog-content] {
|
|
4525
|
+
background: #0f172a !important;
|
|
4526
|
+
border: 1px solid #334155 !important;
|
|
4527
|
+
}
|
|
4528
|
+
`;
|
|
4529
|
+
document.head.appendChild(styleElement);
|
|
4530
|
+
};
|
|
4531
|
+
|
|
4532
|
+
// src/react/components/utils/getAnonymousUserId.ts
|
|
4533
|
+
var ANONYMOUS_USER_ID_KEY = "ttf_auth_anonymous_user_id";
|
|
4534
|
+
function generateUUID() {
|
|
4535
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
4536
|
+
return crypto.randomUUID();
|
|
4537
|
+
}
|
|
4538
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
4539
|
+
const r = Math.random() * 16 | 0;
|
|
4540
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
4541
|
+
return v.toString(16);
|
|
4542
|
+
});
|
|
4543
|
+
}
|
|
4544
|
+
function getAnonymousUserId() {
|
|
4545
|
+
if (typeof window === "undefined" || typeof localStorage === "undefined") {
|
|
4546
|
+
return null;
|
|
4547
|
+
}
|
|
4548
|
+
try {
|
|
4549
|
+
let anonymousId = localStorage.getItem(ANONYMOUS_USER_ID_KEY);
|
|
4550
|
+
if (!anonymousId) {
|
|
4551
|
+
anonymousId = generateUUID();
|
|
4552
|
+
localStorage.setItem(ANONYMOUS_USER_ID_KEY, anonymousId);
|
|
4553
|
+
}
|
|
4554
|
+
return anonymousId;
|
|
4555
|
+
} catch {
|
|
4556
|
+
return generateUUID();
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4469
4559
|
var AvatarUploader = ({
|
|
4470
4560
|
onUploadComplete,
|
|
4471
4561
|
onError,
|
|
@@ -4476,13 +4566,25 @@ var AvatarUploader = ({
|
|
|
4476
4566
|
upfilesConfig,
|
|
4477
4567
|
buttonText = "Upload Avatar"
|
|
4478
4568
|
}) => {
|
|
4479
|
-
const {
|
|
4569
|
+
const { user, updateProfile } = useAuth2();
|
|
4480
4570
|
const [open, setOpen] = React.useState(false);
|
|
4481
4571
|
const [uploading, setUploading] = React.useState(false);
|
|
4572
|
+
React.useEffect(() => {
|
|
4573
|
+
injectModalStyles();
|
|
4574
|
+
}, []);
|
|
4575
|
+
const effectiveFolderPath = React.useMemo(() => {
|
|
4576
|
+
if (user?.id) {
|
|
4577
|
+
return `users/${user.id}/`;
|
|
4578
|
+
}
|
|
4579
|
+
const anonymousId = getAnonymousUserId();
|
|
4580
|
+
if (anonymousId) {
|
|
4581
|
+
return `anonymous/${anonymousId}/`;
|
|
4582
|
+
}
|
|
4583
|
+
return upfilesConfig.folderPath || "/";
|
|
4584
|
+
}, [user?.id, upfilesConfig.folderPath]);
|
|
4482
4585
|
const handleSelect = async (image) => {
|
|
4483
4586
|
setUploading(true);
|
|
4484
4587
|
try {
|
|
4485
|
-
const { updateProfile } = useAuth2();
|
|
4486
4588
|
const response = await updateProfile({ avatar: image.url });
|
|
4487
4589
|
if (response.success && response.user?.avatar) {
|
|
4488
4590
|
onUploadComplete?.(response.user.avatar);
|
|
@@ -4521,7 +4623,7 @@ var AvatarUploader = ({
|
|
|
4521
4623
|
presignPath: upfilesConfig.presignPath
|
|
4522
4624
|
},
|
|
4523
4625
|
projectId: upfilesConfig.projectId,
|
|
4524
|
-
folderPath:
|
|
4626
|
+
folderPath: effectiveFolderPath,
|
|
4525
4627
|
title: "Select Avatar",
|
|
4526
4628
|
description: "Upload a new avatar or select from existing images.",
|
|
4527
4629
|
mode: "full",
|
|
@@ -4848,8 +4950,21 @@ var AvatarManager = ({
|
|
|
4848
4950
|
onDelete,
|
|
4849
4951
|
upfilesConfig
|
|
4850
4952
|
}) => {
|
|
4851
|
-
const { updateProfile } = useAuth2();
|
|
4953
|
+
const { user, updateProfile } = useAuth2();
|
|
4852
4954
|
const [updating, setUpdating] = React.useState(false);
|
|
4955
|
+
React.useEffect(() => {
|
|
4956
|
+
injectModalStyles();
|
|
4957
|
+
}, []);
|
|
4958
|
+
const effectiveFolderPath = React.useMemo(() => {
|
|
4959
|
+
if (user?.id) {
|
|
4960
|
+
return `users/${user.id}/`;
|
|
4961
|
+
}
|
|
4962
|
+
const anonymousId = getAnonymousUserId();
|
|
4963
|
+
if (anonymousId) {
|
|
4964
|
+
return `anonymous/${anonymousId}/`;
|
|
4965
|
+
}
|
|
4966
|
+
return upfilesConfig.folderPath || "/";
|
|
4967
|
+
}, [user?.id, upfilesConfig.folderPath]);
|
|
4853
4968
|
const handleSelect = async (image) => {
|
|
4854
4969
|
setUpdating(true);
|
|
4855
4970
|
try {
|
|
@@ -4882,7 +4997,7 @@ var AvatarManager = ({
|
|
|
4882
4997
|
withCredentials: upfilesConfig.withCredentials
|
|
4883
4998
|
},
|
|
4884
4999
|
projectId,
|
|
4885
|
-
folderPath:
|
|
5000
|
+
folderPath: effectiveFolderPath,
|
|
4886
5001
|
title,
|
|
4887
5002
|
description,
|
|
4888
5003
|
className,
|