@proveanything/smartlinks-auth-ui 0.1.8 → 0.1.9
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/api.d.ts +3 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/components/SmartlinksAuthUI.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +61 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +61 -24
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuthResponse, AuthFormData, AuthUIConfig } from './types';
|
|
1
|
+
import type { AuthResponse, AuthFormData, AuthUIConfig, AuthLogger } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* AuthAPI - Thin wrapper around Smartlinks SDK authKit namespace
|
|
4
4
|
* All authentication operations now use the global Smartlinks SDK
|
|
@@ -6,7 +6,8 @@ import type { AuthResponse, AuthFormData, AuthUIConfig } from './types';
|
|
|
6
6
|
export declare class AuthAPI {
|
|
7
7
|
private clientId;
|
|
8
8
|
private clientName?;
|
|
9
|
-
|
|
9
|
+
private log;
|
|
10
|
+
constructor(_apiEndpoint: string, clientId: string, clientName?: string, logger?: AuthLogger);
|
|
10
11
|
login(email: string, password: string): Promise<AuthResponse>;
|
|
11
12
|
register(data: AuthFormData): Promise<AuthResponse>;
|
|
12
13
|
loginWithGoogle(idToken: string): Promise<AuthResponse>;
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGpF;;;GAGG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,GAAG,CAAyC;gBAExC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU;IAQtF,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAI7D,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IASnD,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIvD,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;IAIvE,eAAe,CACnB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,CAAC;IAIlB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAQxG,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAIlH,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAIzG,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IASzH,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAIhF,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAStH,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;IAuBpC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAOjG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAGlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartlinksAuthUI.d.ts","sourceRoot":"","sources":["../../src/components/SmartlinksAuthUI.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SmartlinksAuthUI.d.ts","sourceRoot":"","sources":["../../src/components/SmartlinksAuthUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAW5D,OAAO,KAAK,EAAE,qBAAqB,EAAyC,MAAM,UAAU,CAAC;AAkD7F,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA06B5D,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export { ProtectedRoute } from './components/ProtectedRoute';
|
|
|
6
6
|
export { tokenStorage } from './utils/tokenStorage';
|
|
7
7
|
export { AuthUIPreview } from './components/AuthUIPreview';
|
|
8
8
|
export type * from './types';
|
|
9
|
+
export type { AuthLogger } from './types';
|
|
9
10
|
export { SmartlinksAuthUI as FirebaseAuthUI } from './components/SmartlinksAuthUI';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,mBAAmB,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,mBAAmB,SAAS,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,OAAO,EAAE,gBAAgB,IAAI,cAAc,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -10589,16 +10589,51 @@ const MagicLinkForm = ({ onSubmit, onCancel, loading = false, error, }) => {
|
|
|
10589
10589
|
return (jsxs("form", { onSubmit: handleSubmit, className: "auth-form", children: [jsxs("div", { className: "auth-form-group", children: [jsx("label", { htmlFor: "magic-link-email", className: "auth-label", children: "Email Address" }), jsx("input", { id: "magic-link-email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), className: "auth-input", placeholder: "you@example.com", required: true, disabled: loading })] }), error && (jsx("div", { className: "auth-error-message", children: error })), jsx("button", { type: "submit", className: "auth-button auth-button-primary", disabled: loading || !email, children: loading ? (jsxs(Fragment, { children: [jsx("span", { className: "auth-spinner" }), "Sending..."] })) : ('Send Magic Link') }), jsx("button", { type: "button", onClick: onCancel, className: "auth-button auth-button-secondary", disabled: loading, children: "Cancel" })] }));
|
|
10590
10590
|
};
|
|
10591
10591
|
|
|
10592
|
+
/**
|
|
10593
|
+
* Creates a normalized logger wrapper that works with different logger types
|
|
10594
|
+
* - If no logger provided, returns no-op logger (silent)
|
|
10595
|
+
* - If function logger, wraps it with level prefixes
|
|
10596
|
+
* - If console-like object, wraps methods with prefixes
|
|
10597
|
+
*/
|
|
10598
|
+
function createLoggerWrapper(logger) {
|
|
10599
|
+
if (!logger) {
|
|
10600
|
+
// No-op logger when not provided
|
|
10601
|
+
return {
|
|
10602
|
+
log: () => { },
|
|
10603
|
+
warn: () => { },
|
|
10604
|
+
error: () => { },
|
|
10605
|
+
debug: () => { },
|
|
10606
|
+
};
|
|
10607
|
+
}
|
|
10608
|
+
if (typeof logger === 'function') {
|
|
10609
|
+
// Function logger - call it for all levels
|
|
10610
|
+
return {
|
|
10611
|
+
log: (...args) => logger('[Auth]', ...args),
|
|
10612
|
+
warn: (...args) => logger('[Auth WARN]', ...args),
|
|
10613
|
+
error: (...args) => logger('[Auth ERROR]', ...args),
|
|
10614
|
+
debug: (...args) => logger('[Auth DEBUG]', ...args),
|
|
10615
|
+
};
|
|
10616
|
+
}
|
|
10617
|
+
// Console-like object logger
|
|
10618
|
+
return {
|
|
10619
|
+
log: logger.log ? (...args) => logger.log('[Auth]', ...args) : () => { },
|
|
10620
|
+
warn: logger.warn ? (...args) => logger.warn('[Auth WARN]', ...args) : () => { },
|
|
10621
|
+
error: logger.error ? (...args) => logger.error('[Auth ERROR]', ...args) : () => { },
|
|
10622
|
+
debug: logger.debug ? (...args) => logger.debug('[Auth DEBUG]', ...args) : () => { },
|
|
10623
|
+
};
|
|
10624
|
+
}
|
|
10625
|
+
|
|
10592
10626
|
/**
|
|
10593
10627
|
* AuthAPI - Thin wrapper around Smartlinks SDK authKit namespace
|
|
10594
10628
|
* All authentication operations now use the global Smartlinks SDK
|
|
10595
10629
|
*/
|
|
10596
10630
|
class AuthAPI {
|
|
10597
|
-
constructor(_apiEndpoint, clientId, clientName) {
|
|
10631
|
+
constructor(_apiEndpoint, clientId, clientName, logger) {
|
|
10598
10632
|
// apiEndpoint is kept for backward compatibility but not used
|
|
10599
10633
|
// Smartlinks SDK is pre-configured globally
|
|
10600
10634
|
this.clientId = clientId;
|
|
10601
10635
|
this.clientName = clientName;
|
|
10636
|
+
this.log = createLoggerWrapper(logger);
|
|
10602
10637
|
}
|
|
10603
10638
|
async login(email, password) {
|
|
10604
10639
|
return smartlinks.authKit.login(this.clientId, email, password);
|
|
@@ -10653,15 +10688,15 @@ class AuthAPI {
|
|
|
10653
10688
|
});
|
|
10654
10689
|
}
|
|
10655
10690
|
async fetchConfig() {
|
|
10656
|
-
|
|
10691
|
+
this.log.log('fetchConfig called with clientId:', this.clientId);
|
|
10657
10692
|
try {
|
|
10658
|
-
|
|
10693
|
+
this.log.log('Calling smartlinks.authKit.load...');
|
|
10659
10694
|
const result = await smartlinks.authKit.load(this.clientId);
|
|
10660
|
-
|
|
10695
|
+
this.log.log('smartlinks.authKit.load returned:', result);
|
|
10661
10696
|
return result;
|
|
10662
10697
|
}
|
|
10663
10698
|
catch (error) {
|
|
10664
|
-
|
|
10699
|
+
this.log.warn('Failed to fetch UI config, using defaults:', error);
|
|
10665
10700
|
return {
|
|
10666
10701
|
branding: {
|
|
10667
10702
|
title: 'Smartlinks Auth',
|
|
@@ -11458,7 +11493,7 @@ const loadGoogleIdentityServices = () => {
|
|
|
11458
11493
|
document.head.appendChild(script);
|
|
11459
11494
|
});
|
|
11460
11495
|
};
|
|
11461
|
-
const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAuthSuccess, onAuthError, enabledProviders = ['email', 'google', 'phone'], initialMode = 'login', redirectUrl, theme = 'auto', className, customization, skipConfigFetch = false, minimal = false, }) => {
|
|
11496
|
+
const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAuthSuccess, onAuthError, enabledProviders = ['email', 'google', 'phone'], initialMode = 'login', redirectUrl, theme = 'auto', className, customization, skipConfigFetch = false, minimal = false, logger, }) => {
|
|
11462
11497
|
const [mode, setMode] = useState(initialMode);
|
|
11463
11498
|
const [loading, setLoading] = useState(false);
|
|
11464
11499
|
const [error, setError] = useState();
|
|
@@ -11474,7 +11509,8 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11474
11509
|
const [config, setConfig] = useState(null);
|
|
11475
11510
|
const [configLoading, setConfigLoading] = useState(!skipConfigFetch);
|
|
11476
11511
|
const [showEmailForm, setShowEmailForm] = useState(false); // Track if email form should be shown when emailDisplayMode is 'button'
|
|
11477
|
-
const
|
|
11512
|
+
const log = useMemo(() => createLoggerWrapper(logger), [logger]);
|
|
11513
|
+
const api = new AuthAPI(apiEndpoint, clientId, clientName, logger);
|
|
11478
11514
|
const auth = useAuth();
|
|
11479
11515
|
// Dark mode detection and theme management
|
|
11480
11516
|
useEffect(() => {
|
|
@@ -11492,30 +11528,31 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11492
11528
|
// Reinitialize Smartlinks SDK when apiEndpoint changes (for test/dev scenarios)
|
|
11493
11529
|
// IMPORTANT: Preserve bearer token during reinitialization
|
|
11494
11530
|
useEffect(() => {
|
|
11495
|
-
|
|
11531
|
+
log.log('SDK reinitialize useEffect triggered', { apiEndpoint });
|
|
11496
11532
|
const reinitializeWithToken = async () => {
|
|
11497
11533
|
if (apiEndpoint) {
|
|
11498
|
-
|
|
11534
|
+
log.log('Reinitializing SDK with baseURL:', apiEndpoint);
|
|
11499
11535
|
// Get current token before reinitializing
|
|
11500
11536
|
const currentToken = await auth.getToken();
|
|
11501
11537
|
smartlinks.initializeApi({
|
|
11502
11538
|
baseURL: apiEndpoint,
|
|
11503
11539
|
proxyMode: false, // Direct API calls when custom endpoint is provided
|
|
11504
11540
|
ngrokSkipBrowserWarning: true,
|
|
11541
|
+
logger: logger, // Pass logger to SDK for verbose SDK logging
|
|
11505
11542
|
});
|
|
11506
11543
|
// Restore bearer token after reinitialization using auth.verifyToken
|
|
11507
11544
|
if (currentToken) {
|
|
11508
11545
|
smartlinks.auth.verifyToken(currentToken).catch(err => {
|
|
11509
|
-
|
|
11546
|
+
log.warn('Failed to restore bearer token after reinit:', err);
|
|
11510
11547
|
});
|
|
11511
11548
|
}
|
|
11512
11549
|
}
|
|
11513
11550
|
else {
|
|
11514
|
-
|
|
11551
|
+
log.log('No apiEndpoint, skipping SDK reinitialize');
|
|
11515
11552
|
}
|
|
11516
11553
|
};
|
|
11517
11554
|
reinitializeWithToken();
|
|
11518
|
-
}, [apiEndpoint, auth]);
|
|
11555
|
+
}, [apiEndpoint, auth, logger, log]);
|
|
11519
11556
|
// Get the effective redirect URL (use prop or default to current page)
|
|
11520
11557
|
const getRedirectUrl = () => {
|
|
11521
11558
|
if (redirectUrl)
|
|
@@ -11527,7 +11564,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11527
11564
|
};
|
|
11528
11565
|
// Fetch UI configuration
|
|
11529
11566
|
useEffect(() => {
|
|
11530
|
-
|
|
11567
|
+
log.log('Config fetch useEffect triggered', {
|
|
11531
11568
|
skipConfigFetch,
|
|
11532
11569
|
clientId,
|
|
11533
11570
|
clientIdType: typeof clientId,
|
|
@@ -11535,14 +11572,14 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11535
11572
|
apiEndpoint
|
|
11536
11573
|
});
|
|
11537
11574
|
if (skipConfigFetch) {
|
|
11538
|
-
|
|
11575
|
+
log.log('Skipping config fetch - skipConfigFetch is true');
|
|
11539
11576
|
setConfig(customization || {});
|
|
11540
11577
|
return;
|
|
11541
11578
|
}
|
|
11542
11579
|
const fetchConfig = async () => {
|
|
11543
11580
|
// If no clientId provided, use default config immediately without API call
|
|
11544
11581
|
if (!clientId) {
|
|
11545
|
-
|
|
11582
|
+
log.log('No clientId provided, using default config');
|
|
11546
11583
|
const defaultConfig = {
|
|
11547
11584
|
...DEFAULT_AUTH_CONFIG,
|
|
11548
11585
|
enabledProviders: enabledProviders || ['email', 'google', 'phone']
|
|
@@ -11573,9 +11610,9 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11573
11610
|
}
|
|
11574
11611
|
}
|
|
11575
11612
|
// Fetch from API
|
|
11576
|
-
|
|
11613
|
+
log.log('Fetching config from API for clientId:', clientId);
|
|
11577
11614
|
const fetchedConfig = await api.fetchConfig();
|
|
11578
|
-
|
|
11615
|
+
log.log('Received config:', fetchedConfig);
|
|
11579
11616
|
// Merge with customization props (props take precedence)
|
|
11580
11617
|
const mergedConfig = { ...fetchedConfig, ...customization };
|
|
11581
11618
|
setConfig(mergedConfig);
|
|
@@ -11586,7 +11623,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11586
11623
|
}));
|
|
11587
11624
|
}
|
|
11588
11625
|
catch (err) {
|
|
11589
|
-
|
|
11626
|
+
log.error('Failed to fetch config:', err);
|
|
11590
11627
|
setConfig(customization || {});
|
|
11591
11628
|
}
|
|
11592
11629
|
finally {
|
|
@@ -11594,7 +11631,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11594
11631
|
}
|
|
11595
11632
|
};
|
|
11596
11633
|
fetchConfig();
|
|
11597
|
-
}, [apiEndpoint, clientId, customization, skipConfigFetch]);
|
|
11634
|
+
}, [apiEndpoint, clientId, customization, skipConfigFetch, log]);
|
|
11598
11635
|
// Reset showEmailForm when mode changes away from login/register
|
|
11599
11636
|
useEffect(() => {
|
|
11600
11637
|
if (mode !== 'login' && mode !== 'register') {
|
|
@@ -11619,7 +11656,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11619
11656
|
const params = getUrlParams();
|
|
11620
11657
|
const urlMode = params.get('mode');
|
|
11621
11658
|
const token = params.get('token');
|
|
11622
|
-
|
|
11659
|
+
log.log('URL params detected:', { urlMode, token, hash: window.location.hash, search: window.location.search });
|
|
11623
11660
|
if (urlMode && token) {
|
|
11624
11661
|
handleURLBasedAuth(urlMode, token);
|
|
11625
11662
|
}
|
|
@@ -11629,7 +11666,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11629
11666
|
setError(undefined);
|
|
11630
11667
|
try {
|
|
11631
11668
|
if (urlMode === 'verifyEmail') {
|
|
11632
|
-
|
|
11669
|
+
log.log('Verifying email with token:', token);
|
|
11633
11670
|
const response = await api.verifyEmailWithToken(token);
|
|
11634
11671
|
// Get email verification mode from response or config
|
|
11635
11672
|
const verificationMode = response.emailVerificationMode || config?.emailVerification?.mode || 'verify-then-auto-login';
|
|
@@ -11664,7 +11701,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11664
11701
|
}
|
|
11665
11702
|
}
|
|
11666
11703
|
else if (urlMode === 'resetPassword') {
|
|
11667
|
-
|
|
11704
|
+
log.log('Verifying reset token:', token);
|
|
11668
11705
|
// Verify token is valid, then show password reset form
|
|
11669
11706
|
await api.verifyResetToken(token);
|
|
11670
11707
|
setResetToken(token); // Store token for use in password reset
|
|
@@ -11674,7 +11711,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11674
11711
|
window.history.replaceState({}, document.title, cleanUrl);
|
|
11675
11712
|
}
|
|
11676
11713
|
else if (urlMode === 'magicLink') {
|
|
11677
|
-
|
|
11714
|
+
log.log('Verifying magic link token:', token);
|
|
11678
11715
|
const response = await api.verifyMagicLink(token);
|
|
11679
11716
|
// Auto-login with magic link if token is provided
|
|
11680
11717
|
if (response.token) {
|
|
@@ -11698,7 +11735,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11698
11735
|
}
|
|
11699
11736
|
}
|
|
11700
11737
|
catch (err) {
|
|
11701
|
-
|
|
11738
|
+
log.error('URL-based auth error:', err);
|
|
11702
11739
|
const errorMessage = err instanceof Error ? err.message : 'An error occurred';
|
|
11703
11740
|
// If it's an email verification error (expired/invalid token), show resend option
|
|
11704
11741
|
if (urlMode === 'verifyEmail') {
|