@flowsta/login-button 0.1.0 → 0.1.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/qwik.js CHANGED
@@ -1,59 +1,59 @@
1
- import { jsx as r } from "@builder.io/qwik/jsx-runtime";
1
+ import { jsx as n } from "@builder.io/qwik/jsx-runtime";
2
2
  import { component$ as m, useSignal as h, $ as w } from "@builder.io/qwik";
3
3
  import { b } from "./oauth-DEOZXwxb.js";
4
- import { h as C, p as F } from "./oauth-DEOZXwxb.js";
5
- const $ = m((n) => {
4
+ import { h as S, p as F } from "./oauth-DEOZXwxb.js";
5
+ const C = m((e) => {
6
6
  const {
7
- clientId: s,
8
- redirectUri: l,
9
- scopes: c = ["profile"],
10
- variant: d = "dark-pill",
11
- loginUrl: u,
12
- className: g = "",
13
- disabled: e = !1,
14
- onSuccess$: v,
15
- onError$: o,
16
- onClick$: i
17
- } = n, a = h(!1), f = w(async () => {
18
- if (!(e || a.value)) {
7
+ clientId: r,
8
+ redirectUri: i,
9
+ scopes: l = ["profile"],
10
+ variant: s = "dark-pill",
11
+ loginUrl: c,
12
+ className: d = "",
13
+ disabled: t = !1,
14
+ onSuccess$: k,
15
+ onError$: u,
16
+ onClick$: g
17
+ } = e, a = h(!1), f = w(async () => {
18
+ if (!(t || a.value)) {
19
19
  a.value = !0;
20
20
  try {
21
- i == null || i();
22
- const { url: t } = await b({
23
- clientId: s,
24
- redirectUri: l,
25
- scopes: c,
26
- loginUrl: u
21
+ g?.();
22
+ const { url: o } = await b({
23
+ clientId: r,
24
+ redirectUri: i,
25
+ scopes: l,
26
+ loginUrl: c
27
27
  });
28
- typeof window < "u" && (window.location.href = t);
29
- } catch (t) {
30
- a.value = !1, o == null || o({
28
+ typeof window < "u" && (window.location.href = o);
29
+ } catch (o) {
30
+ a.value = !1, u?.({
31
31
  error: "authorization_failed",
32
- errorDescription: t instanceof Error ? t.message : "Unknown error"
32
+ errorDescription: o instanceof Error ? o.message : "Unknown error"
33
33
  });
34
34
  }
35
35
  }
36
- }), p = (t) => `/node_modules/@flowsta/login-button/assets/svg/${`flowsta_signin_web_${t.replace("-", "_")}`}.svg`;
37
- return /* @__PURE__ */ r(
36
+ }), p = (o) => `/node_modules/@flowsta/login-button/assets/svg/${`flowsta_signin_web_${o.replace("-", "_")}`}.svg`;
37
+ return /* @__PURE__ */ n(
38
38
  "button",
39
39
  {
40
40
  type: "button",
41
41
  onClick$: f,
42
- disabled: e || a.value,
43
- class: `flowsta-login-button ${g || n.class || ""}`,
42
+ disabled: t || a.value,
43
+ class: `flowsta-login-button ${d || e.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: e || a.value ? "not-allowed" : "pointer",
50
- opacity: e || a.value ? "0.6" : "1",
49
+ cursor: t || a.value ? "not-allowed" : "pointer",
50
+ opacity: t || a.value ? "0.6" : "1",
51
51
  transition: "opacity 0.2s ease"
52
52
  },
53
- children: /* @__PURE__ */ r(
53
+ children: /* @__PURE__ */ n(
54
54
  "img",
55
55
  {
56
- src: p(d),
56
+ src: p(s),
57
57
  alt: "Sign in with Flowsta",
58
58
  width: 175,
59
59
  height: 40,
@@ -68,9 +68,9 @@ const $ = m((n) => {
68
68
  );
69
69
  });
70
70
  export {
71
- $ as FlowstaLoginButton,
71
+ C as FlowstaLoginButton,
72
72
  b as buildAuthorizationUrl,
73
- $ as default,
74
- C as handleCallback,
73
+ C as default,
74
+ S as handleCallback,
75
75
  F as parseCallbackUrl
76
76
  };
package/dist/react.js CHANGED
@@ -1,42 +1,42 @@
1
- import { jsx as p } from "react/jsx-runtime";
1
+ import { jsx as u } from "react/jsx-runtime";
2
2
  import { useState as b, useCallback as y } from "react";
3
3
  import { b as k } from "./oauth-DEOZXwxb.js";
4
- import { h as A, p as D } from "./oauth-DEOZXwxb.js";
4
+ import { h as j, p as A } from "./oauth-DEOZXwxb.js";
5
5
  import { getButtonUrl as x } from "./index.js";
6
- function B({
7
- clientId: s,
8
- redirectUri: i,
9
- scopes: r = ["openid", "email", "display_name"],
10
- variant: c = "dark-pill",
11
- loginUrl: l,
6
+ function z({
7
+ clientId: r,
8
+ redirectUri: n,
9
+ scopes: e = ["openid", "email", "display_name"],
10
+ variant: p = "dark-pill",
11
+ loginUrl: i,
12
12
  className: h = "",
13
13
  disabled: t = !1,
14
- onSuccess: S,
15
- onError: o,
16
- onClick: e,
14
+ onSuccess: C,
15
+ onError: s,
16
+ onClick: l,
17
17
  children: m
18
18
  }) {
19
- const [a, u] = b(!1), f = y(async () => {
19
+ const [a, c] = b(!1), f = y(async () => {
20
20
  if (!(t || a)) {
21
- u(!0);
21
+ c(!0);
22
22
  try {
23
- e == null || e();
24
- const { url: n } = await k({
25
- clientId: s,
26
- redirectUri: i,
27
- scopes: r,
28
- loginUrl: l
23
+ l?.();
24
+ const { url: o } = await k({
25
+ clientId: r,
26
+ redirectUri: n,
27
+ scopes: e,
28
+ loginUrl: i
29
29
  });
30
- window.location.href = n;
31
- } catch (n) {
32
- u(!1), o == null || o({
30
+ window.location.href = o;
31
+ } catch (o) {
32
+ c(!1), s?.({
33
33
  error: "authorization_failed",
34
- errorDescription: n instanceof Error ? n.message : "Unknown error"
34
+ errorDescription: o instanceof Error ? o.message : "Unknown error"
35
35
  });
36
36
  }
37
37
  }
38
- }, [s, i, r, l, t, a, e, o]), [g, d] = c.split("-"), w = x(g, d);
39
- return /* @__PURE__ */ p(
38
+ }, [r, n, e, i, t, a, l, s]), [g, d] = p.split("-"), w = x(g, d);
39
+ return /* @__PURE__ */ u(
40
40
  "button",
41
41
  {
42
42
  type: "button",
@@ -52,7 +52,7 @@ function B({
52
52
  opacity: t || a ? 0.6 : 1,
53
53
  transition: "opacity 0.2s ease"
54
54
  },
55
- children: m || /* @__PURE__ */ p(
55
+ children: m || /* @__PURE__ */ u(
56
56
  "img",
57
57
  {
58
58
  src: w,
@@ -70,9 +70,9 @@ function B({
70
70
  );
71
71
  }
72
72
  export {
73
- B as FlowstaLoginButton,
73
+ z as FlowstaLoginButton,
74
74
  k as buildAuthorizationUrl,
75
- B as default,
76
- A as handleCallback,
77
- D as parseCallbackUrl
75
+ z as default,
76
+ j as handleCallback,
77
+ A as parseCallbackUrl
78
78
  };
package/dist/vanilla.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import { b as w } from "./oauth-DEOZXwxb.js";
2
- import { a as k, g as _, c as E, d as F, h as L, p as U, r as V, f as $, s as x, e as B, v as N } from "./oauth-DEOZXwxb.js";
3
- function u(e) {
2
+ import { a as S, g as E, c as _, d as F, h as L, p as U, r as V, f as $, s as x, e as B, v as N } from "./oauth-DEOZXwxb.js";
3
+ function c(e) {
4
4
  const {
5
5
  clientId: s,
6
6
  redirectUri: n,
7
7
  scopes: r = ["profile"],
8
- variant: g = "dark-pill",
9
- loginUrl: p,
10
- className: f = "",
8
+ variant: d = "dark-pill",
9
+ loginUrl: u,
10
+ className: g = "",
11
11
  disabled: o = !1,
12
12
  onSuccess: m,
13
- onError: l,
14
- onClick: c
13
+ onError: p,
14
+ onClick: f
15
15
  } = e, t = document.createElement("button");
16
- t.type = "button", t.className = `flowsta-login-button ${f}`.trim(), t.setAttribute("aria-label", "Sign in with Flowsta"), t.disabled = o, Object.assign(t.style, {
16
+ t.type = "button", t.className = `flowsta-login-button ${g}`.trim(), t.setAttribute("aria-label", "Sign in with Flowsta"), t.disabled = o, Object.assign(t.style, {
17
17
  border: "none",
18
18
  background: "transparent",
19
19
  padding: "0",
@@ -21,27 +21,27 @@ function u(e) {
21
21
  opacity: o ? "0.6" : "1",
22
22
  transition: "opacity 0.2s ease"
23
23
  });
24
- const a = document.createElement("img"), b = `flowsta_signin_web_${g.replace("-", "_")}`;
24
+ const a = document.createElement("img"), b = `flowsta_signin_web_${d.replace("-", "_")}`;
25
25
  a.src = `/node_modules/@flowsta/login-button/assets/svg/${b}.svg`, a.alt = "Sign in with Flowsta", a.width = 175, a.height = 40, Object.assign(a.style, {
26
26
  display: "block",
27
27
  maxWidth: "100%",
28
28
  height: "auto"
29
29
  }), t.appendChild(a);
30
- let d = !1;
30
+ let l = !1;
31
31
  return t.addEventListener("click", async () => {
32
- if (!(t.disabled || d)) {
33
- d = !0, t.style.opacity = "0.6", t.style.cursor = "not-allowed";
32
+ if (!(t.disabled || l)) {
33
+ l = !0, t.style.opacity = "0.6", t.style.cursor = "not-allowed";
34
34
  try {
35
- c == null || c();
35
+ f?.();
36
36
  const { url: i } = await w({
37
37
  clientId: s,
38
38
  redirectUri: n,
39
39
  scopes: r,
40
- loginUrl: p
40
+ loginUrl: u
41
41
  });
42
42
  window.location.href = i;
43
43
  } catch (i) {
44
- d = !1, t.style.opacity = o ? "0.6" : "1", t.style.cursor = o ? "not-allowed" : "pointer", l == null || l({
44
+ l = !1, t.style.opacity = o ? "0.6" : "1", t.style.cursor = o ? "not-allowed" : "pointer", p?.({
45
45
  error: "authorization_failed",
46
46
  errorDescription: i instanceof Error ? i.message : "Unknown error"
47
47
  });
@@ -53,20 +53,20 @@ function h(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}`);
56
- const r = u(s);
56
+ const r = c(s);
57
57
  return n.appendChild(r), r;
58
58
  }
59
59
  const C = {
60
- createFlowstaLoginButton: u,
60
+ createFlowstaLoginButton: c,
61
61
  initFlowstaLoginButton: h
62
62
  };
63
63
  export {
64
64
  w as buildAuthorizationUrl,
65
- u as createFlowstaLoginButton,
65
+ c as createFlowstaLoginButton,
66
66
  C as default,
67
- k as generateCodeChallenge,
68
- _ as generateCodeVerifier,
69
- E as generatePKCEPair,
67
+ S as generateCodeChallenge,
68
+ E as generateCodeVerifier,
69
+ _ as generatePKCEPair,
70
70
  F as generateState,
71
71
  L as handleCallback,
72
72
  h as initFlowstaLoginButton,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowsta/login-button",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Login with Flowsta button components for React, Vue, Qwik, and vanilla JavaScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -58,9 +58,9 @@
58
58
  "directory": "packages/login-button"
59
59
  },
60
60
  "peerDependencies": {
61
+ "@builder.io/qwik": "^1.0.0",
61
62
  "react": "^18.0.0 || ^19.0.0",
62
- "vue": "^3.0.0",
63
- "@builder.io/qwik": "^1.0.0"
63
+ "vue": "^3.0.0"
64
64
  },
65
65
  "peerDependenciesMeta": {
66
66
  "react": {
@@ -79,10 +79,13 @@
79
79
  "@vitejs/plugin-vue": "^6.0.1",
80
80
  "react": "^18.3.1",
81
81
  "typescript": "^5.5.4",
82
- "vite": "^5.4.2",
82
+ "vite": "^7.3.1",
83
83
  "vue": "^3.4.0"
84
84
  },
85
85
  "engines": {
86
86
  "node": ">=18.0.0"
87
+ },
88
+ "dependencies": {
89
+ "happy-dom": "20.5.0"
87
90
  }
88
91
  }
File without changes