@flowsta/login-button 0.1.0 → 0.1.2
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 +26 -0
- package/dist/FlowstaLoginButton.d.ts.map +1 -0
- package/dist/FlowstaLoginButtonQwik.d.ts +43 -0
- package/dist/FlowstaLoginButtonQwik.d.ts.map +1 -0
- package/dist/FlowstaLoginButtonVanilla.d.ts +58 -0
- package/dist/FlowstaLoginButtonVanilla.d.ts.map +1 -0
- package/dist/buttonAssets.d.ts +43 -0
- package/dist/buttonAssets.d.ts.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{oauth-DEOZXwxb.js → oauth-DieOmaFh.js} +4 -4
- package/dist/qwik.d.ts +12 -0
- package/dist/qwik.d.ts.map +1 -0
- package/dist/qwik.js +37 -37
- package/dist/react.d.ts +12 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +31 -31
- package/dist/types.d.ts +100 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/oauth.d.ts +50 -0
- package/dist/utils/oauth.d.ts.map +1 -0
- package/dist/utils/pkce.d.ts +36 -0
- package/dist/utils/pkce.d.ts.map +1 -0
- package/dist/utils/state.d.ts +25 -0
- package/dist/utils/state.d.ts.map +1 -0
- package/dist/vanilla.d.ts +14 -0
- package/dist/vanilla.d.ts.map +1 -0
- package/dist/vanilla.js +22 -22
- package/dist/vue.d.ts +12 -0
- package/dist/vue.d.ts.map +1 -0
- package/dist/vue.js +4 -4
- package/package.json +6 -5
- /package/dist/{style.css → login-button.css} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowsta Login Button - React Component
|
|
3
|
+
*/
|
|
4
|
+
import type { FlowstaLoginButtonProps } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Flowsta Login Button component for React
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <FlowstaLoginButton
|
|
11
|
+
* clientId="your-client-id"
|
|
12
|
+
* redirectUri="https://yourapp.com/callback"
|
|
13
|
+
* scopes={['profile', 'email']}
|
|
14
|
+
* variant="dark-pill"
|
|
15
|
+
* onSuccess={(data) => {
|
|
16
|
+
* console.log('Authorization code:', data.code);
|
|
17
|
+
* }}
|
|
18
|
+
* onError={(error) => {
|
|
19
|
+
* console.error('Login error:', error);
|
|
20
|
+
* }}
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function FlowstaLoginButton({ clientId, redirectUri, scopes, variant, loginUrl, className, disabled, onSuccess, onError, onClick, children, }: FlowstaLoginButtonProps): JSX.Element;
|
|
25
|
+
export default FlowstaLoginButton;
|
|
26
|
+
//# sourceMappingURL=FlowstaLoginButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowstaLoginButton.d.ts","sourceRoot":"","sources":["../src/FlowstaLoginButton.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAI1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,WAAW,EACX,MAA4C,EAC5C,OAAqB,EACrB,QAAQ,EACR,SAAc,EACd,QAAgB,EAChB,SAAS,EACT,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAkEvC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowsta Login Button - Qwik Component
|
|
3
|
+
* @jsxImportSource @builder.io/qwik
|
|
4
|
+
*/
|
|
5
|
+
import type { FlowstaLoginConfig, FlowstaLoginSuccess, FlowstaLoginError } from './types.js';
|
|
6
|
+
export interface FlowstaLoginButtonQwikProps extends FlowstaLoginConfig {
|
|
7
|
+
/** Callback when login succeeds */
|
|
8
|
+
onSuccess$?: (data: FlowstaLoginSuccess) => void;
|
|
9
|
+
/** Callback when login fails */
|
|
10
|
+
onError$?: (error: FlowstaLoginError) => void;
|
|
11
|
+
/** Callback when button is clicked (before redirect) */
|
|
12
|
+
onClick$?: () => void;
|
|
13
|
+
/** Custom CSS class name */
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Flowsta Login Button component for Qwik
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import { FlowstaLoginButton } from '@flowsta/login-button/qwik';
|
|
22
|
+
*
|
|
23
|
+
* export default component$(() => {
|
|
24
|
+
* return (
|
|
25
|
+
* <FlowstaLoginButton
|
|
26
|
+
* clientId="your-client-id"
|
|
27
|
+
* redirectUri="https://yourapp.com/callback"
|
|
28
|
+
* scopes={['profile', 'email']}
|
|
29
|
+
* variant="dark-pill"
|
|
30
|
+
* onSuccess$={(data) => {
|
|
31
|
+
* console.log('Authorization code:', data.code);
|
|
32
|
+
* }}
|
|
33
|
+
* onError$={(error) => {
|
|
34
|
+
* console.error('Login error:', error);
|
|
35
|
+
* }}
|
|
36
|
+
* />
|
|
37
|
+
* );
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const FlowstaLoginButton: import("@builder.io/qwik").Component<FlowstaLoginButtonQwikProps>;
|
|
42
|
+
export default FlowstaLoginButton;
|
|
43
|
+
//# sourceMappingURL=FlowstaLoginButtonQwik.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowstaLoginButtonQwik.d.ts","sourceRoot":"","sources":["../src/FlowstaLoginButtonQwik.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG7F,MAAM,WAAW,2BAA4B,SAAQ,kBAAkB;IACrE,mCAAmC;IACnC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAEjD,gCAAgC;IAChC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAE9C,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAEtB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,kBAAkB,mEAkF7B,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowsta Login Button - Vanilla JavaScript
|
|
3
|
+
*/
|
|
4
|
+
import type { FlowstaLoginConfig, FlowstaLoginSuccess, FlowstaLoginError } from './types.js';
|
|
5
|
+
export interface FlowstaLoginButtonVanillaOptions extends FlowstaLoginConfig {
|
|
6
|
+
/** Callback when login succeeds */
|
|
7
|
+
onSuccess?: (data: FlowstaLoginSuccess) => void;
|
|
8
|
+
/** Callback when login fails */
|
|
9
|
+
onError?: (error: FlowstaLoginError) => void;
|
|
10
|
+
/** Callback when button is clicked (before redirect) */
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a Flowsta login button element
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```javascript
|
|
18
|
+
* import { createFlowstaLoginButton } from '@flowsta/login-button/vanilla';
|
|
19
|
+
*
|
|
20
|
+
* const button = createFlowstaLoginButton({
|
|
21
|
+
* clientId: 'your-client-id',
|
|
22
|
+
* redirectUri: 'https://yourapp.com/callback',
|
|
23
|
+
* scopes: ['profile', 'email'],
|
|
24
|
+
* variant: 'dark-pill',
|
|
25
|
+
* onSuccess: (data) => {
|
|
26
|
+
* console.log('Authorization code:', data.code);
|
|
27
|
+
* },
|
|
28
|
+
* onError: (error) => {
|
|
29
|
+
* console.error('Login error:', error);
|
|
30
|
+
* }
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* document.getElementById('login-container').appendChild(button);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function createFlowstaLoginButton(options: FlowstaLoginButtonVanillaOptions): HTMLButtonElement;
|
|
37
|
+
/**
|
|
38
|
+
* Initialize Flowsta login button in a container element
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```javascript
|
|
42
|
+
* import { initFlowstaLoginButton } from '@flowsta/login-button/vanilla';
|
|
43
|
+
*
|
|
44
|
+
* initFlowstaLoginButton('#login-button-container', {
|
|
45
|
+
* clientId: 'your-client-id',
|
|
46
|
+
* redirectUri: 'https://yourapp.com/callback',
|
|
47
|
+
* scopes: ['profile', 'email'],
|
|
48
|
+
* variant: 'dark-pill'
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function initFlowstaLoginButton(selector: string | HTMLElement, options: FlowstaLoginButtonVanillaOptions): HTMLButtonElement;
|
|
53
|
+
declare const _default: {
|
|
54
|
+
createFlowstaLoginButton: typeof createFlowstaLoginButton;
|
|
55
|
+
initFlowstaLoginButton: typeof initFlowstaLoginButton;
|
|
56
|
+
};
|
|
57
|
+
export default _default;
|
|
58
|
+
//# sourceMappingURL=FlowstaLoginButtonVanilla.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowstaLoginButtonVanilla.d.ts","sourceRoot":"","sources":["../src/FlowstaLoginButtonVanilla.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG7F,MAAM,WAAW,gCAAiC,SAAQ,kBAAkB;IAC1E,mCAAmC;IACnC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAEhD,gCAAgC;IAChC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAE7C,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,gCAAgC,GACxC,iBAAiB,CAoFnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAC9B,OAAO,EAAE,gCAAgC,GACxC,iBAAiB,CAanB;;;;;AAED,wBAGE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowsta Login Button Assets
|
|
3
|
+
*
|
|
4
|
+
* Industry-standard approach: Ship assets with npm package
|
|
5
|
+
* - Works automatically with all modern bundlers (Vite, Webpack, Parcel, etc.)
|
|
6
|
+
* - Zero configuration required
|
|
7
|
+
* - Falls back to CDN if needed
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { getButtonUrl } from '@flowsta/login-button';
|
|
12
|
+
*
|
|
13
|
+
* <img src={getButtonUrl('dark', 'pill')} alt="Sign in with Flowsta" />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export type ButtonTheme = 'dark' | 'light' | 'neutral';
|
|
17
|
+
export type ButtonShape = 'pill' | 'rectangle';
|
|
18
|
+
/**
|
|
19
|
+
* Get button asset URL
|
|
20
|
+
*
|
|
21
|
+
* @param theme - 'dark' (for light backgrounds), 'light' (for dark backgrounds), or 'neutral' (for any background)
|
|
22
|
+
* @param shape - 'pill' (rounded) or 'rectangle' (square corners)
|
|
23
|
+
* @returns URL to button SVG
|
|
24
|
+
*/
|
|
25
|
+
export declare function getButtonUrl(theme: ButtonTheme, shape: ButtonShape): string;
|
|
26
|
+
/**
|
|
27
|
+
* Pre-made button URLs for all combinations
|
|
28
|
+
*/
|
|
29
|
+
export declare const BUTTON_URLS: {
|
|
30
|
+
readonly dark: {
|
|
31
|
+
readonly pill: string;
|
|
32
|
+
readonly rectangle: string;
|
|
33
|
+
};
|
|
34
|
+
readonly light: {
|
|
35
|
+
readonly pill: string;
|
|
36
|
+
readonly rectangle: string;
|
|
37
|
+
};
|
|
38
|
+
readonly neutral: {
|
|
39
|
+
readonly pill: string;
|
|
40
|
+
readonly rectangle: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=buttonAssets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buttonAssets.d.ts","sourceRoot":"","sources":["../src/buttonAssets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AACvD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,CAAC;AAE/C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAW3E;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAad,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flowsta/login-button
|
|
3
|
+
*
|
|
4
|
+
* Login with Flowsta button components for React, Vue, and vanilla JavaScript
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export * from './utils/pkce.js';
|
|
9
|
+
export * from './utils/state.js';
|
|
10
|
+
export * from './utils/oauth.js';
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
export * from './buttonAssets.js';
|
|
13
|
+
export { buildAuthorizationUrl, handleCallback, parseCallbackUrl } from './utils/oauth.js';
|
|
14
|
+
export { generatePKCEPair, generateCodeVerifier, generateCodeChallenge } from './utils/pkce.js';
|
|
15
|
+
export { generateState, validateState } from './utils/state.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,YAAY,CAAC;AAG3B,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as i,
|
|
1
|
+
import { b as i, g, a as o, c, d as p, h as u, p as d, r as f, e as h, s as C, f as b, v } from "./oauth-DieOmaFh.js";
|
|
2
2
|
function e(a, r) {
|
|
3
3
|
const t = `flowsta_signin_web_${a}_${r}.svg`;
|
|
4
4
|
try {
|
package/dist/qwik.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flowsta/login-button/qwik
|
|
3
|
+
*
|
|
4
|
+
* Qwik components for Flowsta login
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { FlowstaLoginButton, default } from './FlowstaLoginButtonQwik.js';
|
|
9
|
+
export type { FlowstaLoginButtonQwikProps } from './FlowstaLoginButtonQwik.js';
|
|
10
|
+
export * from './utils/oauth.js';
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
//# sourceMappingURL=qwik.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qwik.d.ts","sourceRoot":"","sources":["../src/qwik.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC1E,YAAY,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAG/E,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
package/dist/qwik.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { jsx as
|
|
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
|
-
import { b } from "./oauth-
|
|
4
|
-
import { h as
|
|
5
|
-
const
|
|
3
|
+
import { b } from "./oauth-DieOmaFh.js";
|
|
4
|
+
import { h as S, p as F } from "./oauth-DieOmaFh.js";
|
|
5
|
+
const C = m((e) => {
|
|
6
6
|
const {
|
|
7
|
-
clientId:
|
|
8
|
-
redirectUri:
|
|
9
|
-
scopes:
|
|
10
|
-
variant:
|
|
11
|
-
loginUrl:
|
|
12
|
-
className:
|
|
13
|
-
disabled:
|
|
14
|
-
onSuccess$:
|
|
15
|
-
onError$:
|
|
16
|
-
onClick$:
|
|
17
|
-
} =
|
|
18
|
-
if (!(
|
|
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
|
-
|
|
22
|
-
const { url:
|
|
23
|
-
clientId:
|
|
24
|
-
redirectUri:
|
|
25
|
-
scopes:
|
|
26
|
-
loginUrl:
|
|
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 =
|
|
29
|
-
} catch (
|
|
30
|
-
a.value = !1,
|
|
28
|
+
typeof window < "u" && (window.location.href = o);
|
|
29
|
+
} catch (o) {
|
|
30
|
+
a.value = !1, u?.({
|
|
31
31
|
error: "authorization_failed",
|
|
32
|
-
errorDescription:
|
|
32
|
+
errorDescription: o instanceof Error ? o.message : "Unknown error"
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
}), p = (
|
|
37
|
-
return /* @__PURE__ */
|
|
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:
|
|
43
|
-
class: `flowsta-login-button ${
|
|
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:
|
|
50
|
-
opacity:
|
|
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__ */
|
|
53
|
+
children: /* @__PURE__ */ n(
|
|
54
54
|
"img",
|
|
55
55
|
{
|
|
56
|
-
src: p(
|
|
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
|
-
|
|
71
|
+
C as FlowstaLoginButton,
|
|
72
72
|
b as buildAuthorizationUrl,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
C as default,
|
|
74
|
+
S as handleCallback,
|
|
75
75
|
F as parseCallbackUrl
|
|
76
76
|
};
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flowsta/login-button/react
|
|
3
|
+
*
|
|
4
|
+
* React components for Flowsta login
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { FlowstaLoginButton, default } from './FlowstaLoginButton.js';
|
|
9
|
+
export type { FlowstaLoginButtonProps } from './types.js';
|
|
10
|
+
export * from './utils/oauth.js';
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACtE,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAG1D,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
package/dist/react.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import { useState as b, useCallback as y } from "react";
|
|
3
|
-
import { b as k } from "./oauth-
|
|
4
|
-
import { h as
|
|
3
|
+
import { b as k } from "./oauth-DieOmaFh.js";
|
|
4
|
+
import { h as j, p as A } from "./oauth-DieOmaFh.js";
|
|
5
5
|
import { getButtonUrl as x } from "./index.js";
|
|
6
|
-
function
|
|
7
|
-
clientId:
|
|
8
|
-
redirectUri:
|
|
9
|
-
scopes:
|
|
10
|
-
variant:
|
|
11
|
-
loginUrl:
|
|
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:
|
|
15
|
-
onError:
|
|
16
|
-
onClick:
|
|
14
|
+
onSuccess: C,
|
|
15
|
+
onError: s,
|
|
16
|
+
onClick: l,
|
|
17
17
|
children: m
|
|
18
18
|
}) {
|
|
19
|
-
const [a,
|
|
19
|
+
const [a, c] = b(!1), f = y(async () => {
|
|
20
20
|
if (!(t || a)) {
|
|
21
|
-
|
|
21
|
+
c(!0);
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
const { url:
|
|
25
|
-
clientId:
|
|
26
|
-
redirectUri:
|
|
27
|
-
scopes:
|
|
28
|
-
loginUrl:
|
|
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 =
|
|
31
|
-
} catch (
|
|
32
|
-
|
|
30
|
+
window.location.href = o;
|
|
31
|
+
} catch (o) {
|
|
32
|
+
c(!1), s?.({
|
|
33
33
|
error: "authorization_failed",
|
|
34
|
-
errorDescription:
|
|
34
|
+
errorDescription: o instanceof Error ? o.message : "Unknown error"
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
}, [
|
|
39
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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
|
-
|
|
73
|
+
z as FlowstaLoginButton,
|
|
74
74
|
k as buildAuthorizationUrl,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
z as default,
|
|
76
|
+
j as handleCallback,
|
|
77
|
+
A as parseCallbackUrl
|
|
78
78
|
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript types for Flowsta Login Button
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Available button variants
|
|
6
|
+
*/
|
|
7
|
+
export type ButtonVariant = 'dark-pill' | 'dark-rectangle' | 'light-pill' | 'light-rectangle' | 'neutral-pill' | 'neutral-rectangle';
|
|
8
|
+
/**
|
|
9
|
+
* OAuth scopes for Flowsta (granular)
|
|
10
|
+
* - openid: User ID (sub) - auto-included
|
|
11
|
+
* - email: Email address and verification status
|
|
12
|
+
* - display_name: User's display name
|
|
13
|
+
* - username: User's @username
|
|
14
|
+
* - did: W3C Decentralized Identifier
|
|
15
|
+
* - public_key: Holochain agent public key
|
|
16
|
+
* - profile_picture: User's profile picture
|
|
17
|
+
*/
|
|
18
|
+
export type FlowstaScope = 'openid' | 'email' | 'display_name' | 'username' | 'did' | 'public_key' | 'profile_picture';
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for the Flowsta login button
|
|
21
|
+
*/
|
|
22
|
+
export interface FlowstaLoginConfig {
|
|
23
|
+
/** Your Flowsta application client ID (required) */
|
|
24
|
+
clientId: string;
|
|
25
|
+
/** The URI to redirect back to after authentication (required) */
|
|
26
|
+
redirectUri: string;
|
|
27
|
+
/** OAuth scopes to request (default: ['profile']) */
|
|
28
|
+
scopes?: FlowstaScope[];
|
|
29
|
+
/** Button visual variant (default: 'dark-pill') */
|
|
30
|
+
variant?: ButtonVariant;
|
|
31
|
+
/** The Flowsta login URL (default: https://login.flowsta.com) */
|
|
32
|
+
loginUrl?: string;
|
|
33
|
+
/** Custom CSS class name for the button */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Whether the button is disabled */
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Callback data after successful authentication
|
|
40
|
+
*/
|
|
41
|
+
export interface FlowstaLoginSuccess {
|
|
42
|
+
/** Authorization code to exchange for access token */
|
|
43
|
+
code: string;
|
|
44
|
+
/** State parameter for validation */
|
|
45
|
+
state: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Error data after failed authentication
|
|
49
|
+
*/
|
|
50
|
+
export interface FlowstaLoginError {
|
|
51
|
+
/** Error code */
|
|
52
|
+
error: string;
|
|
53
|
+
/** Human-readable error description */
|
|
54
|
+
errorDescription?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Props for React component
|
|
58
|
+
*/
|
|
59
|
+
export interface FlowstaLoginButtonProps extends FlowstaLoginConfig {
|
|
60
|
+
/** Callback when login succeeds */
|
|
61
|
+
onSuccess?: (data: FlowstaLoginSuccess) => void;
|
|
62
|
+
/** Callback when login fails */
|
|
63
|
+
onError?: (error: FlowstaLoginError) => void;
|
|
64
|
+
/** Callback when button is clicked (before redirect) */
|
|
65
|
+
onClick?: () => void;
|
|
66
|
+
/** Custom button content (overrides default image) */
|
|
67
|
+
children?: React.ReactNode;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Props for Vue component
|
|
71
|
+
*/
|
|
72
|
+
export interface VueFlowstaLoginButtonProps extends FlowstaLoginConfig {
|
|
73
|
+
/** Custom button content (overrides default image) */
|
|
74
|
+
customContent?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Events for Vue component
|
|
78
|
+
*/
|
|
79
|
+
export interface VueFlowstaLoginButtonEvents {
|
|
80
|
+
/** Emitted when login succeeds */
|
|
81
|
+
success: (data: FlowstaLoginSuccess) => void;
|
|
82
|
+
/** Emitted when login fails */
|
|
83
|
+
error: (error: FlowstaLoginError) => void;
|
|
84
|
+
/** Emitted when button is clicked (before redirect) */
|
|
85
|
+
click: () => void;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Props for Qwik component
|
|
89
|
+
*/
|
|
90
|
+
export interface FlowstaLoginButtonQwikProps extends FlowstaLoginConfig {
|
|
91
|
+
/** Callback when login succeeds (Qwik QRL) */
|
|
92
|
+
onSuccess$?: (data: FlowstaLoginSuccess) => void;
|
|
93
|
+
/** Callback when login fails (Qwik QRL) */
|
|
94
|
+
onError$?: (error: FlowstaLoginError) => void;
|
|
95
|
+
/** Callback when button is clicked (before redirect, Qwik QRL) */
|
|
96
|
+
onClick$?: () => void;
|
|
97
|
+
/** Custom CSS class name */
|
|
98
|
+
class?: string;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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;AAEtB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IAEjB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IAEpB,qDAAqD;IACrD,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IAExB,mDAAmD;IACnD,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IAEb,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,uCAAuC;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,mCAAmC;IACnC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAEhD,gCAAgC;IAChC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAE7C,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,kCAAkC;IAClC,OAAO,EAAE,CAAC,IAAI,EAAE,mBAAmB,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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth 2.0 utilities for Flowsta authentication
|
|
3
|
+
*/
|
|
4
|
+
export interface OAuthConfig {
|
|
5
|
+
/** Your Flowsta application client ID */
|
|
6
|
+
clientId: string;
|
|
7
|
+
/** The URI to redirect back to after authentication */
|
|
8
|
+
redirectUri: string;
|
|
9
|
+
/** OAuth scopes to request (e.g., ['profile', 'email']) */
|
|
10
|
+
scopes: string[];
|
|
11
|
+
/** The Flowsta login URL (default: https://login.flowsta.com) */
|
|
12
|
+
loginUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AuthorizationUrlResult {
|
|
15
|
+
/** The complete authorization URL to redirect to */
|
|
16
|
+
url: string;
|
|
17
|
+
/** The state parameter (for validation) */
|
|
18
|
+
state: string;
|
|
19
|
+
/** The code verifier (store securely for token exchange) */
|
|
20
|
+
codeVerifier: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Build the OAuth authorization URL with PKCE
|
|
24
|
+
* @param config - OAuth configuration
|
|
25
|
+
* @returns Promise resolving to authorization URL and PKCE parameters
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildAuthorizationUrl(config: OAuthConfig): Promise<AuthorizationUrlResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Parse the OAuth callback URL for authorization code and state
|
|
30
|
+
* @param callbackUrl - The full callback URL (or search string)
|
|
31
|
+
* @returns Object with code, state, and any error
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseCallbackUrl(callbackUrl: string): {
|
|
34
|
+
code?: string;
|
|
35
|
+
state?: string;
|
|
36
|
+
error?: string;
|
|
37
|
+
errorDescription?: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Handle the OAuth callback after user authentication
|
|
41
|
+
* This should be called on your redirect URI page
|
|
42
|
+
* @returns Object with authorization code or error
|
|
43
|
+
*/
|
|
44
|
+
export declare function handleCallback(): {
|
|
45
|
+
code?: string;
|
|
46
|
+
state?: string;
|
|
47
|
+
error?: string;
|
|
48
|
+
errorDescription?: string;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +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,2DAA2D;IAC3D,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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PKCE (Proof Key for Code Exchange) utilities for OAuth 2.0
|
|
3
|
+
* RFC 7636: https://tools.ietf.org/html/rfc7636
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generate a random code verifier string
|
|
7
|
+
* Must be 43-128 characters long, using [A-Z][a-z][0-9]-._~
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateCodeVerifier(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Generate a code challenge from a code verifier using SHA-256
|
|
12
|
+
* @param verifier - The code verifier string
|
|
13
|
+
* @returns Promise that resolves to the code challenge
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateCodeChallenge(verifier: string): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Generate a PKCE pair (verifier and challenge)
|
|
18
|
+
* @returns Promise that resolves to { verifier, challenge }
|
|
19
|
+
*/
|
|
20
|
+
export declare function generatePKCEPair(): Promise<{
|
|
21
|
+
verifier: string;
|
|
22
|
+
challenge: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Store code verifier in session storage
|
|
26
|
+
* @param verifier - The code verifier to store
|
|
27
|
+
* @param state - The state parameter for correlation
|
|
28
|
+
*/
|
|
29
|
+
export declare function storeCodeVerifier(verifier: string, state: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieve and remove code verifier from session storage
|
|
32
|
+
* @param state - The state parameter for correlation
|
|
33
|
+
* @returns The code verifier or null if not found
|
|
34
|
+
*/
|
|
35
|
+
export declare function retrieveCodeVerifier(state: string): string | null;
|
|
36
|
+
//# sourceMappingURL=pkce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../../src/utils/pkce.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAI7C;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK7E;AAeD;;;GAGG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAID;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAMvE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWjE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State parameter utilities for OAuth 2.0 CSRF protection
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Generate a random state parameter
|
|
6
|
+
* @returns A random base64url encoded string
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateState(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Store state in session storage
|
|
11
|
+
* @param state - The state parameter to store
|
|
12
|
+
*/
|
|
13
|
+
export declare function storeState(state: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Retrieve and remove state from session storage
|
|
16
|
+
* @returns The state parameter or null if not found
|
|
17
|
+
*/
|
|
18
|
+
export declare function retrieveState(): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Validate that the returned state matches the stored state
|
|
21
|
+
* @param returnedState - The state returned from OAuth provider
|
|
22
|
+
* @returns true if states match, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateState(returnedState: string): boolean;
|
|
25
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/utils/state.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAItC;AAeD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAM9C;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,GAAG,IAAI,CAW7C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAG5D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flowsta/login-button/vanilla
|
|
3
|
+
*
|
|
4
|
+
* Vanilla JavaScript implementation for Flowsta login
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { createFlowstaLoginButton, initFlowstaLoginButton, default } from './FlowstaLoginButtonVanilla.js';
|
|
9
|
+
export type { FlowstaLoginButtonVanillaOptions } from './FlowstaLoginButtonVanilla.js';
|
|
10
|
+
export * from './utils/oauth.js';
|
|
11
|
+
export * from './utils/pkce.js';
|
|
12
|
+
export * from './utils/state.js';
|
|
13
|
+
export * from './types.js';
|
|
14
|
+
//# sourceMappingURL=vanilla.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vanilla.d.ts","sourceRoot":"","sources":["../src/vanilla.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,OAAO,EACR,MAAM,gCAAgC,CAAC;AAExC,YAAY,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAGvF,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
package/dist/vanilla.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { b as w } from "./oauth-
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
1
|
+
import { b as w } from "./oauth-DieOmaFh.js";
|
|
2
|
+
import { g as S, a as E, c as _, d as F, h as L, p as U, r as V, e as $, s as x, f as B, v as N } from "./oauth-DieOmaFh.js";
|
|
3
|
+
function c(e) {
|
|
4
4
|
const {
|
|
5
5
|
clientId: s,
|
|
6
6
|
redirectUri: n,
|
|
7
7
|
scopes: r = ["profile"],
|
|
8
|
-
variant:
|
|
9
|
-
loginUrl:
|
|
10
|
-
className:
|
|
8
|
+
variant: d = "dark-pill",
|
|
9
|
+
loginUrl: u,
|
|
10
|
+
className: g = "",
|
|
11
11
|
disabled: o = !1,
|
|
12
12
|
onSuccess: m,
|
|
13
|
-
onError:
|
|
14
|
-
onClick:
|
|
13
|
+
onError: p,
|
|
14
|
+
onClick: f
|
|
15
15
|
} = e, t = document.createElement("button");
|
|
16
|
-
t.type = "button", t.className = `flowsta-login-button ${
|
|
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_${
|
|
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
|
|
30
|
+
let l = !1;
|
|
31
31
|
return t.addEventListener("click", async () => {
|
|
32
|
-
if (!(t.disabled ||
|
|
33
|
-
|
|
32
|
+
if (!(t.disabled || l)) {
|
|
33
|
+
l = !0, t.style.opacity = "0.6", t.style.cursor = "not-allowed";
|
|
34
34
|
try {
|
|
35
|
-
|
|
35
|
+
f?.();
|
|
36
36
|
const { url: i } = await w({
|
|
37
37
|
clientId: s,
|
|
38
38
|
redirectUri: n,
|
|
39
39
|
scopes: r,
|
|
40
|
-
loginUrl:
|
|
40
|
+
loginUrl: u
|
|
41
41
|
});
|
|
42
42
|
window.location.href = i;
|
|
43
43
|
} catch (i) {
|
|
44
|
-
|
|
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 =
|
|
56
|
+
const r = c(s);
|
|
57
57
|
return n.appendChild(r), r;
|
|
58
58
|
}
|
|
59
59
|
const C = {
|
|
60
|
-
createFlowstaLoginButton:
|
|
60
|
+
createFlowstaLoginButton: c,
|
|
61
61
|
initFlowstaLoginButton: h
|
|
62
62
|
};
|
|
63
63
|
export {
|
|
64
64
|
w as buildAuthorizationUrl,
|
|
65
|
-
|
|
65
|
+
c as createFlowstaLoginButton,
|
|
66
66
|
C as default,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flowsta/login-button/vue
|
|
3
|
+
*
|
|
4
|
+
* Vue 3 components for Flowsta login
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { default as FlowstaLoginButton } from './FlowstaLoginButtonVue.vue';
|
|
9
|
+
export type { VueFlowstaLoginButtonProps, VueFlowstaLoginButtonEvents } from './types.js';
|
|
10
|
+
export * from './utils/oauth.js';
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
//# sourceMappingURL=vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../src/vue.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,YAAY,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAG1F,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
package/dist/vue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as u, ref as m, computed as s,
|
|
2
|
-
import { b as _ } from "./oauth-
|
|
3
|
-
import { h as z, p as I } from "./oauth-
|
|
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 w } from "vue";
|
|
2
|
+
import { b as _ } from "./oauth-DieOmaFh.js";
|
|
3
|
+
import { h as z, p as I } from "./oauth-DieOmaFh.js";
|
|
4
4
|
const v = ["disabled"], k = ["src"], y = /* @__PURE__ */ u({
|
|
5
5
|
__name: "FlowstaLoginButtonVue",
|
|
6
6
|
props: {
|
|
@@ -46,7 +46,7 @@ const v = ["disabled"], k = ["src"], y = /* @__PURE__ */ u({
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
return (o, C) => (
|
|
49
|
+
return (o, C) => (p(), g("button", {
|
|
50
50
|
type: "button",
|
|
51
51
|
class: b(["flowsta-login-button", a.className]),
|
|
52
52
|
disabled: a.disabled || t.value,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowsta/login-button",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
36
|
"dev": "vite build --watch",
|
|
37
|
-
"build": "
|
|
37
|
+
"build": "vite build && tsc",
|
|
38
38
|
"test": "echo 'Tests not yet implemented'",
|
|
39
39
|
"prepublishOnly": "npm run build"
|
|
40
40
|
},
|
|
@@ -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": {
|
|
@@ -77,9 +77,10 @@
|
|
|
77
77
|
"@builder.io/qwik": "^1.9.0",
|
|
78
78
|
"@types/react": "^18.3.3",
|
|
79
79
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
80
|
+
"happy-dom": "20.5.0",
|
|
80
81
|
"react": "^18.3.1",
|
|
81
82
|
"typescript": "^5.5.4",
|
|
82
|
-
"vite": "^
|
|
83
|
+
"vite": "^7.3.1",
|
|
83
84
|
"vue": "^3.4.0"
|
|
84
85
|
},
|
|
85
86
|
"engines": {
|
|
File without changes
|