@erikey/react 0.4.34 → 0.4.36
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/ui/index.mjs +13 -9
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/ui/components/auth/auth-flow.tsx +22 -12
package/package.json
CHANGED
|
@@ -40,7 +40,8 @@ export interface AuthFlowProps
|
|
|
40
40
|
initialView?: AuthFlowView
|
|
41
41
|
/**
|
|
42
42
|
* URL to redirect to after successful authentication.
|
|
43
|
-
*
|
|
43
|
+
* Used by OAuth callbacks and underlying auth forms.
|
|
44
|
+
* In "internal" mode, session state change triggers re-render automatically.
|
|
44
45
|
*/
|
|
45
46
|
redirectTo?: string
|
|
46
47
|
/**
|
|
@@ -246,13 +247,27 @@ export function AuthFlow({
|
|
|
246
247
|
// In route mode, or for non-auth paths, let the link work normally
|
|
247
248
|
}
|
|
248
249
|
|
|
249
|
-
//
|
|
250
|
+
// In internal mode for auth paths, ALWAYS use plain <a> that we control
|
|
251
|
+
// This avoids relying on external Link components forwarding onClick
|
|
252
|
+
if (mode === "internal" && isAuthPath(href)) {
|
|
253
|
+
return (
|
|
254
|
+
<a
|
|
255
|
+
href={href}
|
|
256
|
+
className={linkClassName}
|
|
257
|
+
onClick={handleClick}
|
|
258
|
+
{...rest}
|
|
259
|
+
>
|
|
260
|
+
{children}
|
|
261
|
+
</a>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// For non-auth paths or route mode, use external Link if provided
|
|
250
266
|
if (ExternalLink) {
|
|
251
267
|
return (
|
|
252
268
|
<ExternalLink
|
|
253
269
|
href={href}
|
|
254
270
|
className={linkClassName}
|
|
255
|
-
onClick={handleClick}
|
|
256
271
|
{...rest}
|
|
257
272
|
>
|
|
258
273
|
{children}
|
|
@@ -281,16 +296,11 @@ export function AuthFlow({
|
|
|
281
296
|
// Forward to user's handler
|
|
282
297
|
onEvent?.(event)
|
|
283
298
|
|
|
284
|
-
// In internal mode,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
externalNavigate(redirectTo)
|
|
288
|
-
} else {
|
|
289
|
-
window.location.href = redirectTo
|
|
290
|
-
}
|
|
291
|
-
}
|
|
299
|
+
// In internal mode, don't auto-redirect on AUTH_SUCCESS
|
|
300
|
+
// Let React re-render based on session state (useSession hook)
|
|
301
|
+
// User can handle AUTH_SUCCESS in onEvent if custom behavior needed
|
|
292
302
|
},
|
|
293
|
-
[onEvent
|
|
303
|
+
[onEvent]
|
|
294
304
|
)
|
|
295
305
|
|
|
296
306
|
// Get the view key for AuthView component
|