@proveanything/smartlinks-auth-ui 0.4.9 → 0.4.11

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
@@ -11336,10 +11336,11 @@ class AuthAPI {
11336
11336
  throw err;
11337
11337
  }
11338
11338
  }
11339
- async sendMagicLink(email, redirectUrl) {
11339
+ async sendMagicLink(email, redirectUrl, displayName) {
11340
11340
  return smartlinks__namespace.authKit.sendMagicLink(this.clientId, {
11341
11341
  email,
11342
- redirectUrl
11342
+ redirectUrl,
11343
+ accountData: displayName ? { displayName } : undefined,
11343
11344
  });
11344
11345
  }
11345
11346
  async verifyMagicLink(token) {
@@ -12670,7 +12671,9 @@ const WHITELISTED_GOOGLE_OAUTH_HOSTS = [
12670
12671
  ];
12671
12672
  /**
12672
12673
  * Check if the current domain is whitelisted for direct Google OAuth.
12673
- * Uses exact hostname match (plus subdomain match for smartlinks.app production).
12674
+ * Uses EXACT hostname match only subdomains (e.g. hubdev.smartlinks.app)
12675
+ * are NOT auto-whitelisted because they're not registered with Google Cloud Console.
12676
+ * Unregistered domains must route through the Google OAuth proxy.
12674
12677
  * Merges the hardcoded list with any additional domains from auth kit config.
12675
12678
  * Returns true if OneTap/inline flow can work without a proxy.
12676
12679
  */
@@ -12679,7 +12682,7 @@ const isWhitelistedGoogleDomain = (additionalDomains) => {
12679
12682
  const allDomains = additionalDomains?.length
12680
12683
  ? [...WHITELISTED_GOOGLE_OAUTH_HOSTS, ...additionalDomains]
12681
12684
  : WHITELISTED_GOOGLE_OAUTH_HOSTS;
12682
- return allDomains.some(domain => hostname === domain || hostname.endsWith(`.${domain}`));
12685
+ return allDomains.some(domain => hostname === domain);
12683
12686
  };
12684
12687
  // Default auth UI configuration when no clientId is provided
12685
12688
  const DEFAULT_AUTH_CONFIG = {
@@ -14035,9 +14038,8 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
14035
14038
  setLoading(true);
14036
14039
  setError(undefined);
14037
14040
  try {
14038
- // Ensure account exists before sending magic link (creates if new, no-op if exists)
14039
- await api.ensureAccount({ email, displayName });
14040
- await api.sendMagicLink(email, getRedirectUrl());
14041
+ // Send magic link - backend handles account creation automatically on verify
14042
+ await api.sendMagicLink(email, getRedirectUrl(), displayName);
14041
14043
  setAuthSuccess(true);
14042
14044
  setSuccessMessage('Magic link sent! Check your email to log in.');
14043
14045
  }