sveltedfire 0.1.18 → 0.1.20
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.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/sveltedfire/auth/authState.svelte.d.ts +2 -0
- package/dist/sveltedfire/auth/authState.svelte.js +9 -0
- package/dist/sveltedfire/components/PromptSignIn.svelte +2 -2
- package/dist/sveltedfire/components/SignedIn.svelte +2 -2
- package/dist/sveltedfire/components/SignedOut.svelte +2 -2
- package/dist/sveltedfire/components/SveltedAuth.svelte +6 -20
- package/package.json +1 -1
- package/dist/sveltedfire/auth/authState.d.ts +0 -2
- package/dist/sveltedfire/auth/authState.js +0 -8
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { listenDocs } from './sveltedfire/utilities/listenDocs.js';
|
|
|
8
8
|
export { kindlyFetchDoc } from './sveltedfire/utilities/kindlyFetchDoc.js';
|
|
9
9
|
export { kindlyFetchDocs } from './sveltedfire/utilities/kindlyFetchDocs.js';
|
|
10
10
|
export { type AuthSig } from './sveltedfire/auth/AuthSig.js';
|
|
11
|
-
export { authState } from './sveltedfire/auth/authState.
|
|
11
|
+
export { authState } from './sveltedfire/auth/authState.svelte';
|
|
12
12
|
export { handleForm } from './sveltedfire/utilities/handleForm.js';
|
|
13
13
|
import SignedIn from './sveltedfire/components/SignedIn.svelte';
|
|
14
14
|
import SignedOut from './sveltedfire/components/SignedOut.svelte';
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { listenDocs } from './sveltedfire/utilities/listenDocs.js';
|
|
|
9
9
|
export { kindlyFetchDoc } from './sveltedfire/utilities/kindlyFetchDoc.js';
|
|
10
10
|
export { kindlyFetchDocs } from './sveltedfire/utilities/kindlyFetchDocs.js';
|
|
11
11
|
export {} from './sveltedfire/auth/AuthSig.js';
|
|
12
|
-
export { authState } from './sveltedfire/auth/authState.
|
|
12
|
+
export { authState } from './sveltedfire/auth/authState.svelte';
|
|
13
13
|
export { handleForm } from './sveltedfire/utilities/handleForm.js';
|
|
14
14
|
import SignedIn from './sveltedfire/components/SignedIn.svelte';
|
|
15
15
|
import SignedOut from './sveltedfire/components/SignedOut.svelte';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
const { children } = $props()
|
|
3
|
-
import { authState } from '../auth/authState.
|
|
3
|
+
import { authState } from '../auth/authState.svelte';
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
{#if
|
|
6
|
+
{#if authState.initialized && authState!.currentUser}
|
|
7
7
|
{@render children()}
|
|
8
8
|
{/if}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
const { children } = $props()
|
|
3
|
-
import { authState } from '../auth/authState.
|
|
3
|
+
import { authState } from '../auth/authState.svelte';
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
{#if
|
|
6
|
+
{#if authState && authState.initialized && !authState!.currentUser}
|
|
7
7
|
{@render children()}
|
|
8
8
|
{/if}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getAuth, type User } from 'firebase/auth'
|
|
3
|
-
import {
|
|
4
|
-
import { signInWithGoogle } from '../auth/signInWithGoogle.js'
|
|
5
|
-
import { type AuthSig } from '../auth/AuthSig.js';
|
|
6
|
-
import { authState } from '../auth/authState.js'
|
|
3
|
+
import { authState } from '../auth/authState.svelte'
|
|
7
4
|
|
|
8
5
|
const { children, ...rest } = $props()
|
|
9
6
|
|
|
@@ -17,35 +14,24 @@
|
|
|
17
14
|
|
|
18
15
|
const auth = getAuth()
|
|
19
16
|
|
|
20
|
-
let fullAuth = $state<AuthSig>({
|
|
21
|
-
currentUser: null,
|
|
22
|
-
initialized: false,
|
|
23
|
-
signOut,
|
|
24
|
-
signInWithGoogle
|
|
25
|
-
})
|
|
26
|
-
|
|
27
17
|
auth.authStateReady().then(() => {
|
|
28
18
|
console.log('Received authStateReady')
|
|
29
|
-
|
|
30
|
-
authState.set(fullAuth)
|
|
19
|
+
authState.initialized = true
|
|
31
20
|
})
|
|
32
21
|
|
|
33
22
|
auth.onAuthStateChanged(user => {
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
authState.initialized = true
|
|
24
|
+
authState.currentUser = user
|
|
36
25
|
Object.keys(additionalKeys).forEach((k: string) => {
|
|
37
|
-
|
|
26
|
+
authState[k] = rest[additionalKeys[k]](null, null)
|
|
38
27
|
})
|
|
39
28
|
user?.getIdTokenResult().then(token => {
|
|
40
29
|
Object.keys(additionalKeys).forEach((k: string) => {
|
|
41
|
-
|
|
30
|
+
authState[k] = rest[additionalKeys[k]](user, token)
|
|
42
31
|
})
|
|
43
32
|
})
|
|
44
|
-
authState.set(fullAuth)
|
|
45
33
|
})
|
|
46
34
|
|
|
47
|
-
authState.set(fullAuth)
|
|
48
|
-
|
|
49
35
|
</script>
|
|
50
36
|
|
|
51
37
|
{@render children()}
|
package/package.json
CHANGED