@tern-secure/nextjs 3.0.4 → 3.0.5
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/index.js +342 -5
- package/package.json +5 -5
- package/dist/app-router/client/auth.js +0 -7
- package/dist/app-router/client/auth.js.map +0 -1
- package/dist/app-router/client/client-init.js +0 -18
- package/dist/app-router/client/client-init.js.map +0 -1
- package/dist/app-router/client/config.js +0 -18
- package/dist/app-router/client/config.js.map +0 -1
- package/dist/app-router/client/index.js +0 -6
- package/dist/app-router/client/index.js.map +0 -1
- package/dist/app-router/client/providers/ternSecureClientProvider.js +0 -8
- package/dist/app-router/client/providers/ternSecureClientProvider.js.map +0 -1
- package/dist/app-router/client/providers/ternSecureContext.js +0 -41
- package/dist/app-router/client/providers/ternSecureContext.js.map +0 -1
- package/dist/app-router/server/ErrorBoundary.d.ts +0 -15
- package/dist/app-router/server/ErrorBoundary.js +0 -22
- package/dist/app-router/server/ErrorBoundary.js.map +0 -1
- package/dist/app-router/server/index.js +0 -2
- package/dist/app-router/server/index.js.map +0 -1
- package/dist/app-router/server/providers/TernSecureServerProvider.js +0 -30
- package/dist/app-router/server/providers/TernSecureServerProvider.js.map +0 -1
- package/dist/components/index.js +0 -2
- package/dist/components/index.js.map +0 -1
- package/dist/components/sign-in.js +0 -45
- package/dist/components/sign-in.js.map +0 -1
- package/dist/errors/index.js +0 -12
- package/dist/errors/index.js.map +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useAuth.js +0 -58
- package/dist/hooks/useAuth.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/styles/index.css +0 -3
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/utils/create-styles.js +0 -127
- package/dist/utils/create-styles.js.map +0 -1
- package/dist/utils/index.js +0 -2
- package/dist/utils/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,342 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { getApps, initializeApp } from 'firebase/app';
|
|
2
|
+
import { getAuth, setPersistence, browserSessionPersistence, signInWithEmailAndPassword } from 'firebase/auth';
|
|
3
|
+
import { getFirestore } from 'firebase/firestore';
|
|
4
|
+
import { getStorage } from 'firebase/storage';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import React__default, { createContext, useContext, useState, useEffect } from 'react';
|
|
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
|
+
const PREFIX = 'tern';
|
|
176
|
+
// Singleton to track style injection
|
|
177
|
+
const styleInjection = {
|
|
178
|
+
isInjected: false,
|
|
179
|
+
styleElement: null
|
|
180
|
+
};
|
|
181
|
+
const defaultClassNames = {
|
|
182
|
+
container: `${PREFIX}-container`,
|
|
183
|
+
header: `${PREFIX}-header`,
|
|
184
|
+
title: `${PREFIX}-title`,
|
|
185
|
+
formWrapper: `${PREFIX}-formWrapper`,
|
|
186
|
+
formContainer: `${PREFIX}-formContainer`,
|
|
187
|
+
form: `${PREFIX}-form`,
|
|
188
|
+
label: `${PREFIX}-label`,
|
|
189
|
+
input: `${PREFIX}-input`,
|
|
190
|
+
button: `${PREFIX}-button`,
|
|
191
|
+
error: `${PREFIX}-error`
|
|
192
|
+
};
|
|
193
|
+
// Create styles once and cache them
|
|
194
|
+
function createStyleSheet(styles) {
|
|
195
|
+
if (typeof window === 'undefined')
|
|
196
|
+
return defaultClassNames;
|
|
197
|
+
// Return early if styles are already injected
|
|
198
|
+
if (styleInjection.isInjected) {
|
|
199
|
+
return defaultClassNames;
|
|
200
|
+
}
|
|
201
|
+
// Find existing style element or create new one
|
|
202
|
+
let styleElement = document.querySelector('[data-tern-secure]');
|
|
203
|
+
if (!styleElement) {
|
|
204
|
+
styleElement = document.createElement('style');
|
|
205
|
+
styleElement.setAttribute('data-tern-secure', '');
|
|
206
|
+
document.head.appendChild(styleElement);
|
|
207
|
+
styleInjection.styleElement = styleElement;
|
|
208
|
+
}
|
|
209
|
+
// Create CSS rules
|
|
210
|
+
const cssRules = Object.entries(styles).map(([key, rules]) => {
|
|
211
|
+
const className = defaultClassNames[key];
|
|
212
|
+
const cssProperties = Object.entries(rules).map(([prop, value]) => {
|
|
213
|
+
const cssProperty = prop.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
214
|
+
return `${cssProperty}: ${value};`;
|
|
215
|
+
}).join(' ');
|
|
216
|
+
return `.${className} { ${cssProperties} }`;
|
|
217
|
+
}).join('\n');
|
|
218
|
+
// Insert styles only once
|
|
219
|
+
styleElement.textContent = cssRules;
|
|
220
|
+
styleInjection.isInjected = true;
|
|
221
|
+
return defaultClassNames;
|
|
222
|
+
}
|
|
223
|
+
// Style configuration
|
|
224
|
+
const styleConfig = {
|
|
225
|
+
container: {
|
|
226
|
+
display: 'flex',
|
|
227
|
+
minHeight: '100%',
|
|
228
|
+
flex: '1',
|
|
229
|
+
flexDirection: 'column',
|
|
230
|
+
justifyContent: 'center',
|
|
231
|
+
padding: '3rem 1.5rem'
|
|
232
|
+
},
|
|
233
|
+
header: {
|
|
234
|
+
margin: '0 auto',
|
|
235
|
+
width: '100%',
|
|
236
|
+
maxWidth: '28rem'
|
|
237
|
+
},
|
|
238
|
+
title: {
|
|
239
|
+
marginTop: '1.5rem',
|
|
240
|
+
textAlign: 'center',
|
|
241
|
+
fontSize: '1.875rem',
|
|
242
|
+
fontWeight: '700',
|
|
243
|
+
lineHeight: '2.25rem',
|
|
244
|
+
letterSpacing: '-0.025em',
|
|
245
|
+
color: 'var(--tern-text-primary, #111827)'
|
|
246
|
+
},
|
|
247
|
+
formWrapper: {
|
|
248
|
+
marginTop: '2.5rem',
|
|
249
|
+
margin: '0 auto',
|
|
250
|
+
width: '100%',
|
|
251
|
+
maxWidth: '30rem'
|
|
252
|
+
},
|
|
253
|
+
formContainer: {
|
|
254
|
+
padding: '3rem 1.5rem',
|
|
255
|
+
boxShadow: '0 1px 3px 0 rgb(0 0 0 / 0.1)',
|
|
256
|
+
borderRadius: '0.5rem',
|
|
257
|
+
backgroundColor: 'var(--tern-background, white)'
|
|
258
|
+
},
|
|
259
|
+
form: {
|
|
260
|
+
display: 'flex',
|
|
261
|
+
flexDirection: 'column',
|
|
262
|
+
gap: '1rem'
|
|
263
|
+
},
|
|
264
|
+
label: {
|
|
265
|
+
display: 'block',
|
|
266
|
+
fontSize: '0.875rem',
|
|
267
|
+
fontWeight: '500',
|
|
268
|
+
color: 'var(--tern-text-secondary, #374151)'
|
|
269
|
+
},
|
|
270
|
+
input: {
|
|
271
|
+
marginTop: '0.25rem',
|
|
272
|
+
display: 'block',
|
|
273
|
+
width: '100%',
|
|
274
|
+
padding: '0.5rem 0.75rem',
|
|
275
|
+
borderRadius: '0.375rem',
|
|
276
|
+
border: '1px solid var(--tern-border, #D1D5DB)',
|
|
277
|
+
backgroundColor: 'var(--tern-input-background, white)',
|
|
278
|
+
color: 'var(--tern-text-primary, #111827)'
|
|
279
|
+
},
|
|
280
|
+
button: {
|
|
281
|
+
display: 'flex',
|
|
282
|
+
width: '100%',
|
|
283
|
+
justifyContent: 'center',
|
|
284
|
+
padding: '0.5rem 1rem',
|
|
285
|
+
fontSize: '0.875rem',
|
|
286
|
+
fontWeight: '500',
|
|
287
|
+
color: 'white',
|
|
288
|
+
backgroundColor: 'var(--tern-primary, #2563EB)',
|
|
289
|
+
border: 'none',
|
|
290
|
+
borderRadius: '0.375rem',
|
|
291
|
+
cursor: 'pointer'
|
|
292
|
+
},
|
|
293
|
+
error: {
|
|
294
|
+
color: 'var(--tern-error, #DC2626)',
|
|
295
|
+
fontSize: '0.875rem'
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
// Export pre-created styles
|
|
299
|
+
const styles = createStyleSheet(styleConfig);
|
|
300
|
+
|
|
301
|
+
function SignIn({ onSuccess, onError, redirectUrl, className = '', style, customStyles = {} }) {
|
|
302
|
+
const [email, setEmail] = useState('');
|
|
303
|
+
const [password, setPassword] = useState('');
|
|
304
|
+
const [loading, setLoading] = useState(false);
|
|
305
|
+
const [error, setError] = useState('');
|
|
306
|
+
const handleSubmit = async (e) => {
|
|
307
|
+
e.preventDefault();
|
|
308
|
+
setLoading(true);
|
|
309
|
+
setError('');
|
|
310
|
+
try {
|
|
311
|
+
await signInWithEmail({ email, password });
|
|
312
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
313
|
+
if (redirectUrl) {
|
|
314
|
+
window.location.href = redirectUrl;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
catch (err) {
|
|
318
|
+
const errorMessage = err instanceof Error ? err.message : 'Failed to sign in';
|
|
319
|
+
setError(errorMessage);
|
|
320
|
+
onError === null || onError === void 0 ? void 0 : onError(err instanceof Error ? err : new Error('Failed to sign in'));
|
|
321
|
+
}
|
|
322
|
+
finally {
|
|
323
|
+
setLoading(false);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
return (React.createElement("div", { className: `${styles.container} ${customStyles.container || ''}`, style: style },
|
|
327
|
+
React.createElement("div", { className: `${styles.header} ${customStyles.header || ''}` },
|
|
328
|
+
React.createElement("h2", { className: `${styles.title} ${customStyles.title || ''}` }, "Sign in to your account")),
|
|
329
|
+
React.createElement("div", { className: `${styles.formWrapper} ${customStyles.formWrapper || ''}` },
|
|
330
|
+
React.createElement("div", { className: `${styles.formContainer} ${customStyles.formContainer || ''}` },
|
|
331
|
+
React.createElement("form", { onSubmit: handleSubmit, className: `${styles.form} ${customStyles.form || ''} ${className}`, role: "form", "aria-label": "Sign in form" },
|
|
332
|
+
error && (React.createElement("div", { className: `${styles.error} ${customStyles.errorText || ''}`, role: "alert", "aria-live": "polite" }, error)),
|
|
333
|
+
React.createElement("div", null,
|
|
334
|
+
React.createElement("label", { htmlFor: "email", className: `${styles.label} ${customStyles.label || ''}` }, "Email"),
|
|
335
|
+
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 })),
|
|
336
|
+
React.createElement("div", null,
|
|
337
|
+
React.createElement("label", { htmlFor: "password", className: `${styles.label} ${customStyles.label || ''}` }, "Password"),
|
|
338
|
+
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 })),
|
|
339
|
+
React.createElement("button", { type: "submit", disabled: loading, className: `${styles.button} ${customStyles.button || ''}`, "data-testid": "sign-in-submit" }, loading ? 'Signing in...' : 'Sign in'))))));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export { SignIn, TernSecureAuth, TernSecureClientProvider$1 as TernSecureClientProvider, TernSecureContext, TernSecureFirestore, TernSecureProvider, TernSecureStorage, loadFireConfig, signInWithEmail, useAuth, useTernSecure, validateConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tern-secure/nextjs",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -16,12 +16,11 @@
|
|
|
16
16
|
"main": "./dist/index.js",
|
|
17
17
|
"module": "./dist/index.js",
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
20
|
-
|
|
19
|
+
"build": "rollup -c",
|
|
20
|
+
"clean": "rimraf dist",
|
|
21
21
|
"dev": "tsc --watch",
|
|
22
22
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
23
|
-
"format": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
24
|
-
"prepublishOnly": "npm run build"
|
|
23
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
25
24
|
},
|
|
26
25
|
"keywords": [],
|
|
27
26
|
"author": "",
|
|
@@ -57,6 +56,7 @@
|
|
|
57
56
|
"prettier": "^3.3.3",
|
|
58
57
|
"react": "^18.3.1",
|
|
59
58
|
"react-dom": "^18.3.1",
|
|
59
|
+
"rimraf": "^6.0.1",
|
|
60
60
|
"rollup": "^4.27.4",
|
|
61
61
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
62
62
|
"tailwindcss": "^3.4.15",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TernSecureAuth } from './index';
|
|
2
|
-
import { signInWithEmailAndPassword } from 'firebase/auth';
|
|
3
|
-
export async function signInWithEmail({ email, password }) {
|
|
4
|
-
const auth = TernSecureAuth();
|
|
5
|
-
return signInWithEmailAndPassword(auth, email, password);
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/app-router/client/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,0BAA0B,EAAuB,MAAM,eAAe,CAAA;AAO/E,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,KAAK,EACL,QAAQ,EACU;IAClB,MAAM,IAAI,GAAG,cAAc,EAAE,CAAA;IAC7B,OAAO,0BAA0B,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;AAC1D,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getApps, initializeApp } from 'firebase/app';
|
|
2
|
-
import { getAuth, setPersistence, browserSessionPersistence } from 'firebase/auth';
|
|
3
|
-
import { getFirestore } from 'firebase/firestore';
|
|
4
|
-
import { getStorage } from 'firebase/storage';
|
|
5
|
-
import { loadFireConfig, validateConfig } from './index';
|
|
6
|
-
// Initialize immediately
|
|
7
|
-
const app = (() => {
|
|
8
|
-
const config = validateConfig(loadFireConfig());
|
|
9
|
-
return getApps().length ? getApps()[0] : initializeApp(config);
|
|
10
|
-
})();
|
|
11
|
-
const auth = getAuth(app);
|
|
12
|
-
setPersistence(auth, browserSessionPersistence); //to change later user should be able to choose persistance
|
|
13
|
-
const firestore = getFirestore(app);
|
|
14
|
-
const storage = getStorage(app);
|
|
15
|
-
export const TernSecureAuth = () => auth;
|
|
16
|
-
export const TernSecureFirestore = () => firestore;
|
|
17
|
-
export const TernSecureStorage = () => storage;
|
|
18
|
-
//# sourceMappingURL=client-init.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-init.js","sourceRoot":"","sources":["../../../src/app-router/client/client-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzD,yBAAyB;AACzB,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE;IAChB,MAAM,MAAM,GAAG,cAAc,CAAC,cAAc,EAAE,CAAC,CAAC;IAChD,OAAO,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC,EAAE,CAAC;AAEL,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAC1B,cAAc,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC,CAAC,2DAA2D;AAC5G,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;AACpC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAEhC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const loadFireConfig = () => ({
|
|
2
|
-
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
|
|
3
|
-
authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
|
|
4
|
-
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
|
|
5
|
-
storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,
|
|
6
|
-
messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
|
|
7
|
-
appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID,
|
|
8
|
-
measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID,
|
|
9
|
-
});
|
|
10
|
-
export const validateConfig = (config) => {
|
|
11
|
-
Object.entries(config).forEach(([key, value]) => {
|
|
12
|
-
if (!value) {
|
|
13
|
-
throw new Error(`Missing environment variable: NEXT_PUBLIC_FIREBASE_${key.toUpperCase()}`);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return config;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/app-router/client/config.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG,GAAqB,EAAE,CAAC,CAAC;IACrD,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,4BAAsC;IAC1D,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,gCAA0C;IAClE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,+BAAyC;IAChE,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,mCAA6C;IACxE,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,wCAAkD;IACjF,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,2BAAqC;IACxD,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,mCAA6C;CACzE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAwB,EAAE,EAAE;IACzD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sDAAsD,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC7F,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { TernSecureAuth, TernSecureFirestore, TernSecureStorage } from './client-init';
|
|
2
|
-
export { signInWithEmail } from './auth';
|
|
3
|
-
export { loadFireConfig, validateConfig } from './config';
|
|
4
|
-
export { TernSecureContext, useTernSecure } from './providers/ternSecureContext';
|
|
5
|
-
export { TernSecureClientProvider } from './providers/ternSecureClientProvider';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app-router/client/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,eAAe,EAAC,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import { initialState, TernSecureContext } from './ternSecureContext';
|
|
4
|
-
export function TernSecureClientProvider({ children }) {
|
|
5
|
-
const stateAndUpdater = useState(initialState);
|
|
6
|
-
return (React.createElement(TernSecureContext.Provider, { value: stateAndUpdater }, children));
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=ternSecureClientProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternSecureClientProvider.js","sourceRoot":"","sources":["../../../../src/app-router/client/providers/ternSecureClientProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAQrE,MAAM,UAAU,wBAAwB,CAAC,EAAE,QAAQ,EAAyB;IAC1E,MAAM,eAAe,GAAG,QAAQ,CAAkB,YAAY,CAAC,CAAA;IAE/D,OAAO,CACL,oBAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,IAC/C,QAAQ,CACkB,CAC9B,CAAA;AACH,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { createContext, useContext } from 'react';
|
|
3
|
-
const createTernSecureContext = () => {
|
|
4
|
-
const initialState = {
|
|
5
|
-
firebase: {
|
|
6
|
-
initialized: false,
|
|
7
|
-
error: null
|
|
8
|
-
},
|
|
9
|
-
auth: {
|
|
10
|
-
user: null,
|
|
11
|
-
loading: true,
|
|
12
|
-
error: null,
|
|
13
|
-
isSignedIn: false
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
return createContext([initialState, () => { }]);
|
|
17
|
-
};
|
|
18
|
-
// Create context instance only when imported on client
|
|
19
|
-
const TernSecureContext = createTernSecureContext();
|
|
20
|
-
const useTernSecure = (hookname) => {
|
|
21
|
-
const context = useContext(TernSecureContext);
|
|
22
|
-
if (!context) {
|
|
23
|
-
throw new Error(`${hookname} must be used within TernSecureProvider`);
|
|
24
|
-
}
|
|
25
|
-
return context;
|
|
26
|
-
};
|
|
27
|
-
// Export initial state for reuse
|
|
28
|
-
export const initialState = {
|
|
29
|
-
firebase: {
|
|
30
|
-
initialized: false,
|
|
31
|
-
error: null
|
|
32
|
-
},
|
|
33
|
-
auth: {
|
|
34
|
-
user: null,
|
|
35
|
-
loading: true,
|
|
36
|
-
error: null,
|
|
37
|
-
isSignedIn: false
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
export { TernSecureContext, useTernSecure };
|
|
41
|
-
//# sourceMappingURL=ternSecureContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternSecureContext.js","sourceRoot":"","sources":["../../../../src/app-router/client/providers/ternSecureContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGxD,MAAM,uBAAuB,GAAG,GAAG,EAAE;IACnC,MAAM,YAAY,GAAoB;QACpC,QAAQ,EAAE;YACR,WAAW,EAAE,KAAK;YAClB,KAAK,EAAE,IAAI;SACZ;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,KAAK;SAClB;KACF,CAAA;IAED,OAAO,aAAa,CAA2E,CAAC,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAA;AAC1H,CAAC,CAAA;AAED,uDAAuD;AACvD,MAAM,iBAAiB,GAAG,uBAAuB,EAAE,CAAA;AAEnD,MAAM,aAAa,GAAG,CAAC,QAAiB,EAAE,EAAE;IAC1C,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,GAAG,QAAQ,yCAAyC,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,iCAAiC;AACjC,MAAM,CAAC,MAAM,YAAY,GAAoB;IAC3C,QAAQ,EAAE;QACR,WAAW,EAAE,KAAK;QAClB,KAAK,EAAE,IAAI;KACZ;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,KAAK;KAClB;CACF,CAAA;AAED,OAAO,EACL,iBAAiB,EACjB,aAAa,EACd,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { ErrorInfo, ReactNode } from 'react';
|
|
2
|
-
interface ErrorBoundaryProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
fallback: ReactNode;
|
|
5
|
-
}
|
|
6
|
-
interface ErrorBoundaryState {
|
|
7
|
-
hasError: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
10
|
-
constructor(props: ErrorBoundaryProps);
|
|
11
|
-
static getDerivedStateFromError(_: Error): ErrorBoundaryState;
|
|
12
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
13
|
-
render(): React.ReactNode;
|
|
14
|
-
}
|
|
15
|
-
export default ErrorBoundary;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
class ErrorBoundary extends React.Component {
|
|
4
|
-
constructor(props) {
|
|
5
|
-
super(props);
|
|
6
|
-
this.state = { hasError: false };
|
|
7
|
-
}
|
|
8
|
-
static getDerivedStateFromError(_) {
|
|
9
|
-
return { hasError: true };
|
|
10
|
-
}
|
|
11
|
-
componentDidCatch(error, errorInfo) {
|
|
12
|
-
console.error('TernSecureProvider error:', error, errorInfo);
|
|
13
|
-
}
|
|
14
|
-
render() {
|
|
15
|
-
if (this.state.hasError) {
|
|
16
|
-
return this.props.fallback;
|
|
17
|
-
}
|
|
18
|
-
return this.props.children;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export default ErrorBoundary;
|
|
22
|
-
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../src/app-router/server/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAA+B,MAAM,OAAO,CAAC;AAWpD,MAAM,aAAc,SAAQ,KAAK,CAAC,SAAiD;IACjF,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,CAAQ;QACtC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED,iBAAiB,CAAC,KAAY,EAAE,SAAoB;QAClD,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC7B,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app-router/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import dynamic from 'next/dynamic';
|
|
3
|
-
// Dynamically import the client provider with no SSR
|
|
4
|
-
const TernSecureClientProvider = dynamic(() => import('../../client/providers/ternSecureClientProvider').then(mod => mod.TernSecureClientProvider), {
|
|
5
|
-
//ssr: false,
|
|
6
|
-
loading: () => null // Return null or a loading indicator
|
|
7
|
-
});
|
|
8
|
-
export function TernSecureProvider({ children }) {
|
|
9
|
-
// Check if the children contain html/body tags
|
|
10
|
-
const isRootLayout = React.Children.toArray(children).some(child => React.isValidElement(child) && child.type === 'html');
|
|
11
|
-
if (isRootLayout) {
|
|
12
|
-
// If this is the root layout, inject our provider after the body tag
|
|
13
|
-
return React.Children.map(children, child => {
|
|
14
|
-
if (React.isValidElement(child) && child.type === 'html') {
|
|
15
|
-
return React.cloneElement(child, {}, React.Children.map(child.props.children, bodyChild => {
|
|
16
|
-
if (React.isValidElement(bodyChild) && bodyChild.type === 'body') {
|
|
17
|
-
// Type assertion to access props safely
|
|
18
|
-
const bodyProps = bodyChild.props;
|
|
19
|
-
return React.cloneElement(bodyChild, {}, React.createElement(TernSecureClientProvider, null, bodyProps.children));
|
|
20
|
-
}
|
|
21
|
-
return bodyChild;
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
return child;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
// For non-root layouts, wrap normally
|
|
28
|
-
return React.createElement(TernSecureClientProvider, null, children);
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=TernSecureServerProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TernSecureServerProvider.js","sourceRoot":"","sources":["../../../../src/app-router/server/providers/TernSecureServerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,OAAO,MAAM,cAAc,CAAA;AAMlC,qDAAqD;AACrD,MAAM,wBAAwB,GAAG,OAAO,CACtC,GAAG,EAAE,CAAC,MAAM,CAAC,iDAAiD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,wBAAwB,CAAC,EACzG;IACE,aAAa;IACb,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,qCAAqC;CAC1D,CACF,CAAA;AAED,MAAM,UAAU,kBAAkB,CAAC,EAAE,QAAQ,EAA2B;IACtE,+CAA+C;IAC/C,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CACxD,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAC9D,CAAC;IAEF,IAAI,YAAY,EAAE,CAAC;QACjB,qEAAqE;QACrE,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE;YAC1C,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBACzD,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,EACjC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE;oBACnD,IAAI,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;wBACjE,wCAAwC;wBACxC,MAAM,SAAS,GAAG,SAAS,CAAC,KAAgC,CAAC;wBAC7D,OAAO,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,EACrC,oBAAC,wBAAwB,QACtB,SAAS,CAAC,QAAQ,CACM,CAC5B,CAAC;oBACJ,CAAC;oBACD,OAAO,SAAS,CAAC;gBACnB,CAAC,CAAC,CACH,CAAC;YACJ,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAED,sCAAsC;IACtC,OAAO,oBAAC,wBAAwB,QAAE,QAAQ,CAA4B,CAAC;AACzE,CAAC"}
|
package/dist/components/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { signInWithEmail } from '../app-router/client';
|
|
4
|
-
import { styles } from '../utils/create-styles';
|
|
5
|
-
export function SignIn({ onSuccess, onError, redirectUrl, className = '', style, customStyles = {} }) {
|
|
6
|
-
const [email, setEmail] = useState('');
|
|
7
|
-
const [password, setPassword] = useState('');
|
|
8
|
-
const [loading, setLoading] = useState(false);
|
|
9
|
-
const [error, setError] = useState('');
|
|
10
|
-
const handleSubmit = async (e) => {
|
|
11
|
-
e.preventDefault();
|
|
12
|
-
setLoading(true);
|
|
13
|
-
setError('');
|
|
14
|
-
try {
|
|
15
|
-
await signInWithEmail({ email, password });
|
|
16
|
-
onSuccess?.();
|
|
17
|
-
if (redirectUrl) {
|
|
18
|
-
window.location.href = redirectUrl;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
const errorMessage = err instanceof Error ? err.message : 'Failed to sign in';
|
|
23
|
-
setError(errorMessage);
|
|
24
|
-
onError?.(err instanceof Error ? err : new Error('Failed to sign in'));
|
|
25
|
-
}
|
|
26
|
-
finally {
|
|
27
|
-
setLoading(false);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
return (React.createElement("div", { className: `${styles.container} ${customStyles.container || ''}`, style: style },
|
|
31
|
-
React.createElement("div", { className: `${styles.header} ${customStyles.header || ''}` },
|
|
32
|
-
React.createElement("h2", { className: `${styles.title} ${customStyles.title || ''}` }, "Sign in to your account")),
|
|
33
|
-
React.createElement("div", { className: `${styles.formWrapper} ${customStyles.formWrapper || ''}` },
|
|
34
|
-
React.createElement("div", { className: `${styles.formContainer} ${customStyles.formContainer || ''}` },
|
|
35
|
-
React.createElement("form", { onSubmit: handleSubmit, className: `${styles.form} ${customStyles.form || ''} ${className}`, role: "form", "aria-label": "Sign in form" },
|
|
36
|
-
error && (React.createElement("div", { className: `${styles.error} ${customStyles.errorText || ''}`, role: "alert", "aria-live": "polite" }, error)),
|
|
37
|
-
React.createElement("div", null,
|
|
38
|
-
React.createElement("label", { htmlFor: "email", className: `${styles.label} ${customStyles.label || ''}` }, "Email"),
|
|
39
|
-
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 })),
|
|
40
|
-
React.createElement("div", null,
|
|
41
|
-
React.createElement("label", { htmlFor: "password", className: `${styles.label} ${customStyles.label || ''}` }, "Password"),
|
|
42
|
-
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 })),
|
|
43
|
-
React.createElement("button", { type: "submit", disabled: loading, className: `${styles.button} ${customStyles.button || ''}`, "data-testid": "sign-in-submit" }, loading ? 'Signing in...' : 'Sign in'))))));
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=sign-in.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":"AAAA,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,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAsB/C,MAAM,UAAU,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAS,GAAG,EAAE,EACd,KAAK,EACL,YAAY,GAAG,EAAE,EACL;IACZ,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IACtC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC5C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEtC,MAAM,YAAY,GAAG,KAAK,EAAE,CAAkB,EAAE,EAAE;QAChD,CAAC,CAAC,cAAc,EAAE,CAAA;QAClB,UAAU,CAAC,IAAI,CAAC,CA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M,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/errors/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const ERRORS = {
|
|
2
|
-
SERVER_SIDE_INITIALIZATION: 'TernSecure must be initialized on the client side',
|
|
3
|
-
NOT_INITIALIZED: 'TernSecure services are not initialized. Call initializeTernSecure() first',
|
|
4
|
-
HOOK_CONTEXT: (hookName) => `${hookName} must be used within TernSecureProvider`,
|
|
5
|
-
};
|
|
6
|
-
export class TernSecureError extends Error {
|
|
7
|
-
constructor(message) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = 'TernSecureError';
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/dist/errors/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,0BAA0B,EAAE,mDAAmD;IAC/E,eAAe,EAAE,4EAA4E;IAC7F,YAAY,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,GAAG,QAAQ,yCAAyC;CAChF,CAAC;AAEX,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
|
package/dist/hooks/index.js
DELETED
package/dist/hooks/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA"}
|
package/dist/hooks/useAuth.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { TernSecureAuth } from '../app-router/client';
|
|
4
|
-
import { useTernSecure } from '../app-router/client/';
|
|
5
|
-
export function useAuth() {
|
|
6
|
-
const [state, setState] = useTernSecure('useAuth');
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
try {
|
|
9
|
-
const auth = TernSecureAuth(); // This initializes Firebase
|
|
10
|
-
setState(prev => ({
|
|
11
|
-
...prev,
|
|
12
|
-
firebase: {
|
|
13
|
-
initialized: true,
|
|
14
|
-
error: null
|
|
15
|
-
}
|
|
16
|
-
}));
|
|
17
|
-
const unsubscribe = auth.onAuthStateChanged((user) => {
|
|
18
|
-
setState(prev => ({
|
|
19
|
-
...prev,
|
|
20
|
-
auth: {
|
|
21
|
-
user,
|
|
22
|
-
loading: false,
|
|
23
|
-
error: null,
|
|
24
|
-
isSignedIn: !!user
|
|
25
|
-
}
|
|
26
|
-
}));
|
|
27
|
-
}, (error) => {
|
|
28
|
-
setState(prev => ({
|
|
29
|
-
...prev,
|
|
30
|
-
auth: {
|
|
31
|
-
user: null,
|
|
32
|
-
loading: false,
|
|
33
|
-
error,
|
|
34
|
-
isSignedIn: false
|
|
35
|
-
}
|
|
36
|
-
}));
|
|
37
|
-
});
|
|
38
|
-
return () => unsubscribe();
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
setState(prev => ({
|
|
42
|
-
...prev,
|
|
43
|
-
firebase: {
|
|
44
|
-
initialized: false,
|
|
45
|
-
error: error
|
|
46
|
-
},
|
|
47
|
-
auth: {
|
|
48
|
-
user: null,
|
|
49
|
-
loading: false,
|
|
50
|
-
error: error,
|
|
51
|
-
isSignedIn: false
|
|
52
|
-
}
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
}, []); // Only run once on mount
|
|
56
|
-
return state.auth;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=useAuth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,MAAM,UAAU,OAAO;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,aAAa,CAAC,SAAS,CAAC,CAAA;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,cAAc,EAAE,CAAA,CAAC,4BAA4B;YAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAChB,GAAG,IAAI;gBACP,QAAQ,EAAE;oBACR,WAAW,EAAE,IAAI;oBACjB,KAAK,EAAE,IAAI;iBACZ;aACF,CAAC,CAAC,CAAA;YAEH,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CACzC,CAAC,IAAI,EAAE,EAAE;gBACP,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAChB,GAAG,IAAI;oBACP,IAAI,EAAE;wBACJ,IAAI;wBACJ,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,IAAI;wBACX,UAAU,EAAE,CAAC,CAAC,IAAI;qBACnB;iBACF,CAAC,CAAC,CAAA;YACL,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;gBACR,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAChB,GAAG,IAAI;oBACP,IAAI,EAAE;wBACJ,IAAI,EAAE,IAAI;wBACV,OAAO,EAAE,KAAK;wBACd,KAAK;wBACL,UAAU,EAAE,KAAK;qBAClB;iBACF,CAAC,CAAC,CAAA;YACL,CAAC,CACF,CAAA;YAED,OAAO,GAAG,EAAE,CAAC,WAAW,EAAE,CAAA;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAChB,GAAG,IAAI;gBACP,QAAQ,EAAE;oBACR,WAAW,EAAE,KAAK;oBAClB,KAAK,EAAE,KAAc;iBACtB;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,IAAI;oBACV,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAc;oBACrB,UAAU,EAAE,KAAK;iBAClB;aACF,CAAC,CAAC,CAAA;QACL,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,yBAAyB;IAEhC,OAAO,KAAK,CAAC,IAAI,CAAA;AACnB,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/styles/index.css
DELETED
package/dist/types/index.js
DELETED
package/dist/types/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
const PREFIX = 'tern';
|
|
3
|
-
// Singleton to track style injection
|
|
4
|
-
const styleInjection = {
|
|
5
|
-
isInjected: false,
|
|
6
|
-
styleElement: null
|
|
7
|
-
};
|
|
8
|
-
export const defaultClassNames = {
|
|
9
|
-
container: `${PREFIX}-container`,
|
|
10
|
-
header: `${PREFIX}-header`,
|
|
11
|
-
title: `${PREFIX}-title`,
|
|
12
|
-
formWrapper: `${PREFIX}-formWrapper`,
|
|
13
|
-
formContainer: `${PREFIX}-formContainer`,
|
|
14
|
-
form: `${PREFIX}-form`,
|
|
15
|
-
label: `${PREFIX}-label`,
|
|
16
|
-
input: `${PREFIX}-input`,
|
|
17
|
-
button: `${PREFIX}-button`,
|
|
18
|
-
error: `${PREFIX}-error`
|
|
19
|
-
};
|
|
20
|
-
// Create styles once and cache them
|
|
21
|
-
function createStyleSheet(styles) {
|
|
22
|
-
if (typeof window === 'undefined')
|
|
23
|
-
return defaultClassNames;
|
|
24
|
-
// Return early if styles are already injected
|
|
25
|
-
if (styleInjection.isInjected) {
|
|
26
|
-
return defaultClassNames;
|
|
27
|
-
}
|
|
28
|
-
// Find existing style element or create new one
|
|
29
|
-
let styleElement = document.querySelector('[data-tern-secure]');
|
|
30
|
-
if (!styleElement) {
|
|
31
|
-
styleElement = document.createElement('style');
|
|
32
|
-
styleElement.setAttribute('data-tern-secure', '');
|
|
33
|
-
document.head.appendChild(styleElement);
|
|
34
|
-
styleInjection.styleElement = styleElement;
|
|
35
|
-
}
|
|
36
|
-
// Create CSS rules
|
|
37
|
-
const cssRules = Object.entries(styles).map(([key, rules]) => {
|
|
38
|
-
const className = defaultClassNames[key];
|
|
39
|
-
const cssProperties = Object.entries(rules).map(([prop, value]) => {
|
|
40
|
-
const cssProperty = prop.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
41
|
-
return `${cssProperty}: ${value};`;
|
|
42
|
-
}).join(' ');
|
|
43
|
-
return `.${className} { ${cssProperties} }`;
|
|
44
|
-
}).join('\n');
|
|
45
|
-
// Insert styles only once
|
|
46
|
-
styleElement.textContent = cssRules;
|
|
47
|
-
styleInjection.isInjected = true;
|
|
48
|
-
return defaultClassNames;
|
|
49
|
-
}
|
|
50
|
-
// Style configuration
|
|
51
|
-
export const styleConfig = {
|
|
52
|
-
container: {
|
|
53
|
-
display: 'flex',
|
|
54
|
-
minHeight: '100%',
|
|
55
|
-
flex: '1',
|
|
56
|
-
flexDirection: 'column',
|
|
57
|
-
justifyContent: 'center',
|
|
58
|
-
padding: '3rem 1.5rem'
|
|
59
|
-
},
|
|
60
|
-
header: {
|
|
61
|
-
margin: '0 auto',
|
|
62
|
-
width: '100%',
|
|
63
|
-
maxWidth: '28rem'
|
|
64
|
-
},
|
|
65
|
-
title: {
|
|
66
|
-
marginTop: '1.5rem',
|
|
67
|
-
textAlign: 'center',
|
|
68
|
-
fontSize: '1.875rem',
|
|
69
|
-
fontWeight: '700',
|
|
70
|
-
lineHeight: '2.25rem',
|
|
71
|
-
letterSpacing: '-0.025em',
|
|
72
|
-
color: 'var(--tern-text-primary, #111827)'
|
|
73
|
-
},
|
|
74
|
-
formWrapper: {
|
|
75
|
-
marginTop: '2.5rem',
|
|
76
|
-
margin: '0 auto',
|
|
77
|
-
width: '100%',
|
|
78
|
-
maxWidth: '30rem'
|
|
79
|
-
},
|
|
80
|
-
formContainer: {
|
|
81
|
-
padding: '3rem 1.5rem',
|
|
82
|
-
boxShadow: '0 1px 3px 0 rgb(0 0 0 / 0.1)',
|
|
83
|
-
borderRadius: '0.5rem',
|
|
84
|
-
backgroundColor: 'var(--tern-background, white)'
|
|
85
|
-
},
|
|
86
|
-
form: {
|
|
87
|
-
display: 'flex',
|
|
88
|
-
flexDirection: 'column',
|
|
89
|
-
gap: '1rem'
|
|
90
|
-
},
|
|
91
|
-
label: {
|
|
92
|
-
display: 'block',
|
|
93
|
-
fontSize: '0.875rem',
|
|
94
|
-
fontWeight: '500',
|
|
95
|
-
color: 'var(--tern-text-secondary, #374151)'
|
|
96
|
-
},
|
|
97
|
-
input: {
|
|
98
|
-
marginTop: '0.25rem',
|
|
99
|
-
display: 'block',
|
|
100
|
-
width: '100%',
|
|
101
|
-
padding: '0.5rem 0.75rem',
|
|
102
|
-
borderRadius: '0.375rem',
|
|
103
|
-
border: '1px solid var(--tern-border, #D1D5DB)',
|
|
104
|
-
backgroundColor: 'var(--tern-input-background, white)',
|
|
105
|
-
color: 'var(--tern-text-primary, #111827)'
|
|
106
|
-
},
|
|
107
|
-
button: {
|
|
108
|
-
display: 'flex',
|
|
109
|
-
width: '100%',
|
|
110
|
-
justifyContent: 'center',
|
|
111
|
-
padding: '0.5rem 1rem',
|
|
112
|
-
fontSize: '0.875rem',
|
|
113
|
-
fontWeight: '500',
|
|
114
|
-
color: 'white',
|
|
115
|
-
backgroundColor: 'var(--tern-primary, #2563EB)',
|
|
116
|
-
border: 'none',
|
|
117
|
-
borderRadius: '0.375rem',
|
|
118
|
-
cursor: 'pointer'
|
|
119
|
-
},
|
|
120
|
-
error: {
|
|
121
|
-
color: 'var(--tern-error, #DC2626)',
|
|
122
|
-
fontSize: '0.875rem'
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
// Export pre-created styles
|
|
126
|
-
export const styles = createStyleSheet(styleConfig);
|
|
127
|
-
//# sourceMappingURL=create-styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-styles.js","sourceRoot":"","sources":["../../src/utils/create-styles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,MAAM,MAAM,GAAG,MAAM,CAAA;AAErB,qCAAqC;AACrC,MAAM,cAAc,GAAG;IACrB,UAAU,EAAE,KAAK;IACjB,YAAY,EAAE,IAA+B;CAC9C,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,GAAG,MAAM,YAAY;IAChC,MAAM,EAAE,GAAG,MAAM,SAAS;IAC1B,KAAK,E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B,GAAG,EAAE,MAAM;KACZ;IACD,KAAK,EAAE;QACL,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,qCAAqC;KAC7C;IACD,KAAK,EAAE;QACL,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,gBAAgB;QACzB,YAAY,EAAE,UAAU;QACxB,MAAM,EAAE,uCAAuC;QAC/C,eAAe,EAAE,qCAAqC;QACtD,KAAK,EAAE,mCAAmC;KAC3C;IACD,MAAM,EAAE;QACN,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,MAAM;QACb,cAAc,EAAE,QAAQ;QACxB,OAAO,EAAE,aAAa;QACtB,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,8BAA8B;QAC/C,MAAM,EAAE,MAAM;QACd,YAAY,EAAE,UAAU;QACxB,MAAM,EAAE,SAAS;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,4BAA4B;QACnC,QAAQ,EAAE,UAAU;KACrB;CACO,CAAA;AAEV,4BAA4B;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAA"}
|
package/dist/utils/index.js
DELETED
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":""}
|