@erikey/react 0.4.29 → 0.4.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erikey/react",
3
- "version": "0.4.29",
3
+ "version": "0.4.30",
4
4
  "description": "React SDK for Erikey - B2B authentication and user management. UI components based on better-auth-ui.",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  import { createAuthClient as createBetterAuthClient } from 'better-auth/react';
16
- import { siweClient } from 'better-auth/client/plugins';
16
+ import { siweClient, emailOTPClient } from 'better-auth/client/plugins';
17
17
  import {
18
18
  shouldUseBearerAuth,
19
19
  storeToken,
@@ -145,8 +145,8 @@ export function createAuthClient(config: AuthClientConfig) {
145
145
  fetchOptions,
146
146
  // For same-origin, include cookies (cross-origin uses Bearer from fetchOptions.auth)
147
147
  ...(!useBearerAuth && { credentials: 'include' as const }),
148
- // Enable SIWE (Sign-In with Ethereum) support
149
- plugins: [siweClient()],
148
+ // Enable SIWE (Sign-In with Ethereum) and email OTP support
149
+ plugins: [siweClient(), emailOTPClient()],
150
150
  });
151
151
 
152
152
  return client;
@@ -384,7 +384,12 @@ export function SignUpForm({
384
384
  fetchOptions
385
385
  })
386
386
 
387
- if ("token" in data && data.token) {
387
+ // Check for 2FA redirect first (same pattern as sign-in form)
388
+ if ((data as { twoFactorRedirect?: boolean }).twoFactorRedirect) {
389
+ navigate(
390
+ `${basePath}/${viewPaths.TWO_FACTOR}${window.location.search}`
391
+ )
392
+ } else if ("token" in data && data.token) {
388
393
  await onSuccess()
389
394
  } else if (emailVerification?.otp) {
390
395
  navigate(