@blinkdotnew/sdk 0.18.0 → 0.18.2

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/README.md CHANGED
@@ -30,17 +30,21 @@ const blink = createClient({
30
30
  authRequired: false // Don't force immediate auth - let users browse first
31
31
  })
32
32
 
33
- // Authentication (flexible) - Two modes available
33
+ // Authentication - Choose your mode:
34
34
 
35
- // For websites: Let users browse, require auth for protected areas
36
- if (!blink.auth.isAuthenticated() && needsAuth) {
37
- blink.auth.login() // Redirects to blink.new auth page when needed
38
- }
35
+ // 🎯 MANAGED MODE: Quick setup with hosted auth page
36
+ const blink = createClient({
37
+ projectId: 'your-project',
38
+ auth: { mode: 'managed' }
39
+ })
40
+ // Use: blink.auth.login() - redirects to blink.new auth
39
41
 
40
- // For apps with custom auth UI (headless mode)
41
- const user = await blink.auth.signUp({ email: 'user@example.com', password: 'secure123' })
42
- const user = await blink.auth.signInWithEmail('user@example.com', 'secure123')
43
- const user = await blink.auth.signInWithGoogle()
42
+ // 🎨 HEADLESS MODE: Custom UI with full control
43
+ const blink = createClient({
44
+ projectId: 'your-project',
45
+ auth: { mode: 'headless' }
46
+ })
47
+ // Use: blink.auth.signInWithEmail(), blink.auth.signInWithGoogle(), etc.
44
48
 
45
49
  // Current user (works in both modes)
46
50
  const user = await blink.auth.me()
@@ -193,65 +197,77 @@ blink.auth.setToken(jwtFromHeader)
193
197
 
194
198
  > **⚠️ Version Requirement**: The flexible authentication system requires SDK version **0.18.0 or higher**. Version 0.17.x and below only support the legacy authentication system.
195
199
 
196
- Blink provides **two authentication modes** for maximum flexibility:
197
-
198
- #### Managed Mode (Default - Redirect-based)
200
+ Blink provides **two authentication modes**:
199
201
 
200
- Perfect for quick setup with Blink's hosted auth page:
202
+ ## 🎯 Managed Mode (Redirect-based)
203
+ **Perfect for:** Quick setup, minimal code
204
+ **Best for:** Websites, simple apps, MVP development
201
205
 
202
206
  ```typescript
203
- // ⚠️ DEPRECATED: authRequired is legacy - use auth.mode instead
204
- const blink = createClient({
205
- projectId: 'your-project',
206
- authRequired: false // Legacy - still works but deprecated
207
- })
208
-
209
- // ✅ RECOMMENDED: Use new auth configuration
210
207
  const blink = createClient({
211
208
  projectId: 'your-project',
212
- auth: {
213
- mode: 'managed', // Explicit mode configuration
214
- redirectUrl: 'https://myapp.com/dashboard'
215
- }
209
+ auth: { mode: 'managed' }
216
210
  })
217
211
 
218
- // Simple redirect authentication
219
- blink.auth.login() // Redirects to blink.new auth page
212
+ // ONE METHOD: Redirect to hosted auth page
213
+ blink.auth.login() // Redirects to blink.new/auth
220
214
  blink.auth.logout() // Clear tokens and redirect
221
- ```
222
215
 
223
- #### Headless Mode (Custom UI Control)
216
+ // User state (automatic after redirect)
217
+ const user = await blink.auth.me()
218
+ ```
224
219
 
225
- Build your own authentication UI with full control:
220
+ ## 🎨 Headless Mode (Custom UI)
221
+ **Perfect for:** Custom branding, advanced UX, mobile apps
222
+ **Best for:** Production apps, branded experiences
226
223
 
227
224
  ```typescript
228
225
  const blink = createClient({
229
226
  projectId: 'your-project',
230
- auth: {
231
- mode: 'headless'
232
- // Providers controlled via project settings
233
- }
227
+ auth: { mode: 'headless' }
234
228
  })
235
229
 
236
- // Email/password authentication
237
- const user = await blink.auth.signUp({
238
- email: 'user@example.com',
239
- password: 'SecurePass123!',
240
- metadata: { displayName: 'John Doe' }
241
- })
242
-
243
- const user = await blink.auth.signInWithEmail('user@example.com', 'password')
244
-
245
- // Social provider authentication
230
+ // MULTIPLE METHODS: Build your own UI
231
+ const user = await blink.auth.signUp({ email, password })
232
+ const user = await blink.auth.signInWithEmail(email, password)
246
233
  const user = await blink.auth.signInWithGoogle()
247
234
  const user = await blink.auth.signInWithGitHub()
248
235
  const user = await blink.auth.signInWithApple()
249
236
  const user = await blink.auth.signInWithMicrosoft()
250
237
 
251
238
  // Magic links (passwordless)
252
- await blink.auth.sendMagicLink('user@example.com', {
253
- redirectUrl: 'https://myapp.com/dashboard'
239
+ await blink.auth.sendMagicLink(email)
240
+
241
+ // Password management
242
+ await blink.auth.sendPasswordResetEmail(email)
243
+ await blink.auth.changePassword(oldPass, newPass)
244
+
245
+ // Email verification
246
+ await blink.auth.sendEmailVerification()
247
+ ```
248
+
249
+ ### ⚡ Quick Mode Comparison
250
+
251
+ | Feature | **Managed Mode** | **Headless Mode** |
252
+ |---------|------------------|-------------------|
253
+ | **Setup** | 1 line of code | Custom UI required |
254
+ | **Methods** | `login()` only | `signInWith*()` methods |
255
+ | **UI** | Hosted auth page | Your custom forms |
256
+ | **Branding** | Blink-branded | Fully customizable |
257
+ | **Mobile** | Web redirects | Native integration |
258
+
259
+ ### 🚨 **Common Mistake**
260
+
261
+ ```typescript
262
+ // ❌ WRONG: Using managed method in headless mode
263
+ const blink = createClient({
264
+ auth: { mode: 'headless' }
254
265
  })
266
+ blink.auth.login() // Still redirects! Wrong method for headless
267
+
268
+ // ✅ CORRECT: Use headless methods
269
+ await blink.auth.signInWithEmail(email, password)
270
+ await blink.auth.signInWithGoogle()
255
271
  ```
256
272
 
257
273
  #### 🔧 Provider Configuration
@@ -1567,8 +1583,8 @@ const blink = createClient({
1567
1583
  baseUrl: 'https://custom-api.example.com',
1568
1584
  auth: {
1569
1585
  mode: 'headless', // 'managed' | 'headless'
1570
- authUrl: 'https://custom-auth.example.com', // Custom auth domain
1571
- coreUrl: 'https://custom-core.example.com', // Custom API domain
1586
+ authUrl: 'https://your-auth-service.com', // Custom auth domain (for all auth endpoints)
1587
+ coreUrl: 'https://custom-core.example.com', // Custom API domain (for db, ai, storage)
1572
1588
  // Providers controlled via project settings
1573
1589
  redirectUrl: 'https://myapp.com/dashboard',
1574
1590
  roles: {
@@ -1777,152 +1793,93 @@ function MyRealtimeComponent() {
1777
1793
 
1778
1794
  ### React
1779
1795
 
1780
- #### Authentication Integration
1796
+ #### 🔑 Complete Examples by Mode
1781
1797
 
1782
- **Complete authentication example with custom UI:**
1798
+ **🎯 Managed Mode Example:**
1783
1799
 
1784
1800
  ```typescript
1785
1801
  import { createClient } from '@blinkdotnew/sdk'
1786
- import { useState, useEffect } from 'react'
1787
1802
 
1788
- // ✅ RECOMMENDED: Don't force immediate auth - let users browse first
1789
1803
  const blink = createClient({
1790
1804
  projectId: 'your-project',
1791
- authRequired: false, // Let users browse public areas
1792
- auth: {
1793
- mode: 'headless' // Use headless for custom UI
1794
- // Providers controlled via project settings
1795
- }
1805
+ auth: { mode: 'managed' }
1796
1806
  })
1797
1807
 
1798
1808
  function App() {
1799
1809
  const [user, setUser] = useState(null)
1800
- const [loading, setLoading] = useState(true)
1801
- const [currentPage, setCurrentPage] = useState('home')
1802
1810
 
1803
- // ✅ CRITICAL: Always use onAuthStateChanged
1804
1811
  useEffect(() => {
1805
1812
  const unsubscribe = blink.auth.onAuthStateChanged((state) => {
1806
1813
  setUser(state.user)
1807
- setLoading(state.isLoading)
1808
1814
  })
1809
1815
  return unsubscribe
1810
1816
  }, [])
1811
1817
 
1812
- // Protected route check - only require auth for dashboard/account areas
1813
- const requiresAuth = ['dashboard', 'account', 'settings'].includes(currentPage)
1814
-
1815
- if (loading) return <div>Loading...</div>
1816
- if (requiresAuth && !user) return <AuthForm />
1818
+ if (!user) {
1819
+ return (
1820
+ <div>
1821
+ <h1>Welcome to My App</h1>
1822
+ <button onClick={() => blink.auth.login()}>
1823
+ Sign In
1824
+ </button>
1825
+ </div>
1826
+ )
1827
+ }
1817
1828
 
1818
- // Public pages (home, pricing, about) don't require auth
1819
- if (currentPage === 'home') return <HomePage />
1820
- if (currentPage === 'pricing') return <PricingPage />
1821
-
1822
- // Protected pages require authentication
1823
1829
  return <Dashboard user={user} />
1824
1830
  }
1831
+ ```
1832
+
1833
+ **🎨 Headless Mode Example:**
1834
+
1835
+ ```typescript
1836
+ import { createClient } from '@blinkdotnew/sdk'
1837
+
1838
+ const blink = createClient({
1839
+ projectId: 'your-project',
1840
+ auth: { mode: 'headless' }
1841
+ })
1825
1842
 
1826
1843
  function AuthForm() {
1827
- const [mode, setMode] = useState('signin') // 'signin' | 'signup' | 'reset'
1828
1844
  const [email, setEmail] = useState('')
1829
1845
  const [password, setPassword] = useState('')
1830
- const [error, setError] = useState('')
1831
- const [message, setMessage] = useState('')
1832
1846
 
1833
- const handleEmailAuth = async (e) => {
1834
- e.preventDefault()
1835
- setError('')
1836
-
1847
+ const handleEmailAuth = async () => {
1837
1848
  try {
1838
- if (mode === 'signup') {
1839
- const user = await blink.auth.signUp({ email, password })
1840
- setMessage('Account created! Please check your email to verify.')
1841
- await blink.auth.sendEmailVerification()
1842
- } else if (mode === 'signin') {
1843
- await blink.auth.signInWithEmail(email, password)
1844
- // User state updates automatically via onAuthStateChanged
1845
- } else if (mode === 'reset') {
1846
- await blink.auth.sendPasswordResetEmail(email)
1847
- setMessage('Password reset email sent!')
1848
- }
1849
- } catch (err) {
1850
- if (err.code === 'EMAIL_NOT_VERIFIED') {
1851
- setError('Please verify your email first')
1852
- await blink.auth.sendEmailVerification()
1853
- } else {
1854
- setError(err.message)
1855
- }
1849
+ await blink.auth.signInWithEmail(email, password)
1850
+ // User state updates via onAuthStateChanged
1851
+ } catch (error) {
1852
+ console.error('Auth failed:', error.message)
1856
1853
  }
1857
1854
  }
1858
1855
 
1859
- const handleSocialAuth = async (provider) => {
1856
+ const handleSocialAuth = async () => {
1860
1857
  try {
1861
- await blink.auth.signInWithProvider(provider)
1862
- } catch (err) {
1863
- setError(err.message)
1858
+ await blink.auth.signInWithGoogle()
1859
+ } catch (error) {
1860
+ console.error('Social auth failed:', error.message)
1864
1861
  }
1865
1862
  }
1866
1863
 
1867
1864
  return (
1868
- <div style={{ maxWidth: '400px', margin: '0 auto', padding: '2rem' }}>
1869
- <h1>{mode === 'signin' ? 'Sign In' : mode === 'signup' ? 'Sign Up' : 'Reset Password'}</h1>
1870
-
1871
- {error && <div style={{ color: 'red', marginBottom: '1rem' }}>{error}</div>}
1872
- {message && <div style={{ color: 'green', marginBottom: '1rem' }}>{message}</div>}
1873
-
1874
- <form onSubmit={handleEmailAuth} style={{ marginBottom: '1rem' }}>
1875
- <input
1876
- type="email"
1877
- placeholder="Email"
1878
- value={email}
1879
- onChange={(e) => setEmail(e.target.value)}
1880
- style={{ width: '100%', padding: '0.5rem', marginBottom: '0.5rem' }}
1881
- />
1882
-
1883
- {mode !== 'reset' && (
1884
- <input
1885
- type="password"
1886
- placeholder="Password"
1887
- value={password}
1888
- onChange={(e) => setPassword(e.target.value)}
1889
- style={{ width: '100%', padding: '0.5rem', marginBottom: '1rem' }}
1890
- />
1891
- )}
1892
-
1893
- <button type="submit" style={{ width: '100%', padding: '0.75rem', marginBottom: '1rem' }}>
1894
- {mode === 'signin' ? 'Sign In' : mode === 'signup' ? 'Create Account' : 'Send Reset Email'}
1895
- </button>
1896
- </form>
1897
-
1898
- {mode !== 'reset' && (
1899
- <div style={{ display: 'flex', gap: '0.5rem', marginBottom: '1rem' }}>
1900
- <button onClick={() => handleSocialAuth('google')} style={{ flex: 1, padding: '0.5rem' }}>
1901
- Google
1902
- </button>
1903
- <button onClick={() => handleSocialAuth('github')} style={{ flex: 1, padding: '0.5rem' }}>
1904
- GitHub
1905
- </button>
1906
- </div>
1907
- )}
1908
-
1909
- <div style={{ textAlign: 'center', fontSize: '0.875rem' }}>
1910
- {mode === 'signin' && (
1911
- <>
1912
- <button onClick={() => setMode('signup')} style={{ marginRight: '1rem' }}>
1913
- Create Account
1914
- </button>
1915
- <button onClick={() => setMode('reset')}>Forgot Password?</button>
1916
- </>
1917
- )}
1918
- {mode === 'signup' && (
1919
- <button onClick={() => setMode('signin')}>Already have an account?</button>
1920
- )}
1921
- {mode === 'reset' && (
1922
- <button onClick={() => setMode('signin')}>Back to Sign In</button>
1923
- )}
1924
- </div>
1925
- </div>
1865
+ <form onSubmit={handleEmailAuth}>
1866
+ <input
1867
+ type="email"
1868
+ value={email}
1869
+ onChange={(e) => setEmail(e.target.value)}
1870
+ placeholder="Email"
1871
+ />
1872
+ <input
1873
+ type="password"
1874
+ value={password}
1875
+ onChange={(e) => setPassword(e.target.value)}
1876
+ placeholder="Password"
1877
+ />
1878
+ <button type="submit">Sign In</button>
1879
+ <button type="button" onClick={handleSocialAuth}>
1880
+ Continue with Google
1881
+ </button>
1882
+ </form>
1926
1883
  )
1927
1884
  }
1928
1885
  ```
@@ -2061,6 +2018,7 @@ function AuthForm() {
2061
2018
  }
2062
2019
  ```
2063
2020
 
2021
+ ```typescript
2064
2022
  // React example with search functionality
2065
2023
  function SearchResults() {
2066
2024
  const [query, setQuery] = useState('')
package/dist/index.js CHANGED
@@ -925,8 +925,8 @@ var BlinkAuth = class {
925
925
  };
926
926
  this.authUrl = this.authConfig.authUrl || "https://blink.new";
927
927
  this.coreUrl = this.authConfig.coreUrl || "https://core.blink.new";
928
- if (typeof window !== "undefined" && this.coreUrl === "https://core.blink.new" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1")) {
929
- console.warn("\u26A0\uFE0F Using default coreUrl in development. Set auth.coreUrl to your app origin for headless auth endpoints to work.");
928
+ if (typeof window !== "undefined" && this.authUrl === "https://blink.new" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1")) {
929
+ console.warn("\u26A0\uFE0F Using default authUrl in development. Set auth.authUrl to your app origin for headless auth endpoints to work.");
930
930
  }
931
931
  if (config.authRequired !== void 0 && !config.auth?.mode) {
932
932
  this.authConfig.mode = config.authRequired ? "managed" : "headless";
@@ -1258,7 +1258,7 @@ var BlinkAuth = class {
1258
1258
  throw new BlinkAuthError("INVALID_CREDENTIALS" /* INVALID_CREDENTIALS */, "signUp is only available in headless mode");
1259
1259
  }
1260
1260
  try {
1261
- const response = await fetch(`${this.coreUrl}/api/auth/signup`, {
1261
+ const response = await fetch(`${this.authUrl}/api/auth/signup`, {
1262
1262
  method: "POST",
1263
1263
  headers: {
1264
1264
  "Content-Type": "application/json"
@@ -1297,7 +1297,7 @@ var BlinkAuth = class {
1297
1297
  throw new BlinkAuthError("INVALID_CREDENTIALS" /* INVALID_CREDENTIALS */, "signInWithEmail is only available in headless mode");
1298
1298
  }
1299
1299
  try {
1300
- const response = await fetch(`${this.coreUrl}/api/auth/signin/email`, {
1300
+ const response = await fetch(`${this.authUrl}/api/auth/signin/email`, {
1301
1301
  method: "POST",
1302
1302
  headers: {
1303
1303
  "Content-Type": "application/json"
@@ -1466,7 +1466,7 @@ var BlinkAuth = class {
1466
1466
  */
1467
1467
  async generatePasswordResetToken(email) {
1468
1468
  try {
1469
- const response = await fetch(`${this.coreUrl}/api/auth/password/reset/generate`, {
1469
+ const response = await fetch(`${this.authUrl}/api/auth/password/reset/generate`, {
1470
1470
  method: "POST",
1471
1471
  headers: {
1472
1472
  "Content-Type": "application/json"
@@ -1503,7 +1503,7 @@ var BlinkAuth = class {
1503
1503
  */
1504
1504
  async sendPasswordResetEmail(email) {
1505
1505
  try {
1506
- const response = await fetch(`${this.coreUrl}/api/auth/password/reset`, {
1506
+ const response = await fetch(`${this.authUrl}/api/auth/password/reset`, {
1507
1507
  method: "POST",
1508
1508
  headers: {
1509
1509
  "Content-Type": "application/json"
@@ -1530,7 +1530,7 @@ var BlinkAuth = class {
1530
1530
  */
1531
1531
  async confirmPasswordReset(token, newPassword) {
1532
1532
  try {
1533
- const response = await fetch(`${this.coreUrl}/api/auth/password/reset/confirm`, {
1533
+ const response = await fetch(`${this.authUrl}/api/auth/password/reset/confirm`, {
1534
1534
  method: "POST",
1535
1535
  headers: {
1536
1536
  "Content-Type": "application/json"
@@ -1562,7 +1562,7 @@ var BlinkAuth = class {
1562
1562
  throw new BlinkAuthError("TOKEN_EXPIRED" /* TOKEN_EXPIRED */, "No access token available");
1563
1563
  }
1564
1564
  try {
1565
- const response = await fetch(`${this.coreUrl}/api/auth/password/change`, {
1565
+ const response = await fetch(`${this.authUrl}/api/auth/password/change`, {
1566
1566
  method: "POST",
1567
1567
  headers: {
1568
1568
  "Authorization": `Bearer ${token}`,
@@ -1594,7 +1594,7 @@ var BlinkAuth = class {
1594
1594
  throw new BlinkAuthError("TOKEN_EXPIRED" /* TOKEN_EXPIRED */, "No access token available");
1595
1595
  }
1596
1596
  try {
1597
- const response = await fetch(`${this.coreUrl}/api/auth/email/verify/generate`, {
1597
+ const response = await fetch(`${this.authUrl}/api/auth/email/verify/generate`, {
1598
1598
  method: "POST",
1599
1599
  headers: {
1600
1600
  "Authorization": `Bearer ${token}`,
@@ -1632,7 +1632,7 @@ var BlinkAuth = class {
1632
1632
  throw new BlinkAuthError("TOKEN_EXPIRED" /* TOKEN_EXPIRED */, "No access token available");
1633
1633
  }
1634
1634
  try {
1635
- const response = await fetch(`${this.coreUrl}/api/auth/email/verify/send`, {
1635
+ const response = await fetch(`${this.authUrl}/api/auth/email/verify/send`, {
1636
1636
  method: "POST",
1637
1637
  headers: {
1638
1638
  "Authorization": `Bearer ${token}`,
@@ -1656,7 +1656,7 @@ var BlinkAuth = class {
1656
1656
  */
1657
1657
  async verifyEmail(token) {
1658
1658
  try {
1659
- const response = await fetch(`${this.coreUrl}/api/auth/email/verify`, {
1659
+ const response = await fetch(`${this.authUrl}/api/auth/email/verify`, {
1660
1660
  method: "POST",
1661
1661
  headers: {
1662
1662
  "Content-Type": "application/json"
@@ -1683,7 +1683,7 @@ var BlinkAuth = class {
1683
1683
  */
1684
1684
  async generateMagicLinkToken(email, options) {
1685
1685
  try {
1686
- const response = await fetch(`${this.coreUrl}/api/auth/signin/magic/generate`, {
1686
+ const response = await fetch(`${this.authUrl}/api/auth/signin/magic/generate`, {
1687
1687
  method: "POST",
1688
1688
  headers: {
1689
1689
  "Content-Type": "application/json"
@@ -1721,7 +1721,7 @@ var BlinkAuth = class {
1721
1721
  */
1722
1722
  async sendMagicLink(email, options) {
1723
1723
  try {
1724
- const response = await fetch(`${this.coreUrl}/api/auth/signin/magic`, {
1724
+ const response = await fetch(`${this.authUrl}/api/auth/signin/magic`, {
1725
1725
  method: "POST",
1726
1726
  headers: {
1727
1727
  "Content-Type": "application/json"
@@ -1753,7 +1753,7 @@ var BlinkAuth = class {
1753
1753
  throw new BlinkAuthError("VERIFICATION_FAILED" /* VERIFICATION_FAILED */, "No magic link token found");
1754
1754
  }
1755
1755
  try {
1756
- const response = await fetch(`${this.coreUrl}/api/auth/signin/magic/verify`, {
1756
+ const response = await fetch(`${this.authUrl}/api/auth/signin/magic/verify`, {
1757
1757
  method: "POST",
1758
1758
  headers: {
1759
1759
  "Content-Type": "application/json"
@@ -1789,7 +1789,7 @@ var BlinkAuth = class {
1789
1789
  */
1790
1790
  async getAvailableProviders() {
1791
1791
  try {
1792
- const response = await fetch(`${this.coreUrl}/api/auth/providers?projectId=${encodeURIComponent(this.config.projectId)}`);
1792
+ const response = await fetch(`${this.authUrl}/api/auth/providers?projectId=${encodeURIComponent(this.config.projectId)}`);
1793
1793
  if (!response.ok) {
1794
1794
  return ["email", "google"];
1795
1795
  }
package/dist/index.mjs CHANGED
@@ -923,8 +923,8 @@ var BlinkAuth = class {
923
923
  };
924
924
  this.authUrl = this.authConfig.authUrl || "https://blink.new";
925
925
  this.coreUrl = this.authConfig.coreUrl || "https://core.blink.new";
926
- if (typeof window !== "undefined" && this.coreUrl === "https://core.blink.new" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1")) {
927
- console.warn("\u26A0\uFE0F Using default coreUrl in development. Set auth.coreUrl to your app origin for headless auth endpoints to work.");
926
+ if (typeof window !== "undefined" && this.authUrl === "https://blink.new" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1")) {
927
+ console.warn("\u26A0\uFE0F Using default authUrl in development. Set auth.authUrl to your app origin for headless auth endpoints to work.");
928
928
  }
929
929
  if (config.authRequired !== void 0 && !config.auth?.mode) {
930
930
  this.authConfig.mode = config.authRequired ? "managed" : "headless";
@@ -1256,7 +1256,7 @@ var BlinkAuth = class {
1256
1256
  throw new BlinkAuthError("INVALID_CREDENTIALS" /* INVALID_CREDENTIALS */, "signUp is only available in headless mode");
1257
1257
  }
1258
1258
  try {
1259
- const response = await fetch(`${this.coreUrl}/api/auth/signup`, {
1259
+ const response = await fetch(`${this.authUrl}/api/auth/signup`, {
1260
1260
  method: "POST",
1261
1261
  headers: {
1262
1262
  "Content-Type": "application/json"
@@ -1295,7 +1295,7 @@ var BlinkAuth = class {
1295
1295
  throw new BlinkAuthError("INVALID_CREDENTIALS" /* INVALID_CREDENTIALS */, "signInWithEmail is only available in headless mode");
1296
1296
  }
1297
1297
  try {
1298
- const response = await fetch(`${this.coreUrl}/api/auth/signin/email`, {
1298
+ const response = await fetch(`${this.authUrl}/api/auth/signin/email`, {
1299
1299
  method: "POST",
1300
1300
  headers: {
1301
1301
  "Content-Type": "application/json"
@@ -1464,7 +1464,7 @@ var BlinkAuth = class {
1464
1464
  */
1465
1465
  async generatePasswordResetToken(email) {
1466
1466
  try {
1467
- const response = await fetch(`${this.coreUrl}/api/auth/password/reset/generate`, {
1467
+ const response = await fetch(`${this.authUrl}/api/auth/password/reset/generate`, {
1468
1468
  method: "POST",
1469
1469
  headers: {
1470
1470
  "Content-Type": "application/json"
@@ -1501,7 +1501,7 @@ var BlinkAuth = class {
1501
1501
  */
1502
1502
  async sendPasswordResetEmail(email) {
1503
1503
  try {
1504
- const response = await fetch(`${this.coreUrl}/api/auth/password/reset`, {
1504
+ const response = await fetch(`${this.authUrl}/api/auth/password/reset`, {
1505
1505
  method: "POST",
1506
1506
  headers: {
1507
1507
  "Content-Type": "application/json"
@@ -1528,7 +1528,7 @@ var BlinkAuth = class {
1528
1528
  */
1529
1529
  async confirmPasswordReset(token, newPassword) {
1530
1530
  try {
1531
- const response = await fetch(`${this.coreUrl}/api/auth/password/reset/confirm`, {
1531
+ const response = await fetch(`${this.authUrl}/api/auth/password/reset/confirm`, {
1532
1532
  method: "POST",
1533
1533
  headers: {
1534
1534
  "Content-Type": "application/json"
@@ -1560,7 +1560,7 @@ var BlinkAuth = class {
1560
1560
  throw new BlinkAuthError("TOKEN_EXPIRED" /* TOKEN_EXPIRED */, "No access token available");
1561
1561
  }
1562
1562
  try {
1563
- const response = await fetch(`${this.coreUrl}/api/auth/password/change`, {
1563
+ const response = await fetch(`${this.authUrl}/api/auth/password/change`, {
1564
1564
  method: "POST",
1565
1565
  headers: {
1566
1566
  "Authorization": `Bearer ${token}`,
@@ -1592,7 +1592,7 @@ var BlinkAuth = class {
1592
1592
  throw new BlinkAuthError("TOKEN_EXPIRED" /* TOKEN_EXPIRED */, "No access token available");
1593
1593
  }
1594
1594
  try {
1595
- const response = await fetch(`${this.coreUrl}/api/auth/email/verify/generate`, {
1595
+ const response = await fetch(`${this.authUrl}/api/auth/email/verify/generate`, {
1596
1596
  method: "POST",
1597
1597
  headers: {
1598
1598
  "Authorization": `Bearer ${token}`,
@@ -1630,7 +1630,7 @@ var BlinkAuth = class {
1630
1630
  throw new BlinkAuthError("TOKEN_EXPIRED" /* TOKEN_EXPIRED */, "No access token available");
1631
1631
  }
1632
1632
  try {
1633
- const response = await fetch(`${this.coreUrl}/api/auth/email/verify/send`, {
1633
+ const response = await fetch(`${this.authUrl}/api/auth/email/verify/send`, {
1634
1634
  method: "POST",
1635
1635
  headers: {
1636
1636
  "Authorization": `Bearer ${token}`,
@@ -1654,7 +1654,7 @@ var BlinkAuth = class {
1654
1654
  */
1655
1655
  async verifyEmail(token) {
1656
1656
  try {
1657
- const response = await fetch(`${this.coreUrl}/api/auth/email/verify`, {
1657
+ const response = await fetch(`${this.authUrl}/api/auth/email/verify`, {
1658
1658
  method: "POST",
1659
1659
  headers: {
1660
1660
  "Content-Type": "application/json"
@@ -1681,7 +1681,7 @@ var BlinkAuth = class {
1681
1681
  */
1682
1682
  async generateMagicLinkToken(email, options) {
1683
1683
  try {
1684
- const response = await fetch(`${this.coreUrl}/api/auth/signin/magic/generate`, {
1684
+ const response = await fetch(`${this.authUrl}/api/auth/signin/magic/generate`, {
1685
1685
  method: "POST",
1686
1686
  headers: {
1687
1687
  "Content-Type": "application/json"
@@ -1719,7 +1719,7 @@ var BlinkAuth = class {
1719
1719
  */
1720
1720
  async sendMagicLink(email, options) {
1721
1721
  try {
1722
- const response = await fetch(`${this.coreUrl}/api/auth/signin/magic`, {
1722
+ const response = await fetch(`${this.authUrl}/api/auth/signin/magic`, {
1723
1723
  method: "POST",
1724
1724
  headers: {
1725
1725
  "Content-Type": "application/json"
@@ -1751,7 +1751,7 @@ var BlinkAuth = class {
1751
1751
  throw new BlinkAuthError("VERIFICATION_FAILED" /* VERIFICATION_FAILED */, "No magic link token found");
1752
1752
  }
1753
1753
  try {
1754
- const response = await fetch(`${this.coreUrl}/api/auth/signin/magic/verify`, {
1754
+ const response = await fetch(`${this.authUrl}/api/auth/signin/magic/verify`, {
1755
1755
  method: "POST",
1756
1756
  headers: {
1757
1757
  "Content-Type": "application/json"
@@ -1787,7 +1787,7 @@ var BlinkAuth = class {
1787
1787
  */
1788
1788
  async getAvailableProviders() {
1789
1789
  try {
1790
- const response = await fetch(`${this.coreUrl}/api/auth/providers?projectId=${encodeURIComponent(this.config.projectId)}`);
1790
+ const response = await fetch(`${this.authUrl}/api/auth/providers?projectId=${encodeURIComponent(this.config.projectId)}`);
1791
1791
  if (!response.ok) {
1792
1792
  return ["email", "google"];
1793
1793
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/sdk",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "description": "Blink TypeScript SDK for client-side applications - Zero-boilerplate CRUD + auth + AI + analytics + notifications for modern SaaS/AI apps",
5
5
  "keywords": [
6
6
  "blink",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {},
52
52
  "devDependencies": {
53
- "@blink/core": "0.4.0",
53
+ "@blink/core": "0.4.1",
54
54
  "tsup": "^8.0.0",
55
55
  "typescript": "^5.0.0"
56
56
  },