svelte-firekit 0.0.25 → 0.1.0
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 +445 -213
- package/dist/components/Collection.svelte +150 -0
- package/dist/components/Collection.svelte.d.ts +27 -0
- package/dist/components/Ddoc.svelte +131 -0
- package/dist/components/Ddoc.svelte.d.ts +28 -0
- package/dist/components/Node.svelte +97 -0
- package/dist/components/Node.svelte.d.ts +23 -0
- package/dist/components/auth-guard.svelte +89 -0
- package/dist/components/auth-guard.svelte.d.ts +26 -0
- package/dist/components/custom-guard.svelte +122 -0
- package/dist/components/custom-guard.svelte.d.ts +31 -0
- package/dist/components/download-url.svelte +92 -0
- package/dist/components/download-url.svelte.d.ts +19 -0
- package/dist/components/firebase-app.svelte +30 -0
- package/dist/components/firebase-app.svelte.d.ts +7 -0
- package/dist/components/node-list.svelte +102 -0
- package/dist/components/node-list.svelte.d.ts +27 -0
- package/dist/components/signed-in.svelte +42 -0
- package/dist/components/signed-in.svelte.d.ts +11 -0
- package/dist/components/signed-out.svelte +42 -0
- package/dist/components/signed-out.svelte.d.ts +11 -0
- package/dist/components/storage-list.svelte +97 -0
- package/dist/components/storage-list.svelte.d.ts +26 -0
- package/dist/components/upload-task.svelte +108 -0
- package/dist/components/upload-task.svelte.d.ts +24 -0
- package/dist/config.js +17 -39
- package/dist/firebase.d.ts +43 -21
- package/dist/firebase.js +121 -35
- package/dist/index.d.ts +21 -13
- package/dist/index.js +27 -15
- package/dist/services/auth.d.ts +389 -0
- package/dist/services/auth.js +824 -0
- package/dist/services/collection.svelte.d.ts +286 -0
- package/dist/services/collection.svelte.js +871 -0
- package/dist/services/document.svelte.d.ts +288 -0
- package/dist/services/document.svelte.js +555 -0
- package/dist/services/mutations.d.ts +336 -0
- package/dist/services/mutations.js +1079 -0
- package/dist/services/presence.svelte.d.ts +141 -0
- package/dist/services/presence.svelte.js +727 -0
- package/dist/{realtime → services}/realtime.svelte.d.ts +3 -1
- package/dist/{realtime → services}/realtime.svelte.js +13 -7
- package/dist/services/storage.svelte.d.ts +257 -0
- package/dist/services/storage.svelte.js +374 -0
- package/dist/services/user.svelte.d.ts +290 -0
- package/dist/services/user.svelte.js +533 -0
- package/dist/types/auth.d.ts +158 -0
- package/dist/types/auth.js +106 -0
- package/dist/types/collection.d.ts +360 -0
- package/dist/types/collection.js +167 -0
- package/dist/types/document.d.ts +342 -0
- package/dist/types/document.js +148 -0
- package/dist/types/firebase.d.ts +44 -0
- package/dist/types/firebase.js +33 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +4 -0
- package/dist/types/mutations.d.ts +387 -0
- package/dist/types/mutations.js +205 -0
- package/dist/types/presence.d.ts +282 -0
- package/dist/types/presence.js +80 -0
- package/dist/utils/errors.d.ts +21 -0
- package/dist/utils/errors.js +35 -0
- package/dist/utils/firestore.d.ts +9 -0
- package/dist/utils/firestore.js +33 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/providers.d.ts +16 -0
- package/dist/utils/providers.js +30 -0
- package/dist/utils/user.d.ts +8 -0
- package/dist/utils/user.js +29 -0
- package/package.json +65 -65
- package/dist/auth/auth.d.ts +0 -117
- package/dist/auth/auth.js +0 -194
- package/dist/auth/presence.svelte.d.ts +0 -139
- package/dist/auth/presence.svelte.js +0 -373
- package/dist/auth/user.svelte.d.ts +0 -112
- package/dist/auth/user.svelte.js +0 -155
- package/dist/firestore/awaitable-doc.svelte.d.ts +0 -141
- package/dist/firestore/awaitable-doc.svelte.js +0 -183
- package/dist/firestore/batch-mutations.svelte.d.ts +0 -140
- package/dist/firestore/batch-mutations.svelte.js +0 -218
- package/dist/firestore/collection-group.svelte.d.ts +0 -78
- package/dist/firestore/collection-group.svelte.js +0 -120
- package/dist/firestore/collection.svelte.d.ts +0 -96
- package/dist/firestore/collection.svelte.js +0 -137
- package/dist/firestore/doc.svelte.d.ts +0 -90
- package/dist/firestore/doc.svelte.js +0 -131
- package/dist/firestore/document-mutations.svelte.d.ts +0 -164
- package/dist/firestore/document-mutations.svelte.js +0 -273
- package/dist/storage/download-url.svelte.d.ts +0 -83
- package/dist/storage/download-url.svelte.js +0 -114
- package/dist/storage/storage-list.svelte.d.ts +0 -89
- package/dist/storage/storage-list.svelte.js +0 -123
- package/dist/storage/upload-task.svelte.d.ts +0 -94
- package/dist/storage/upload-task.svelte.js +0 -138
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FirekitAuth - Complete Firebase Authentication Service for Svelte
|
|
3
|
+
* @module FirekitAuth
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import { type User } from 'firebase/auth';
|
|
7
|
+
import { type UserProfile, type AuthState, type PasswordUpdateResult, type AccountDeletionResult, type PhoneVerificationResult } from '../types/auth.js';
|
|
8
|
+
/**
|
|
9
|
+
* Comprehensive Firebase Authentication service for Svelte applications.
|
|
10
|
+
* Provides a complete authentication solution with automatic Firestore integration,
|
|
11
|
+
* error handling, and support for all major authentication methods.
|
|
12
|
+
*
|
|
13
|
+
* @class FirekitAuth
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { firekitAuth } from 'svelte-firekit';
|
|
17
|
+
*
|
|
18
|
+
* // Sign in with Google
|
|
19
|
+
* await firekitAuth.signInWithGoogle();
|
|
20
|
+
*
|
|
21
|
+
* // Register new user
|
|
22
|
+
* await firekitAuth.registerWithEmail("user@example.com", "password123", "John Doe");
|
|
23
|
+
*
|
|
24
|
+
* // Listen to auth state changes
|
|
25
|
+
* const unsubscribe = firekitAuth.onAuthStateChanged((user) => {
|
|
26
|
+
* console.log('User:', user);
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare class FirekitAuth {
|
|
31
|
+
private static instance;
|
|
32
|
+
private auth;
|
|
33
|
+
private firestore;
|
|
34
|
+
private authState;
|
|
35
|
+
private stateListeners;
|
|
36
|
+
private recaptchaVerifiers;
|
|
37
|
+
private constructor();
|
|
38
|
+
/**
|
|
39
|
+
* Gets singleton instance of FirekitAuth
|
|
40
|
+
* @returns {FirekitAuth} The FirekitAuth instance
|
|
41
|
+
*/
|
|
42
|
+
static getInstance(): FirekitAuth;
|
|
43
|
+
/**
|
|
44
|
+
* Initializes the authentication state listener
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
private initializeAuthStateListener;
|
|
48
|
+
/**
|
|
49
|
+
* Notifies all state listeners of auth state changes
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
private notifyStateListeners;
|
|
53
|
+
/**
|
|
54
|
+
* Maps Firebase User to UserProfile interface
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
private mapFirebaseUserToProfile;
|
|
58
|
+
/**
|
|
59
|
+
* Updates user data in Firestore with comprehensive profile information
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
private updateUserInFirestore;
|
|
63
|
+
/**
|
|
64
|
+
* Handles Firebase authentication errors and throws FirekitAuthError
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
private handleAuthError;
|
|
68
|
+
/**
|
|
69
|
+
* Gets the current authentication state
|
|
70
|
+
* @returns {AuthState} Current authentication state
|
|
71
|
+
*/
|
|
72
|
+
getState(): AuthState;
|
|
73
|
+
/**
|
|
74
|
+
* Gets the current authenticated user
|
|
75
|
+
* @returns {User | null} Current Firebase user or null
|
|
76
|
+
*/
|
|
77
|
+
getCurrentUser(): User | null;
|
|
78
|
+
/**
|
|
79
|
+
* Gets the current user profile
|
|
80
|
+
* @returns {UserProfile | null} Current user profile or null
|
|
81
|
+
*/
|
|
82
|
+
getCurrentUserProfile(): UserProfile | null;
|
|
83
|
+
/**
|
|
84
|
+
* Waits for auth initialization to complete
|
|
85
|
+
* @returns {Promise<UserProfile | null>} Promise that resolves when auth is initialized
|
|
86
|
+
*/
|
|
87
|
+
waitForAuth(): Promise<UserProfile | null>;
|
|
88
|
+
/**
|
|
89
|
+
* Subscribes to authentication state changes
|
|
90
|
+
* @param {Function} callback Callback function to handle state changes
|
|
91
|
+
* @returns {Function} Unsubscribe function
|
|
92
|
+
*/
|
|
93
|
+
onAuthStateChanged(callback: (state: AuthState) => void): () => void;
|
|
94
|
+
/**
|
|
95
|
+
* Signs in user with email and password
|
|
96
|
+
* @param {string} email User's email address
|
|
97
|
+
* @param {string} password User's password
|
|
98
|
+
* @returns {Promise<UserProfile>} Promise resolving to user profile
|
|
99
|
+
* @throws {FirekitAuthError} If sign-in fails
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* try {
|
|
104
|
+
* const user = await firekitAuth.signInWithEmail("user@example.com", "password123");
|
|
105
|
+
* console.log("Signed in:", user.displayName);
|
|
106
|
+
* } catch (error) {
|
|
107
|
+
* console.error("Sign-in failed:", error.message);
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
signInWithEmail(email: string, password: string): Promise<UserProfile>;
|
|
112
|
+
/**
|
|
113
|
+
* Signs in user with Google popup
|
|
114
|
+
* @returns {Promise<UserProfile>} Promise resolving to user profile
|
|
115
|
+
* @throws {FirekitAuthError} If sign-in fails
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* try {
|
|
120
|
+
* const user = await firekitAuth.signInWithGoogle();
|
|
121
|
+
* console.log("Signed in with Google:", user.email);
|
|
122
|
+
* } catch (error) {
|
|
123
|
+
* if (error.code === 'auth/popup-closed-by-user') {
|
|
124
|
+
* console.log("User cancelled sign-in");
|
|
125
|
+
* }
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
signInWithGoogle(): Promise<UserProfile>;
|
|
130
|
+
/**
|
|
131
|
+
* Signs in user with Facebook popup
|
|
132
|
+
* @returns {Promise<UserProfile>} Promise resolving to user profile
|
|
133
|
+
* @throws {FirekitAuthError} If sign-in fails
|
|
134
|
+
*/
|
|
135
|
+
signInWithFacebook(): Promise<UserProfile>;
|
|
136
|
+
/**
|
|
137
|
+
* Signs in user with Apple popup
|
|
138
|
+
* @returns {Promise<UserProfile>} Promise resolving to user profile
|
|
139
|
+
* @throws {FirekitAuthError} If sign-in fails
|
|
140
|
+
*/
|
|
141
|
+
signInWithApple(): Promise<UserProfile>;
|
|
142
|
+
/**
|
|
143
|
+
* Signs in user anonymously
|
|
144
|
+
* @returns {Promise<UserProfile>} Promise resolving to user profile
|
|
145
|
+
* @throws {FirekitAuthError} If sign-in fails
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const user = await firekitAuth.signInAnonymously();
|
|
150
|
+
* console.log("Anonymous user:", user.uid);
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
signInAnonymously(): Promise<UserProfile>;
|
|
154
|
+
/**
|
|
155
|
+
* Initiates phone number sign-in process
|
|
156
|
+
* @param {string} phoneNumber Phone number in international format
|
|
157
|
+
* @param {string} recaptchaContainerId ID of the reCAPTCHA container element
|
|
158
|
+
* @returns {Promise<PhoneVerificationResult>} Promise resolving to verification result
|
|
159
|
+
* @throws {FirekitAuthError} If verification initiation fails
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const verification = await firekitAuth.signInWithPhoneNumber("+1234567890", "recaptcha-container");
|
|
164
|
+
* const user = await verification.confirm("123456");
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
signInWithPhoneNumber(phoneNumber: string, recaptchaContainerId: string): Promise<PhoneVerificationResult>;
|
|
168
|
+
/**
|
|
169
|
+
* Registers new user with email and password
|
|
170
|
+
* @param {string} email User's email address
|
|
171
|
+
* @param {string} password User's password
|
|
172
|
+
* @param {string} [displayName] User's display name
|
|
173
|
+
* @param {boolean} [sendVerification=true] Whether to send email verification
|
|
174
|
+
* @returns {Promise<UserProfile>} Promise resolving to user profile
|
|
175
|
+
* @throws {FirekitAuthError} If registration fails
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* const user = await firekitAuth.registerWithEmail(
|
|
180
|
+
* "user@example.com",
|
|
181
|
+
* "password123",
|
|
182
|
+
* "John Doe"
|
|
183
|
+
* );
|
|
184
|
+
* console.log("Registered:", user.displayName);
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
registerWithEmail(email: string, password: string, displayName?: string, sendVerification?: boolean): Promise<UserProfile>;
|
|
188
|
+
/**
|
|
189
|
+
* Sends password reset email
|
|
190
|
+
* @param {string} email User's email address
|
|
191
|
+
* @returns {Promise<void>} Promise that resolves when email is sent
|
|
192
|
+
* @throws {FirekitAuthError} If sending fails
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* await firekitAuth.sendPasswordReset("user@example.com");
|
|
197
|
+
* console.log("Password reset email sent");
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
sendPasswordReset(email: string): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Confirms password reset with code
|
|
203
|
+
* @param {string} code Password reset code from email
|
|
204
|
+
* @param {string} newPassword New password
|
|
205
|
+
* @returns {Promise<void>} Promise that resolves when password is reset
|
|
206
|
+
* @throws {FirekitAuthError} If reset fails
|
|
207
|
+
*/
|
|
208
|
+
confirmPasswordReset(code: string, newPassword: string): Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Updates user password with reauthentication
|
|
211
|
+
* @param {string} newPassword New password
|
|
212
|
+
* @param {string} currentPassword Current password for reauthentication
|
|
213
|
+
* @returns {Promise<PasswordUpdateResult>} Promise resolving to update result
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const result = await firekitAuth.updatePassword("newPassword123", "oldPassword123");
|
|
218
|
+
* if (result.success) {
|
|
219
|
+
* console.log("Password updated successfully");
|
|
220
|
+
* } else {
|
|
221
|
+
* console.error("Update failed:", result.message);
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
updatePassword(newPassword: string, currentPassword: string): Promise<PasswordUpdateResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Updates user profile
|
|
228
|
+
* @param {Object} profile Profile update data
|
|
229
|
+
* @param {string} [profile.displayName] New display name
|
|
230
|
+
* @param {string} [profile.photoURL] New photo URL
|
|
231
|
+
* @returns {Promise<void>} Promise that resolves when profile is updated
|
|
232
|
+
* @throws {FirekitAuthError} If update fails
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* await firekitAuth.updateUserProfile({
|
|
237
|
+
* displayName: "John Smith",
|
|
238
|
+
* photoURL: "https://example.com/photo.jpg"
|
|
239
|
+
* });
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
updateUserProfile(profile: {
|
|
243
|
+
displayName?: string;
|
|
244
|
+
photoURL?: string;
|
|
245
|
+
}): Promise<void>;
|
|
246
|
+
/**
|
|
247
|
+
* Updates user email address
|
|
248
|
+
* @param {string} newEmail New email address
|
|
249
|
+
* @returns {Promise<void>} Promise that resolves when email is updated
|
|
250
|
+
* @throws {FirekitAuthError} If update fails
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* await firekitAuth.updateEmail("newemail@example.com");
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
updateEmail(newEmail: string): Promise<void>;
|
|
258
|
+
/**
|
|
259
|
+
* Sends email verification to current user
|
|
260
|
+
* @returns {Promise<void>} Promise that resolves when verification email is sent
|
|
261
|
+
* @throws {FirekitAuthError} If sending fails
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* await firekitAuth.sendEmailVerification();
|
|
266
|
+
* console.log("Verification email sent");
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
sendEmailVerification(): Promise<void>;
|
|
270
|
+
/**
|
|
271
|
+
* Reloads current user to get updated email verification status
|
|
272
|
+
* @returns {Promise<void>} Promise that resolves when user is reloaded
|
|
273
|
+
* @throws {FirekitAuthError} If reload fails
|
|
274
|
+
*/
|
|
275
|
+
reloadUser(): Promise<void>;
|
|
276
|
+
/**
|
|
277
|
+
* Gets the current user's ID token
|
|
278
|
+
* @param {boolean} [forceRefresh=false] Whether to force token refresh
|
|
279
|
+
* @returns {Promise<string>} Promise resolving to ID token
|
|
280
|
+
* @throws {FirekitAuthError} If getting token fails
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* const token = await firekitAuth.getIdToken();
|
|
285
|
+
* // Use token for authenticated API calls
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
getIdToken(forceRefresh?: boolean): Promise<string>;
|
|
289
|
+
/**
|
|
290
|
+
* Reauthenticates current user with email/password
|
|
291
|
+
* @param {string} currentPassword Current password
|
|
292
|
+
* @returns {Promise<void>} Promise that resolves when reauthentication succeeds
|
|
293
|
+
* @throws {FirekitAuthError} If reauthentication fails
|
|
294
|
+
* @private
|
|
295
|
+
*/
|
|
296
|
+
private reauthenticateUser;
|
|
297
|
+
/**
|
|
298
|
+
* Deletes user account and associated data
|
|
299
|
+
* @param {string} [currentPassword] Current password for reauthentication (required for email/password accounts)
|
|
300
|
+
* @returns {Promise<AccountDeletionResult>} Promise resolving to deletion result
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```typescript
|
|
304
|
+
* const result = await firekitAuth.deleteAccount("currentPassword123");
|
|
305
|
+
* if (result.success) {
|
|
306
|
+
* console.log("Account deleted successfully");
|
|
307
|
+
* }
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
deleteAccount(currentPassword?: string): Promise<AccountDeletionResult>;
|
|
311
|
+
/**
|
|
312
|
+
* Signs out current user
|
|
313
|
+
* @returns {Promise<void>} Promise that resolves when sign-out completes
|
|
314
|
+
* @throws {FirekitAuthError} If sign-out fails
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```typescript
|
|
318
|
+
* await firekitAuth.signOut();
|
|
319
|
+
* console.log("User signed out");
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
signOut(): Promise<void>;
|
|
323
|
+
/**
|
|
324
|
+
* Checks if user is authenticated
|
|
325
|
+
* @returns {boolean} True if user is authenticated
|
|
326
|
+
*/
|
|
327
|
+
isAuthenticated(): boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Checks if user is anonymous
|
|
330
|
+
* @returns {boolean} True if user is anonymous
|
|
331
|
+
*/
|
|
332
|
+
isAnonymous(): boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Checks if user's email is verified
|
|
335
|
+
* @returns {boolean} True if email is verified
|
|
336
|
+
*/
|
|
337
|
+
isEmailVerified(): boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Gets user's primary email address
|
|
340
|
+
* @returns {string | null} User's email or null
|
|
341
|
+
*/
|
|
342
|
+
getUserEmail(): string | null;
|
|
343
|
+
/**
|
|
344
|
+
* Gets user's display name
|
|
345
|
+
* @returns {string | null} User's display name or null
|
|
346
|
+
*/
|
|
347
|
+
getUserDisplayName(): string | null;
|
|
348
|
+
/**
|
|
349
|
+
* Gets user's photo URL
|
|
350
|
+
* @returns {string | null} User's photo URL or null
|
|
351
|
+
*/
|
|
352
|
+
getUserPhotoURL(): string | null;
|
|
353
|
+
/**
|
|
354
|
+
* Gets user's UID
|
|
355
|
+
* @returns {string | null} User's UID or null
|
|
356
|
+
*/
|
|
357
|
+
getUserId(): string | null;
|
|
358
|
+
/**
|
|
359
|
+
* Cleans up all resources
|
|
360
|
+
* @returns {Promise<void>} Promise that resolves when cleanup is complete
|
|
361
|
+
*/
|
|
362
|
+
cleanup(): Promise<void>;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Pre-initialized singleton instance of FirekitAuth.
|
|
366
|
+
* This is the main export that should be used throughout your application.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```typescript
|
|
370
|
+
* import { firekitAuth } from 'svelte-firekit';
|
|
371
|
+
*
|
|
372
|
+
* // Sign in with email
|
|
373
|
+
* await firekitAuth.signInWithEmail("user@example.com", "password");
|
|
374
|
+
*
|
|
375
|
+
* // Listen to auth state
|
|
376
|
+
* const unsubscribe = firekitAuth.onAuthStateChanged((state) => {
|
|
377
|
+
* if (state.user) {
|
|
378
|
+
* console.log("User is signed in:", state.user.email);
|
|
379
|
+
* } else {
|
|
380
|
+
* console.log("User is signed out");
|
|
381
|
+
* }
|
|
382
|
+
* });
|
|
383
|
+
*
|
|
384
|
+
* // Clean up listener
|
|
385
|
+
* unsubscribe();
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export declare const firekitAuth: FirekitAuth;
|
|
389
|
+
export {};
|