@main12/auth-login 0.1.7 → 0.1.8
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/components/pages/LoginPage.js +6 -2
- package/dist/components/pages/SignupPage.js +6 -2
- package/dist/config.d.ts +1 -0
- package/dist/config.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -4
- package/package.json +1 -1
|
@@ -4,9 +4,13 @@ import { pluginConfig } from '../../config.js';
|
|
|
4
4
|
import LoginPageTailwind from './LoginPageTailwind.js';
|
|
5
5
|
import LoginPageHero from './LoginPageHero.js';
|
|
6
6
|
export default function LoginPage(props) {
|
|
7
|
-
|
|
7
|
+
const resolved = {
|
|
8
|
+
showGoogleOAuth: pluginConfig.googleOAuthEnabled,
|
|
8
9
|
...props
|
|
10
|
+
};
|
|
11
|
+
return pluginConfig.style === 'hero-ui' ? /*#__PURE__*/ _jsx(LoginPageHero, {
|
|
12
|
+
...resolved
|
|
9
13
|
}) : /*#__PURE__*/ _jsx(LoginPageTailwind, {
|
|
10
|
-
...
|
|
14
|
+
...resolved
|
|
11
15
|
});
|
|
12
16
|
}
|
|
@@ -4,9 +4,13 @@ import { pluginConfig } from '../../config.js';
|
|
|
4
4
|
import SignupPageTailwind from './SignupPageTailwind.js';
|
|
5
5
|
import SignupPageHero from './SignupPageHero.js';
|
|
6
6
|
export default function SignupPage(props) {
|
|
7
|
-
|
|
7
|
+
const resolved = {
|
|
8
|
+
showGoogleOAuth: pluginConfig.googleOAuthEnabled,
|
|
8
9
|
...props
|
|
10
|
+
};
|
|
11
|
+
return pluginConfig.style === 'hero-ui' ? /*#__PURE__*/ _jsx(SignupPageHero, {
|
|
12
|
+
...resolved
|
|
9
13
|
}) : /*#__PURE__*/ _jsx(SignupPageTailwind, {
|
|
10
|
-
...
|
|
14
|
+
...resolved
|
|
11
15
|
});
|
|
12
16
|
}
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface AuthLoginPluginOptions {
|
|
|
7
7
|
domain?: string;
|
|
8
8
|
style?: AuthStyle;
|
|
9
9
|
logo?: string;
|
|
10
|
-
/** Enable Google OAuth
|
|
10
|
+
/** Enable Google OAuth. Default: auto-detects GOOGLE_CLIENT_ID env var. Set false to force-disable. */
|
|
11
11
|
googleOAuth?: boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare const authLoginPlugin: (options?: AuthLoginPluginOptions) => (config: Config) => Config;
|
package/dist/index.js
CHANGED
|
@@ -3,16 +3,23 @@ import { googleOAuthEndpoints } from './endpoints/googleOAuth.js';
|
|
|
3
3
|
import { pluginConfig } from './config.js';
|
|
4
4
|
export const authLoginPlugin = (options = {})=>(config)=>{
|
|
5
5
|
if (options.enabled === false) return config;
|
|
6
|
-
// Set global
|
|
6
|
+
// Set global config — all components read this at render time
|
|
7
7
|
pluginConfig.style = options.style || 'tailwind';
|
|
8
8
|
pluginConfig.logoUrl = options.logo;
|
|
9
|
+
// Google OAuth: auto-detect from env vars
|
|
10
|
+
if (options.googleOAuth === false) {
|
|
11
|
+
pluginConfig.googleOAuthEnabled = false;
|
|
12
|
+
} else {
|
|
13
|
+
const hasGoogleCreds = !!(process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET);
|
|
14
|
+
pluginConfig.googleOAuthEnabled = options.googleOAuth === true || hasGoogleCreds;
|
|
15
|
+
}
|
|
9
16
|
// Register auth API endpoints
|
|
10
17
|
config.endpoints = [
|
|
11
18
|
...config.endpoints || [],
|
|
12
19
|
...authEndpoints
|
|
13
20
|
];
|
|
14
|
-
// Register Google OAuth endpoints if enabled
|
|
15
|
-
if (
|
|
21
|
+
// Register Google OAuth endpoints only if enabled
|
|
22
|
+
if (pluginConfig.googleOAuthEnabled) {
|
|
16
23
|
config.endpoints = [
|
|
17
24
|
...config.endpoints,
|
|
18
25
|
...googleOAuthEndpoints
|
|
@@ -22,7 +29,7 @@ export const authLoginPlugin = (options = {})=>(config)=>{
|
|
|
22
29
|
const incomingOnInit = config.onInit;
|
|
23
30
|
config.onInit = async (payload)=>{
|
|
24
31
|
if (incomingOnInit) await incomingOnInit(payload);
|
|
25
|
-
payload.logger.info(`[auth-login] Initialized (style: ${pluginConfig.style}) for ${options.projectName || 'project'}`);
|
|
32
|
+
payload.logger.info(`[auth-login] Initialized (style: ${pluginConfig.style}, googleOAuth: ${pluginConfig.googleOAuthEnabled}) for ${options.projectName || 'project'}`);
|
|
26
33
|
};
|
|
27
34
|
return config;
|
|
28
35
|
};
|
package/package.json
CHANGED