@beamarco/auth-sdk 0.1.3 → 0.1.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../src/components/SignIn.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDlB,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oBAAoB;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,aAAa,CAAC,CAAA;IACtC,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,KAAK,CAAC,SAAS,CAAA;CACzD;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxD,gBAAgB,EAAE,CAAC,UAAU,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACzF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,MAAM,CAAC,EACrB,cAAc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,EAAE,YAAiB,EACzB,UAAiB,EACjB,SAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,QAAQ,GACT,EAAE,WAAW,2CAuHb"}
@@ -1,5 +1,5 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useState } from 'react';
2
+ import { useState } from 'react';
3
3
  import { useBeamarAuth } from '../hooks';
4
4
  const defaultStyles = {
5
5
  container: {
@@ -59,7 +59,7 @@ const defaultStyles = {
59
59
  },
60
60
  };
61
61
  export function SignIn({ afterSignInUrl, styles: customStyles = {}, showGoogle = true, signUpUrl = '/sign-up', forgotPasswordUrl, onSuccess, children, }) {
62
- const { signIn, signInWithGoogle, googleClientId } = useBeamarAuth();
62
+ const { signIn, apiUrl, appName } = useBeamarAuth();
63
63
  const [email, setEmail] = useState('');
64
64
  const [password, setPassword] = useState('');
65
65
  const [error, setError] = useState(null);
@@ -83,22 +83,17 @@ export function SignIn({ afterSignInUrl, styles: customStyles = {}, showGoogle =
83
83
  setIsLoading(false);
84
84
  }
85
85
  };
86
- const handleGoogleSuccess = async (credential) => {
87
- setError(null);
88
- setIsLoading(true);
89
- try {
90
- await signInWithGoogle(credential);
91
- onSuccess?.();
92
- if (afterSignInUrl) {
93
- window.location.href = afterSignInUrl;
94
- }
95
- }
96
- catch (err) {
97
- setError(err instanceof Error ? err.message : 'Sign in with Google failed');
98
- }
99
- finally {
100
- setIsLoading(false);
101
- }
86
+ const redirectToHostedGoogleSignIn = () => {
87
+ const base = afterSignInUrl ?? '/';
88
+ const redirectUri = typeof window !== 'undefined' && base.startsWith('/')
89
+ ? window.location.origin + base
90
+ : base;
91
+ const params = new URLSearchParams({
92
+ redirect_uri: redirectUri,
93
+ app: appName,
94
+ mode: 'signin',
95
+ });
96
+ window.location.href = `${apiUrl.replace(/\/$/, '')}/sign-in?${params}`;
102
97
  };
103
98
  if (children) {
104
99
  return (_jsx(_Fragment, { children: children({
@@ -119,32 +114,12 @@ export function SignIn({ afterSignInUrl, styles: customStyles = {}, showGoogle =
119
114
  setIsLoading(false);
120
115
  }
121
116
  },
122
- signInWithGoogle: handleGoogleSuccess,
117
+ signInWithGoogle: async () => {
118
+ redirectToHostedGoogleSignIn();
119
+ },
123
120
  error,
124
121
  isLoading,
125
122
  }) }));
126
123
  }
127
- return (_jsxs("form", { onSubmit: handleSubmit, style: styles.container, children: [error && _jsx("div", { style: styles.error, children: error }), _jsx("input", { type: "email", placeholder: "Email", value: email, onChange: (e) => setEmail(e.target.value), required: true, disabled: isLoading, style: styles.input }), _jsx("input", { type: "password", placeholder: "Password", value: password, onChange: (e) => setPassword(e.target.value), required: true, disabled: isLoading, style: styles.input }), forgotPasswordUrl && (_jsx("a", { href: forgotPasswordUrl, style: styles.link, children: "Forgot password?" })), _jsx("button", { type: "submit", disabled: isLoading, style: styles.button, children: isLoading ? 'Signing in...' : 'Sign in' }), showGoogle && (_jsxs(_Fragment, { children: [_jsxs("div", { style: styles.divider, children: [_jsx("span", { style: styles.dividerLine }), _jsx("span", { children: "or" }), _jsx("span", { style: styles.dividerLine })] }), _jsx(GoogleSignInButton, { onSuccess: handleGoogleSuccess, disabled: isLoading, clientId: googleClientId })] })), _jsxs("p", { children: ["Don't have an account? ", _jsx("a", { href: signUpUrl, style: styles.link, children: "Sign up" })] })] }));
128
- }
129
- /**
130
- * Google Sign In button - requires GoogleOAuthProvider wrapper with clientId from config
131
- */
132
- function GoogleSignInButton({ onSuccess, disabled, clientId, }) {
133
- const [GoogleLogin, setGoogleLogin] = useState(null);
134
- React.useEffect(() => {
135
- import('@react-oauth/google').then((mod) => {
136
- setGoogleLogin(() => mod.GoogleLogin);
137
- });
138
- }, []);
139
- if (!clientId)
140
- return null;
141
- if (!GoogleLogin) {
142
- return (_jsx("button", { type: "button", disabled: true, style: { ...defaultStyles.buttonGoogle, opacity: 0.7 }, children: "Loading..." }));
143
- }
144
- const GoogleLoginAny = GoogleLogin;
145
- return (_jsx(GoogleLoginAny, { onSuccess: (res) => {
146
- if (res.credential && res.clientId) {
147
- onSuccess({ credential: res.credential, clientId: res.clientId });
148
- }
149
- }, onError: () => { }, useOneTap: false, type: "standard", theme: "outline", size: "large", text: "signin_with", shape: "rectangular", logo_alignment: "left", width: "320" }));
124
+ return (_jsxs("form", { onSubmit: handleSubmit, style: styles.container, children: [error && _jsx("div", { style: styles.error, children: error }), _jsx("input", { type: "email", placeholder: "Email", value: email, onChange: (e) => setEmail(e.target.value), required: true, disabled: isLoading, style: styles.input }), _jsx("input", { type: "password", placeholder: "Password", value: password, onChange: (e) => setPassword(e.target.value), required: true, disabled: isLoading, style: styles.input }), forgotPasswordUrl && (_jsx("a", { href: forgotPasswordUrl, style: styles.link, children: "Forgot password?" })), _jsx("button", { type: "submit", disabled: isLoading, style: styles.button, children: isLoading ? 'Signing in...' : 'Sign in' }), showGoogle && (_jsxs(_Fragment, { children: [_jsxs("div", { style: styles.divider, children: [_jsx("span", { style: styles.dividerLine }), _jsx("span", { children: "or" }), _jsx("span", { style: styles.dividerLine })] }), _jsx("button", { type: "button", onClick: redirectToHostedGoogleSignIn, disabled: isLoading, style: styles.buttonGoogle, children: "Sign in with Google" })] })), _jsxs("p", { children: ["Don't have an account? ", _jsx("a", { href: signUpUrl, style: styles.link, children: "Sign up" })] })] }));
150
125
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SignUp.d.ts","sourceRoot":"","sources":["../../src/components/SignUp.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAEnD,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDlB,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,aAAa,CAAC,CAAA;IACtC,UAAU,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KAAK,CAAC,SAAS,CAAA;CACzD;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,CAAC,WAAW,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3D,gBAAgB,EAAE,CAAC,UAAU,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACzF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,MAAM,CAAC,EACrB,cAAoB,EACpB,MAAM,EAAE,YAAiB,EACzB,UAAiB,EACjB,SAAsB,EACtB,SAAS,EACT,QAAQ,GACT,EAAE,WAAW,2CAmHb"}
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useState } from 'react';
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
3
  import { useBeamarAuth } from '../hooks';
4
4
  const defaultStyles = {
5
5
  container: {
@@ -58,24 +58,8 @@ const defaultStyles = {
58
58
  backgroundColor: '#ddd',
59
59
  },
60
60
  };
61
- function GoogleSignUpButton({ onSuccess, disabled, clientId, }) {
62
- const [GoogleLogin, setGoogleLogin] = useState(null);
63
- React.useEffect(() => {
64
- import('@react-oauth/google').then((mod) => {
65
- setGoogleLogin(() => mod.GoogleLogin);
66
- });
67
- }, []);
68
- if (!clientId || !GoogleLogin)
69
- return null;
70
- const GoogleLoginAny = GoogleLogin;
71
- return (_jsx(GoogleLoginAny, { onSuccess: (res) => {
72
- if (res.credential && res.clientId) {
73
- onSuccess({ credential: res.credential, clientId: res.clientId });
74
- }
75
- }, onError: () => { }, type: "standard", theme: "outline", size: "large", text: "signup_with", shape: "rectangular", logo_alignment: "left", width: "320" }));
76
- }
77
61
  export function SignUp({ afterSignUpUrl = '/', styles: customStyles = {}, showGoogle = true, signInUrl = '/sign-in', onSuccess, children, }) {
78
- const { signUp, signUpWithGoogle, googleClientId } = useBeamarAuth();
62
+ const { signUp, apiUrl, appName } = useBeamarAuth();
79
63
  const [email, setEmail] = useState('');
80
64
  const [password, setPassword] = useState('');
81
65
  const [error, setError] = useState(null);
@@ -99,22 +83,17 @@ export function SignUp({ afterSignUpUrl = '/', styles: customStyles = {}, showGo
99
83
  setIsLoading(false);
100
84
  }
101
85
  };
102
- const handleGoogleSuccess = async (credential) => {
103
- setError(null);
104
- setIsLoading(true);
105
- try {
106
- await signUpWithGoogle(credential);
107
- onSuccess?.();
108
- if (afterSignUpUrl) {
109
- window.location.href = afterSignUpUrl;
110
- }
111
- }
112
- catch (err) {
113
- setError(err instanceof Error ? err.message : 'Sign up with Google failed');
114
- }
115
- finally {
116
- setIsLoading(false);
117
- }
86
+ const redirectToHostedGoogleSignUp = () => {
87
+ const base = afterSignUpUrl ?? '/';
88
+ const redirectUri = typeof window !== 'undefined' && base.startsWith('/')
89
+ ? window.location.origin + base
90
+ : base;
91
+ const params = new URLSearchParams({
92
+ redirect_uri: redirectUri,
93
+ app: appName,
94
+ mode: 'signup',
95
+ });
96
+ window.location.href = `${apiUrl.replace(/\/$/, '')}/sign-in?${params}`;
118
97
  };
119
98
  if (children) {
120
99
  return (_jsx(_Fragment, { children: children({
@@ -135,10 +114,12 @@ export function SignUp({ afterSignUpUrl = '/', styles: customStyles = {}, showGo
135
114
  setIsLoading(false);
136
115
  }
137
116
  },
138
- signUpWithGoogle: handleGoogleSuccess,
117
+ signUpWithGoogle: async () => {
118
+ redirectToHostedGoogleSignUp();
119
+ },
139
120
  error,
140
121
  isLoading,
141
122
  }) }));
142
123
  }
143
- return (_jsxs("form", { onSubmit: handleSubmit, style: styles.container, children: [error && _jsx("div", { style: styles.error, children: error }), _jsx("input", { type: "email", placeholder: "Email", value: email, onChange: (e) => setEmail(e.target.value), required: true, disabled: isLoading, style: styles.input }), _jsx("input", { type: "password", placeholder: "Password", value: password, onChange: (e) => setPassword(e.target.value), required: true, disabled: isLoading, minLength: 6, style: styles.input }), _jsx("button", { type: "submit", disabled: isLoading, style: styles.button, children: isLoading ? 'Creating account...' : 'Sign up' }), showGoogle && (_jsxs(_Fragment, { children: [_jsxs("div", { style: styles.divider, children: [_jsx("span", { style: styles.dividerLine }), _jsx("span", { children: "or" }), _jsx("span", { style: styles.dividerLine })] }), _jsx(GoogleSignUpButton, { onSuccess: handleGoogleSuccess, disabled: isLoading, clientId: googleClientId })] })), _jsxs("p", { children: ["Already have an account? ", _jsx("a", { href: signInUrl, style: styles.link, children: "Sign in" })] })] }));
124
+ return (_jsxs("form", { onSubmit: handleSubmit, style: styles.container, children: [error && _jsx("div", { style: styles.error, children: error }), _jsx("input", { type: "email", placeholder: "Email", value: email, onChange: (e) => setEmail(e.target.value), required: true, disabled: isLoading, style: styles.input }), _jsx("input", { type: "password", placeholder: "Password", value: password, onChange: (e) => setPassword(e.target.value), required: true, disabled: isLoading, minLength: 6, style: styles.input }), _jsx("button", { type: "submit", disabled: isLoading, style: styles.button, children: isLoading ? 'Creating account...' : 'Sign up' }), showGoogle && (_jsxs(_Fragment, { children: [_jsxs("div", { style: styles.divider, children: [_jsx("span", { style: styles.dividerLine }), _jsx("span", { children: "or" }), _jsx("span", { style: styles.dividerLine })] }), _jsx("button", { type: "button", onClick: redirectToHostedGoogleSignUp, disabled: isLoading, style: styles.buttonGoogle, children: "Sign up with Google" })] })), _jsxs("p", { children: ["Already have an account? ", _jsx("a", { href: signInUrl, style: styles.link, children: "Sign in" })] })] }));
144
125
  }
package/dist/context.d.ts CHANGED
@@ -13,7 +13,11 @@ export interface AuthContextValue {
13
13
  getToken: () => Promise<string | null>;
14
14
  refreshSession: () => Promise<User | null>;
15
15
  client: BeamarAuthClient;
16
- /** Google OAuth client ID if configured */
16
+ /** Auth API base URL (for redirect flow) */
17
+ apiUrl: string;
18
+ /** App name (for redirect flow) */
19
+ appName: string;
20
+ /** Google OAuth client ID - only used when googleSignInFlow is 'inline' */
17
21
  googleClientId?: string;
18
22
  }
19
23
  declare const AuthContext: React.Context<AuthContextValue | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0D,MAAM,OAAO,CAAA;AAE9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE9G,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;IACjB,MAAM,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxD,MAAM,EAAE,CAAC,WAAW,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3D,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,gBAAgB,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjE,gBAAgB,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjE,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACtC,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;IAC1C,MAAM,EAAE,gBAAgB,CAAA;IACxB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,QAAA,MAAM,WAAW,wCAA+C,CAAA;AAEhE,MAAM,WAAW,uBAAuB;IACtC,6BAA6B;IAC7B,MAAM,CA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AA;IACxB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAA;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,QAAA,MAAM,WAAW,wCAA+C,CAAA;AAEhE,MAAM,WAAW,uBAAuB;IACtC,6BAA6B;IAC7B,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,yFAAyF;IACzF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,uBAAuB,2CA6I3G;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
package/dist/context.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { createContext, useCallback, useEffect, useState } from 'react';
3
- import { GoogleOAuthProvider } from '@react-oauth/google';
4
3
  import { BeamarAuthClient } from './client';
5
4
  import { resolveConfigFromPublishableKey } from './resolve-config';
6
5
  const AuthContext = createContext(null);
@@ -117,6 +116,8 @@ export function BeamarAuthProvider({ config: configProp, publishableKey, childre
117
116
  getToken,
118
117
  refreshSession,
119
118
  client: client,
119
+ apiUrl: config?.apiUrl ?? '',
120
+ appName: config?.appName ?? 'default',
120
121
  googleClientId: config?.googleClientId,
121
122
  };
122
123
  if (!config || !client) {
@@ -125,10 +126,6 @@ export function BeamarAuthProvider({ config: configProp, publishableKey, childre
125
126
  : 'Loading...';
126
127
  return (_jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', minHeight: '100vh' }, children: _jsx("span", { children: msg }) }));
127
128
  }
128
- const content = _jsx(AuthContext.Provider, { value: value, children: children });
129
- if (config.googleClientId) {
130
- return (_jsx(GoogleOAuthProvider, { clientId: config.googleClientId, children: content }));
131
- }
132
- return content;
129
+ return _jsx(AuthContext.Provider, { value: value, children: children });
133
130
  }
134
131
  export { AuthContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beamarco/auth-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Beamar Auth SDK - Embed authentication like Clerk in your React apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,9 +25,7 @@
25
25
  "react": ">=17.0.0",
26
26
  "react-dom": ">=17.0.0"
27
27
  },
28
- "dependencies": {
29
- "@react-oauth/google": "^0.11.1"
30
- },
28
+ "dependencies": {},
31
29
  "devDependencies": {
32
30
  "@types/react": "^18.2.0",
33
31
  "react": "^18.2.0",