@proveanything/smartlinks-auth-ui 0.1.7 → 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 +71 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +71 -14
- 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,11 +10688,15 @@ class AuthAPI {
|
|
|
10653
10688
|
});
|
|
10654
10689
|
}
|
|
10655
10690
|
async fetchConfig() {
|
|
10691
|
+
this.log.log('fetchConfig called with clientId:', this.clientId);
|
|
10656
10692
|
try {
|
|
10657
|
-
|
|
10693
|
+
this.log.log('Calling smartlinks.authKit.load...');
|
|
10694
|
+
const result = await smartlinks.authKit.load(this.clientId);
|
|
10695
|
+
this.log.log('smartlinks.authKit.load returned:', result);
|
|
10696
|
+
return result;
|
|
10658
10697
|
}
|
|
10659
10698
|
catch (error) {
|
|
10660
|
-
|
|
10699
|
+
this.log.warn('Failed to fetch UI config, using defaults:', error);
|
|
10661
10700
|
return {
|
|
10662
10701
|
branding: {
|
|
10663
10702
|
title: 'Smartlinks Auth',
|
|
@@ -11454,7 +11493,7 @@ const loadGoogleIdentityServices = () => {
|
|
|
11454
11493
|
document.head.appendChild(script);
|
|
11455
11494
|
});
|
|
11456
11495
|
};
|
|
11457
|
-
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, }) => {
|
|
11458
11497
|
const [mode, setMode] = useState(initialMode);
|
|
11459
11498
|
const [loading, setLoading] = useState(false);
|
|
11460
11499
|
const [error, setError] = useState();
|
|
@@ -11470,7 +11509,8 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11470
11509
|
const [config, setConfig] = useState(null);
|
|
11471
11510
|
const [configLoading, setConfigLoading] = useState(!skipConfigFetch);
|
|
11472
11511
|
const [showEmailForm, setShowEmailForm] = useState(false); // Track if email form should be shown when emailDisplayMode is 'button'
|
|
11473
|
-
const
|
|
11512
|
+
const log = useMemo(() => createLoggerWrapper(logger), [logger]);
|
|
11513
|
+
const api = new AuthAPI(apiEndpoint, clientId, clientName, logger);
|
|
11474
11514
|
const auth = useAuth();
|
|
11475
11515
|
// Dark mode detection and theme management
|
|
11476
11516
|
useEffect(() => {
|
|
@@ -11488,25 +11528,31 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11488
11528
|
// Reinitialize Smartlinks SDK when apiEndpoint changes (for test/dev scenarios)
|
|
11489
11529
|
// IMPORTANT: Preserve bearer token during reinitialization
|
|
11490
11530
|
useEffect(() => {
|
|
11531
|
+
log.log('SDK reinitialize useEffect triggered', { apiEndpoint });
|
|
11491
11532
|
const reinitializeWithToken = async () => {
|
|
11492
11533
|
if (apiEndpoint) {
|
|
11534
|
+
log.log('Reinitializing SDK with baseURL:', apiEndpoint);
|
|
11493
11535
|
// Get current token before reinitializing
|
|
11494
11536
|
const currentToken = await auth.getToken();
|
|
11495
11537
|
smartlinks.initializeApi({
|
|
11496
11538
|
baseURL: apiEndpoint,
|
|
11497
11539
|
proxyMode: false, // Direct API calls when custom endpoint is provided
|
|
11498
11540
|
ngrokSkipBrowserWarning: true,
|
|
11541
|
+
logger: logger, // Pass logger to SDK for verbose SDK logging
|
|
11499
11542
|
});
|
|
11500
11543
|
// Restore bearer token after reinitialization using auth.verifyToken
|
|
11501
11544
|
if (currentToken) {
|
|
11502
11545
|
smartlinks.auth.verifyToken(currentToken).catch(err => {
|
|
11503
|
-
|
|
11546
|
+
log.warn('Failed to restore bearer token after reinit:', err);
|
|
11504
11547
|
});
|
|
11505
11548
|
}
|
|
11506
11549
|
}
|
|
11550
|
+
else {
|
|
11551
|
+
log.log('No apiEndpoint, skipping SDK reinitialize');
|
|
11552
|
+
}
|
|
11507
11553
|
};
|
|
11508
11554
|
reinitializeWithToken();
|
|
11509
|
-
}, [apiEndpoint, auth]);
|
|
11555
|
+
}, [apiEndpoint, auth, logger, log]);
|
|
11510
11556
|
// Get the effective redirect URL (use prop or default to current page)
|
|
11511
11557
|
const getRedirectUrl = () => {
|
|
11512
11558
|
if (redirectUrl)
|
|
@@ -11518,13 +11564,22 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11518
11564
|
};
|
|
11519
11565
|
// Fetch UI configuration
|
|
11520
11566
|
useEffect(() => {
|
|
11567
|
+
log.log('Config fetch useEffect triggered', {
|
|
11568
|
+
skipConfigFetch,
|
|
11569
|
+
clientId,
|
|
11570
|
+
clientIdType: typeof clientId,
|
|
11571
|
+
clientIdTruthy: !!clientId,
|
|
11572
|
+
apiEndpoint
|
|
11573
|
+
});
|
|
11521
11574
|
if (skipConfigFetch) {
|
|
11575
|
+
log.log('Skipping config fetch - skipConfigFetch is true');
|
|
11522
11576
|
setConfig(customization || {});
|
|
11523
11577
|
return;
|
|
11524
11578
|
}
|
|
11525
11579
|
const fetchConfig = async () => {
|
|
11526
11580
|
// If no clientId provided, use default config immediately without API call
|
|
11527
11581
|
if (!clientId) {
|
|
11582
|
+
log.log('No clientId provided, using default config');
|
|
11528
11583
|
const defaultConfig = {
|
|
11529
11584
|
...DEFAULT_AUTH_CONFIG,
|
|
11530
11585
|
enabledProviders: enabledProviders || ['email', 'google', 'phone']
|
|
@@ -11555,7 +11610,9 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11555
11610
|
}
|
|
11556
11611
|
}
|
|
11557
11612
|
// Fetch from API
|
|
11613
|
+
log.log('Fetching config from API for clientId:', clientId);
|
|
11558
11614
|
const fetchedConfig = await api.fetchConfig();
|
|
11615
|
+
log.log('Received config:', fetchedConfig);
|
|
11559
11616
|
// Merge with customization props (props take precedence)
|
|
11560
11617
|
const mergedConfig = { ...fetchedConfig, ...customization };
|
|
11561
11618
|
setConfig(mergedConfig);
|
|
@@ -11566,7 +11623,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11566
11623
|
}));
|
|
11567
11624
|
}
|
|
11568
11625
|
catch (err) {
|
|
11569
|
-
|
|
11626
|
+
log.error('Failed to fetch config:', err);
|
|
11570
11627
|
setConfig(customization || {});
|
|
11571
11628
|
}
|
|
11572
11629
|
finally {
|
|
@@ -11574,7 +11631,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11574
11631
|
}
|
|
11575
11632
|
};
|
|
11576
11633
|
fetchConfig();
|
|
11577
|
-
}, [apiEndpoint, clientId, customization, skipConfigFetch]);
|
|
11634
|
+
}, [apiEndpoint, clientId, customization, skipConfigFetch, log]);
|
|
11578
11635
|
// Reset showEmailForm when mode changes away from login/register
|
|
11579
11636
|
useEffect(() => {
|
|
11580
11637
|
if (mode !== 'login' && mode !== 'register') {
|
|
@@ -11599,7 +11656,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11599
11656
|
const params = getUrlParams();
|
|
11600
11657
|
const urlMode = params.get('mode');
|
|
11601
11658
|
const token = params.get('token');
|
|
11602
|
-
|
|
11659
|
+
log.log('URL params detected:', { urlMode, token, hash: window.location.hash, search: window.location.search });
|
|
11603
11660
|
if (urlMode && token) {
|
|
11604
11661
|
handleURLBasedAuth(urlMode, token);
|
|
11605
11662
|
}
|
|
@@ -11609,7 +11666,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11609
11666
|
setError(undefined);
|
|
11610
11667
|
try {
|
|
11611
11668
|
if (urlMode === 'verifyEmail') {
|
|
11612
|
-
|
|
11669
|
+
log.log('Verifying email with token:', token);
|
|
11613
11670
|
const response = await api.verifyEmailWithToken(token);
|
|
11614
11671
|
// Get email verification mode from response or config
|
|
11615
11672
|
const verificationMode = response.emailVerificationMode || config?.emailVerification?.mode || 'verify-then-auto-login';
|
|
@@ -11644,7 +11701,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11644
11701
|
}
|
|
11645
11702
|
}
|
|
11646
11703
|
else if (urlMode === 'resetPassword') {
|
|
11647
|
-
|
|
11704
|
+
log.log('Verifying reset token:', token);
|
|
11648
11705
|
// Verify token is valid, then show password reset form
|
|
11649
11706
|
await api.verifyResetToken(token);
|
|
11650
11707
|
setResetToken(token); // Store token for use in password reset
|
|
@@ -11654,7 +11711,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11654
11711
|
window.history.replaceState({}, document.title, cleanUrl);
|
|
11655
11712
|
}
|
|
11656
11713
|
else if (urlMode === 'magicLink') {
|
|
11657
|
-
|
|
11714
|
+
log.log('Verifying magic link token:', token);
|
|
11658
11715
|
const response = await api.verifyMagicLink(token);
|
|
11659
11716
|
// Auto-login with magic link if token is provided
|
|
11660
11717
|
if (response.token) {
|
|
@@ -11678,7 +11735,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11678
11735
|
}
|
|
11679
11736
|
}
|
|
11680
11737
|
catch (err) {
|
|
11681
|
-
|
|
11738
|
+
log.error('URL-based auth error:', err);
|
|
11682
11739
|
const errorMessage = err instanceof Error ? err.message : 'An error occurred';
|
|
11683
11740
|
// If it's an email verification error (expired/invalid token), show resend option
|
|
11684
11741
|
if (urlMode === 'verifyEmail') {
|