@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/index.js CHANGED
@@ -11434,6 +11434,21 @@ const useAuth = () => {
11434
11434
 
11435
11435
  // Default Smartlinks Google OAuth Client ID (public - safe to expose)
11436
11436
  const DEFAULT_GOOGLE_CLIENT_ID = '696509063554-jdlbjl8vsjt7cr0vgkjkjf3ffnvi3a70.apps.googleusercontent.com';
11437
+ // Default auth UI configuration when no clientId is provided
11438
+ const DEFAULT_AUTH_CONFIG = {
11439
+ branding: {
11440
+ title: '', // No title by default (minimal)
11441
+ subtitle: 'Sign in to your account',
11442
+ logoUrl: 'https://smartlinks.app/smartlinks/landscape-medium.png',
11443
+ primaryColor: '#3B82F6',
11444
+ secondaryColor: '#1D4ED8',
11445
+ backgroundColor: '#e0f2fe',
11446
+ buttonStyle: 'rounded',
11447
+ fontFamily: 'Inter, sans-serif'
11448
+ },
11449
+ emailDisplayMode: 'button',
11450
+ googleOAuthFlow: 'oneTap'
11451
+ };
11437
11452
  const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAuthSuccess, onAuthError, enabledProviders = ['email', 'google', 'phone'], initialMode = 'login', redirectUrl, theme = 'light', className, customization, skipConfigFetch = false, minimal = false, }) => {
11438
11453
  const [mode, setMode] = React.useState(initialMode);
11439
11454
  const [loading, setLoading] = React.useState(false);
@@ -11489,9 +11504,19 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
11489
11504
  return;
11490
11505
  }
11491
11506
  const fetchConfig = async () => {
11507
+ // If no clientId provided, use default config immediately without API call
11508
+ if (!clientId) {
11509
+ const defaultConfig = {
11510
+ ...DEFAULT_AUTH_CONFIG,
11511
+ enabledProviders: enabledProviders || ['email', 'google', 'phone']
11512
+ };
11513
+ setConfig({ ...defaultConfig, ...customization });
11514
+ setConfigLoading(false);
11515
+ return;
11516
+ }
11492
11517
  try {
11493
11518
  // Check localStorage cache first
11494
- const cacheKey = `auth_ui_config_${clientId || 'default'}`;
11519
+ const cacheKey = `auth_ui_config_${clientId}`;
11495
11520
  const cached = localStorage.getItem(cacheKey);
11496
11521
  if (cached) {
11497
11522
  const { config: cachedConfig, timestamp } = JSON.parse(cached);