@hellocoop/svelte 1.0.0 → 1.0.1
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/Provider.svelte +10 -13
- package/dist/buttons/BaseButton.svelte +26 -48
- package/dist/buttons/ContinueButton.svelte +1 -2
- package/dist/buttons/LoginButton.svelte +1 -2
- package/dist/buttons/UpdateDiscordButton.svelte +1 -2
- package/dist/buttons/UpdateEmailButton.svelte +1 -2
- package/dist/buttons/UpdateGitHubButton.svelte +1 -2
- package/dist/buttons/UpdateGitLabButton.svelte +1 -2
- package/dist/buttons/UpdatePictureButton.svelte +1 -2
- package/dist/buttons/UpdateTwitterButton.svelte +1 -2
- package/dist/index.d.ts +13 -5
- package/dist/index.js +18 -5
- package/dist/login-status/LoggedIn.svelte +2 -5
- package/dist/login-status/LoggedOut.svelte +3 -6
- package/package.json +2 -1
- package/dist/buttons/index.d.ts +0 -8
- package/dist/buttons/index.js +0 -9
- package/dist/login-status/index.d.ts +0 -2
- package/dist/login-status/index.js +0 -3
package/dist/Provider.svelte
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
<script context="module"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export const getHelloProviderContext = (): Auth | undefined => {
|
|
12
|
-
return getContext('HelloProviderContext')
|
|
13
|
-
}
|
|
1
|
+
<script context="module">import {} from "./auth";
|
|
2
|
+
import { setContext, getContext } from "svelte";
|
|
3
|
+
export const routeConfig = {
|
|
4
|
+
login: "/api/hellocoop?login=true",
|
|
5
|
+
auth: "/api/hellocoop?auth=true",
|
|
6
|
+
logout: "/api/hellocoop?logout=true"
|
|
7
|
+
};
|
|
8
|
+
export const getHelloProviderContext = () => {
|
|
9
|
+
return getContext("HelloProviderContext");
|
|
10
|
+
};
|
|
14
11
|
</script>
|
|
15
12
|
|
|
16
13
|
<script>
|
|
@@ -1,51 +1,29 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export let targetURI: string = ""
|
|
28
|
-
export let providerHint: ProviderHint[];
|
|
29
|
-
export let showLoader: boolean = false
|
|
30
|
-
export let disabled: boolean = false
|
|
31
|
-
|
|
32
|
-
let clicked: boolean = false
|
|
33
|
-
const loginRoute = new URL(routeConfig.login, window.location.origin)
|
|
34
|
-
if(scope)
|
|
35
|
-
loginRoute.searchParams.set("scope", scope.join(" "))
|
|
36
|
-
|
|
37
|
-
loginRoute.searchParams.set("target_uri", targetURI || window.location.pathname)
|
|
38
|
-
|
|
39
|
-
if(updateScope)
|
|
40
|
-
loginRoute.searchParams.set("scope", "profile_update " + updateScope)
|
|
41
|
-
|
|
42
|
-
if(providerHint)
|
|
43
|
-
loginRoute.searchParams.set("provider_hint", providerHint.join(" "))
|
|
44
|
-
|
|
45
|
-
const onClickHandler = (): void => {
|
|
46
|
-
clicked = true
|
|
47
|
-
window.location.href = loginRoute.href
|
|
48
|
-
}
|
|
1
|
+
<script>import { routeConfig } from "../Provider.svelte";
|
|
2
|
+
import { Button } from "@hellocoop/types";
|
|
3
|
+
export let label = "\u014D Continue with Hell\u014D";
|
|
4
|
+
export let style = {};
|
|
5
|
+
export let color = "black";
|
|
6
|
+
export let theme = "ignore-light";
|
|
7
|
+
export let hover = "pop";
|
|
8
|
+
export let scope;
|
|
9
|
+
export let updateScope;
|
|
10
|
+
export let targetURI = "";
|
|
11
|
+
export let providerHint;
|
|
12
|
+
export let showLoader = false;
|
|
13
|
+
export let disabled = false;
|
|
14
|
+
let clicked = false;
|
|
15
|
+
const loginRoute = new URL(routeConfig.login, window.location.origin);
|
|
16
|
+
if (scope)
|
|
17
|
+
loginRoute.searchParams.set("scope", scope.join(" "));
|
|
18
|
+
loginRoute.searchParams.set("target_uri", targetURI || window.location.pathname);
|
|
19
|
+
if (updateScope)
|
|
20
|
+
loginRoute.searchParams.set("scope", "profile_update " + updateScope);
|
|
21
|
+
if (providerHint)
|
|
22
|
+
loginRoute.searchParams.set("provider_hint", providerHint.join(" "));
|
|
23
|
+
const onClickHandler = () => {
|
|
24
|
+
clicked = true;
|
|
25
|
+
window.location.href = loginRoute.href;
|
|
26
|
+
};
|
|
49
27
|
</script>
|
|
50
28
|
|
|
51
29
|
<button
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export { default as ContinueButton } from './buttons/ContinueButton.svelte';
|
|
2
|
+
export { default as LoginButton } from './buttons/LoginButton.svelte';
|
|
3
|
+
export { default as UpdateEmailButton } from './buttons/UpdateEmailButton.svelte';
|
|
4
|
+
export { default as UpdatePictureButton } from './buttons/UpdatePictureButton.svelte';
|
|
5
|
+
export { default as UpdateTwitterButton } from './buttons/UpdateTwitterButton.svelte';
|
|
6
|
+
export { default as UpdateDiscordButton } from './buttons/UpdateDiscordButton.svelte';
|
|
7
|
+
export { default as UpdateGitHubButton } from './buttons/UpdateGitHubButton.svelte';
|
|
8
|
+
export { default as UpdateGitLabButton } from './buttons/UpdateGitLabButton.svelte';
|
|
9
|
+
export { default as LoggedIn } from './login-status/LoggedIn.svelte';
|
|
10
|
+
export { default as LoggedOut } from './login-status/LoggedOut.svelte';
|
|
11
|
+
export * from './auth.js';
|
|
12
|
+
export * from './logout.js';
|
|
13
|
+
export { default as Provider, routeConfig, getHelloProviderContext } from './Provider.svelte';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
2
|
+
//Buttons
|
|
3
|
+
export { default as ContinueButton } from './buttons/ContinueButton.svelte';
|
|
4
|
+
export { default as LoginButton } from './buttons/LoginButton.svelte';
|
|
5
|
+
export { default as UpdateEmailButton } from './buttons/UpdateEmailButton.svelte';
|
|
6
|
+
export { default as UpdatePictureButton } from './buttons/UpdatePictureButton.svelte';
|
|
7
|
+
export { default as UpdateTwitterButton } from './buttons/UpdateTwitterButton.svelte';
|
|
8
|
+
export { default as UpdateDiscordButton } from './buttons/UpdateDiscordButton.svelte';
|
|
9
|
+
export { default as UpdateGitHubButton } from './buttons/UpdateGitHubButton.svelte';
|
|
10
|
+
export { default as UpdateGitLabButton } from './buttons/UpdateGitLabButton.svelte';
|
|
11
|
+
//Login Status
|
|
12
|
+
export { default as LoggedIn } from './login-status/LoggedIn.svelte';
|
|
13
|
+
export { default as LoggedOut } from './login-status/LoggedOut.svelte';
|
|
14
|
+
//Auth
|
|
15
|
+
export * from './auth.js';
|
|
16
|
+
//Logout
|
|
17
|
+
export * from './logout.js';
|
|
18
|
+
//Provider
|
|
19
|
+
export { default as Provider, routeConfig, getHelloProviderContext } from './Provider.svelte';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
import type { Readable } from "svelte/store"
|
|
4
|
-
|
|
5
|
-
const isLoggedIn = (): Readable<boolean> | boolean => useAuth()?.isLoggedIn || false
|
|
1
|
+
<script>import { useAuth } from "../auth";
|
|
2
|
+
const isLoggedIn = () => useAuth()?.isLoggedIn || false;
|
|
6
3
|
</script>
|
|
7
4
|
|
|
8
5
|
{#if isLoggedIn}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const isLoggedIn = (): Readable<boolean> | boolean => useAuth()?.isLoggedIn || false
|
|
6
|
-
</script>
|
|
1
|
+
<script>import { useAuth } from "../auth";
|
|
2
|
+
const isLoggedIn = () => useAuth()?.isLoggedIn || false;
|
|
3
|
+
</script>
|
|
7
4
|
|
|
8
5
|
{#if !isLoggedIn}
|
|
9
6
|
<slot/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hellocoop/svelte",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Svelte SDK for Hellō https://hello.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"types": "./dist/index.d.ts",
|
|
58
58
|
"type": "module",
|
|
59
59
|
"dependencies": {
|
|
60
|
+
"@hellocoop/types": "^1.0.2",
|
|
60
61
|
"sswr": "^2.0.0"
|
|
61
62
|
}
|
|
62
63
|
}
|
package/dist/buttons/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default as ContinueButton } from './ContinueButton.svelte';
|
|
2
|
-
export { default as LoginButton } from './LoginButton.svelte';
|
|
3
|
-
export { default as UpdateEmailButton } from './UpdateEmailButton.svelte';
|
|
4
|
-
export { default as UpdatePictureButton } from './UpdatePictureButton.svelte';
|
|
5
|
-
export { default as UpdateTwitterButton } from './UpdateTwitterButton.svelte';
|
|
6
|
-
export { default as UpdateDiscordButton } from './UpdateDiscordButton.svelte';
|
|
7
|
-
export { default as UpdateGitHubButton } from './UpdateGitHubButton.svelte';
|
|
8
|
-
export { default as UpdateGitLabButton } from './UpdateGitLabButton.svelte';
|
package/dist/buttons/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
export { default as ContinueButton } from './ContinueButton.svelte';
|
|
3
|
-
export { default as LoginButton } from './LoginButton.svelte';
|
|
4
|
-
export { default as UpdateEmailButton } from './UpdateEmailButton.svelte';
|
|
5
|
-
export { default as UpdatePictureButton } from './UpdatePictureButton.svelte';
|
|
6
|
-
export { default as UpdateTwitterButton } from './UpdateTwitterButton.svelte';
|
|
7
|
-
export { default as UpdateDiscordButton } from './UpdateDiscordButton.svelte';
|
|
8
|
-
export { default as UpdateGitHubButton } from './UpdateGitHubButton.svelte';
|
|
9
|
-
export { default as UpdateGitLabButton } from './UpdateGitLabButton.svelte';
|