@tern-secure/nextjs 2.0.9 → 3.0.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/components/sign-in.d.ts +7 -2
- package/dist/components/sign-in.js +88 -29
- package/dist/components/sign-in.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +5 -233
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +3 -0
- package/dist/utils/create-styles.d.ts +1 -0
- package/dist/utils/create-styles.js +22 -0
- package/dist/utils/create-styles.js.map +1 -0
- package/package.json +3 -4
- package/dist/app-router/client/ClientProvider.d.ts +0 -3
- package/dist/app-router/client/ClientProvider.js +0 -34
- package/dist/app-router/client/ClientProvider.js.map +0 -1
- package/dist/app-router/client/providers/ReactTernSecureProvider.d.ts +0 -13
- package/dist/app-router/client/providers/ReactTernSecureProvider.js +0 -16
- package/dist/app-router/client/providers/ReactTernSecureProvider.js.map +0 -1
- package/dist/jest.setup.d.ts +0 -0
- package/dist/jest.setup.js +0 -8
- package/dist/jest.setup.js.map +0 -1
- package/dist/src/app-router/client/ClientProvider.d.ts +0 -3
- package/dist/src/app-router/client/ClientProvider.js +0 -34
- package/dist/src/app-router/client/ClientProvider.js.map +0 -1
- package/dist/src/app-router/client/client-init.d.ts +0 -6
- package/dist/src/app-router/client/client-init.js +0 -44
- package/dist/src/app-router/client/client-init.js.map +0 -1
- package/dist/src/app-router/client/config.d.ts +0 -3
- package/dist/src/app-router/client/config.js +0 -18
- package/dist/src/app-router/client/config.js.map +0 -1
- package/dist/src/app-router/client/index.d.ts +0 -2
- package/dist/src/app-router/client/index.js +0 -3
- package/dist/src/app-router/client/index.js.map +0 -1
- package/dist/src/app-router/client/providers/ReactTernSecureProvider.d.ts +0 -13
- package/dist/src/app-router/client/providers/ReactTernSecureProvider.js +0 -16
- package/dist/src/app-router/client/providers/ReactTernSecureProvider.js.map +0 -1
- package/dist/src/app-router/client/providers/ternSecureClientProvider.d.ts +0 -8
- package/dist/src/app-router/client/providers/ternSecureClientProvider.js +0 -34
- package/dist/src/app-router/client/providers/ternSecureClientProvider.js.map +0 -1
- package/dist/src/app-router/client/providers/ternSecureContext.d.ts +0 -6
- package/dist/src/app-router/client/providers/ternSecureContext.js +0 -5
- package/dist/src/app-router/client/providers/ternSecureContext.js.map +0 -1
- package/dist/src/app-router/server/ErrorBoundary.d.ts +0 -15
- package/dist/src/app-router/server/ErrorBoundary.js +0 -22
- package/dist/src/app-router/server/ErrorBoundary.js.map +0 -1
- package/dist/src/app-router/server/index.d.ts +0 -1
- package/dist/src/app-router/server/index.js +0 -2
- package/dist/src/app-router/server/index.js.map +0 -1
- package/dist/src/app-router/server/providers/TernSecureServerProvider.d.ts +0 -6
- package/dist/src/app-router/server/providers/TernSecureServerProvider.js +0 -18
- package/dist/src/app-router/server/providers/TernSecureServerProvider.js.map +0 -1
- package/dist/src/components/index.d.ts +0 -1
- package/dist/src/components/index.js +0 -2
- package/dist/src/components/index.js.map +0 -1
- package/dist/src/errors/index.d.ts +0 -8
- package/dist/src/errors/index.js +0 -12
- package/dist/src/errors/index.js.map +0 -1
- package/dist/src/hooks/useAuth.d.ts +0 -2
- package/dist/src/hooks/useAuth.js +0 -42
- package/dist/src/hooks/useAuth.js.map +0 -1
- package/dist/src/index.d.ts +0 -4
- package/dist/src/index.js +0 -5
- package/dist/src/index.js.map +0 -1
- package/dist/src/types/ternsecure.d.ts +0 -39
- package/dist/src/types/ternsecure.js +0 -2
- package/dist/src/types/ternsecure.js.map +0 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +0 -2
- package/dist/src/utils/index.js.map +0 -1
- package/dist/types/ternsecure.d.ts +0 -47
- package/dist/types/ternsecure.js +0 -2
- package/dist/types/ternsecure.js.map +0 -1
|
@@ -4,13 +4,18 @@ export interface SignInProps {
|
|
|
4
4
|
onError?: (error: Error) => void;
|
|
5
5
|
redirectUrl?: string;
|
|
6
6
|
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
7
8
|
customStyles?: {
|
|
8
|
-
form?: string;
|
|
9
9
|
container?: string;
|
|
10
|
+
header?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
formWrapper?: string;
|
|
13
|
+
formContainer?: string;
|
|
14
|
+
form?: string;
|
|
10
15
|
input?: string;
|
|
11
16
|
button?: string;
|
|
12
17
|
errorText?: string;
|
|
13
18
|
label?: string;
|
|
14
19
|
};
|
|
15
20
|
}
|
|
16
|
-
export declare function SignIn({ onSuccess, onError, redirectUrl, className, customStyles }: SignInProps): React.JSX.Element;
|
|
21
|
+
export declare function SignIn({ onSuccess, onError, redirectUrl, className, style, customStyles }: SignInProps): React.JSX.Element;
|
|
@@ -2,7 +2,82 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { signInWithEmail } from '../app-router/client';
|
|
5
|
-
|
|
5
|
+
import { createStyles } from '../utils/create-styles';
|
|
6
|
+
const styles = createStyles('tern', {
|
|
7
|
+
container: {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
minHeight: '100%',
|
|
10
|
+
flex: '1',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
padding: '3rem 1.5rem'
|
|
14
|
+
},
|
|
15
|
+
header: {
|
|
16
|
+
margin: '0 auto',
|
|
17
|
+
width: '100%',
|
|
18
|
+
maxWidth: '28rem'
|
|
19
|
+
},
|
|
20
|
+
title: {
|
|
21
|
+
marginTop: '1.5rem',
|
|
22
|
+
textAlign: 'center',
|
|
23
|
+
fontSize: '1.875rem',
|
|
24
|
+
fontWeight: '700',
|
|
25
|
+
lineHeight: '2.25rem',
|
|
26
|
+
letterSpacing: '-0.025em',
|
|
27
|
+
color: 'var(--tern-text-primary, #111827)'
|
|
28
|
+
},
|
|
29
|
+
formWrapper: {
|
|
30
|
+
marginTop: '2.5rem',
|
|
31
|
+
margin: '0 auto',
|
|
32
|
+
width: '100%',
|
|
33
|
+
maxWidth: '30rem'
|
|
34
|
+
},
|
|
35
|
+
formContainer: {
|
|
36
|
+
padding: '3rem 1.5rem',
|
|
37
|
+
boxShadow: '0 1px 3px 0 rgb(0 0 0 / 0.1)',
|
|
38
|
+
borderRadius: '0.5rem',
|
|
39
|
+
backgroundColor: 'var(--tern-background, white)'
|
|
40
|
+
},
|
|
41
|
+
form: {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'column',
|
|
44
|
+
gap: '1rem'
|
|
45
|
+
},
|
|
46
|
+
label: {
|
|
47
|
+
display: 'block',
|
|
48
|
+
fontSize: '0.875rem',
|
|
49
|
+
fontWeight: '500',
|
|
50
|
+
color: 'var(--tern-text-secondary, #374151)'
|
|
51
|
+
},
|
|
52
|
+
input: {
|
|
53
|
+
marginTop: '0.25rem',
|
|
54
|
+
display: 'block',
|
|
55
|
+
width: '100%',
|
|
56
|
+
padding: '0.5rem 0.75rem',
|
|
57
|
+
borderRadius: '0.375rem',
|
|
58
|
+
border: '1px solid var(--tern-border, #D1D5DB)',
|
|
59
|
+
backgroundColor: 'var(--tern-input-background, white)',
|
|
60
|
+
color: 'var(--tern-text-primary, #111827)'
|
|
61
|
+
},
|
|
62
|
+
button: {
|
|
63
|
+
display: 'flex',
|
|
64
|
+
width: '100%',
|
|
65
|
+
justifyContent: 'center',
|
|
66
|
+
padding: '0.5rem 1rem',
|
|
67
|
+
fontSize: '0.875rem',
|
|
68
|
+
fontWeight: '500',
|
|
69
|
+
color: 'white',
|
|
70
|
+
backgroundColor: 'var(--tern-primary, #2563EB)',
|
|
71
|
+
border: 'none',
|
|
72
|
+
borderRadius: '0.375rem',
|
|
73
|
+
cursor: 'pointer'
|
|
74
|
+
},
|
|
75
|
+
error: {
|
|
76
|
+
color: 'var(--tern-error, #DC2626)',
|
|
77
|
+
fontSize: '0.875rem'
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
export function SignIn({ onSuccess, onError, redirectUrl, className = '', style, customStyles = {} }) {
|
|
6
81
|
const [email, setEmail] = useState('');
|
|
7
82
|
const [password, setPassword] = useState('');
|
|
8
83
|
const [loading, setLoading] = useState(false);
|
|
@@ -27,35 +102,19 @@ export function SignIn({ onSuccess, onError, redirectUrl, className = '', custom
|
|
|
27
102
|
setLoading(false);
|
|
28
103
|
}
|
|
29
104
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
const styles = {
|
|
39
|
-
form: customStyles.form || defaultStyles.form,
|
|
40
|
-
label: customStyles.label || defaultStyles.label,
|
|
41
|
-
container: customStyles.container || defaultStyles.container,
|
|
42
|
-
input: customStyles.input || defaultStyles.input,
|
|
43
|
-
button: customStyles.button || defaultStyles.button,
|
|
44
|
-
errorText: customStyles.errorText || defaultStyles.errorText
|
|
45
|
-
};
|
|
46
|
-
return (React.createElement("div", { className: styles.container },
|
|
47
|
-
React.createElement("div", { className: "sm:mx-auto sm:w-full sm:max-w-md" },
|
|
48
|
-
React.createElement("h2", { className: `mt-6 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900}` }, "Sign in to your account")),
|
|
49
|
-
React.createElement("div", { className: "mt-10 sm:mx-auto sm:w-full sm:max-w-[480px]" },
|
|
50
|
-
React.createElement("div", { className: "px-6 py-12 shadow sm:rounded-lg sm:px-12 " },
|
|
51
|
-
React.createElement("form", { onSubmit: handleSubmit, className: `${styles.form} ${className}`, role: "form", "aria-label": "Sign in form" },
|
|
52
|
-
error && (React.createElement("div", { className: styles.errorText, role: "alert", "aria-live": "polite" }, error)),
|
|
105
|
+
return (React.createElement("div", { className: `${styles.container} ${customStyles.container || ''}`, style: style },
|
|
106
|
+
React.createElement("div", { className: `${styles.header} ${customStyles.header || ''}` },
|
|
107
|
+
React.createElement("h2", { className: `${styles.title} ${customStyles.title || ''}` }, "Sign in to your account")),
|
|
108
|
+
React.createElement("div", { className: `${styles.formWrapper} ${customStyles.formWrapper || ''}` },
|
|
109
|
+
React.createElement("div", { className: `${styles.formContainer} ${customStyles.formContainer || ''}` },
|
|
110
|
+
React.createElement("form", { onSubmit: handleSubmit, className: `${styles.form} ${customStyles.form || ''} ${className}`, role: "form", "aria-label": "Sign in form" },
|
|
111
|
+
error && (React.createElement("div", { className: `${styles.error} ${customStyles.errorText || ''}`, role: "alert", "aria-live": "polite" }, error)),
|
|
53
112
|
React.createElement("div", null,
|
|
54
|
-
React.createElement("label", { htmlFor: "email", className: styles.label }, "Email"),
|
|
55
|
-
React.createElement("input", { id: "email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), placeholder: "Enter your email", required: true, className: styles.input
|
|
113
|
+
React.createElement("label", { htmlFor: "email", className: `${styles.label} ${customStyles.label || ''}` }, "Email"),
|
|
114
|
+
React.createElement("input", { id: "email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), placeholder: "Enter your email", required: true, className: `${styles.input} ${customStyles.input || ''}`, disabled: loading, "aria-required": "true", "aria-invalid": !!error })),
|
|
56
115
|
React.createElement("div", null,
|
|
57
|
-
React.createElement("label", { htmlFor: "password", className: styles.label }, "Password"),
|
|
58
|
-
React.createElement("input", { id: "password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), placeholder: "Enter your password", required: true, className: styles.input
|
|
59
|
-
React.createElement("button", { type: "submit", disabled: loading, className: styles.button
|
|
116
|
+
React.createElement("label", { htmlFor: "password", className: `${styles.label} ${customStyles.label || ''}` }, "Password"),
|
|
117
|
+
React.createElement("input", { id: "password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), placeholder: "Enter your password", required: true, className: `${styles.input} ${customStyles.input || ''}`, disabled: loading, "aria-required": "true", "aria-invalid": !!error })),
|
|
118
|
+
React.createElement("button", { type: "submit", disabled: loading, className: `${styles.button} ${customStyles.button || ''}`, "data-testid": "sign-in-submit" }, loading ? 'Signing in...' : 'Sign in'))))));
|
|
60
119
|
}
|
|
61
120
|
//# sourceMappingURL=sign-in.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE;IAClC,SAAS,EAAE;QACT,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,GAAG;QACT,aAAa,EAAE,QAAQ;QACvB,cAAc,EAAE,QAAQ;QACxB,OAAO,EAAE,aAAa;KACvB;IACD,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,OAAO;KAClB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,SAAS;QACrB,aAAa,EAAE,UAAU;QACzB,KAAK,EAAE,mCAAmC;KAC3C;IACD,WAAW,EAAE;QACX,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,OAAO;KAClB;IACD,aAAa,EAAE;QACb,OAAO,EAAE,aAAa;QACtB,SA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E,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,WAAW,EAAC,qBAAqB,EACjC,QAAQ,QACR,SAAS,EAAE,GAAG,MAAM,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,IAAI,EAAE,EAAE,EACxD,QAAQ,EAAE,OAAO,mBACH,MAAM,kBACN,CAAC,CAAC,KAAK,GACrB,CACE;oBACN,gCACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,YAAY,CAAC,MAAM,IAAI,EAAE,EAAE,iBAC9C,gBAAgB,IAE3B,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAC/B,CACJ,CACH,CACF,CACF,CACP,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { TernSecureProvider, useAuth, SignIn, TernSecureAuth, TernSecureFirestore, TernSecureStorage };
|
|
1
|
+
export { TernSecureAuth, TernSecureFirestore, TernSecureStorage, signInWithEmail, loadFireConfig, validateConfig, TernSecureContext, useTernSecure, TernSecureClientProvider, SignInCredentials } from './app-router/client';
|
|
2
|
+
export { TernSecureProvider } from './app-router/server';
|
|
3
|
+
export { useAuth } from './hooks';
|
|
4
|
+
export { SignIn } from './components';
|
package/dist/index.js
CHANGED
|
@@ -1,233 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { getStorage } from 'firebase/storage';
|
|
7
|
-
import dynamic from 'next/dynamic';
|
|
8
|
-
|
|
9
|
-
// Initialize immediately
|
|
10
|
-
const app = (() => {
|
|
11
|
-
const config = validateConfig(loadFireConfig());
|
|
12
|
-
return getApps().length ? getApps()[0] : initializeApp(config);
|
|
13
|
-
})();
|
|
14
|
-
const auth = getAuth(app);
|
|
15
|
-
setPersistence(auth, browserSessionPersistence); //to change later user should be able to choose persistance
|
|
16
|
-
const firestore = getFirestore(app);
|
|
17
|
-
const storage = getStorage(app);
|
|
18
|
-
const TernSecureAuth = () => auth;
|
|
19
|
-
const TernSecureFirestore = () => firestore;
|
|
20
|
-
const TernSecureStorage = () => storage;
|
|
21
|
-
|
|
22
|
-
async function signInWithEmail({ email, password }) {
|
|
23
|
-
const auth = TernSecureAuth();
|
|
24
|
-
return signInWithEmailAndPassword(auth, email, password);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const loadFireConfig = () => ({
|
|
28
|
-
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
|
|
29
|
-
authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
|
|
30
|
-
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
|
|
31
|
-
storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,
|
|
32
|
-
messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
|
|
33
|
-
appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID,
|
|
34
|
-
measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID,
|
|
35
|
-
});
|
|
36
|
-
const validateConfig = (config) => {
|
|
37
|
-
Object.entries(config).forEach(([key, value]) => {
|
|
38
|
-
if (!value) {
|
|
39
|
-
throw new Error(`Missing environment variable: NEXT_PUBLIC_FIREBASE_${key.toUpperCase()}`);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
return config;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const createTernSecureContext = () => {
|
|
46
|
-
const initialState = {
|
|
47
|
-
firebase: {
|
|
48
|
-
initialized: false,
|
|
49
|
-
error: null
|
|
50
|
-
},
|
|
51
|
-
auth: {
|
|
52
|
-
user: null,
|
|
53
|
-
loading: true,
|
|
54
|
-
error: null,
|
|
55
|
-
isSignedIn: false
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
return createContext([initialState, () => { }]);
|
|
59
|
-
};
|
|
60
|
-
// Create context instance only when imported on client
|
|
61
|
-
const TernSecureContext = createTernSecureContext();
|
|
62
|
-
const useTernSecure = (hookname) => {
|
|
63
|
-
const context = useContext(TernSecureContext);
|
|
64
|
-
if (!context) {
|
|
65
|
-
throw new Error(`${hookname} must be used within TernSecureProvider`);
|
|
66
|
-
}
|
|
67
|
-
return context;
|
|
68
|
-
};
|
|
69
|
-
// Export initial state for reuse
|
|
70
|
-
const initialState = {
|
|
71
|
-
firebase: {
|
|
72
|
-
initialized: false,
|
|
73
|
-
error: null
|
|
74
|
-
},
|
|
75
|
-
auth: {
|
|
76
|
-
user: null,
|
|
77
|
-
loading: true,
|
|
78
|
-
error: null,
|
|
79
|
-
isSignedIn: false
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
function TernSecureClientProvider$1({ children }) {
|
|
84
|
-
const stateAndUpdater = useState(initialState);
|
|
85
|
-
return (React__default.createElement(TernSecureContext.Provider, { value: stateAndUpdater }, children));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
var ternSecureClientProvider = /*#__PURE__*/Object.freeze({
|
|
89
|
-
__proto__: null,
|
|
90
|
-
TernSecureClientProvider: TernSecureClientProvider$1
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
// Dynamically import the client provider with no SSR
|
|
94
|
-
const TernSecureClientProvider = dynamic(() => Promise.resolve().then(function () { return ternSecureClientProvider; }).then(mod => mod.TernSecureClientProvider), {
|
|
95
|
-
//ssr: false,
|
|
96
|
-
loading: () => null // Return null or a loading indicator
|
|
97
|
-
});
|
|
98
|
-
function TernSecureProvider({ children }) {
|
|
99
|
-
// Check if the children contain html/body tags
|
|
100
|
-
const isRootLayout = React__default.Children.toArray(children).some(child => React__default.isValidElement(child) && child.type === 'html');
|
|
101
|
-
if (isRootLayout) {
|
|
102
|
-
// If this is the root layout, inject our provider after the body tag
|
|
103
|
-
return React__default.Children.map(children, child => {
|
|
104
|
-
if (React__default.isValidElement(child) && child.type === 'html') {
|
|
105
|
-
return React__default.cloneElement(child, {}, React__default.Children.map(child.props.children, bodyChild => {
|
|
106
|
-
if (React__default.isValidElement(bodyChild) && bodyChild.type === 'body') {
|
|
107
|
-
// Type assertion to access props safely
|
|
108
|
-
const bodyProps = bodyChild.props;
|
|
109
|
-
return React__default.cloneElement(bodyChild, {}, React__default.createElement(TernSecureClientProvider, null, bodyProps.children));
|
|
110
|
-
}
|
|
111
|
-
return bodyChild;
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
return child;
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
// For non-root layouts, wrap normally
|
|
118
|
-
return React__default.createElement(TernSecureClientProvider, null, children);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function useAuth() {
|
|
122
|
-
const [state, setState] = useTernSecure('useAuth');
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
try {
|
|
125
|
-
const auth = TernSecureAuth(); // This initializes Firebase
|
|
126
|
-
setState(prev => ({
|
|
127
|
-
...prev,
|
|
128
|
-
firebase: {
|
|
129
|
-
initialized: true,
|
|
130
|
-
error: null
|
|
131
|
-
}
|
|
132
|
-
}));
|
|
133
|
-
const unsubscribe = auth.onAuthStateChanged((user) => {
|
|
134
|
-
setState(prev => ({
|
|
135
|
-
...prev,
|
|
136
|
-
auth: {
|
|
137
|
-
user,
|
|
138
|
-
loading: false,
|
|
139
|
-
error: null,
|
|
140
|
-
isSignedIn: !!user
|
|
141
|
-
}
|
|
142
|
-
}));
|
|
143
|
-
}, (error) => {
|
|
144
|
-
setState(prev => ({
|
|
145
|
-
...prev,
|
|
146
|
-
auth: {
|
|
147
|
-
user: null,
|
|
148
|
-
loading: false,
|
|
149
|
-
error,
|
|
150
|
-
isSignedIn: false
|
|
151
|
-
}
|
|
152
|
-
}));
|
|
153
|
-
});
|
|
154
|
-
return () => unsubscribe();
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
setState(prev => ({
|
|
158
|
-
...prev,
|
|
159
|
-
firebase: {
|
|
160
|
-
initialized: false,
|
|
161
|
-
error: error
|
|
162
|
-
},
|
|
163
|
-
auth: {
|
|
164
|
-
user: null,
|
|
165
|
-
loading: false,
|
|
166
|
-
error: error,
|
|
167
|
-
isSignedIn: false
|
|
168
|
-
}
|
|
169
|
-
}));
|
|
170
|
-
}
|
|
171
|
-
}, []); // Only run once on mount
|
|
172
|
-
return state.auth;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function SignIn({ onSuccess, onError, redirectUrl, className = '', customStyles = {} }) {
|
|
176
|
-
const [email, setEmail] = useState('');
|
|
177
|
-
const [password, setPassword] = useState('');
|
|
178
|
-
const [loading, setLoading] = useState(false);
|
|
179
|
-
const [error, setError] = useState('');
|
|
180
|
-
const handleSubmit = async (e) => {
|
|
181
|
-
e.preventDefault();
|
|
182
|
-
setLoading(true);
|
|
183
|
-
setError('');
|
|
184
|
-
try {
|
|
185
|
-
await signInWithEmail({ email, password });
|
|
186
|
-
onSuccess?.();
|
|
187
|
-
if (redirectUrl) {
|
|
188
|
-
window.location.href = redirectUrl;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
catch (err) {
|
|
192
|
-
const errorMessage = err instanceof Error ? err.message : 'Failed to sign in';
|
|
193
|
-
setError(errorMessage);
|
|
194
|
-
onError?.(err instanceof Error ? err : new Error('Failed to sign in'));
|
|
195
|
-
}
|
|
196
|
-
finally {
|
|
197
|
-
setLoading(false);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
const defaultStyles = {
|
|
201
|
-
form: 'space-y-4',
|
|
202
|
-
label: 'block text-sm font-medium text-gray-700',
|
|
203
|
-
input: 'mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary',
|
|
204
|
-
button: 'w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary disabled:opacity-50',
|
|
205
|
-
errorText: 'text-red-500 text-sm',
|
|
206
|
-
container: 'flex min-h-full flex-1 flex-col justify-center py-12 sm:px-6 lg:px-8'
|
|
207
|
-
};
|
|
208
|
-
const styles = {
|
|
209
|
-
form: customStyles.form || defaultStyles.form,
|
|
210
|
-
label: customStyles.label || defaultStyles.label,
|
|
211
|
-
container: customStyles.container || defaultStyles.container,
|
|
212
|
-
input: customStyles.input || defaultStyles.input,
|
|
213
|
-
button: customStyles.button || defaultStyles.button,
|
|
214
|
-
errorText: customStyles.errorText || defaultStyles.errorText
|
|
215
|
-
};
|
|
216
|
-
return (React.createElement("div", { className: styles.container },
|
|
217
|
-
React.createElement("div", { className: "sm:mx-auto sm:w-full sm:max-w-md" },
|
|
218
|
-
React.createElement("h2", { className: `mt-6 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900}` }, "Sign in to your account")),
|
|
219
|
-
React.createElement("div", { className: "mt-10 sm:mx-auto sm:w-full sm:max-w-[480px]" },
|
|
220
|
-
React.createElement("div", { className: "px-6 py-12 shadow sm:rounded-lg sm:px-12 " },
|
|
221
|
-
React.createElement("form", { onSubmit: handleSubmit, className: `${styles.form} ${className}`, role: "form", "aria-label": "Sign in form" },
|
|
222
|
-
error && (React.createElement("div", { className: styles.errorText, role: "alert", "aria-live": "polite" }, error)),
|
|
223
|
-
React.createElement("div", null,
|
|
224
|
-
React.createElement("label", { htmlFor: "email", className: styles.label }, "Email"),
|
|
225
|
-
React.createElement("input", { id: "email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), placeholder: "Enter your email", required: true, className: styles.input, disabled: loading, "aria-required": "true", "aria-invalid": !!error })),
|
|
226
|
-
React.createElement("div", null,
|
|
227
|
-
React.createElement("label", { htmlFor: "password", className: styles.label }, "Password"),
|
|
228
|
-
React.createElement("input", { id: "password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), placeholder: "Enter your password", required: true, className: styles.input, disabled: loading, "aria-required": "true", "aria-invalid": !!error })),
|
|
229
|
-
React.createElement("button", { type: "submit", disabled: loading, className: styles.button, "data-testid": "sign-in-submit" }, loading ? 'Signing in...' : 'Sign in'))))));
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export { SignIn, TernSecureAuth, TernSecureFirestore, TernSecureProvider, TernSecureStorage, useAuth };
|
|
233
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { TernSecureAuth, TernSecureFirestore, TernSecureStorage, signInWithEmail, loadFireConfig, validateConfig, TernSecureContext, useTernSecure, TernSecureClientProvider } from './app-router/client';
|
|
2
|
+
export { TernSecureProvider } from './app-router/server';
|
|
3
|
+
export { useAuth } from './hooks';
|
|
4
|
+
export { SignIn } from './components';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,wBAAwB,EAAsB,MAAM,qBAAqB,CAAA;AAC7N,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createStyles: (prefix: string, styles: Record<string, React.CSSProperties>) => Record<string, string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
let styleSheet = null;
|
|
2
|
+
if (typeof window !== 'undefined') {
|
|
3
|
+
styleSheet = document.createElement('style');
|
|
4
|
+
styleSheet.setAttribute('data-tern-secure', '');
|
|
5
|
+
document.head.appendChild(styleSheet);
|
|
6
|
+
}
|
|
7
|
+
export const createStyles = (prefix, styles) => {
|
|
8
|
+
if (!styleSheet)
|
|
9
|
+
return {};
|
|
10
|
+
const classNames = Object.entries(styles).reduce((acc, [key, rules]) => {
|
|
11
|
+
const className = `${prefix}-${key}`;
|
|
12
|
+
const cssRules = Object.entries(rules).map(([prop, value]) => {
|
|
13
|
+
const cssProperty = prop.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
14
|
+
return `${cssProperty}: ${value};`;
|
|
15
|
+
}).join(' ');
|
|
16
|
+
const cssRule = `.${className} { ${cssRules} }`;
|
|
17
|
+
styleSheet.sheet?.insertRule(cssRule, styleSheet.sheet.cssRules.length);
|
|
18
|
+
return { ...acc, [key]: className };
|
|
19
|
+
}, {});
|
|
20
|
+
return classNames;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=create-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-styles.js","sourceRoot":"","sources":["../../src/utils/create-styles.ts"],"names":[],"mappings":"AAAA,IAAI,UAAU,GAA4B,IAAI,CAAC;AAE/C,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,UAAU,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAChD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,MAA2C,EAAE,EAAE;IAC1F,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAE3B,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACrE,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;YAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YAClE,OAAO,GAAG,WAAW,KAAK,KAAK,GAAG,CAAC;QACrC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,MAAM,OAAO,GAAG,IAAI,SAAS,MAAM,QAAQ,IAAI,CAAC;QAChD,UAAW,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,UAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE1E,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC;IACtC,CAAC,EAAE,EAA4B,CAAC,CAAC;IAEjC,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tern-secure/nextjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"main": "./dist/index.js",
|
|
17
17
|
"module": "./dist/index.js",
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "tsc --build",
|
|
20
20
|
"clean": "tsc --build --clean",
|
|
21
21
|
"dev": "tsc --watch",
|
|
22
22
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
@@ -67,8 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"types": "./dist/index.d.ts",
|
|
69
69
|
"files": [
|
|
70
|
-
"dist"
|
|
71
|
-
"styles"
|
|
70
|
+
"dist"
|
|
72
71
|
],
|
|
73
72
|
"peerDependencies": {
|
|
74
73
|
"firebase": "^10.0.0",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { getTernSecureAuth } from './client-init';
|
|
4
|
-
let globalAuthState = {
|
|
5
|
-
user: null,
|
|
6
|
-
loading: true,
|
|
7
|
-
error: null,
|
|
8
|
-
initialized: false
|
|
9
|
-
};
|
|
10
|
-
let listeners = [];
|
|
11
|
-
function setGlobalAuthState(newState) {
|
|
12
|
-
globalAuthState = { ...globalAuthState, ...newState };
|
|
13
|
-
listeners.forEach(listener => listener(globalAuthState));
|
|
14
|
-
}
|
|
15
|
-
export function subscribeToAuthState(listener) {
|
|
16
|
-
listeners.push(listener);
|
|
17
|
-
listener(globalAuthState);
|
|
18
|
-
return () => {
|
|
19
|
-
listeners = listeners.filter(l => l !== listener);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export default function ClientProvider() {
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
const auth = getTernSecureAuth();
|
|
25
|
-
const unsubscribe = auth.onAuthStateChanged((user) => {
|
|
26
|
-
setGlobalAuthState({ user, loading: false, error: null, initialized: true });
|
|
27
|
-
}, (error) => {
|
|
28
|
-
setGlobalAuthState({ user: null, loading: false, error, initialized: true });
|
|
29
|
-
});
|
|
30
|
-
return () => unsubscribe();
|
|
31
|
-
}, []);
|
|
32
|
-
return null; // This component doesn't render anything
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=ClientProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientProvider.js","sourceRoot":"","sources":["../../../src/app-router/client/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AW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/E,CAAC,CACF,CAAC;QAEF,OAAO,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,IAAI,CAAC,CAAC,yCAAyC;AACxD,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AuthState } from '../../../types/ternsecure';
|
|
3
|
-
type ProviderProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
value: AuthState;
|
|
6
|
-
onChange: (state: AuthState) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare function ReactTernSecureProvider({ children, value, onChange }: ProviderProps): React.JSX.Element;
|
|
9
|
-
export declare function useTernSecure(): {
|
|
10
|
-
user: null;
|
|
11
|
-
isLoaded: boolean;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export function ReactTernSecureProvider({ children, value, onChange }) {
|
|
4
|
-
// Add any core React functionality here
|
|
5
|
-
return (React.createElement("div", { "data-tern-secure-provider": true }, children));
|
|
6
|
-
}
|
|
7
|
-
// Add hooks for consuming the auth state
|
|
8
|
-
export function useTernSecure() {
|
|
9
|
-
// Implementation here
|
|
10
|
-
return {
|
|
11
|
-
user: null,
|
|
12
|
-
isLoaded: false,
|
|
13
|
-
// ... other auth state
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=ReactTernSecureProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReactTernSecureProvider.js","sourceRoot":"","sources":["../../../../src/app-router/client/providers/ReactTernSecureProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,MAAM,UAAU,uBAAuB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAiB;IAClF,wCAAwC;IACxC,OAAO,CACL,kEACG,QAAQ,CACL,CACP,CAAA;AACH,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,aAAa;IAC3B,sBAAsB;IACtB,OAAO;QACL,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,KAAK;QACf,uBAAuB;KACxB,CAAA;AACH,CAAC"}
|
package/dist/jest.setup.d.ts
DELETED
|
File without changes
|
package/dist/jest.setup.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
process.env.NEXT_PUBLIC_FIREBASE_API_KEY = 'test-api-key';
|
|
3
|
-
process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN = 'test-auth-domain';
|
|
4
|
-
process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID = 'test-project-id';
|
|
5
|
-
process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET = 'test-bucket';
|
|
6
|
-
process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID = 'test-sender-id';
|
|
7
|
-
process.env.NEXT_PUBLIC_FIREBASE_APP_ID = 'test-app-id';
|
|
8
|
-
//# sourceMappingURL=jest.setup.js.map
|
package/dist/jest.setup.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.setup.js","sourceRoot":"","sources":["../jest.setup.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,GAAG,CAAC,4BAA4B,GAAG,cAAc,CAAC;AAC1D,OAAO,CAAC,GAAG,CAAC,gCAAgC,GAAG,kBAAkB,CAAC;AAClE,OAAO,CAAC,GAAG,CAAC,+BAA+B,GAAG,iBAAiB,CAAC;AAChE,OAAO,CAAC,GAAG,CAAC,mCAAmC,GAAG,aAAa,CAAC;AAChE,OAAO,CAAC,GAAG,CAAC,wCAAwC,GAAG,gBAAgB,CAAC;AACxE,OAAO,CAAC,GAAG,CAAC,2BAA2B,GAAG,aAAa,CAAC"}
|