@hellocoop/vue 1.0.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 +10 -0
- package/dist/auth.d.ts +19 -0
- package/dist/buttons/BaseButton.vue.d.ts +54 -0
- package/dist/buttons/ContinueButton.vue.d.ts +2 -0
- package/dist/buttons/LoginButton.vue.d.ts +2 -0
- package/dist/buttons/UpdateDiscordButton.vue.d.ts +2 -0
- package/dist/buttons/UpdateEmailButton.vue.d.ts +2 -0
- package/dist/buttons/UpdateGitHubButton.vue.d.ts +2 -0
- package/dist/buttons/UpdateGitLabButton.vue.d.ts +2 -0
- package/dist/buttons/UpdatePictureButton.vue.d.ts +2 -0
- package/dist/buttons/UpdateTwitterButton.vue.d.ts +2 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +186 -0
- package/dist/index.umd.js +1 -0
- package/dist/login-status/LoggedIn.vue.d.ts +9 -0
- package/dist/login-status/LoggedOut.vue.d.ts +9 -0
- package/dist/logout.d.ts +2 -0
- package/dist/provider.d.ts +13 -0
- package/dist/types.d.ts +63 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Vue package for Hellō
|
|
2
|
+
|
|
3
|
+
[Hellō](https://hello.dev) is an identity network that provides login and registration using the standard OpenID Connect protocol. Hellō offers your users choice between all popular social login providers.
|
|
4
|
+
|
|
5
|
+
This [Vue](https://vuejs.org/) package provides:
|
|
6
|
+
- Vue components for buttons and logged in context
|
|
7
|
+
|
|
8
|
+
See the [Vue SDK documentation](https://www.hello.dev/docs/sdks/vue) for details.
|
|
9
|
+
|
|
10
|
+
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Claims } from './types';
|
|
2
|
+
type AuthCookie = {
|
|
3
|
+
sub: string;
|
|
4
|
+
iat: number;
|
|
5
|
+
} & Claims & {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export type Auth = {
|
|
9
|
+
isLoggedIn: false;
|
|
10
|
+
} | ({
|
|
11
|
+
isLoggedIn: true;
|
|
12
|
+
} & AuthCookie);
|
|
13
|
+
export type AuthState = {
|
|
14
|
+
auth: Auth | {};
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
isLoggedIn: boolean | undefined;
|
|
17
|
+
};
|
|
18
|
+
export declare const useAuth: () => AuthState;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Button, type ProviderHint, type Scope } from '../types';
|
|
2
|
+
interface Props {
|
|
3
|
+
label?: string;
|
|
4
|
+
style?: any;
|
|
5
|
+
color?: Button.Color;
|
|
6
|
+
theme?: Button.Theme;
|
|
7
|
+
hover?: Button.Hover;
|
|
8
|
+
scope?: Scope[];
|
|
9
|
+
updateScope?: Button.UpdateScope;
|
|
10
|
+
targetURI?: string;
|
|
11
|
+
providerHint?: ProviderHint[];
|
|
12
|
+
showLoader?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
16
|
+
label: string;
|
|
17
|
+
color: string;
|
|
18
|
+
theme: string;
|
|
19
|
+
hover: string;
|
|
20
|
+
showLoader: boolean;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
23
|
+
label: string;
|
|
24
|
+
color: string;
|
|
25
|
+
theme: string;
|
|
26
|
+
hover: string;
|
|
27
|
+
showLoader: boolean;
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
}>>>, {
|
|
30
|
+
label: string;
|
|
31
|
+
color: Button.Color;
|
|
32
|
+
theme: Button.Theme;
|
|
33
|
+
hover: Button.Hover;
|
|
34
|
+
showLoader: boolean;
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
}, {}>;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
39
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
40
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
41
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
42
|
+
} : {
|
|
43
|
+
type: import('vue').PropType<T[K]>;
|
|
44
|
+
required: true;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
type __VLS_WithDefaults<P, D> = {
|
|
48
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
49
|
+
default: D[K];
|
|
50
|
+
}> : P[K];
|
|
51
|
+
};
|
|
52
|
+
type __VLS_Prettify<T> = {
|
|
53
|
+
[K in keyof T]: T[K];
|
|
54
|
+
} & {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
|
+
export default _default;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as ContinueButton } from './buttons/ContinueButton.vue';
|
|
2
|
+
export { default as LoginButton } from './buttons/LoginButton.vue';
|
|
3
|
+
export { default as UpdateEmailButton } from './buttons/UpdateEmailButton.vue';
|
|
4
|
+
export { default as UpdatePictureButton } from './buttons/UpdatePictureButton.vue';
|
|
5
|
+
export { default as UpdateTwitterButton } from './buttons/UpdateTwitterButton.vue';
|
|
6
|
+
export { default as UpdateDiscordButton } from './buttons/UpdateDiscordButton.vue';
|
|
7
|
+
export { default as UpdateGitHubButton } from './buttons/UpdateGitHubButton.vue';
|
|
8
|
+
export { default as UpdateGitLabButton } from './buttons/UpdateGitLabButton.vue';
|
|
9
|
+
export { default as LoggedIn } from './login-status/LoggedIn.vue';
|
|
10
|
+
export { default as LoggedOut } from './login-status/LoggedOut.vue';
|
|
11
|
+
export * from './auth.js';
|
|
12
|
+
export * from './logout.js';
|
|
13
|
+
export { default as HelloProvider, routeConfig, useHelloProviderContext } from './provider.js';
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { provide as w, inject as L, defineComponent as n, ref as v, openBlock as a, createElementBlock as d, normalizeClass as B, unref as h, normalizeStyle as H, createElementVNode as U, createBlock as i, renderSlot as p, createCommentVNode as g } from "vue";
|
|
2
|
+
const c = {
|
|
3
|
+
login: "/api/hellocoop?login=true",
|
|
4
|
+
auth: "/api/hellocoop?auth=true",
|
|
5
|
+
logout: "/api/hellocoop?logout=true"
|
|
6
|
+
}, f = "HelloAuth", P = () => L(f), E = {
|
|
7
|
+
props: ["auth", "config"],
|
|
8
|
+
setup(t) {
|
|
9
|
+
var o, e, l;
|
|
10
|
+
(o = t == null ? void 0 : t.config) != null && o.login && (c.login = t.config.login), (e = t == null ? void 0 : t.config) != null && e.auth && (c.auth = t.config.auth), (l = t == null ? void 0 : t.config) != null && l.logout && (c.logout = t.config.logout), w(f, t.auth);
|
|
11
|
+
},
|
|
12
|
+
render() {
|
|
13
|
+
return this.$slots.default();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var u;
|
|
17
|
+
((t) => {
|
|
18
|
+
t.STYLES_URL = "https://cdn.hello.coop/css/hello-btn.css", t.HOVER_MAPPING = {
|
|
19
|
+
pop: "",
|
|
20
|
+
glow: "hello-btn-hover-glow",
|
|
21
|
+
flare: "hello-btn-hover-flare",
|
|
22
|
+
none: "hello-btn-hover-none"
|
|
23
|
+
}, t.CLASS_MAPPING = {
|
|
24
|
+
black: {
|
|
25
|
+
"ignore-light": "",
|
|
26
|
+
"ignore-dark": "hello-btn-black-on-dark",
|
|
27
|
+
"aware-invert": "hello-btn-black-and-invert",
|
|
28
|
+
"aware-static": "hello-btn-black-and-static"
|
|
29
|
+
},
|
|
30
|
+
white: {
|
|
31
|
+
"ignore-light": "hello-btn-white-on-light",
|
|
32
|
+
"ignore-dark": "hello-btn-white-on-dark",
|
|
33
|
+
"aware-invert": "hello-btn-white-and-invert",
|
|
34
|
+
"aware-static": "hello-btn-white-and-static"
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
})(u || (u = {}));
|
|
38
|
+
const S = ["disabled"], k = ["innerHTML"], r = /* @__PURE__ */ n({
|
|
39
|
+
__name: "BaseButton",
|
|
40
|
+
props: {
|
|
41
|
+
label: { default: "ō Continue with Hellō" },
|
|
42
|
+
style: {},
|
|
43
|
+
color: { default: "black" },
|
|
44
|
+
theme: { default: "ignore-light" },
|
|
45
|
+
hover: { default: "pop" },
|
|
46
|
+
scope: {},
|
|
47
|
+
updateScope: {},
|
|
48
|
+
targetURI: {},
|
|
49
|
+
providerHint: {},
|
|
50
|
+
showLoader: { type: Boolean, default: !1 },
|
|
51
|
+
disabled: { type: Boolean, default: !1 }
|
|
52
|
+
},
|
|
53
|
+
setup(t) {
|
|
54
|
+
const o = v(!1), e = t, l = new URL(c.login, window.location.origin);
|
|
55
|
+
e.scope && l.searchParams.set("scope", e.scope.join(" ")), l.searchParams.set("target_uri", e.targetURI || window.location.pathname), e.updateScope && l.searchParams.set("scope", "profile_update " + e.updateScope), e.providerHint && l.searchParams.set("provider_hint", e.providerHint.join(" "));
|
|
56
|
+
const m = () => {
|
|
57
|
+
o.value = !0, window.location.href = l.href;
|
|
58
|
+
};
|
|
59
|
+
return (s, R) => {
|
|
60
|
+
var _;
|
|
61
|
+
return a(), d("button", {
|
|
62
|
+
onClick: m,
|
|
63
|
+
class: B(["hello-btn", (_ = h(u).CLASS_MAPPING[e.color]) == null ? void 0 : _[e.theme], h(u).HOVER_MAPPING[s.hover], (s.showLoader || o.value) && "hello-btn-loader"]),
|
|
64
|
+
disabled: e.disabled || o.value,
|
|
65
|
+
style: H(s.style)
|
|
66
|
+
}, [
|
|
67
|
+
U("span", { innerHTML: s.label }, null, 8, k)
|
|
68
|
+
], 14, S);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}), G = /* @__PURE__ */ n({
|
|
72
|
+
__name: "ContinueButton",
|
|
73
|
+
setup(t) {
|
|
74
|
+
return (o, e) => (a(), i(r));
|
|
75
|
+
}
|
|
76
|
+
}), A = /* @__PURE__ */ n({
|
|
77
|
+
__name: "LoginButton",
|
|
78
|
+
setup(t) {
|
|
79
|
+
return (o, e) => (a(), i(r, { label: "ō Login with Hellō" }));
|
|
80
|
+
}
|
|
81
|
+
}), x = /* @__PURE__ */ n({
|
|
82
|
+
__name: "UpdateEmailButton",
|
|
83
|
+
setup(t) {
|
|
84
|
+
return (o, e) => (a(), i(r, {
|
|
85
|
+
label: "ō Update Email with Hellō",
|
|
86
|
+
updateScope: "email"
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
}), O = /* @__PURE__ */ n({
|
|
90
|
+
__name: "UpdatePictureButton",
|
|
91
|
+
setup(t) {
|
|
92
|
+
return (o, e) => (a(), i(r, {
|
|
93
|
+
label: "ō Update Picture with Hellō",
|
|
94
|
+
updateScope: "picture"
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
}), M = /* @__PURE__ */ n({
|
|
98
|
+
__name: "UpdateTwitterButton",
|
|
99
|
+
setup(t) {
|
|
100
|
+
return (o, e) => (a(), i(r, {
|
|
101
|
+
label: "ō Update Twitter with Hellō",
|
|
102
|
+
updateScope: "twitter"
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
}), N = /* @__PURE__ */ n({
|
|
106
|
+
__name: "UpdateDiscordButton",
|
|
107
|
+
setup(t) {
|
|
108
|
+
return (o, e) => (a(), i(r, {
|
|
109
|
+
label: "ō Update Discord with Hellō",
|
|
110
|
+
updateScope: "discord"
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
}), T = /* @__PURE__ */ n({
|
|
114
|
+
__name: "UpdateGitHubButton",
|
|
115
|
+
setup(t) {
|
|
116
|
+
return (o, e) => (a(), i(r, {
|
|
117
|
+
label: "ō Update GitHub with Hellō",
|
|
118
|
+
updateScope: "github"
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
}), V = /* @__PURE__ */ n({
|
|
122
|
+
__name: "UpdateGitLabButton",
|
|
123
|
+
setup(t) {
|
|
124
|
+
return (o, e) => (a(), i(r, {
|
|
125
|
+
label: "ō Update GitLab with Hellō",
|
|
126
|
+
updateScope: "gitlab"
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
}), I = async (t) => {
|
|
130
|
+
try {
|
|
131
|
+
return await (await fetch(t)).json();
|
|
132
|
+
} catch (o) {
|
|
133
|
+
console.error(o);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
}, b = () => {
|
|
137
|
+
const t = P(), { data: o = t, isValidating: e } = useSWR(c.auth, I);
|
|
138
|
+
return {
|
|
139
|
+
auth: o || {},
|
|
140
|
+
isLoading: e,
|
|
141
|
+
isLoggedIn: o == null ? void 0 : o.isLoggedIn
|
|
142
|
+
};
|
|
143
|
+
}, $ = { key: 0 }, j = /* @__PURE__ */ n({
|
|
144
|
+
__name: "LoggedIn",
|
|
145
|
+
setup(t) {
|
|
146
|
+
const o = () => {
|
|
147
|
+
var e;
|
|
148
|
+
return ((e = b()) == null ? void 0 : e.isLoggedIn) || !1;
|
|
149
|
+
};
|
|
150
|
+
return (e, l) => o() ? (a(), d("div", $, [
|
|
151
|
+
p(e.$slots, "default")
|
|
152
|
+
])) : g("", !0);
|
|
153
|
+
}
|
|
154
|
+
}), C = { key: 0 }, D = /* @__PURE__ */ n({
|
|
155
|
+
__name: "LoggedOut",
|
|
156
|
+
setup(t) {
|
|
157
|
+
const o = () => {
|
|
158
|
+
var e;
|
|
159
|
+
return ((e = b()) == null ? void 0 : e.isLoggedIn) || !1;
|
|
160
|
+
};
|
|
161
|
+
return (e, l) => o() ? g("", !0) : (a(), d("div", C, [
|
|
162
|
+
p(e.$slots, "default")
|
|
163
|
+
]));
|
|
164
|
+
}
|
|
165
|
+
}), z = () => c.logout;
|
|
166
|
+
function Y() {
|
|
167
|
+
window.location.href = c.logout;
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
G as ContinueButton,
|
|
171
|
+
E as HelloProvider,
|
|
172
|
+
j as LoggedIn,
|
|
173
|
+
D as LoggedOut,
|
|
174
|
+
A as LoginButton,
|
|
175
|
+
N as UpdateDiscordButton,
|
|
176
|
+
x as UpdateEmailButton,
|
|
177
|
+
T as UpdateGitHubButton,
|
|
178
|
+
V as UpdateGitLabButton,
|
|
179
|
+
O as UpdatePictureButton,
|
|
180
|
+
M as UpdateTwitterButton,
|
|
181
|
+
z as getLogOutRoute,
|
|
182
|
+
Y as logOut,
|
|
183
|
+
c as routeConfig,
|
|
184
|
+
b as useAuth,
|
|
185
|
+
P as useHelloProviderContext
|
|
186
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a["@hellocoop/vue"]={},a.Vue))})(this,function(a,e){"use strict";const i={login:"/api/hellocoop?login=true",auth:"/api/hellocoop?auth=true",logout:"/api/hellocoop?logout=true"},u="HelloAuth",_=()=>e.inject(u),p={props:["auth","config"],setup(o){var n,t,l;(n=o==null?void 0:o.config)!=null&&n.login&&(i.login=o.config.login),(t=o==null?void 0:o.config)!=null&&t.auth&&(i.auth=o.config.auth),(l=o==null?void 0:o.config)!=null&&l.logout&&(i.logout=o.config.logout),e.provide(u,o.auth)},render(){return this.$slots.default()}};var r;(o=>{o.STYLES_URL="https://cdn.hello.coop/css/hello-btn.css",o.HOVER_MAPPING={pop:"",glow:"hello-btn-hover-glow",flare:"hello-btn-hover-flare",none:"hello-btn-hover-none"},o.CLASS_MAPPING={black:{"ignore-light":"","ignore-dark":"hello-btn-black-on-dark","aware-invert":"hello-btn-black-and-invert","aware-static":"hello-btn-black-and-static"},white:{"ignore-light":"hello-btn-white-on-light","ignore-dark":"hello-btn-white-on-dark","aware-invert":"hello-btn-white-and-invert","aware-static":"hello-btn-white-and-static"}}})(r||(r={}));const f=["disabled"],g=["innerHTML"],c=e.defineComponent({__name:"BaseButton",props:{label:{default:"ō Continue with Hellō"},style:{},color:{default:"black"},theme:{default:"ignore-light"},hover:{default:"pop"},scope:{},updateScope:{},targetURI:{},providerHint:{},showLoader:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},setup(o){const n=e.ref(!1),t=o,l=new URL(i.login,window.location.origin);t.scope&&l.searchParams.set("scope",t.scope.join(" ")),l.searchParams.set("target_uri",t.targetURI||window.location.pathname),t.updateScope&&l.searchParams.set("scope","profile_update "+t.updateScope),t.providerHint&&l.searchParams.set("provider_hint",t.providerHint.join(" "));const R=()=>{n.value=!0,window.location.href=l.href};return(s,A)=>{var h;return e.openBlock(),e.createElementBlock("button",{onClick:R,class:e.normalizeClass(["hello-btn",(h=e.unref(r).CLASS_MAPPING[t.color])==null?void 0:h[t.theme],e.unref(r).HOVER_MAPPING[s.hover],(s.showLoader||n.value)&&"hello-btn-loader"]),disabled:t.disabled||n.value,style:e.normalizeStyle(s.style)},[e.createElementVNode("span",{innerHTML:s.label},null,8,g)],14,f)}}}),m=e.defineComponent({__name:"ContinueButton",setup(o){return(n,t)=>(e.openBlock(),e.createBlock(c))}}),b=e.defineComponent({__name:"LoginButton",setup(o){return(n,t)=>(e.openBlock(),e.createBlock(c,{label:"ō Login with Hellō"}))}}),B=e.defineComponent({__name:"UpdateEmailButton",setup(o){return(n,t)=>(e.openBlock(),e.createBlock(c,{label:"ō Update Email with Hellō",updateScope:"email"}))}}),k=e.defineComponent({__name:"UpdatePictureButton",setup(o){return(n,t)=>(e.openBlock(),e.createBlock(c,{label:"ō Update Picture with Hellō",updateScope:"picture"}))}}),w=e.defineComponent({__name:"UpdateTwitterButton",setup(o){return(n,t)=>(e.openBlock(),e.createBlock(c,{label:"ō Update Twitter with Hellō",updateScope:"twitter"}))}}),L=e.defineComponent({__name:"UpdateDiscordButton",setup(o){return(n,t)=>(e.openBlock(),e.createBlock(c,{label:"ō Update Discord with Hellō",updateScope:"discord"}))}}),C=e.defineComponent({__name:"UpdateGitHubButton",setup(o){return(n,t)=>(e.openBlock(),e.createBlock(c,{label:"ō Update GitHub with Hellō",updateScope:"github"}))}}),H=e.defineComponent({__name:"UpdateGitLabButton",setup(o){return(n,t)=>(e.openBlock(),e.createBlock(c,{label:"ō Update GitLab with Hellō",updateScope:"gitlab"}))}}),U=async o=>{try{return await(await fetch(o)).json()}catch(n){console.error(n);return}},d=()=>{const o=_(),{data:n=o,isValidating:t}=useSWR(i.auth,U);return{auth:n||{},isLoading:t,isLoggedIn:n==null?void 0:n.isLoggedIn}},S={key:0},P=e.defineComponent({__name:"LoggedIn",setup(o){const n=()=>{var t;return((t=d())==null?void 0:t.isLoggedIn)||!1};return(t,l)=>n()?(e.openBlock(),e.createElementBlock("div",S,[e.renderSlot(t.$slots,"default")])):e.createCommentVNode("",!0)}}),I={key:0},$=e.defineComponent({__name:"LoggedOut",setup(o){const n=()=>{var t;return((t=d())==null?void 0:t.isLoggedIn)||!1};return(t,l)=>n()?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"default")]))}}),y=()=>i.logout;function E(){window.location.href=i.logout}a.ContinueButton=m,a.HelloProvider=p,a.LoggedIn=P,a.LoggedOut=$,a.LoginButton=b,a.UpdateDiscordButton=L,a.UpdateEmailButton=B,a.UpdateGitHubButton=C,a.UpdateGitLabButton=H,a.UpdatePictureButton=k,a.UpdateTwitterButton=w,a.getLogOutRoute=y,a.logOut=E,a.routeConfig=i,a.useAuth=d,a.useHelloProviderContext=_,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
|
|
2
|
+
default?(_: {}): any;
|
|
3
|
+
}>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
6
|
+
new (): {
|
|
7
|
+
$slots: S;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
|
|
2
|
+
default?(_: {}): any;
|
|
3
|
+
}>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
6
|
+
new (): {
|
|
7
|
+
$slots: S;
|
|
8
|
+
};
|
|
9
|
+
};
|
package/dist/logout.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RouteConfig = {
|
|
2
|
+
login: string;
|
|
3
|
+
auth: string;
|
|
4
|
+
logout: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const routeConfig: RouteConfig;
|
|
7
|
+
export declare const useHelloProviderContext: () => unknown;
|
|
8
|
+
declare const _default: {
|
|
9
|
+
props: string[];
|
|
10
|
+
setup(props: any): void;
|
|
11
|
+
render(): void;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const PRODUCTION_WALLET: string;
|
|
2
|
+
export declare const DEFAULT_SCOPE: Scope[];
|
|
3
|
+
export declare const DEFAULT_RESPONSE_TYPE: AuthResponseType;
|
|
4
|
+
export declare const DEFAULT_RESPONSE_MODE: AuthResponseMode;
|
|
5
|
+
export declare const DEFAULT_PATH: string;
|
|
6
|
+
export declare const VALID_IDENTITY_CLAIMS: readonly ["name", "nickname", "preferred_username", "given_name", "family_name", "email", "phone", "picture", "ethereum", "discord", "twitter", "github", "gitlab"];
|
|
7
|
+
export declare const VALID_SCOPES: readonly ["name", "nickname", "preferred_username", "given_name", "family_name", "email", "phone", "picture", "ethereum", "discord", "twitter", "github", "gitlab", "openid", "profile_update"];
|
|
8
|
+
export declare const VALID_RESPONSE_TYPE: readonly ["id_token", "code"];
|
|
9
|
+
export declare const VALID_RESPONSE_MODE: string[];
|
|
10
|
+
export declare const VALID_PROVIDER_HINT: readonly ["apple", "discord", "facebook", "github", "gitlab", "google", "twitch", "twitter", "tumblr", "mastodon", "microsoft", "line", "wordpress", "yahoo", "phone", "ethereum", "qrcode", "apple--", "microsoft--", "google--", "email--", "passkey--"];
|
|
11
|
+
export type Scope = typeof VALID_SCOPES[number];
|
|
12
|
+
export type AuthResponseType = typeof VALID_RESPONSE_TYPE[number];
|
|
13
|
+
export type AuthResponseMode = typeof VALID_RESPONSE_MODE[number];
|
|
14
|
+
export type ProviderHint = typeof VALID_PROVIDER_HINT[number];
|
|
15
|
+
type IdentityClaims = typeof VALID_IDENTITY_CLAIMS[number];
|
|
16
|
+
type OptionalClaims = {
|
|
17
|
+
[K in IdentityClaims]?: unknown;
|
|
18
|
+
};
|
|
19
|
+
export type Claims = OptionalClaims & {
|
|
20
|
+
sub: string;
|
|
21
|
+
};
|
|
22
|
+
export type TokenPayload = OptionalClaims & {
|
|
23
|
+
iss: string;
|
|
24
|
+
aud: string;
|
|
25
|
+
nonce: string;
|
|
26
|
+
jti: string;
|
|
27
|
+
sub: string;
|
|
28
|
+
scope: string[];
|
|
29
|
+
iat: number;
|
|
30
|
+
exp: number;
|
|
31
|
+
};
|
|
32
|
+
export type TokenHeader = {
|
|
33
|
+
typ: string;
|
|
34
|
+
alg: string;
|
|
35
|
+
};
|
|
36
|
+
export declare namespace Button {
|
|
37
|
+
type Color = "black" | "white";
|
|
38
|
+
type Theme = "ignore-light" | "ignore-dark" | "aware-invert" | "aware-static";
|
|
39
|
+
type Hover = "pop" | "glow" | "flare" | "none";
|
|
40
|
+
type UpdateScope = "email" | "picture" | "twitter" | "discord" | "github" | "gitlab";
|
|
41
|
+
const STYLES_URL = "https://cdn.hello.coop/css/hello-btn.css";
|
|
42
|
+
const HOVER_MAPPING: {
|
|
43
|
+
pop: string;
|
|
44
|
+
glow: string;
|
|
45
|
+
flare: string;
|
|
46
|
+
none: string;
|
|
47
|
+
};
|
|
48
|
+
const CLASS_MAPPING: {
|
|
49
|
+
black: {
|
|
50
|
+
"ignore-light": string;
|
|
51
|
+
"ignore-dark": string;
|
|
52
|
+
"aware-invert": string;
|
|
53
|
+
"aware-static": string;
|
|
54
|
+
};
|
|
55
|
+
white: {
|
|
56
|
+
"ignore-light": string;
|
|
57
|
+
"ignore-dark": string;
|
|
58
|
+
"aware-invert": string;
|
|
59
|
+
"aware-static": string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hellocoop/vue",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Svelte SDK for Hellō https://hello.dev",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/hellocoop/packages.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://www.hello.dev/docs/sdks/vue",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"vuejs",
|
|
12
|
+
"vue",
|
|
13
|
+
"vue.js",
|
|
14
|
+
"hello",
|
|
15
|
+
"openid",
|
|
16
|
+
"oidc",
|
|
17
|
+
"sso"
|
|
18
|
+
],
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "Hello Identity Co-op",
|
|
21
|
+
"email": "contact@hello.coop",
|
|
22
|
+
"url": "https://hello.coop"
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/index.umd.js",
|
|
25
|
+
"module": "./dist/index.mjs",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./dist/index.mjs",
|
|
29
|
+
"require": "./dist/index.umd.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"unpkg": "dist/index.umd.min.js",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/hellocoop/packages/issues"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "vite build"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"swrv": "^1.0.4",
|
|
46
|
+
"vue": "^3.0.5"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"typescript": "^5.2.2",
|
|
50
|
+
"vite-plugin-dts": "^3.6.3"
|
|
51
|
+
}
|
|
52
|
+
}
|