@tern-secure/nextjs 3.1.22 → 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-AHVNPKXU.js +41 -0
- package/dist/index.cjs +174 -71
- package/dist/index.js +50 -23
- package/dist/ternSecureClientProvider-P663N3F7.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/app-router/client/providers/ternSecureClientProvider.tsx
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
|
|
4
|
+
// src/app-router/client/providers/ternSecureContext.tsx
|
|
5
|
+
import React from "react";
|
|
6
|
+
var initialState = {
|
|
7
|
+
firebase: {
|
|
8
|
+
initialized: false,
|
|
9
|
+
error: null
|
|
10
|
+
},
|
|
11
|
+
auth: {
|
|
12
|
+
user: null,
|
|
13
|
+
loading: true,
|
|
14
|
+
error: null,
|
|
15
|
+
isSignedIn: false
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var TernSecureContext = React.createContext([initialState, () => {
|
|
19
|
+
}]);
|
|
20
|
+
var useTernSecure = (hookname) => {
|
|
21
|
+
const context = React.useContext(TernSecureContext);
|
|
22
|
+
if (!context) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`${hookname} must be used within TernSecureProvider`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return context;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// src/app-router/client/providers/ternSecureClientProvider.tsx
|
|
31
|
+
import { jsx } from "react/jsx-runtime";
|
|
32
|
+
function TernSecureClientProvider({ children }) {
|
|
33
|
+
const stateAndUpdater = useState(initialState);
|
|
34
|
+
return /* @__PURE__ */ jsx(TernSecureContext.Provider, { value: stateAndUpdater, children });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
TernSecureContext,
|
|
39
|
+
useTernSecure,
|
|
40
|
+
TernSecureClientProvider
|
|
41
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,20 +1,111 @@
|
|
|
1
|
-
|
|
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);
|
|
2
32
|
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
33
|
+
// src/app-router/client/providers/ternSecureContext.tsx
|
|
34
|
+
var import_react, initialState, TernSecureContext, useTernSecure;
|
|
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
|
+
useTernSecure = (hookname) => {
|
|
55
|
+
const context = import_react.default.useContext(TernSecureContext);
|
|
56
|
+
if (!context) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
`${hookname} must be used within TernSecureProvider`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
return context;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
11
65
|
|
|
12
|
-
|
|
66
|
+
// src/app-router/client/providers/ternSecureClientProvider.tsx
|
|
67
|
+
var ternSecureClientProvider_exports = {};
|
|
68
|
+
__export(ternSecureClientProvider_exports, {
|
|
69
|
+
TernSecureClientProvider: () => TernSecureClientProvider
|
|
70
|
+
});
|
|
71
|
+
function TernSecureClientProvider({ children }) {
|
|
72
|
+
const stateAndUpdater = (0, import_react2.useState)(initialState);
|
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TernSecureContext.Provider, { value: stateAndUpdater, children });
|
|
74
|
+
}
|
|
75
|
+
var import_react2, import_jsx_runtime;
|
|
76
|
+
var init_ternSecureClientProvider = __esm({
|
|
77
|
+
"src/app-router/client/providers/ternSecureClientProvider.tsx"() {
|
|
78
|
+
"use strict";
|
|
79
|
+
"use client";
|
|
80
|
+
import_react2 = require("react");
|
|
81
|
+
init_ternSecureContext();
|
|
82
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
83
|
+
}
|
|
84
|
+
});
|
|
13
85
|
|
|
14
|
-
|
|
15
|
-
var
|
|
86
|
+
// src/index.ts
|
|
87
|
+
var src_exports = {};
|
|
88
|
+
__export(src_exports, {
|
|
89
|
+
SignIn: () => SignIn,
|
|
90
|
+
TernSecureAuth: () => TernSecureAuth,
|
|
91
|
+
TernSecureClientProvider: () => TernSecureClientProvider,
|
|
92
|
+
TernSecureContext: () => TernSecureContext,
|
|
93
|
+
TernSecureFirestore: () => TernSecureFirestore,
|
|
94
|
+
TernSecureProvider: () => TernSecureProvider,
|
|
95
|
+
TernSecureStorage: () => TernSecureStorage,
|
|
96
|
+
loadFireConfig: () => loadFireConfig,
|
|
97
|
+
signInWithEmail: () => signInWithEmail,
|
|
98
|
+
useAuth: () => useAuth,
|
|
99
|
+
useTernSecure: () => useTernSecure,
|
|
100
|
+
validateConfig: () => validateConfig
|
|
101
|
+
});
|
|
102
|
+
module.exports = __toCommonJS(src_exports);
|
|
16
103
|
|
|
17
|
-
|
|
104
|
+
// src/app-router/client/client-init.ts
|
|
105
|
+
var import_app = require("firebase/app");
|
|
106
|
+
var import_auth = require("firebase/auth");
|
|
107
|
+
var import_firestore = require("firebase/firestore");
|
|
108
|
+
var import_storage = require("firebase/storage");
|
|
18
109
|
|
|
19
110
|
// src/app-router/client/config.ts
|
|
20
111
|
var loadFireConfig = () => ({
|
|
@@ -38,46 +129,58 @@ var validateConfig = (config) => {
|
|
|
38
129
|
// src/app-router/client/client-init.ts
|
|
39
130
|
var app = (() => {
|
|
40
131
|
const config = validateConfig(loadFireConfig());
|
|
41
|
-
return
|
|
132
|
+
return (0, import_app.getApps)().length ? (0, import_app.getApps)()[0] : (0, import_app.initializeApp)(config);
|
|
42
133
|
})();
|
|
43
|
-
var auth =
|
|
44
|
-
|
|
45
|
-
var firestore =
|
|
46
|
-
var storage =
|
|
134
|
+
var auth = (0, import_auth.getAuth)(app);
|
|
135
|
+
(0, import_auth.setPersistence)(auth, import_auth.browserSessionPersistence);
|
|
136
|
+
var firestore = (0, import_firestore.getFirestore)(app);
|
|
137
|
+
var storage = (0, import_storage.getStorage)(app);
|
|
47
138
|
var TernSecureAuth = () => auth;
|
|
48
139
|
var TernSecureFirestore = () => firestore;
|
|
49
140
|
var TernSecureStorage = () => storage;
|
|
141
|
+
|
|
142
|
+
// src/app-router/client/auth.ts
|
|
143
|
+
var import_auth2 = require("firebase/auth");
|
|
50
144
|
async function signInWithEmail({
|
|
51
145
|
email,
|
|
52
146
|
password
|
|
53
147
|
}) {
|
|
54
148
|
const auth2 = TernSecureAuth();
|
|
55
|
-
return
|
|
149
|
+
return (0, import_auth2.signInWithEmailAndPassword)(auth2, email, password);
|
|
56
150
|
}
|
|
57
|
-
|
|
58
|
-
|
|
151
|
+
|
|
152
|
+
// src/app-router/client/index.ts
|
|
153
|
+
init_ternSecureContext();
|
|
154
|
+
init_ternSecureClientProvider();
|
|
155
|
+
|
|
156
|
+
// src/app-router/server/providers/TernSecureServerProvider.tsx
|
|
157
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
158
|
+
var import_dynamic = __toESM(require("next/dynamic"), 1);
|
|
159
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
160
|
+
var TernSecureClientProvider2 = (0, import_dynamic.default)(
|
|
161
|
+
() => Promise.resolve().then(() => (init_ternSecureClientProvider(), ternSecureClientProvider_exports)).then((mod) => mod.TernSecureClientProvider),
|
|
59
162
|
{
|
|
60
163
|
ssr: false
|
|
61
164
|
//loading: () => null // Return null or a loading indicator
|
|
62
165
|
}
|
|
63
166
|
);
|
|
64
167
|
function TernSecureProvider({ children }) {
|
|
65
|
-
const isRootLayout =
|
|
66
|
-
(child) =>
|
|
168
|
+
const isRootLayout = import_react3.default.Children.toArray(children).some(
|
|
169
|
+
(child) => import_react3.default.isValidElement(child) && child.type === "html"
|
|
67
170
|
);
|
|
68
171
|
if (isRootLayout) {
|
|
69
|
-
return
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
172
|
+
return import_react3.default.Children.map(children, (child) => {
|
|
173
|
+
if (import_react3.default.isValidElement(child) && child.type === "html") {
|
|
174
|
+
return import_react3.default.cloneElement(
|
|
72
175
|
child,
|
|
73
176
|
{},
|
|
74
|
-
|
|
75
|
-
if (
|
|
177
|
+
import_react3.default.Children.map(child.props.children, (bodyChild) => {
|
|
178
|
+
if (import_react3.default.isValidElement(bodyChild) && bodyChild.type === "body") {
|
|
76
179
|
const bodyProps = bodyChild.props;
|
|
77
|
-
return
|
|
180
|
+
return import_react3.default.cloneElement(
|
|
78
181
|
bodyChild,
|
|
79
182
|
{},
|
|
80
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TernSecureClientProvider2, { children: bodyProps.children })
|
|
81
184
|
);
|
|
82
185
|
}
|
|
83
186
|
return bodyChild;
|
|
@@ -87,11 +190,14 @@ function TernSecureProvider({ children }) {
|
|
|
87
190
|
return child;
|
|
88
191
|
});
|
|
89
192
|
}
|
|
90
|
-
return /* @__PURE__ */
|
|
193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TernSecureClientProvider2, { children });
|
|
91
194
|
}
|
|
195
|
+
|
|
196
|
+
// src/hooks/useAuth.ts
|
|
197
|
+
var import_react4 = require("react");
|
|
92
198
|
function useAuth() {
|
|
93
|
-
const [state, setState] =
|
|
94
|
-
|
|
199
|
+
const [state, setState] = useTernSecure("useAuth");
|
|
200
|
+
(0, import_react4.useEffect)(() => {
|
|
95
201
|
try {
|
|
96
202
|
const auth2 = TernSecureAuth();
|
|
97
203
|
setState((prev) => ({
|
|
@@ -145,6 +251,9 @@ function useAuth() {
|
|
|
145
251
|
return state.auth;
|
|
146
252
|
}
|
|
147
253
|
|
|
254
|
+
// src/components/sign-in.tsx
|
|
255
|
+
var import_react5 = require("react");
|
|
256
|
+
|
|
148
257
|
// src/utils/create-styles.ts
|
|
149
258
|
var PREFIX = "tern";
|
|
150
259
|
var styleInjection = {
|
|
@@ -262,6 +371,9 @@ var styleConfig = {
|
|
|
262
371
|
}
|
|
263
372
|
};
|
|
264
373
|
var styles = createStyleSheet(styleConfig);
|
|
374
|
+
|
|
375
|
+
// src/components/sign-in.tsx
|
|
376
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
265
377
|
function SignIn({
|
|
266
378
|
onSuccess,
|
|
267
379
|
onError,
|
|
@@ -270,10 +382,10 @@ function SignIn({
|
|
|
270
382
|
style,
|
|
271
383
|
customStyles = {}
|
|
272
384
|
}) {
|
|
273
|
-
const [email, setEmail] =
|
|
274
|
-
const [password, setPassword] =
|
|
275
|
-
const [loading, setLoading] =
|
|
276
|
-
const [error, setError] =
|
|
385
|
+
const [email, setEmail] = (0, import_react5.useState)("");
|
|
386
|
+
const [password, setPassword] = (0, import_react5.useState)("");
|
|
387
|
+
const [loading, setLoading] = (0, import_react5.useState)(false);
|
|
388
|
+
const [error, setError] = (0, import_react5.useState)("");
|
|
277
389
|
const handleSubmit = async (e) => {
|
|
278
390
|
e.preventDefault();
|
|
279
391
|
setLoading(true);
|
|
@@ -292,9 +404,9 @@ function SignIn({
|
|
|
292
404
|
setLoading(false);
|
|
293
405
|
}
|
|
294
406
|
};
|
|
295
|
-
return /* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
297
|
-
/* @__PURE__ */
|
|
407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `${styles.container} ${customStyles.container || ""}`, style, children: [
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `${styles.header} ${customStyles.header || ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: `${styles.title} ${customStyles.title || ""}`, children: "Sign in to your account" }) }),
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `${styles.formWrapper} ${customStyles.formWrapper || ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `${styles.formContainer} ${customStyles.formContainer || ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
298
410
|
"form",
|
|
299
411
|
{
|
|
300
412
|
onSubmit: handleSubmit,
|
|
@@ -302,7 +414,7 @@ function SignIn({
|
|
|
302
414
|
role: "form",
|
|
303
415
|
"aria-label": "Sign in form",
|
|
304
416
|
children: [
|
|
305
|
-
error && /* @__PURE__ */
|
|
417
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
306
418
|
"div",
|
|
307
419
|
{
|
|
308
420
|
className: `${styles.error} ${customStyles.errorText || ""}`,
|
|
@@ -311,9 +423,9 @@ function SignIn({
|
|
|
311
423
|
children: error
|
|
312
424
|
}
|
|
313
425
|
),
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { htmlFor: "email", className: `${styles.label} ${customStyles.label || ""}`, children: "Email" }),
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
317
429
|
"input",
|
|
318
430
|
{
|
|
319
431
|
id: "email",
|
|
@@ -329,9 +441,9 @@ function SignIn({
|
|
|
329
441
|
}
|
|
330
442
|
)
|
|
331
443
|
] }),
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { htmlFor: "password", className: `${styles.label} ${customStyles.label || ""}`, children: "Password" }),
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
335
447
|
"input",
|
|
336
448
|
{
|
|
337
449
|
id: "password",
|
|
@@ -347,7 +459,7 @@ function SignIn({
|
|
|
347
459
|
}
|
|
348
460
|
)
|
|
349
461
|
] }),
|
|
350
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
351
463
|
"button",
|
|
352
464
|
{
|
|
353
465
|
type: "submit",
|
|
@@ -362,27 +474,18 @@ function SignIn({
|
|
|
362
474
|
) }) })
|
|
363
475
|
] });
|
|
364
476
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
477
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
478
|
+
0 && (module.exports = {
|
|
479
|
+
SignIn,
|
|
480
|
+
TernSecureAuth,
|
|
481
|
+
TernSecureClientProvider,
|
|
482
|
+
TernSecureContext,
|
|
483
|
+
TernSecureFirestore,
|
|
484
|
+
TernSecureProvider,
|
|
485
|
+
TernSecureStorage,
|
|
486
|
+
loadFireConfig,
|
|
487
|
+
signInWithEmail,
|
|
488
|
+
useAuth,
|
|
489
|
+
useTernSecure,
|
|
490
|
+
validateConfig
|
|
377
491
|
});
|
|
378
|
-
exports.SignIn = SignIn;
|
|
379
|
-
exports.TernSecureAuth = TernSecureAuth;
|
|
380
|
-
exports.TernSecureFirestore = TernSecureFirestore;
|
|
381
|
-
exports.TernSecureProvider = TernSecureProvider;
|
|
382
|
-
exports.TernSecureStorage = TernSecureStorage;
|
|
383
|
-
exports.loadFireConfig = loadFireConfig;
|
|
384
|
-
exports.signInWithEmail = signInWithEmail;
|
|
385
|
-
exports.useAuth = useAuth;
|
|
386
|
-
exports.validateConfig = validateConfig;
|
|
387
|
-
//# sourceMappingURL=index.cjs.map
|
|
388
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { getStorage } from 'firebase/storage';
|
|
7
|
-
import React, { useEffect, useState } from 'react';
|
|
8
|
-
import dynamic from 'next/dynamic';
|
|
9
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import {
|
|
2
|
+
TernSecureClientProvider,
|
|
3
|
+
TernSecureContext,
|
|
4
|
+
useTernSecure
|
|
5
|
+
} from "./chunk-AHVNPKXU.js";
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
// src/app-router/client/client-init.ts
|
|
8
|
+
import { getApps, initializeApp } from "firebase/app";
|
|
9
|
+
import { getAuth, setPersistence, browserSessionPersistence } from "firebase/auth";
|
|
10
|
+
import { getFirestore } from "firebase/firestore";
|
|
11
|
+
import { getStorage } from "firebase/storage";
|
|
12
12
|
|
|
13
13
|
// src/app-router/client/config.ts
|
|
14
14
|
var loadFireConfig = () => ({
|
|
@@ -41,6 +41,9 @@ var storage = getStorage(app);
|
|
|
41
41
|
var TernSecureAuth = () => auth;
|
|
42
42
|
var TernSecureFirestore = () => firestore;
|
|
43
43
|
var TernSecureStorage = () => storage;
|
|
44
|
+
|
|
45
|
+
// src/app-router/client/auth.ts
|
|
46
|
+
import { signInWithEmailAndPassword } from "firebase/auth";
|
|
44
47
|
async function signInWithEmail({
|
|
45
48
|
email,
|
|
46
49
|
password
|
|
@@ -48,8 +51,13 @@ async function signInWithEmail({
|
|
|
48
51
|
const auth2 = TernSecureAuth();
|
|
49
52
|
return signInWithEmailAndPassword(auth2, email, password);
|
|
50
53
|
}
|
|
54
|
+
|
|
55
|
+
// src/app-router/server/providers/TernSecureServerProvider.tsx
|
|
56
|
+
import React from "react";
|
|
57
|
+
import dynamic from "next/dynamic";
|
|
58
|
+
import { jsx } from "react/jsx-runtime";
|
|
51
59
|
var TernSecureClientProvider2 = dynamic(
|
|
52
|
-
() => import(
|
|
60
|
+
() => import("./ternSecureClientProvider-P663N3F7.js").then((mod) => mod.TernSecureClientProvider),
|
|
53
61
|
{
|
|
54
62
|
ssr: false
|
|
55
63
|
//loading: () => null // Return null or a loading indicator
|
|
@@ -83,6 +91,9 @@ function TernSecureProvider({ children }) {
|
|
|
83
91
|
}
|
|
84
92
|
return /* @__PURE__ */ jsx(TernSecureClientProvider2, { children });
|
|
85
93
|
}
|
|
94
|
+
|
|
95
|
+
// src/hooks/useAuth.ts
|
|
96
|
+
import { useEffect } from "react";
|
|
86
97
|
function useAuth() {
|
|
87
98
|
const [state, setState] = useTernSecure("useAuth");
|
|
88
99
|
useEffect(() => {
|
|
@@ -139,6 +150,9 @@ function useAuth() {
|
|
|
139
150
|
return state.auth;
|
|
140
151
|
}
|
|
141
152
|
|
|
153
|
+
// src/components/sign-in.tsx
|
|
154
|
+
import { useState } from "react";
|
|
155
|
+
|
|
142
156
|
// src/utils/create-styles.ts
|
|
143
157
|
var PREFIX = "tern";
|
|
144
158
|
var styleInjection = {
|
|
@@ -256,6 +270,9 @@ var styleConfig = {
|
|
|
256
270
|
}
|
|
257
271
|
};
|
|
258
272
|
var styles = createStyleSheet(styleConfig);
|
|
273
|
+
|
|
274
|
+
// src/components/sign-in.tsx
|
|
275
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
259
276
|
function SignIn({
|
|
260
277
|
onSuccess,
|
|
261
278
|
onError,
|
|
@@ -287,8 +304,8 @@ function SignIn({
|
|
|
287
304
|
}
|
|
288
305
|
};
|
|
289
306
|
return /* @__PURE__ */ jsxs("div", { className: `${styles.container} ${customStyles.container || ""}`, style, children: [
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ jsx2("div", { className: `${styles.header} ${customStyles.header || ""}`, children: /* @__PURE__ */ jsx2("h2", { className: `${styles.title} ${customStyles.title || ""}`, children: "Sign in to your account" }) }),
|
|
308
|
+
/* @__PURE__ */ jsx2("div", { className: `${styles.formWrapper} ${customStyles.formWrapper || ""}`, children: /* @__PURE__ */ jsx2("div", { className: `${styles.formContainer} ${customStyles.formContainer || ""}`, children: /* @__PURE__ */ jsxs(
|
|
292
309
|
"form",
|
|
293
310
|
{
|
|
294
311
|
onSubmit: handleSubmit,
|
|
@@ -296,7 +313,7 @@ function SignIn({
|
|
|
296
313
|
role: "form",
|
|
297
314
|
"aria-label": "Sign in form",
|
|
298
315
|
children: [
|
|
299
|
-
error && /* @__PURE__ */
|
|
316
|
+
error && /* @__PURE__ */ jsx2(
|
|
300
317
|
"div",
|
|
301
318
|
{
|
|
302
319
|
className: `${styles.error} ${customStyles.errorText || ""}`,
|
|
@@ -306,8 +323,8 @@ function SignIn({
|
|
|
306
323
|
}
|
|
307
324
|
),
|
|
308
325
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ jsx2("label", { htmlFor: "email", className: `${styles.label} ${customStyles.label || ""}`, children: "Email" }),
|
|
327
|
+
/* @__PURE__ */ jsx2(
|
|
311
328
|
"input",
|
|
312
329
|
{
|
|
313
330
|
id: "email",
|
|
@@ -324,8 +341,8 @@ function SignIn({
|
|
|
324
341
|
)
|
|
325
342
|
] }),
|
|
326
343
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ jsx2("label", { htmlFor: "password", className: `${styles.label} ${customStyles.label || ""}`, children: "Password" }),
|
|
345
|
+
/* @__PURE__ */ jsx2(
|
|
329
346
|
"input",
|
|
330
347
|
{
|
|
331
348
|
id: "password",
|
|
@@ -341,7 +358,7 @@ function SignIn({
|
|
|
341
358
|
}
|
|
342
359
|
)
|
|
343
360
|
] }),
|
|
344
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ jsx2(
|
|
345
362
|
"button",
|
|
346
363
|
{
|
|
347
364
|
type: "submit",
|
|
@@ -356,7 +373,17 @@ function SignIn({
|
|
|
356
373
|
) }) })
|
|
357
374
|
] });
|
|
358
375
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
376
|
+
export {
|
|
377
|
+
SignIn,
|
|
378
|
+
TernSecureAuth,
|
|
379
|
+
TernSecureClientProvider,
|
|
380
|
+
TernSecureContext,
|
|
381
|
+
TernSecureFirestore,
|
|
382
|
+
TernSecureProvider,
|
|
383
|
+
TernSecureStorage,
|
|
384
|
+
loadFireConfig,
|
|
385
|
+
signInWithEmail,
|
|
386
|
+
useAuth,
|
|
387
|
+
useTernSecure,
|
|
388
|
+
validateConfig
|
|
389
|
+
};
|