@proveanything/smartlinks-auth-ui 0.1.5 → 0.1.6
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/components/SmartlinksAuthUI.d.ts.map +1 -1
- package/dist/index.esm.js +26 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartlinksAuthUI.d.ts","sourceRoot":"","sources":["../../src/components/SmartlinksAuthUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAUnD,OAAO,KAAK,EAAE,qBAAqB,EAAyC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"SmartlinksAuthUI.d.ts","sourceRoot":"","sources":["../../src/components/SmartlinksAuthUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAUnD,OAAO,KAAK,EAAE,qBAAqB,EAAyC,MAAM,UAAU,CAAC;AAqB7F,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAk4B5D,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -11413,6 +11413,21 @@ const useAuth = () => {
|
|
|
11413
11413
|
|
|
11414
11414
|
// Default Smartlinks Google OAuth Client ID (public - safe to expose)
|
|
11415
11415
|
const DEFAULT_GOOGLE_CLIENT_ID = '696509063554-jdlbjl8vsjt7cr0vgkjkjf3ffnvi3a70.apps.googleusercontent.com';
|
|
11416
|
+
// Default auth UI configuration when no clientId is provided
|
|
11417
|
+
const DEFAULT_AUTH_CONFIG = {
|
|
11418
|
+
branding: {
|
|
11419
|
+
title: '', // No title by default (minimal)
|
|
11420
|
+
subtitle: 'Sign in to your account',
|
|
11421
|
+
logoUrl: 'https://smartlinks.app/smartlinks/landscape-medium.png',
|
|
11422
|
+
primaryColor: '#3B82F6',
|
|
11423
|
+
secondaryColor: '#1D4ED8',
|
|
11424
|
+
backgroundColor: '#e0f2fe',
|
|
11425
|
+
buttonStyle: 'rounded',
|
|
11426
|
+
fontFamily: 'Inter, sans-serif'
|
|
11427
|
+
},
|
|
11428
|
+
emailDisplayMode: 'button',
|
|
11429
|
+
googleOAuthFlow: 'oneTap'
|
|
11430
|
+
};
|
|
11416
11431
|
const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAuthSuccess, onAuthError, enabledProviders = ['email', 'google', 'phone'], initialMode = 'login', redirectUrl, theme = 'light', className, customization, skipConfigFetch = false, minimal = false, }) => {
|
|
11417
11432
|
const [mode, setMode] = useState(initialMode);
|
|
11418
11433
|
const [loading, setLoading] = useState(false);
|
|
@@ -11468,9 +11483,19 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
11468
11483
|
return;
|
|
11469
11484
|
}
|
|
11470
11485
|
const fetchConfig = async () => {
|
|
11486
|
+
// If no clientId provided, use default config immediately without API call
|
|
11487
|
+
if (!clientId) {
|
|
11488
|
+
const defaultConfig = {
|
|
11489
|
+
...DEFAULT_AUTH_CONFIG,
|
|
11490
|
+
enabledProviders: enabledProviders || ['email', 'google', 'phone']
|
|
11491
|
+
};
|
|
11492
|
+
setConfig({ ...defaultConfig, ...customization });
|
|
11493
|
+
setConfigLoading(false);
|
|
11494
|
+
return;
|
|
11495
|
+
}
|
|
11471
11496
|
try {
|
|
11472
11497
|
// Check localStorage cache first
|
|
11473
|
-
const cacheKey = `auth_ui_config_${clientId
|
|
11498
|
+
const cacheKey = `auth_ui_config_${clientId}`;
|
|
11474
11499
|
const cached = localStorage.getItem(cacheKey);
|
|
11475
11500
|
if (cached) {
|
|
11476
11501
|
const { config: cachedConfig, timestamp } = JSON.parse(cached);
|