@tern-secure/nextjs 1.5.9 → 1.6.1
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/app-router/client/providers/ternSecureClientProvider.d.ts +1 -1
- package/dist/app-router/client/providers/ternSecureContext.d.ts +4 -11
- package/dist/app-router/server/providers/TernSecureServerProvider.d.ts +3 -2
- package/dist/index.js +15 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,5 +4,5 @@ interface TernSecureClientProps {
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
initialState: AuthState;
|
|
6
6
|
}
|
|
7
|
-
export declare
|
|
7
|
+
export declare function TernSecureClientProvider({ children, initialState }: TernSecureClientProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
error: Error | null;
|
|
6
|
-
}
|
|
7
|
-
export interface TernSecureContextType {
|
|
8
|
-
authState: AuthState;
|
|
9
|
-
}
|
|
10
|
-
export declare const TernSecureContext: import("react").Context<TernSecureContextType | null>;
|
|
11
|
-
export declare const useTernSecure: () => TernSecureContextType;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AuthState } from '../../../types/ternsecure';
|
|
3
|
+
export declare const TernSecureContext: React.Context<AuthState | null>;
|
|
4
|
+
export declare function useTernSecure(): AuthState;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare function TernSecureProvider({ children }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
}): Promise<import("react/jsx-runtime").JSX.Element>;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import dynamic from 'next/dynamic';
|
|
3
|
-
import React, { useState, useEffect } from 'react';
|
|
4
1
|
import { getApps, initializeApp } from 'firebase/app';
|
|
5
2
|
import { getAuth } from 'firebase/auth';
|
|
6
3
|
import { getFirestore } from 'firebase/firestore';
|
|
7
4
|
import { getStorage } from 'firebase/storage';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import React, { useState, useEffect } from 'react';
|
|
8
7
|
|
|
9
8
|
function getEnvVariable(name) {
|
|
10
9
|
const value = process.env[`NEXT_PUBLIC_FIREBASE_${name}`];
|
|
@@ -66,20 +65,9 @@ const getTernSecureStorage = () => {
|
|
|
66
65
|
return storage;
|
|
67
66
|
};
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
const TernSecureClientProvider$1 = dynamic(() => Promise.resolve().then(function () { return ternSecureClientProvider; }).then((mod) => mod.TernSecureClientProvider), { ssr: false });
|
|
71
|
-
function TernSecureProvider({ children }) {
|
|
72
|
-
const initialState = {
|
|
73
|
-
user: null,
|
|
74
|
-
loading: true,
|
|
75
|
-
error: null,
|
|
76
|
-
initialized: false
|
|
77
|
-
};
|
|
78
|
-
// Don't modify the HTML structure, just pass through
|
|
79
|
-
return (jsx(TernSecureClientProvider$1, { initialState: initialState, children: children }));
|
|
80
|
-
}
|
|
68
|
+
const TernSecureContext = React.createContext(null);
|
|
81
69
|
|
|
82
|
-
|
|
70
|
+
function TernSecureClientProvider({ children, initialState }) {
|
|
83
71
|
const [authState, setAuthState] = useState(initialState);
|
|
84
72
|
useEffect(() => {
|
|
85
73
|
const auth = getTernSecureAuth();
|
|
@@ -90,23 +78,18 @@ const TernSecureClientProvider = ({ children, initialState }) => {
|
|
|
90
78
|
});
|
|
91
79
|
return () => unsubscribe();
|
|
92
80
|
}, []);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return children;
|
|
96
|
-
}
|
|
97
|
-
// For other children, pass the authState
|
|
98
|
-
return React.Children.map(children, child => {
|
|
99
|
-
if (React.isValidElement(child)) {
|
|
100
|
-
return React.cloneElement(child, { authState });
|
|
101
|
-
}
|
|
102
|
-
return child;
|
|
103
|
-
});
|
|
104
|
-
};
|
|
81
|
+
return (jsx(TernSecureContext.Provider, { value: authState, children: children }));
|
|
82
|
+
}
|
|
105
83
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
84
|
+
async function TernSecureProvider({ children }) {
|
|
85
|
+
const initialState = {
|
|
86
|
+
user: null,
|
|
87
|
+
loading: true,
|
|
88
|
+
error: null,
|
|
89
|
+
initialized: false
|
|
90
|
+
};
|
|
91
|
+
return (jsx(TernSecureClientProvider, { initialState: initialState, children: children }));
|
|
92
|
+
}
|
|
110
93
|
|
|
111
94
|
export { TernSecureProvider, getTernSecureAuth, getTernSecureFirestore, getTernSecureStorage, initializeTernSecure, loadFireConfig };
|
|
112
95
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/app-router/client/config.ts","../src/errors/index.ts","../src/app-router/client/client-init.ts","../src/app-router/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/app-router/client/config.ts","../src/errors/index.ts","../src/app-router/client/client-init.ts","../src/app-router/client/providers/ternSecureContext.ts","../src/app-router/client/providers/ternSecureClientProvider.tsx","../src/app-router/server/providers/TernSecureServerProvider.tsx"],"sourcesContent":[null,null,null,null,null,null],"names":["_jsx"],"mappings":";;;;;;;AAEA,SAAS,cAAc,CAAC,IAAY,EAAA;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAwB,qBAAA,EAAA,IAAI,CAAE,CAAA,CAAC;IACzD,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,MAAM,IAAI,KAAK,CAAC,sDAAsD,IAAI,CAAA,CAAE,CAAC;;AAE/E,IAAA,OAAO,KAAK;AACd;AAEa,MAAA,cAAc,GAAqB;AAC9C,IAAA,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC;AACjC,IAAA,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC;A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