@tern-secure/nextjs 3.1.21 → 3.1.23
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/chunk-2RTGO3FB.js +36 -0
- package/dist/chunk-2RTGO3FB.js.map +1 -0
- package/dist/chunk-AHVNPKXU.js +41 -0
- package/dist/chunk-WR6O4YMW.cjs +44 -0
- package/dist/chunk-WR6O4YMW.cjs.map +1 -0
- package/dist/cjs/index.cjs +433 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +81 -0
- package/dist/cjs/index.d.ts +81 -0
- package/dist/cjs/index.js +417 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/chunk-6K2MNSU3.cjs +42 -0
- package/dist/esm/chunk-6K2MNSU3.cjs.map +1 -0
- package/dist/esm/chunk-RGPCPA2T.js +34 -0
- package/dist/esm/chunk-RGPCPA2T.js.map +1 -0
- package/dist/esm/index.cjs +386 -0
- package/dist/esm/index.cjs.map +1 -0
- package/dist/esm/index.d.cts +81 -0
- package/dist/esm/index.d.ts +81 -0
- package/dist/esm/index.js +360 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/ternSecureClientProvider-6Z2OJ7S6.cjs +12 -0
- package/dist/esm/ternSecureClientProvider-6Z2OJ7S6.cjs.map +1 -0
- package/dist/esm/ternSecureClientProvider-KBSFXQOM.js +3 -0
- package/dist/esm/ternSecureClientProvider-KBSFXQOM.js.map +1 -0
- package/dist/index.cjs +491 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +81 -0
- package/dist/index.d.ts +81 -5
- package/dist/index.js +389 -5
- package/dist/index.js.map +1 -1
- package/dist/ternSecureClientProvider-DXLMGG2U.cjs +12 -0
- package/dist/ternSecureClientProvider-DXLMGG2U.cjs.map +1 -0
- package/dist/ternSecureClientProvider-OJMAWZZ2.js +3 -0
- package/dist/ternSecureClientProvider-OJMAWZZ2.js.map +1 -0
- package/dist/ternSecureClientProvider-P663N3F7.js +7 -0
- package/package.json +19 -18
- package/dist/app-router/client/auth.d.ts +0 -7
- package/dist/app-router/client/auth.d.ts.map +0 -1
- 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.d.ts +0 -4
- package/dist/app-router/client/client-init.d.ts.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.d.ts +0 -4
- package/dist/app-router/client/config.d.ts.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.d.ts +0 -7
- package/dist/app-router/client/index.d.ts.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.d.ts +0 -5
- package/dist/app-router/client/providers/ternSecureClientProvider.d.ts.map +0 -1
- package/dist/app-router/client/providers/ternSecureClientProvider.js +0 -9
- package/dist/app-router/client/providers/ternSecureClientProvider.js.map +0 -1
- package/dist/app-router/client/providers/ternSecureContext.d.ts +0 -7
- package/dist/app-router/client/providers/ternSecureContext.d.ts.map +0 -1
- package/dist/app-router/client/providers/ternSecureContext.js +0 -24
- package/dist/app-router/client/providers/ternSecureContext.js.map +0 -1
- package/dist/app-router/server/index.d.ts +0 -2
- package/dist/app-router/server/index.d.ts.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.d.ts +0 -7
- package/dist/app-router/server/providers/TernSecureServerProvider.d.ts.map +0 -1
- package/dist/app-router/server/providers/TernSecureServerProvider.js +0 -31
- package/dist/app-router/server/providers/TernSecureServerProvider.js.map +0 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -2
- package/dist/components/index.js.map +0 -1
- package/dist/components/sign-in.d.ts +0 -22
- package/dist/components/sign-in.d.ts.map +0 -1
- package/dist/components/sign-in.js +0 -32
- package/dist/components/sign-in.js.map +0 -1
- package/dist/errors/index.d.ts +0 -9
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js +0 -12
- package/dist/errors/index.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useAuth.d.ts +0 -2
- package/dist/hooks/useAuth.d.ts.map +0 -1
- package/dist/hooks/useAuth.js +0 -58
- package/dist/hooks/useAuth.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -41
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/utils/create-styles.d.ts +0 -99
- package/dist/utils/create-styles.d.ts.map +0 -1
- package/dist/utils/create-styles.js +0 -127
- package/dist/utils/create-styles.js.map +0 -1
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const TernSecureAuth: () => import("@firebase/auth").Auth;
|
|
2
|
-
export declare const TernSecureFirestore: () => import("@firebase/firestore").Firestore;
|
|
3
|
-
export declare const TernSecureStorage: () => import("@firebase/storage").FirebaseStorage;
|
|
4
|
-
//# sourceMappingURL=client-init.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-init.d.ts","sourceRoot":"","sources":["../../../src/app-router/client/client-init.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,cAAc,qCAAa,CAAC;AACzC,eAAO,MAAM,mBAAmB,+CAAkB,CAAC;AACnD,eAAO,MAAM,iBAAiB,mDAAgB,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 './config';
|
|
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,UAAU,CAAC;AAE1D,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/app-router/client/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,cAAc,QAAO,gBAQhC,CAAC;AAEH,eAAO,MAAM,cAAc,WAAY,gBAAgB,KAAG,gBAOzD,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,EAAoB,EAAE;IAC3E,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,7 +0,0 @@
|
|
|
1
|
-
export { TernSecureAuth, TernSecureFirestore, TernSecureStorage } from './client-init';
|
|
2
|
-
export type { SignInCredentials } from './auth';
|
|
3
|
-
export { signInWithEmail } from './auth';
|
|
4
|
-
export { loadFireConfig, validateConfig } from './config';
|
|
5
|
-
export { TernSecureContext, useTernSecure } from './providers/ternSecureContext';
|
|
6
|
-
export { TernSecureClientProvider } from './providers/ternSecureClientProvider';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app-router/client/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAE/C,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,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternSecureClientProvider.d.ts","sourceRoot":"","sources":["../../../../src/app-router/client/providers/ternSecureClientProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAGvC,wBAAgB,wBAAwB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQnF"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { TernSecureContext, initialState } from './ternSecureContext';
|
|
5
|
-
export function TernSecureClientProvider({ children }) {
|
|
6
|
-
const stateAndUpdater = useState(initialState);
|
|
7
|
-
return (_jsx(TernSecureContext.Provider, { value: stateAndUpdater, children: children }));
|
|
8
|
-
}
|
|
9
|
-
//# 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,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAErE,MAAM,UAAU,wBAAwB,CAAC,EAAE,QAAQ,EAAiC;IAClF,MAAM,eAAe,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;IAE9C,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAC/C,QAAQ,GACkB,CAC9B,CAAA;AACH,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TernSecureState } from '../../../types';
|
|
3
|
-
declare const initialState: TernSecureState;
|
|
4
|
-
declare const TernSecureContext: React.Context<[TernSecureState, React.Dispatch<React.SetStateAction<TernSecureState>>]>;
|
|
5
|
-
declare const useTernSecure: (hookname?: string) => [TernSecureState, React.Dispatch<React.SetStateAction<TernSecureState>>];
|
|
6
|
-
export { TernSecureContext, useTernSecure, initialState };
|
|
7
|
-
//# sourceMappingURL=ternSecureContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternSecureContext.d.ts","sourceRoot":"","sources":["../../../../src/app-router/client/providers/ternSecureContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,QAAA,MAAM,YAAY,EAAE,eAWnB,CAAA;AAED,QAAA,MAAM,iBAAiB,yFAA0H,CAAA;AAEjJ,QAAA,MAAM,aAAa,cAAe,MAAM,6EAOvC,CAAA;AAED,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,YAAY,EACb,CAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
const initialState = {
|
|
4
|
-
firebase: {
|
|
5
|
-
initialized: false,
|
|
6
|
-
error: null
|
|
7
|
-
},
|
|
8
|
-
auth: {
|
|
9
|
-
user: null,
|
|
10
|
-
loading: true,
|
|
11
|
-
error: null,
|
|
12
|
-
isSignedIn: false
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const TernSecureContext = React.createContext([initialState, () => { }]);
|
|
16
|
-
const useTernSecure = (hookname) => {
|
|
17
|
-
const context = React.useContext(TernSecureContext);
|
|
18
|
-
if (!context) {
|
|
19
|
-
throw new Error(`${hookname} must be used within TernSecureProvider`);
|
|
20
|
-
}
|
|
21
|
-
return context;
|
|
22
|
-
};
|
|
23
|
-
export { TernSecureContext, useTernSecure, initialState };
|
|
24
|
-
//# 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,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,YAAY,GAAoB;IACpC,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,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAA2E,CAAC,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAA;AAEjJ,MAAM,aAAa,GAAG,CAAC,QAAiB,EAAE,EAAE;IAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAA;IACnD,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,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,YAAY,EACb,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app-router/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,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,7 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
interface TernSecureProviderProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
export declare function TernSecureProvider({ children }: TernSecureProviderProps): import("react/jsx-runtime").JSX.Element | (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>)[] | null | undefined;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=TernSecureServerProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TernSecureServerProvider.d.ts","sourceRoot":"","sources":["../../../../src/app-router/server/providers/TernSecureServerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAWD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,qLA+BvE"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import dynamic from 'next/dynamic';
|
|
4
|
-
// Dynamically import the client provider with no SSR
|
|
5
|
-
const TernSecureClientProvider = dynamic(() => import('../../client/providers/ternSecureClientProvider').then(mod => mod.TernSecureClientProvider), {
|
|
6
|
-
ssr: false
|
|
7
|
-
//loading: () => null // Return null or a loading indicator
|
|
8
|
-
});
|
|
9
|
-
export function TernSecureProvider({ children }) {
|
|
10
|
-
// Check if the children contain html/body tags
|
|
11
|
-
const isRootLayout = React.Children.toArray(children).some(child => React.isValidElement(child) && child.type === 'html');
|
|
12
|
-
if (isRootLayout) {
|
|
13
|
-
// If this is the root layout, inject our provider after the body tag
|
|
14
|
-
return React.Children.map(children, child => {
|
|
15
|
-
if (React.isValidElement(child) && child.type === 'html') {
|
|
16
|
-
return React.cloneElement(child, {}, React.Children.map(child.props.children, bodyChild => {
|
|
17
|
-
if (React.isValidElement(bodyChild) && bodyChild.type === 'body') {
|
|
18
|
-
// Type assertion to access props safely
|
|
19
|
-
const bodyProps = bodyChild.props;
|
|
20
|
-
return React.cloneElement(bodyChild, {}, _jsx(TernSecureClientProvider, { children: bodyProps.children }));
|
|
21
|
-
}
|
|
22
|
-
return bodyChild;
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
return child;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
// For non-root layouts, wrap normally
|
|
29
|
-
return _jsx(TernSecureClientProvider, { children: children });
|
|
30
|
-
}
|
|
31
|
-
//# 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,GAAG,EAAE,KAAK;IACV,2DAA2D;CAC5D,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,KAAC,wBAAwB,cACtB,SAAS,CAAC,QAAQ,GACM,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,KAAC,wBAAwB,cAAE,QAAQ,GAA4B,CAAC;AACzE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,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,22 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface SignInProps {
|
|
3
|
-
onSuccess?: () => void;
|
|
4
|
-
onError?: (error: Error) => void;
|
|
5
|
-
redirectUrl?: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
customStyles?: {
|
|
9
|
-
container?: string;
|
|
10
|
-
header?: string;
|
|
11
|
-
title?: string;
|
|
12
|
-
formWrapper?: string;
|
|
13
|
-
formContainer?: string;
|
|
14
|
-
form?: string;
|
|
15
|
-
input?: string;
|
|
16
|
-
button?: string;
|
|
17
|
-
errorText?: string;
|
|
18
|
-
label?: string;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export declare function SignIn({ onSuccess, onError, redirectUrl, className, style, customStyles }: SignInProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
//# sourceMappingURL=sign-in.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in.d.ts","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,YAAY,CAAC,EAAE;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAc,EACd,KAAK,EACL,YAAiB,EAClB,EAAE,WAAW,2CAmGb"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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 (_jsxs("div", { className: `${styles.container} ${customStyles.container || ''}`, style: style, children: [_jsx("div", { className: `${styles.header} ${customStyles.header || ''}`, children: _jsx("h2", { className: `${styles.title} ${customStyles.title || ''}`, children: "Sign in to your account" }) }), _jsx("div", { className: `${styles.formWrapper} ${customStyles.formWrapper || ''}`, children: _jsx("div", { className: `${styles.formContainer} ${customStyles.formContainer || ''}`, children: _jsxs("form", { onSubmit: handleSubmit, className: `${styles.form} ${customStyles.form || ''} ${className}`, role: "form", "aria-label": "Sign in form", children: [error && (_jsx("div", { className: `${styles.error} ${customStyles.errorText || ''}`, role: "alert", "aria-live": "polite", children: error })), _jsxs("div", { children: [_jsx("label", { htmlFor: "email", className: `${styles.label} ${customStyles.label || ''}`, children: "Email" }), _jsx("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 })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "password", className: `${styles.label} ${customStyles.label || ''}`, children: "Password" }), _jsx("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 })] }), _jsx("button", { type: "submit", disabled: loading, className: `${styles.button} ${customStyles.button || ''}`, "data-testid": "sign-in-submit", children: loading ? 'Signing in...' : 'Sign in' })] }) }) })] }));
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=sign-in.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":"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"}
|
package/dist/errors/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const ERRORS: {
|
|
2
|
-
readonly SERVER_SIDE_INITIALIZATION: "TernSecure must be initialized on the client side";
|
|
3
|
-
readonly NOT_INITIALIZED: "TernSecure services are not initialized. Call initializeTernSecure() first";
|
|
4
|
-
readonly HOOK_CONTEXT: (hookName: string) => string;
|
|
5
|
-
};
|
|
6
|
-
export declare class TernSecureError extends Error {
|
|
7
|
-
constructor(message: string);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;sCAGU,MAAM;CACvB,CAAC;AAEX,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B"}
|
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.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA"}
|
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.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAMA,wBAAgB,OAAO,iCA0DtB"}
|
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.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","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,EAAE,MAAM,qBAAqB,CAAA;AACzM,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import { User, Auth } from 'firebase/auth';
|
|
3
|
-
export interface TernSecureConfig {
|
|
4
|
-
apiKey: string;
|
|
5
|
-
authDomain: string;
|
|
6
|
-
projectId: string;
|
|
7
|
-
storageBucket: string;
|
|
8
|
-
messagingSenderId: string;
|
|
9
|
-
appId: string;
|
|
10
|
-
measurementId: string;
|
|
11
|
-
}
|
|
12
|
-
export interface TernSecureOptions {
|
|
13
|
-
environment?: 'development' | 'production';
|
|
14
|
-
region?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface FirebaseState {
|
|
17
|
-
initialized: boolean;
|
|
18
|
-
error: Error | null;
|
|
19
|
-
}
|
|
20
|
-
export interface TernSecureState {
|
|
21
|
-
firebase: FirebaseState;
|
|
22
|
-
auth: AuthState;
|
|
23
|
-
}
|
|
24
|
-
export interface AuthState {
|
|
25
|
-
user: User | null;
|
|
26
|
-
loading: boolean;
|
|
27
|
-
error: Error | null;
|
|
28
|
-
isSignedIn: boolean;
|
|
29
|
-
}
|
|
30
|
-
export interface TernSecureContextValue {
|
|
31
|
-
_contextKey: symbol;
|
|
32
|
-
authState: AuthState;
|
|
33
|
-
auth: Auth;
|
|
34
|
-
}
|
|
35
|
-
export interface TernSecureContextType {
|
|
36
|
-
authState: AuthState;
|
|
37
|
-
}
|
|
38
|
-
export interface TernSecureProviderProps {
|
|
39
|
-
children: ReactNode;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACvB;AAGD,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AACD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,SAAS,CAAC;CACjB;AACD,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACvB;AACD,MAAM,WAAW,sBAAsB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;CACd;AACD,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,SAAS,CAAC;CACtB;AACD,MAAM,WAAW,uBAAuB;IACpC,QAAQ,EAAE,SAAS,CAAC;CACvB"}
|
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,99 +0,0 @@
|
|
|
1
|
-
export declare const defaultClassNames: {
|
|
2
|
-
readonly container: "tern-container";
|
|
3
|
-
readonly header: "tern-header";
|
|
4
|
-
readonly title: "tern-title";
|
|
5
|
-
readonly formWrapper: "tern-formWrapper";
|
|
6
|
-
readonly formContainer: "tern-formContainer";
|
|
7
|
-
readonly form: "tern-form";
|
|
8
|
-
readonly label: "tern-label";
|
|
9
|
-
readonly input: "tern-input";
|
|
10
|
-
readonly button: "tern-button";
|
|
11
|
-
readonly error: "tern-error";
|
|
12
|
-
};
|
|
13
|
-
export declare const styleConfig: {
|
|
14
|
-
readonly container: {
|
|
15
|
-
readonly display: "flex";
|
|
16
|
-
readonly minHeight: "100%";
|
|
17
|
-
readonly flex: "1";
|
|
18
|
-
readonly flexDirection: "column";
|
|
19
|
-
readonly justifyContent: "center";
|
|
20
|
-
readonly padding: "3rem 1.5rem";
|
|
21
|
-
};
|
|
22
|
-
readonly header: {
|
|
23
|
-
readonly margin: "0 auto";
|
|
24
|
-
readonly width: "100%";
|
|
25
|
-
readonly maxWidth: "28rem";
|
|
26
|
-
};
|
|
27
|
-
readonly title: {
|
|
28
|
-
readonly marginTop: "1.5rem";
|
|
29
|
-
readonly textAlign: "center";
|
|
30
|
-
readonly fontSize: "1.875rem";
|
|
31
|
-
readonly fontWeight: "700";
|
|
32
|
-
readonly lineHeight: "2.25rem";
|
|
33
|
-
readonly letterSpacing: "-0.025em";
|
|
34
|
-
readonly color: "var(--tern-text-primary, #111827)";
|
|
35
|
-
};
|
|
36
|
-
readonly formWrapper: {
|
|
37
|
-
readonly marginTop: "2.5rem";
|
|
38
|
-
readonly margin: "0 auto";
|
|
39
|
-
readonly width: "100%";
|
|
40
|
-
readonly maxWidth: "30rem";
|
|
41
|
-
};
|
|
42
|
-
readonly formContainer: {
|
|
43
|
-
readonly padding: "3rem 1.5rem";
|
|
44
|
-
readonly boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)";
|
|
45
|
-
readonly borderRadius: "0.5rem";
|
|
46
|
-
readonly backgroundColor: "var(--tern-background, white)";
|
|
47
|
-
};
|
|
48
|
-
readonly form: {
|
|
49
|
-
readonly display: "flex";
|
|
50
|
-
readonly flexDirection: "column";
|
|
51
|
-
readonly gap: "1rem";
|
|
52
|
-
};
|
|
53
|
-
readonly label: {
|
|
54
|
-
readonly display: "block";
|
|
55
|
-
readonly fontSize: "0.875rem";
|
|
56
|
-
readonly fontWeight: "500";
|
|
57
|
-
readonly color: "var(--tern-text-secondary, #374151)";
|
|
58
|
-
};
|
|
59
|
-
readonly input: {
|
|
60
|
-
readonly marginTop: "0.25rem";
|
|
61
|
-
readonly display: "block";
|
|
62
|
-
readonly width: "100%";
|
|
63
|
-
readonly padding: "0.5rem 0.75rem";
|
|
64
|
-
readonly borderRadius: "0.375rem";
|
|
65
|
-
readonly border: "1px solid var(--tern-border, #D1D5DB)";
|
|
66
|
-
readonly backgroundColor: "var(--tern-input-background, white)";
|
|
67
|
-
readonly color: "var(--tern-text-primary, #111827)";
|
|
68
|
-
};
|
|
69
|
-
readonly button: {
|
|
70
|
-
readonly display: "flex";
|
|
71
|
-
readonly width: "100%";
|
|
72
|
-
readonly justifyContent: "center";
|
|
73
|
-
readonly padding: "0.5rem 1rem";
|
|
74
|
-
readonly fontSize: "0.875rem";
|
|
75
|
-
readonly fontWeight: "500";
|
|
76
|
-
readonly color: "white";
|
|
77
|
-
readonly backgroundColor: "var(--tern-primary, #2563EB)";
|
|
78
|
-
readonly border: "none";
|
|
79
|
-
readonly borderRadius: "0.375rem";
|
|
80
|
-
readonly cursor: "pointer";
|
|
81
|
-
};
|
|
82
|
-
readonly error: {
|
|
83
|
-
readonly color: "var(--tern-error, #DC2626)";
|
|
84
|
-
readonly fontSize: "0.875rem";
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
export declare const styles: {
|
|
88
|
-
readonly container: "tern-container";
|
|
89
|
-
readonly header: "tern-header";
|
|
90
|
-
readonly title: "tern-title";
|
|
91
|
-
readonly formWrapper: "tern-formWrapper";
|
|
92
|
-
readonly formContainer: "tern-formContainer";
|
|
93
|
-
readonly form: "tern-form";
|
|
94
|
-
readonly label: "tern-label";
|
|
95
|
-
readonly input: "tern-input";
|
|
96
|
-
readonly button: "tern-button";
|
|
97
|
-
readonly error: "tern-error";
|
|
98
|
-
};
|
|
99
|
-
//# sourceMappingURL=create-styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-styles.d.ts","sourceRoot":"","sources":["../../src/utils/create-styles.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB;;;;;;;;;;;CAWpB,CAAA;AAwCV,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEd,CAAA;AAGV,eAAO,MAAM,MAAM;;;;;;;;;;;CAAgC,CAAA"}
|