@tern-secure/nextjs 3.1.0 → 3.1.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/cjs/app-router/client/index.js +136 -0
- package/dist/cjs/app-router/client/index.js.map +7 -0
- package/dist/cjs/app-router/server/index.js +128 -0
- package/dist/cjs/app-router/server/index.js.map +7 -0
- package/dist/{index.js → cjs/components/index.js} +78 -198
- package/dist/cjs/components/index.js.map +7 -0
- package/dist/{index.cjs.js → cjs/index.js} +1 -1
- package/dist/{index.cjs.js.map → cjs/index.js.map} +1 -1
- package/dist/esm/app-router/client/auth.d.ts.map +1 -0
- package/dist/esm/app-router/client/client-init.d.ts.map +1 -0
- package/dist/esm/app-router/client/config.d.ts.map +1 -0
- package/dist/esm/app-router/client/index.d.ts.map +1 -0
- package/dist/esm/app-router/client/index.js +25 -0
- package/dist/esm/app-router/client/index.js.map +7 -0
- package/dist/esm/app-router/client/providers/ternSecureClientProvider.d.ts.map +1 -0
- package/dist/esm/app-router/client/providers/ternSecureContext.d.ts.map +1 -0
- package/dist/esm/app-router/server/index.d.ts.map +1 -0
- package/dist/esm/app-router/server/index.js +7 -0
- package/dist/esm/app-router/server/index.js.map +7 -0
- package/dist/esm/app-router/server/providers/TernSecureServerProvider.d.ts.map +1 -0
- package/dist/esm/chunk-C2Y6UR4A.js +45 -0
- package/dist/esm/chunk-C2Y6UR4A.js.map +7 -0
- package/dist/esm/chunk-GHCNUZT6.js +55 -0
- package/dist/esm/chunk-GHCNUZT6.js.map +7 -0
- package/dist/esm/chunk-P4LC45HN.js +42 -0
- package/dist/esm/chunk-P4LC45HN.js.map +7 -0
- package/dist/esm/chunk-WMPFLBAY.js +232 -0
- package/dist/esm/chunk-WMPFLBAY.js.map +7 -0
- package/dist/esm/components/index.d.ts.map +1 -0
- package/dist/esm/components/index.js +9 -0
- package/dist/esm/components/index.js.map +7 -0
- package/dist/esm/components/sign-in.d.ts.map +1 -0
- package/dist/esm/errors/index.d.ts.map +1 -0
- package/dist/esm/hooks/index.d.ts.map +1 -0
- package/dist/esm/hooks/useAuth.d.ts.map +1 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +92 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/ternSecureClientProvider-FZVUEXLU.js +8 -0
- package/dist/esm/ternSecureClientProvider-FZVUEXLU.js.map +7 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/utils/create-styles.d.ts.map +1 -0
- package/package.json +14 -14
- package/dist/app-router/client/auth.d.ts.map +0 -1
- package/dist/app-router/client/client-init.d.ts.map +0 -1
- package/dist/app-router/client/config.d.ts.map +0 -1
- package/dist/app-router/client/index.d.ts.map +0 -1
- package/dist/app-router/client/providers/ternSecureClientProvider.d.ts.map +0 -1
- package/dist/app-router/client/providers/ternSecureContext.d.ts.map +0 -1
- package/dist/app-router/server/index.d.ts.map +0 -1
- package/dist/app-router/server/providers/TernSecureServerProvider.d.ts.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/sign-in.d.ts.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/useAuth.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -7
- package/dist/types/index.d.ts.map +0 -1
- package/dist/utils/create-styles.d.ts.map +0 -1
- /package/dist/{app-router → esm/app-router}/client/auth.d.ts +0 -0
- /package/dist/{app-router → esm/app-router}/client/client-init.d.ts +0 -0
- /package/dist/{app-router → esm/app-router}/client/config.d.ts +0 -0
- /package/dist/{app-router → esm/app-router}/client/index.d.ts +0 -0
- /package/dist/{app-router → esm/app-router}/client/providers/ternSecureClientProvider.d.ts +0 -0
- /package/dist/{app-router → esm/app-router}/client/providers/ternSecureContext.d.ts +0 -0
- /package/dist/{app-router → esm/app-router}/server/index.d.ts +0 -0
- /package/dist/{app-router → esm/app-router}/server/providers/TernSecureServerProvider.d.ts +0 -0
- /package/dist/{components → esm/components}/index.d.ts +0 -0
- /package/dist/{components → esm/components}/sign-in.d.ts +0 -0
- /package/dist/{errors → esm/errors}/index.d.ts +0 -0
- /package/dist/{hooks → esm/hooks}/index.d.ts +0 -0
- /package/dist/{hooks → esm/hooks}/useAuth.d.ts +0 -0
- /package/dist/{index.d.ts → esm/index.d.ts} +0 -0
- /package/dist/{types → esm/types}/index.d.ts +0 -0
- /package/dist/{utils → esm/utils}/create-styles.d.ts +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/app-router/client/index.ts
|
|
31
|
+
var client_exports = {};
|
|
32
|
+
__export(client_exports, {
|
|
33
|
+
TernSecureAuth: () => TernSecureAuth,
|
|
34
|
+
TernSecureClientProvider: () => TernSecureClientProvider,
|
|
35
|
+
TernSecureContext: () => TernSecureContext,
|
|
36
|
+
TernSecureFirestore: () => TernSecureFirestore,
|
|
37
|
+
TernSecureStorage: () => TernSecureStorage,
|
|
38
|
+
loadFireConfig: () => loadFireConfig,
|
|
39
|
+
signInWithEmail: () => signInWithEmail,
|
|
40
|
+
useTernSecure: () => useTernSecure,
|
|
41
|
+
validateConfig: () => validateConfig
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(client_exports);
|
|
44
|
+
|
|
45
|
+
// src/app-router/client/client-init.ts
|
|
46
|
+
var import_app = require("firebase/app");
|
|
47
|
+
var import_auth = require("firebase/auth");
|
|
48
|
+
var import_firestore = require("firebase/firestore");
|
|
49
|
+
var import_storage = require("firebase/storage");
|
|
50
|
+
var app = (() => {
|
|
51
|
+
const config = validateConfig(loadFireConfig());
|
|
52
|
+
return (0, import_app.getApps)().length ? (0, import_app.getApps)()[0] : (0, import_app.initializeApp)(config);
|
|
53
|
+
})();
|
|
54
|
+
var auth = (0, import_auth.getAuth)(app);
|
|
55
|
+
(0, import_auth.setPersistence)(auth, import_auth.browserSessionPersistence);
|
|
56
|
+
var firestore = (0, import_firestore.getFirestore)(app);
|
|
57
|
+
var storage = (0, import_storage.getStorage)(app);
|
|
58
|
+
var TernSecureAuth = () => auth;
|
|
59
|
+
var TernSecureFirestore = () => firestore;
|
|
60
|
+
var TernSecureStorage = () => storage;
|
|
61
|
+
|
|
62
|
+
// src/app-router/client/auth.ts
|
|
63
|
+
var import_auth2 = require("firebase/auth");
|
|
64
|
+
async function signInWithEmail({
|
|
65
|
+
email,
|
|
66
|
+
password
|
|
67
|
+
}) {
|
|
68
|
+
const auth2 = TernSecureAuth();
|
|
69
|
+
return (0, import_auth2.signInWithEmailAndPassword)(auth2, email, password);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/app-router/client/config.ts
|
|
73
|
+
var loadFireConfig = () => ({
|
|
74
|
+
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
|
|
75
|
+
authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
|
|
76
|
+
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
|
|
77
|
+
storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,
|
|
78
|
+
messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
|
|
79
|
+
appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID,
|
|
80
|
+
measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID
|
|
81
|
+
});
|
|
82
|
+
var validateConfig = (config) => {
|
|
83
|
+
Object.entries(config).forEach(([key, value]) => {
|
|
84
|
+
if (!value) {
|
|
85
|
+
throw new Error(`Missing environment variable: NEXT_PUBLIC_FIREBASE_${key.toUpperCase()}`);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return config;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// src/app-router/client/providers/ternSecureContext.tsx
|
|
92
|
+
var import_react = __toESM(require("react"), 1);
|
|
93
|
+
var initialState = {
|
|
94
|
+
firebase: {
|
|
95
|
+
initialized: false,
|
|
96
|
+
error: null
|
|
97
|
+
},
|
|
98
|
+
auth: {
|
|
99
|
+
user: null,
|
|
100
|
+
loading: true,
|
|
101
|
+
error: null,
|
|
102
|
+
isSignedIn: false
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var TernSecureContext = import_react.default.createContext([initialState, () => {
|
|
106
|
+
}]);
|
|
107
|
+
var useTernSecure = (hookname) => {
|
|
108
|
+
const context = import_react.default.useContext(TernSecureContext);
|
|
109
|
+
if (!context) {
|
|
110
|
+
throw new Error(
|
|
111
|
+
`${hookname} must be used within TernSecureProvider`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
return context;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/app-router/client/providers/ternSecureClientProvider.tsx
|
|
118
|
+
var import_react2 = require("react");
|
|
119
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
120
|
+
function TernSecureClientProvider({ children }) {
|
|
121
|
+
const stateAndUpdater = (0, import_react2.useState)(initialState);
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TernSecureContext.Provider, { value: stateAndUpdater, children });
|
|
123
|
+
}
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
TernSecureAuth,
|
|
127
|
+
TernSecureClientProvider,
|
|
128
|
+
TernSecureContext,
|
|
129
|
+
TernSecureFirestore,
|
|
130
|
+
TernSecureStorage,
|
|
131
|
+
loadFireConfig,
|
|
132
|
+
signInWithEmail,
|
|
133
|
+
useTernSecure,
|
|
134
|
+
validateConfig
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/app-router/client/index.ts", "../../../../src/app-router/client/client-init.ts", "../../../../src/app-router/client/auth.ts", "../../../../src/app-router/client/config.ts", "../../../../src/app-router/client/providers/ternSecureContext.tsx", "../../../../src/app-router/client/providers/ternSecureClientProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["\r\nexport { \r\n TernSecureAuth,\r\n TernSecureFirestore,\r\n TernSecureStorage \r\n } from './client-init';\r\n\r\n export type { SignInCredentials } from './auth'\r\n\r\n export { signInWithEmail} from './auth'\r\n export { loadFireConfig, validateConfig } from './config';\r\n export { TernSecureContext, useTernSecure } from './providers/ternSecureContext';\r\n export { TernSecureClientProvider } from './providers/ternSecureClientProvider'", "import { getApps, initializeApp } from 'firebase/app';\r\nimport { getAuth, setPersistence, browserSessionPersistence } from 'firebase/auth';\r\nimport { getFirestore } from 'firebase/firestore';\r\nimport { getStorage } from 'firebase/storage';\r\nimport { loadFireConfig, validateConfig } from './index';\r\n\r\n// Initialize immediately\r\nconst app = (() => {\r\n const config = validateConfig(loadFireConfig());\r\n return getApps().length ? getApps()[0] : initializeApp(config);\r\n})();\r\n\r\nconst auth = getAuth(app);\r\nsetPersistence(auth, browserSessionPersistence); //to change later user should be able to choose persistance\r\nconst firestore = getFirestore(app);\r\nconst storage = getStorage(app);\r\n\r\nexport const TernSecureAuth = () => auth;\r\nexport const TernSecureFirestore = () => firestore;\r\nexport const TernSecureStorage = () => storage;", "import { TernSecureAuth } from './index'\r\nimport { signInWithEmailAndPassword, type UserCredential } from 'firebase/auth'\r\n\r\nexport interface SignInCredentials {\r\n email: string\r\n password: string\r\n}\r\n\r\nexport async function signInWithEmail({ \r\n email, \r\n password \r\n}: SignInCredentials): Promise<UserCredential> {\r\n const auth = TernSecureAuth()\r\n return signInWithEmailAndPassword(auth, email, password)\r\n} ", "import { TernSecureConfig } from \"../../types\";\r\n\r\nexport const loadFireConfig = (): TernSecureConfig => ({\r\n apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY as string,\r\n authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN as string,\r\n projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID as string,\r\n storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET as string,\r\n messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID as string,\r\n appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID as string,\r\n measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID as string,\r\n});\r\n\r\nexport const validateConfig = (config: TernSecureConfig) => {\r\n Object.entries(config).forEach(([key, value]) => {\r\n if (!value) {\r\n throw new Error(`Missing environment variable: NEXT_PUBLIC_FIREBASE_${key.toUpperCase()}`);\r\n }\r\n });\r\n return config;\r\n};", "'use client'\r\n\r\nimport React from 'react'\r\nimport { TernSecureState } from '../../../types'\r\n\r\nconst initialState: TernSecureState = {\r\n firebase: {\r\n initialized: false,\r\n error: null\r\n },\r\n auth: {\r\n user: null,\r\n loading: true,\r\n error: null,\r\n isSignedIn: false\r\n }\r\n}\r\n\r\nconst TernSecureContext = React.createContext<[TernSecureState, React.Dispatch<React.SetStateAction<TernSecureState>>]>([initialState, () => {}])\r\n\r\nconst useTernSecure = (hookname?: string) => {\r\n const context = React.useContext(TernSecureContext)\r\n if (!context) {\r\n throw new Error(\r\n `${hookname} must be used within TernSecureProvider`)\r\n }\r\n return context\r\n}\r\n\r\nexport {\r\n TernSecureContext,\r\n useTernSecure,\r\n initialState\r\n}", "'use client'\r\n\r\nimport React, { useState } from 'react'\r\nimport { TernSecureContext, initialState } from './ternSecureContext'\r\n\r\nexport function TernSecureClientProvider({ children }: { children: React.ReactNode }) {\r\n const stateAndUpdater = useState(initialState)\r\n\r\n return (\r\n <TernSecureContext.Provider value={stateAndUpdater}>\r\n {children}\r\n </TernSecureContext.Provider>\r\n )\r\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAuC;AACvC,kBAAmE;AACnE,uBAA6B;AAC7B,qBAA2B;AAI3B,IAAM,OAAO,MAAM;AACjB,QAAM,SAAS,eAAe,eAAe,CAAC;AAC9C,aAAO,oBAAQ,EAAE,aAAS,oBAAQ,EAAE,CAAC,QAAI,0BAAc,MAAM;AAC/D,GAAG;AAEH,IAAM,WAAO,qBAAQ,GAAG;AAAA,IACxB,4BAAe,MAAM,qCAAyB;AAC9C,IAAM,gBAAY,+BAAa,GAAG;AAClC,IAAM,cAAU,2BAAW,GAAG;AAEvB,IAAM,iBAAiB,MAAM;AAC7B,IAAM,sBAAsB,MAAM;AAClC,IAAM,oBAAoB,MAAM;;;AClBvC,IAAAA,eAAgE;AAOhE,eAAsB,gBAAgB;AAAA,EACpC;AAAA,EACA;AACF,GAA+C;AAC7C,QAAMC,QAAO,eAAe;AAC5B,aAAO,yCAA2BA,OAAM,OAAO,QAAQ;AACzD;;;ACZO,IAAM,iBAAiB,OAAyB;AAAA,EACrD,QAAQ,QAAQ,IAAI;AAAA,EACpB,YAAY,QAAQ,IAAI;AAAA,EACxB,WAAW,QAAQ,IAAI;AAAA,EACvB,eAAe,QAAQ,IAAI;AAAA,EAC3B,mBAAmB,QAAQ,IAAI;AAAA,EAC/B,OAAO,QAAQ,IAAI;AAAA,EACnB,eAAe,QAAQ,IAAI;AAC7B;AAEO,IAAM,iBAAiB,CAAC,WAA6B;AAC1D,SAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC/C,QAAI,CAAC,OAAO;AACV,YAAM,IAAI,MAAM,sDAAsD,IAAI,YAAY,CAAC,EAAE;AAAA,IAC3F;AAAA,EACF,CAAC;AACD,SAAO;AACT;;;ACjBA,mBAAkB;AAGlB,IAAM,eAAgC;AAAA,EACpC,UAAU;AAAA,IACR,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,IACP,YAAY;AAAA,EACd;AACF;AAEA,IAAM,oBAAoB,aAAAC,QAAM,cAAwF,CAAC,cAAc,MAAM;AAAC,CAAC,CAAC;AAEhJ,IAAM,gBAAgB,CAAC,aAAsB;AAC3C,QAAM,UAAU,aAAAA,QAAM,WAAW,iBAAiB;AAClD,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR,GAAG,QAAQ;AAAA,IAAyC;AAAA,EACxD;AACA,SAAO;AACT;;;ACzBA,IAAAC,gBAAgC;AAO5B;AAJG,SAAS,yBAAyB,EAAE,SAAS,GAAkC;AACpF,QAAM,sBAAkB,wBAAS,YAAY;AAE7C,SACE,4CAAC,kBAAkB,UAAlB,EAA2B,OAAO,iBAChC,UACH;AAEJ;",
|
|
6
|
+
"names": ["import_auth", "auth", "React", "import_react"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// src/app-router/client/providers/ternSecureContext.tsx
|
|
34
|
+
var import_react, initialState, TernSecureContext;
|
|
35
|
+
var init_ternSecureContext = __esm({
|
|
36
|
+
"src/app-router/client/providers/ternSecureContext.tsx"() {
|
|
37
|
+
"use strict";
|
|
38
|
+
"use client";
|
|
39
|
+
import_react = __toESM(require("react"), 1);
|
|
40
|
+
initialState = {
|
|
41
|
+
firebase: {
|
|
42
|
+
initialized: false,
|
|
43
|
+
error: null
|
|
44
|
+
},
|
|
45
|
+
auth: {
|
|
46
|
+
user: null,
|
|
47
|
+
loading: true,
|
|
48
|
+
error: null,
|
|
49
|
+
isSignedIn: false
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
TernSecureContext = import_react.default.createContext([initialState, () => {
|
|
53
|
+
}]);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// src/app-router/client/providers/ternSecureClientProvider.tsx
|
|
58
|
+
var ternSecureClientProvider_exports = {};
|
|
59
|
+
__export(ternSecureClientProvider_exports, {
|
|
60
|
+
TernSecureClientProvider: () => TernSecureClientProvider
|
|
61
|
+
});
|
|
62
|
+
function TernSecureClientProvider({ children }) {
|
|
63
|
+
const stateAndUpdater = (0, import_react2.useState)(initialState);
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TernSecureContext.Provider, { value: stateAndUpdater, children });
|
|
65
|
+
}
|
|
66
|
+
var import_react2, import_jsx_runtime;
|
|
67
|
+
var init_ternSecureClientProvider = __esm({
|
|
68
|
+
"src/app-router/client/providers/ternSecureClientProvider.tsx"() {
|
|
69
|
+
"use strict";
|
|
70
|
+
"use client";
|
|
71
|
+
import_react2 = require("react");
|
|
72
|
+
init_ternSecureContext();
|
|
73
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// src/app-router/server/index.ts
|
|
78
|
+
var server_exports = {};
|
|
79
|
+
__export(server_exports, {
|
|
80
|
+
TernSecureProvider: () => TernSecureProvider
|
|
81
|
+
});
|
|
82
|
+
module.exports = __toCommonJS(server_exports);
|
|
83
|
+
|
|
84
|
+
// src/app-router/server/providers/TernSecureServerProvider.tsx
|
|
85
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
86
|
+
var import_dynamic = __toESM(require("next/dynamic"), 1);
|
|
87
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
88
|
+
var TernSecureClientProvider2 = (0, import_dynamic.default)(
|
|
89
|
+
() => Promise.resolve().then(() => (init_ternSecureClientProvider(), ternSecureClientProvider_exports)).then((mod) => mod.TernSecureClientProvider),
|
|
90
|
+
{
|
|
91
|
+
//ssr: false,
|
|
92
|
+
loading: () => null
|
|
93
|
+
// Return null or a loading indicator
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
function TernSecureProvider({ children }) {
|
|
97
|
+
const isRootLayout = import_react3.default.Children.toArray(children).some(
|
|
98
|
+
(child) => import_react3.default.isValidElement(child) && child.type === "html"
|
|
99
|
+
);
|
|
100
|
+
if (isRootLayout) {
|
|
101
|
+
return import_react3.default.Children.map(children, (child) => {
|
|
102
|
+
if (import_react3.default.isValidElement(child) && child.type === "html") {
|
|
103
|
+
return import_react3.default.cloneElement(
|
|
104
|
+
child,
|
|
105
|
+
{},
|
|
106
|
+
import_react3.default.Children.map(child.props.children, (bodyChild) => {
|
|
107
|
+
if (import_react3.default.isValidElement(bodyChild) && bodyChild.type === "body") {
|
|
108
|
+
const bodyProps = bodyChild.props;
|
|
109
|
+
return import_react3.default.cloneElement(
|
|
110
|
+
bodyChild,
|
|
111
|
+
{},
|
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TernSecureClientProvider2, { children: bodyProps.children })
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return bodyChild;
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return child;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TernSecureClientProvider2, { children });
|
|
123
|
+
}
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
TernSecureProvider
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/app-router/client/providers/ternSecureContext.tsx", "../../../../src/app-router/client/providers/ternSecureClientProvider.tsx", "../../../../src/app-router/server/index.ts", "../../../../src/app-router/server/providers/TernSecureServerProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\r\n\r\nimport React from 'react'\r\nimport { TernSecureState } from '../../../types'\r\n\r\nconst initialState: TernSecureState = {\r\n firebase: {\r\n initialized: false,\r\n error: null\r\n },\r\n auth: {\r\n user: null,\r\n loading: true,\r\n error: null,\r\n isSignedIn: false\r\n }\r\n}\r\n\r\nconst TernSecureContext = React.createContext<[TernSecureState, React.Dispatch<React.SetStateAction<TernSecureState>>]>([initialState, () => {}])\r\n\r\nconst useTernSecure = (hookname?: string) => {\r\n const context = React.useContext(TernSecureContext)\r\n if (!context) {\r\n throw new Error(\r\n `${hookname} must be used within TernSecureProvider`)\r\n }\r\n return context\r\n}\r\n\r\nexport {\r\n TernSecureContext,\r\n useTernSecure,\r\n initialState\r\n}", "'use client'\r\n\r\nimport React, { useState } from 'react'\r\nimport { TernSecureContext, initialState } from './ternSecureContext'\r\n\r\nexport function TernSecureClientProvider({ children }: { children: React.ReactNode }) {\r\n const stateAndUpdater = useState(initialState)\r\n\r\n return (\r\n <TernSecureContext.Provider value={stateAndUpdater}>\r\n {children}\r\n </TernSecureContext.Provider>\r\n )\r\n}", "export { TernSecureProvider } from './providers/TernSecureServerProvider';", "import React, { ReactNode } from 'react';\r\nimport dynamic from 'next/dynamic'\r\n\r\ninterface TernSecureProviderProps {\r\n children: ReactNode;\r\n}\r\n\r\n// Dynamically import the client provider with no SSR\r\nconst TernSecureClientProvider = dynamic(\r\n () => import('../../client/providers/ternSecureClientProvider').then(mod => mod.TernSecureClientProvider),\r\n { \r\n //ssr: false,\r\n loading: () => null // Return null or a loading indicator\r\n }\r\n)\r\n\r\nexport function TernSecureProvider({ children }: TernSecureProviderProps) {\r\n // Check if the children contain html/body tags\r\n const isRootLayout = React.Children.toArray(children).some(\r\n child => React.isValidElement(child) && child.type === 'html'\r\n );\r\n\r\n if (isRootLayout) {\r\n // If this is the root layout, inject our provider after the body tag\r\n return React.Children.map(children, child => {\r\n if (React.isValidElement(child) && child.type === 'html') {\r\n return React.cloneElement(child, {}, \r\n React.Children.map(child.props.children, bodyChild => {\r\n if (React.isValidElement(bodyChild) && bodyChild.type === 'body') {\r\n // Type assertion to access props safely\r\n const bodyProps = bodyChild.props as { children: ReactNode };\r\n return React.cloneElement(bodyChild, {}, \r\n <TernSecureClientProvider>\r\n {bodyProps.children}\r\n </TernSecureClientProvider>\r\n );\r\n }\r\n return bodyChild;\r\n })\r\n );\r\n }\r\n return child;\r\n });\r\n }\r\n\r\n // For non-root layouts, wrap normally\r\n return <TernSecureClientProvider>{children}</TernSecureClientProvider>;\r\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAEA,cAGM,cAaA;AAlBN;AAAA;AAAA;AAAA;AAEA,mBAAkB;AAGlB,IAAM,eAAgC;AAAA,MACpC,UAAU;AAAA,QACR,aAAa;AAAA,QACb,OAAO;AAAA,MACT;AAAA,MACA,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,QACP,YAAY;AAAA,MACd;AAAA,IACF;AAEA,IAAM,oBAAoB,aAAAA,QAAM,cAAwF,CAAC,cAAc,MAAM;AAAA,IAAC,CAAC,CAAC;AAAA;AAAA;;;AClBhJ;AAAA;AAAA;AAAA;AAKO,SAAS,yBAAyB,EAAE,SAAS,GAAkC;AACpF,QAAM,sBAAkB,wBAAS,YAAY;AAE7C,SACE,4CAAC,kBAAkB,UAAlB,EAA2B,OAAO,iBAChC,UACH;AAEJ;AAbA,IAEAC,eAOI;AATJ;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAAgC;AAChC;AAMI;AAAA;AAAA;;;ACTJ;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAC,gBAAiC;AACjC,qBAAoB;AA+BJ,IAAAC,sBAAA;AAxBhB,IAAMC,gCAA2B,eAAAC;AAAA,EAC/B,MAAM,kGAA0D,KAAK,SAAO,IAAI,wBAAwB;AAAA,EACxG;AAAA;AAAA,IAEE,SAAS,MAAM;AAAA;AAAA,EACjB;AACF;AAEO,SAAS,mBAAmB,EAAE,SAAS,GAA4B;AAExE,QAAM,eAAe,cAAAC,QAAM,SAAS,QAAQ,QAAQ,EAAE;AAAA,IACpD,WAAS,cAAAA,QAAM,eAAe,KAAK,KAAK,MAAM,SAAS;AAAA,EACzD;AAEA,MAAI,cAAc;AAEhB,WAAO,cAAAA,QAAM,SAAS,IAAI,UAAU,WAAS;AAC3C,UAAI,cAAAA,QAAM,eAAe,KAAK,KAAK,MAAM,SAAS,QAAQ;AACxD,eAAO,cAAAA,QAAM;AAAA,UAAa;AAAA,UAAO,CAAC;AAAA,UAChC,cAAAA,QAAM,SAAS,IAAI,MAAM,MAAM,UAAU,eAAa;AACpD,gBAAI,cAAAA,QAAM,eAAe,SAAS,KAAK,UAAU,SAAS,QAAQ;AAEhE,oBAAM,YAAY,UAAU;AAC5B,qBAAO,cAAAA,QAAM;AAAA,gBAAa;AAAA,gBAAW,CAAC;AAAA,gBACpC,6CAACF,2BAAA,EACE,oBAAU,UACb;AAAA,cACF;AAAA,YACF;AACA,mBAAO;AAAA,UACT,CAAC;AAAA,QACH;AAAA,MACF;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAGA,SAAO,6CAACA,2BAAA,EAA0B,UAAS;AAC7C;",
|
|
6
|
+
"names": ["React", "import_react", "import_react", "import_jsx_runtime", "TernSecureClientProvider", "dynamic", "React"]
|
|
7
|
+
}
|
|
@@ -1,90 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
1
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
8
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
11
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"src/app-router/client/providers/ternSecureContext.tsx"() {
|
|
16
|
-
"use strict";
|
|
17
|
-
"use client";
|
|
18
|
-
initialState = {
|
|
19
|
-
firebase: {
|
|
20
|
-
initialized: false,
|
|
21
|
-
error: null
|
|
22
|
-
},
|
|
23
|
-
auth: {
|
|
24
|
-
user: null,
|
|
25
|
-
loading: true,
|
|
26
|
-
error: null,
|
|
27
|
-
isSignedIn: false
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
TernSecureContext = React.createContext([initialState, () => {
|
|
31
|
-
}]);
|
|
32
|
-
useTernSecure = (hookname) => {
|
|
33
|
-
const context = React.useContext(TernSecureContext);
|
|
34
|
-
if (!context) {
|
|
35
|
-
throw new Error(
|
|
36
|
-
`${hookname} must be used within TernSecureProvider`
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
return context;
|
|
40
|
-
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
41
17
|
}
|
|
42
|
-
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
29
|
|
|
44
|
-
// src/
|
|
45
|
-
var
|
|
46
|
-
__export(
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
import { useState } from "react";
|
|
50
|
-
import { jsx } from "react/jsx-runtime";
|
|
51
|
-
function TernSecureClientProvider({ children }) {
|
|
52
|
-
const stateAndUpdater = useState(initialState);
|
|
53
|
-
return /* @__PURE__ */ jsx(TernSecureContext.Provider, { value: stateAndUpdater, children });
|
|
54
|
-
}
|
|
55
|
-
var init_ternSecureClientProvider = __esm({
|
|
56
|
-
"src/app-router/client/providers/ternSecureClientProvider.tsx"() {
|
|
57
|
-
"use strict";
|
|
58
|
-
"use client";
|
|
59
|
-
init_ternSecureContext();
|
|
60
|
-
}
|
|
30
|
+
// src/components/index.ts
|
|
31
|
+
var components_exports = {};
|
|
32
|
+
__export(components_exports, {
|
|
33
|
+
SignIn: () => SignIn
|
|
61
34
|
});
|
|
35
|
+
module.exports = __toCommonJS(components_exports);
|
|
36
|
+
|
|
37
|
+
// src/components/sign-in.tsx
|
|
38
|
+
var import_react3 = require("react");
|
|
62
39
|
|
|
63
40
|
// src/app-router/client/client-init.ts
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
41
|
+
var import_app = require("firebase/app");
|
|
42
|
+
var import_auth = require("firebase/auth");
|
|
43
|
+
var import_firestore = require("firebase/firestore");
|
|
44
|
+
var import_storage = require("firebase/storage");
|
|
68
45
|
var app = (() => {
|
|
69
46
|
const config = validateConfig(loadFireConfig());
|
|
70
|
-
return getApps().length ? getApps()[0] : initializeApp(config);
|
|
47
|
+
return (0, import_app.getApps)().length ? (0, import_app.getApps)()[0] : (0, import_app.initializeApp)(config);
|
|
71
48
|
})();
|
|
72
|
-
var auth = getAuth(app);
|
|
73
|
-
setPersistence(auth, browserSessionPersistence);
|
|
74
|
-
var firestore = getFirestore(app);
|
|
75
|
-
var storage = getStorage(app);
|
|
49
|
+
var auth = (0, import_auth.getAuth)(app);
|
|
50
|
+
(0, import_auth.setPersistence)(auth, import_auth.browserSessionPersistence);
|
|
51
|
+
var firestore = (0, import_firestore.getFirestore)(app);
|
|
52
|
+
var storage = (0, import_storage.getStorage)(app);
|
|
76
53
|
var TernSecureAuth = () => auth;
|
|
77
|
-
var TernSecureFirestore = () => firestore;
|
|
78
|
-
var TernSecureStorage = () => storage;
|
|
79
54
|
|
|
80
55
|
// src/app-router/client/auth.ts
|
|
81
|
-
|
|
56
|
+
var import_auth2 = require("firebase/auth");
|
|
82
57
|
async function signInWithEmail({
|
|
83
58
|
email,
|
|
84
59
|
password
|
|
85
60
|
}) {
|
|
86
61
|
const auth2 = TernSecureAuth();
|
|
87
|
-
return signInWithEmailAndPassword(auth2, email, password);
|
|
62
|
+
return (0, import_auth2.signInWithEmailAndPassword)(auth2, email, password);
|
|
88
63
|
}
|
|
89
64
|
|
|
90
65
|
// src/app-router/client/config.ts
|
|
@@ -106,111 +81,26 @@ var validateConfig = (config) => {
|
|
|
106
81
|
return config;
|
|
107
82
|
};
|
|
108
83
|
|
|
109
|
-
// src/app-router/client/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
loading: () => null
|
|
122
|
-
// Return null or a loading indicator
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
function TernSecureProvider({ children }) {
|
|
126
|
-
const isRootLayout = React3.Children.toArray(children).some(
|
|
127
|
-
(child) => React3.isValidElement(child) && child.type === "html"
|
|
128
|
-
);
|
|
129
|
-
if (isRootLayout) {
|
|
130
|
-
return React3.Children.map(children, (child) => {
|
|
131
|
-
if (React3.isValidElement(child) && child.type === "html") {
|
|
132
|
-
return React3.cloneElement(
|
|
133
|
-
child,
|
|
134
|
-
{},
|
|
135
|
-
React3.Children.map(child.props.children, (bodyChild) => {
|
|
136
|
-
if (React3.isValidElement(bodyChild) && bodyChild.type === "body") {
|
|
137
|
-
const bodyProps = bodyChild.props;
|
|
138
|
-
return React3.cloneElement(
|
|
139
|
-
bodyChild,
|
|
140
|
-
{},
|
|
141
|
-
/* @__PURE__ */ jsx2(TernSecureClientProvider2, { children: bodyProps.children })
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
return bodyChild;
|
|
145
|
-
})
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
return child;
|
|
149
|
-
});
|
|
84
|
+
// src/app-router/client/providers/ternSecureContext.tsx
|
|
85
|
+
var import_react = __toESM(require("react"), 1);
|
|
86
|
+
var initialState = {
|
|
87
|
+
firebase: {
|
|
88
|
+
initialized: false,
|
|
89
|
+
error: null
|
|
90
|
+
},
|
|
91
|
+
auth: {
|
|
92
|
+
user: null,
|
|
93
|
+
loading: true,
|
|
94
|
+
error: null,
|
|
95
|
+
isSignedIn: false
|
|
150
96
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// src/hooks/useAuth.ts
|
|
155
|
-
import { useEffect } from "react";
|
|
156
|
-
function useAuth() {
|
|
157
|
-
const [state, setState] = useTernSecure("useAuth");
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
try {
|
|
160
|
-
const auth2 = TernSecureAuth();
|
|
161
|
-
setState((prev) => ({
|
|
162
|
-
...prev,
|
|
163
|
-
firebase: {
|
|
164
|
-
initialized: true,
|
|
165
|
-
error: null
|
|
166
|
-
}
|
|
167
|
-
}));
|
|
168
|
-
const unsubscribe = auth2.onAuthStateChanged(
|
|
169
|
-
(user) => {
|
|
170
|
-
setState((prev) => ({
|
|
171
|
-
...prev,
|
|
172
|
-
auth: {
|
|
173
|
-
user,
|
|
174
|
-
loading: false,
|
|
175
|
-
error: null,
|
|
176
|
-
isSignedIn: !!user
|
|
177
|
-
}
|
|
178
|
-
}));
|
|
179
|
-
},
|
|
180
|
-
(error) => {
|
|
181
|
-
setState((prev) => ({
|
|
182
|
-
...prev,
|
|
183
|
-
auth: {
|
|
184
|
-
user: null,
|
|
185
|
-
loading: false,
|
|
186
|
-
error,
|
|
187
|
-
isSignedIn: false
|
|
188
|
-
}
|
|
189
|
-
}));
|
|
190
|
-
}
|
|
191
|
-
);
|
|
192
|
-
return () => unsubscribe();
|
|
193
|
-
} catch (error) {
|
|
194
|
-
setState((prev) => ({
|
|
195
|
-
...prev,
|
|
196
|
-
firebase: {
|
|
197
|
-
initialized: false,
|
|
198
|
-
error
|
|
199
|
-
},
|
|
200
|
-
auth: {
|
|
201
|
-
user: null,
|
|
202
|
-
loading: false,
|
|
203
|
-
error,
|
|
204
|
-
isSignedIn: false
|
|
205
|
-
}
|
|
206
|
-
}));
|
|
207
|
-
}
|
|
208
|
-
}, []);
|
|
209
|
-
return state.auth;
|
|
210
|
-
}
|
|
97
|
+
};
|
|
98
|
+
var TernSecureContext = import_react.default.createContext([initialState, () => {
|
|
99
|
+
}]);
|
|
211
100
|
|
|
212
|
-
// src/
|
|
213
|
-
|
|
101
|
+
// src/app-router/client/providers/ternSecureClientProvider.tsx
|
|
102
|
+
var import_react2 = require("react");
|
|
103
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
214
104
|
|
|
215
105
|
// src/utils/create-styles.ts
|
|
216
106
|
var PREFIX = "tern";
|
|
@@ -331,7 +221,7 @@ var styleConfig = {
|
|
|
331
221
|
var styles = createStyleSheet(styleConfig);
|
|
332
222
|
|
|
333
223
|
// src/components/sign-in.tsx
|
|
334
|
-
|
|
224
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
335
225
|
function SignIn({
|
|
336
226
|
onSuccess,
|
|
337
227
|
onError,
|
|
@@ -340,10 +230,10 @@ function SignIn({
|
|
|
340
230
|
style,
|
|
341
231
|
customStyles = {}
|
|
342
232
|
}) {
|
|
343
|
-
const [email, setEmail] =
|
|
344
|
-
const [password, setPassword] =
|
|
345
|
-
const [loading, setLoading] =
|
|
346
|
-
const [error, setError] =
|
|
233
|
+
const [email, setEmail] = (0, import_react3.useState)("");
|
|
234
|
+
const [password, setPassword] = (0, import_react3.useState)("");
|
|
235
|
+
const [loading, setLoading] = (0, import_react3.useState)(false);
|
|
236
|
+
const [error, setError] = (0, import_react3.useState)("");
|
|
347
237
|
const handleSubmit = async (e) => {
|
|
348
238
|
e.preventDefault();
|
|
349
239
|
setLoading(true);
|
|
@@ -362,9 +252,9 @@ function SignIn({
|
|
|
362
252
|
setLoading(false);
|
|
363
253
|
}
|
|
364
254
|
};
|
|
365
|
-
return /* @__PURE__ */ jsxs("div", { className: `${styles.container} ${customStyles.container || ""}`, style, children: [
|
|
366
|
-
/* @__PURE__ */
|
|
367
|
-
/* @__PURE__ */
|
|
255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `${styles.container} ${customStyles.container || ""}`, style, children: [
|
|
256
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${styles.header} ${customStyles.header || ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: `${styles.title} ${customStyles.title || ""}`, children: "Sign in to your account" }) }),
|
|
257
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${styles.formWrapper} ${customStyles.formWrapper || ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${styles.formContainer} ${customStyles.formContainer || ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
368
258
|
"form",
|
|
369
259
|
{
|
|
370
260
|
onSubmit: handleSubmit,
|
|
@@ -372,7 +262,7 @@ function SignIn({
|
|
|
372
262
|
role: "form",
|
|
373
263
|
"aria-label": "Sign in form",
|
|
374
264
|
children: [
|
|
375
|
-
error && /* @__PURE__ */
|
|
265
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
376
266
|
"div",
|
|
377
267
|
{
|
|
378
268
|
className: `${styles.error} ${customStyles.errorText || ""}`,
|
|
@@ -381,9 +271,9 @@ function SignIn({
|
|
|
381
271
|
children: error
|
|
382
272
|
}
|
|
383
273
|
),
|
|
384
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
/* @__PURE__ */
|
|
274
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: "email", className: `${styles.label} ${customStyles.label || ""}`, children: "Email" }),
|
|
276
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
387
277
|
"input",
|
|
388
278
|
{
|
|
389
279
|
id: "email",
|
|
@@ -399,9 +289,9 @@ function SignIn({
|
|
|
399
289
|
}
|
|
400
290
|
)
|
|
401
291
|
] }),
|
|
402
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
293
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: "password", className: `${styles.label} ${customStyles.label || ""}`, children: "Password" }),
|
|
294
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
405
295
|
"input",
|
|
406
296
|
{
|
|
407
297
|
id: "password",
|
|
@@ -417,7 +307,7 @@ function SignIn({
|
|
|
417
307
|
}
|
|
418
308
|
)
|
|
419
309
|
] }),
|
|
420
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
421
311
|
"button",
|
|
422
312
|
{
|
|
423
313
|
type: "submit",
|
|
@@ -432,18 +322,8 @@ function SignIn({
|
|
|
432
322
|
) }) })
|
|
433
323
|
] });
|
|
434
324
|
}
|
|
435
|
-
export
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
TernSecureContext,
|
|
440
|
-
TernSecureFirestore,
|
|
441
|
-
TernSecureProvider,
|
|
442
|
-
TernSecureStorage,
|
|
443
|
-
loadFireConfig,
|
|
444
|
-
signInWithEmail,
|
|
445
|
-
useAuth,
|
|
446
|
-
useTernSecure,
|
|
447
|
-
validateConfig
|
|
448
|
-
};
|
|
325
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
326
|
+
0 && (module.exports = {
|
|
327
|
+
SignIn
|
|
328
|
+
});
|
|
449
329
|
//# sourceMappingURL=index.js.map
|