@flowsta/login-button 0.1.2 → 0.1.3
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/FlowstaLoginButton.d.ts +1 -1
- package/dist/FlowstaLoginButtonQwik.d.ts +1 -1
- package/dist/FlowstaLoginButtonVanilla.d.ts +2 -2
- package/dist/qwik.js +21 -21
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/oauth.d.ts +1 -1
- package/dist/utils/oauth.d.ts.map +1 -1
- package/dist/vanilla.js +5 -5
- package/dist/vue.js +20 -20
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ import type { FlowstaLoginButtonProps } from './types.js';
|
|
|
10
10
|
* <FlowstaLoginButton
|
|
11
11
|
* clientId="your-client-id"
|
|
12
12
|
* redirectUri="https://yourapp.com/callback"
|
|
13
|
-
* scopes={['
|
|
13
|
+
* scopes={['openid', 'email', 'display_name']}
|
|
14
14
|
* variant="dark-pill"
|
|
15
15
|
* onSuccess={(data) => {
|
|
16
16
|
* console.log('Authorization code:', data.code);
|
|
@@ -25,7 +25,7 @@ export interface FlowstaLoginButtonQwikProps extends FlowstaLoginConfig {
|
|
|
25
25
|
* <FlowstaLoginButton
|
|
26
26
|
* clientId="your-client-id"
|
|
27
27
|
* redirectUri="https://yourapp.com/callback"
|
|
28
|
-
* scopes={['
|
|
28
|
+
* scopes={['openid', 'email', 'display_name']}
|
|
29
29
|
* variant="dark-pill"
|
|
30
30
|
* onSuccess$={(data) => {
|
|
31
31
|
* console.log('Authorization code:', data.code);
|
|
@@ -20,7 +20,7 @@ export interface FlowstaLoginButtonVanillaOptions extends FlowstaLoginConfig {
|
|
|
20
20
|
* const button = createFlowstaLoginButton({
|
|
21
21
|
* clientId: 'your-client-id',
|
|
22
22
|
* redirectUri: 'https://yourapp.com/callback',
|
|
23
|
-
* scopes: ['
|
|
23
|
+
* scopes: ['openid', 'email', 'display_name'],
|
|
24
24
|
* variant: 'dark-pill',
|
|
25
25
|
* onSuccess: (data) => {
|
|
26
26
|
* console.log('Authorization code:', data.code);
|
|
@@ -44,7 +44,7 @@ export declare function createFlowstaLoginButton(options: FlowstaLoginButtonVani
|
|
|
44
44
|
* initFlowstaLoginButton('#login-button-container', {
|
|
45
45
|
* clientId: 'your-client-id',
|
|
46
46
|
* redirectUri: 'https://yourapp.com/callback',
|
|
47
|
-
* scopes: ['
|
|
47
|
+
* scopes: ['openid', 'email', 'display_name'],
|
|
48
48
|
* variant: 'dark-pill'
|
|
49
49
|
* });
|
|
50
50
|
* ```
|
package/dist/qwik.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import { jsx as n } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
-
import { component$ as
|
|
2
|
+
import { component$ as f, useSignal as h, $ as w } from "@builder.io/qwik";
|
|
3
3
|
import { b } from "./oauth-DieOmaFh.js";
|
|
4
4
|
import { h as S, p as F } from "./oauth-DieOmaFh.js";
|
|
5
|
-
const C =
|
|
5
|
+
const C = f((t) => {
|
|
6
6
|
const {
|
|
7
|
-
clientId:
|
|
8
|
-
redirectUri:
|
|
9
|
-
scopes: l = ["
|
|
7
|
+
clientId: i,
|
|
8
|
+
redirectUri: r,
|
|
9
|
+
scopes: l = ["openid", "email", "display_name"],
|
|
10
10
|
variant: s = "dark-pill",
|
|
11
11
|
loginUrl: c,
|
|
12
12
|
className: d = "",
|
|
13
|
-
disabled:
|
|
14
|
-
onSuccess$:
|
|
13
|
+
disabled: o = !1,
|
|
14
|
+
onSuccess$: y,
|
|
15
15
|
onError$: u,
|
|
16
16
|
onClick$: g
|
|
17
|
-
} =
|
|
18
|
-
if (!(
|
|
17
|
+
} = t, a = h(!1), m = w(async () => {
|
|
18
|
+
if (!(o || a.value)) {
|
|
19
19
|
a.value = !0;
|
|
20
20
|
try {
|
|
21
21
|
g?.();
|
|
22
|
-
const { url:
|
|
23
|
-
clientId:
|
|
24
|
-
redirectUri:
|
|
22
|
+
const { url: e } = await b({
|
|
23
|
+
clientId: i,
|
|
24
|
+
redirectUri: r,
|
|
25
25
|
scopes: l,
|
|
26
26
|
loginUrl: c
|
|
27
27
|
});
|
|
28
|
-
typeof window < "u" && (window.location.href =
|
|
29
|
-
} catch (
|
|
28
|
+
typeof window < "u" && (window.location.href = e);
|
|
29
|
+
} catch (e) {
|
|
30
30
|
a.value = !1, u?.({
|
|
31
31
|
error: "authorization_failed",
|
|
32
|
-
errorDescription:
|
|
32
|
+
errorDescription: e instanceof Error ? e.message : "Unknown error"
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
}), p = (
|
|
36
|
+
}), p = (e) => `/node_modules/@flowsta/login-button/assets/svg/${`flowsta_signin_web_${e.replace("-", "_")}`}.svg`;
|
|
37
37
|
return /* @__PURE__ */ n(
|
|
38
38
|
"button",
|
|
39
39
|
{
|
|
40
40
|
type: "button",
|
|
41
|
-
onClick$:
|
|
42
|
-
disabled:
|
|
43
|
-
class: `flowsta-login-button ${d ||
|
|
41
|
+
onClick$: m,
|
|
42
|
+
disabled: o || a.value,
|
|
43
|
+
class: `flowsta-login-button ${d || t.class || ""}`,
|
|
44
44
|
"aria-label": "Sign in with Flowsta",
|
|
45
45
|
style: {
|
|
46
46
|
border: "none",
|
|
47
47
|
background: "transparent",
|
|
48
48
|
padding: "0",
|
|
49
|
-
cursor:
|
|
50
|
-
opacity:
|
|
49
|
+
cursor: o || a.value ? "not-allowed" : "pointer",
|
|
50
|
+
opacity: o || a.value ? "0.6" : "1",
|
|
51
51
|
transition: "opacity 0.2s ease"
|
|
52
52
|
},
|
|
53
53
|
children: /* @__PURE__ */ n(
|
package/dist/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type ButtonVariant = 'dark-pill' | 'dark-rectangle' | 'light-pill' | 'lig
|
|
|
15
15
|
* - public_key: Holochain agent public key
|
|
16
16
|
* - profile_picture: User's profile picture
|
|
17
17
|
*/
|
|
18
|
-
export type FlowstaScope = 'openid' | 'email' | 'display_name' | 'username' | 'did' | 'public_key' | 'profile_picture';
|
|
18
|
+
export type FlowstaScope = 'openid' | 'email' | 'display_name' | 'username' | 'did' | 'public_key' | 'profile_picture' | 'holochain';
|
|
19
19
|
/**
|
|
20
20
|
* Configuration for the Flowsta login button
|
|
21
21
|
*/
|
|
@@ -24,7 +24,7 @@ export interface FlowstaLoginConfig {
|
|
|
24
24
|
clientId: string;
|
|
25
25
|
/** The URI to redirect back to after authentication (required) */
|
|
26
26
|
redirectUri: string;
|
|
27
|
-
/** OAuth scopes to request (default: ['
|
|
27
|
+
/** OAuth scopes to request (default: ['openid', 'email', 'display_name']) */
|
|
28
28
|
scopes?: FlowstaScope[];
|
|
29
29
|
/** Button visual variant (default: 'dark-pill') */
|
|
30
30
|
variant?: ButtonVariant;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,gBAAgB,GAChB,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,mBAAmB,CAAC;AAExB;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,OAAO,GACP,cAAc,GACd,UAAU,GACV,KAAK,GACL,YAAY,GACZ,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,gBAAgB,GAChB,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,mBAAmB,CAAC;AAExB;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,OAAO,GACP,cAAc,GACd,UAAU,GACV,KAAK,GACL,YAAY,GACZ,iBAAiB,GACjB,WAAW,CA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mB,KAAK,IAAI,CAAC;IAE7C,+BAA+B;IAC/B,KAAK,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAE1C,uDAAuD;IACvD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,kBAAkB;IACrE,8CAA8C;IAC9C,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAEjD,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAE9C,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAEtB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/utils/oauth.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface OAuthConfig {
|
|
|
6
6
|
clientId: string;
|
|
7
7
|
/** The URI to redirect back to after authentication */
|
|
8
8
|
redirectUri: string;
|
|
9
|
-
/** OAuth scopes to request (e.g., ['
|
|
9
|
+
/** OAuth scopes to request (e.g., ['openid', 'email', 'display_name']) */
|
|
10
10
|
scopes: string[];
|
|
11
11
|
/** The Flowsta login URL (default: https://login.flowsta.com) */
|
|
12
12
|
loginUrl?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/utils/oauth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/utils/oauth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,sBAAsB,CAAC,CA+BjC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAUA;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAEA"}
|
package/dist/vanilla.js
CHANGED
|
@@ -4,12 +4,12 @@ function c(e) {
|
|
|
4
4
|
const {
|
|
5
5
|
clientId: s,
|
|
6
6
|
redirectUri: n,
|
|
7
|
-
scopes: r = ["
|
|
7
|
+
scopes: r = ["openid", "email", "display_name"],
|
|
8
8
|
variant: d = "dark-pill",
|
|
9
9
|
loginUrl: u,
|
|
10
10
|
className: g = "",
|
|
11
11
|
disabled: o = !1,
|
|
12
|
-
onSuccess:
|
|
12
|
+
onSuccess: h,
|
|
13
13
|
onError: p,
|
|
14
14
|
onClick: f
|
|
15
15
|
} = e, t = document.createElement("button");
|
|
@@ -49,7 +49,7 @@ function c(e) {
|
|
|
49
49
|
}
|
|
50
50
|
}), t;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function m(e, s) {
|
|
53
53
|
const n = typeof e == "string" ? document.querySelector(e) : e;
|
|
54
54
|
if (!n)
|
|
55
55
|
throw new Error(`Container not found: ${e}`);
|
|
@@ -58,7 +58,7 @@ function h(e, s) {
|
|
|
58
58
|
}
|
|
59
59
|
const C = {
|
|
60
60
|
createFlowstaLoginButton: c,
|
|
61
|
-
initFlowstaLoginButton:
|
|
61
|
+
initFlowstaLoginButton: m
|
|
62
62
|
};
|
|
63
63
|
export {
|
|
64
64
|
w as buildAuthorizationUrl,
|
|
@@ -69,7 +69,7 @@ export {
|
|
|
69
69
|
_ as generatePKCEPair,
|
|
70
70
|
F as generateState,
|
|
71
71
|
L as handleCallback,
|
|
72
|
-
|
|
72
|
+
m as initFlowstaLoginButton,
|
|
73
73
|
U as parseCallbackUrl,
|
|
74
74
|
V as retrieveCodeVerifier,
|
|
75
75
|
$ as retrieveState,
|
package/dist/vue.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as u, ref as m, computed as s, openBlock as p, createElementBlock as g, normalizeStyle as f, normalizeClass as b, renderSlot as h, createElementVNode as
|
|
2
|
-
import { b as
|
|
1
|
+
import { defineComponent as u, ref as m, computed as s, openBlock as p, createElementBlock as g, normalizeStyle as f, normalizeClass as b, renderSlot as h, createElementVNode as _ } from "vue";
|
|
2
|
+
import { b as w } from "./oauth-DieOmaFh.js";
|
|
3
3
|
import { h as z, p as I } from "./oauth-DieOmaFh.js";
|
|
4
|
-
const v = ["disabled"],
|
|
4
|
+
const v = ["disabled"], y = ["src"], k = /* @__PURE__ */ u({
|
|
5
5
|
__name: "FlowstaLoginButtonVue",
|
|
6
6
|
props: {
|
|
7
7
|
customContent: {},
|
|
8
8
|
clientId: {},
|
|
9
9
|
redirectUri: {},
|
|
10
|
-
scopes: { default: () => ["
|
|
10
|
+
scopes: { default: () => ["openid", "email", "display_name"] },
|
|
11
11
|
variant: { default: "dark-pill" },
|
|
12
12
|
loginUrl: {},
|
|
13
13
|
className: { default: "" },
|
|
14
14
|
disabled: { type: Boolean, default: !1 }
|
|
15
15
|
},
|
|
16
16
|
emits: ["success", "error", "click"],
|
|
17
|
-
setup(
|
|
18
|
-
const e =
|
|
17
|
+
setup(o, { emit: n }) {
|
|
18
|
+
const e = o, l = n, t = m(!1), r = s(() => `/node_modules/@flowsta/login-button/assets/svg/${`flowsta_signin_web_${e.variant.replace("-", "_")}`}.svg`), i = s(() => ({
|
|
19
19
|
border: "none",
|
|
20
20
|
background: "transparent",
|
|
21
21
|
padding: 0,
|
|
@@ -31,49 +31,49 @@ const v = ["disabled"], k = ["src"], y = /* @__PURE__ */ u({
|
|
|
31
31
|
t.value = !0;
|
|
32
32
|
try {
|
|
33
33
|
l("click");
|
|
34
|
-
const { url:
|
|
34
|
+
const { url: a } = await w({
|
|
35
35
|
clientId: e.clientId,
|
|
36
36
|
redirectUri: e.redirectUri,
|
|
37
37
|
scopes: e.scopes,
|
|
38
38
|
loginUrl: e.loginUrl
|
|
39
39
|
});
|
|
40
|
-
window.location.href =
|
|
41
|
-
} catch (
|
|
40
|
+
window.location.href = a;
|
|
41
|
+
} catch (a) {
|
|
42
42
|
t.value = !1, l("error", {
|
|
43
43
|
error: "authorization_failed",
|
|
44
|
-
errorDescription:
|
|
44
|
+
errorDescription: a instanceof Error ? a.message : "Unknown error"
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
return (
|
|
49
|
+
return (a, C) => (p(), g("button", {
|
|
50
50
|
type: "button",
|
|
51
|
-
class: b(["flowsta-login-button",
|
|
52
|
-
disabled:
|
|
51
|
+
class: b(["flowsta-login-button", o.className]),
|
|
52
|
+
disabled: o.disabled || t.value,
|
|
53
53
|
"aria-label": "Sign in with Flowsta",
|
|
54
54
|
style: f(i.value),
|
|
55
55
|
onClick: d
|
|
56
56
|
}, [
|
|
57
|
-
h(
|
|
58
|
-
|
|
57
|
+
h(a.$slots, "default", {}, () => [
|
|
58
|
+
_("img", {
|
|
59
59
|
src: r.value,
|
|
60
60
|
alt: "Sign in with Flowsta",
|
|
61
61
|
width: "175",
|
|
62
62
|
height: "40",
|
|
63
63
|
style: c
|
|
64
|
-
}, null, 8,
|
|
64
|
+
}, null, 8, y)
|
|
65
65
|
], !0)
|
|
66
66
|
], 14, v));
|
|
67
67
|
}
|
|
68
|
-
}), U = (
|
|
69
|
-
const e =
|
|
68
|
+
}), U = (o, n) => {
|
|
69
|
+
const e = o.__vccOpts || o;
|
|
70
70
|
for (const [l, t] of n)
|
|
71
71
|
e[l] = t;
|
|
72
72
|
return e;
|
|
73
|
-
}, F = /* @__PURE__ */ U(
|
|
73
|
+
}, F = /* @__PURE__ */ U(k, [["__scopeId", "data-v-a5deb683"]]);
|
|
74
74
|
export {
|
|
75
75
|
F as FlowstaLoginButton,
|
|
76
|
-
|
|
76
|
+
w as buildAuthorizationUrl,
|
|
77
77
|
z as handleCallback,
|
|
78
78
|
I as parseCallbackUrl
|
|
79
79
|
};
|