@tern-secure/nextjs 3.4.0 → 3.4.2
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/TernSecureProvider.js +33 -0
- package/dist/cjs/app-router/client/TernSecureProvider.js.map +1 -0
- package/dist/cjs/app-router/client/actions.js +180 -0
- package/dist/cjs/app-router/client/actions.js.map +1 -0
- package/dist/cjs/app-router/route-handler/internal-route.js +45 -0
- package/dist/cjs/app-router/route-handler/internal-route.js.map +1 -0
- package/dist/cjs/app-router/server/auth.js +71 -0
- package/dist/cjs/app-router/server/auth.js.map +1 -0
- package/dist/cjs/app-router/server/index.js +42 -0
- package/dist/cjs/app-router/server/index.js.map +1 -0
- package/dist/cjs/app-router/server/sessionTernSecure.js +159 -0
- package/dist/cjs/app-router/server/sessionTernSecure.js.map +1 -0
- package/dist/cjs/app-router/server/ternSecureMiddleware.js +50 -0
- package/dist/cjs/app-router/server/ternSecureMiddleware.js.map +1 -0
- package/dist/cjs/boundary/TernSecureClientProvider.js +107 -0
- package/dist/cjs/boundary/TernSecureClientProvider.js.map +1 -0
- package/dist/cjs/boundary/TernSecureCtx.js +49 -0
- package/dist/cjs/boundary/TernSecureCtx.js.map +1 -0
- package/dist/cjs/boundary/hooks/useAuth.js +51 -0
- package/dist/cjs/boundary/hooks/useAuth.js.map +1 -0
- package/dist/cjs/boundary/hooks/useSignUp.js +40 -0
- package/dist/cjs/boundary/hooks/useSignUp.js.map +1 -0
- package/dist/cjs/boundary/hooks/useUser.js +44 -0
- package/dist/cjs/boundary/hooks/useUser.js.map +1 -0
- package/dist/cjs/components/background.js +65 -0
- package/dist/cjs/components/background.js.map +1 -0
- package/dist/cjs/components/sign-in.js +242 -0
- package/dist/cjs/components/sign-in.js.map +1 -0
- package/dist/cjs/components/sign-out.js +69 -0
- package/dist/cjs/components/sign-out.js.map +1 -0
- package/dist/cjs/components/sign-up.js +327 -0
- package/dist/cjs/components/sign-up.js.map +1 -0
- package/dist/cjs/components/ui/alert.js +88 -0
- package/dist/cjs/components/ui/alert.js.map +1 -0
- package/dist/cjs/components/ui/button.js +84 -0
- package/dist/cjs/components/ui/button.js.map +1 -0
- package/dist/cjs/components/ui/card.js +101 -0
- package/dist/cjs/components/ui/card.js.map +1 -0
- package/dist/cjs/components/ui/input.js +58 -0
- package/dist/cjs/components/ui/input.js.map +1 -0
- package/dist/cjs/components/ui/label.js +55 -0
- package/dist/cjs/components/ui/label.js.map +1 -0
- package/dist/cjs/components/ui/separator.js +59 -0
- package/dist/cjs/components/ui/separator.js.map +1 -0
- package/dist/cjs/components/verify.js +195 -0
- package/dist/cjs/components/verify.js.map +1 -0
- package/dist/cjs/errors.js +41 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.js +59 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/utils.d.js +17 -0
- package/dist/cjs/lib/utils.d.js.map +1 -0
- package/dist/cjs/lib/utils.js +33 -0
- package/dist/cjs/lib/utils.js.map +1 -0
- package/dist/cjs/types.js +17 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/admin-init.js +57 -0
- package/dist/cjs/utils/admin-init.js.map +1 -0
- package/dist/cjs/utils/client-init.js +49 -0
- package/dist/cjs/utils/client-init.js.map +1 -0
- package/dist/cjs/utils/config.js +113 -0
- package/dist/cjs/utils/config.js.map +1 -0
- package/dist/cjs/utils/construct.js +63 -0
- package/dist/cjs/utils/construct.js.map +1 -0
- package/dist/cjs/utils/create-styles.js +149 -0
- package/dist/cjs/utils/create-styles.js.map +1 -0
- package/dist/esm/app-router/client/TernSecureProvider.js +9 -0
- package/dist/esm/app-router/client/TernSecureProvider.js.map +1 -0
- package/dist/esm/app-router/client/actions.js +151 -0
- package/dist/esm/app-router/client/actions.js.map +1 -0
- package/dist/esm/app-router/route-handler/internal-route.js +20 -0
- package/dist/esm/app-router/route-handler/internal-route.js.map +1 -0
- package/dist/esm/app-router/server/auth.js +47 -0
- package/dist/esm/app-router/server/auth.js.map +1 -0
- package/dist/esm/app-router/server/index.js +13 -0
- package/dist/esm/app-router/server/index.js.map +1 -0
- package/dist/esm/app-router/server/sessionTernSecure.js +129 -0
- package/dist/esm/app-router/server/sessionTernSecure.js.map +1 -0
- package/dist/esm/app-router/server/ternSecureMiddleware.js +26 -0
- package/dist/esm/app-router/server/ternSecureMiddleware.js.map +1 -0
- package/dist/esm/boundary/TernSecureClientProvider.js +83 -0
- package/dist/esm/boundary/TernSecureClientProvider.js.map +1 -0
- package/dist/esm/boundary/TernSecureCtx.js +23 -0
- package/dist/esm/boundary/TernSecureCtx.js.map +1 -0
- package/dist/esm/boundary/hooks/useAuth.js +27 -0
- package/dist/esm/boundary/hooks/useAuth.js.map +1 -0
- package/dist/esm/boundary/hooks/useSignUp.js +16 -0
- package/dist/esm/boundary/hooks/useSignUp.js.map +1 -0
- package/dist/esm/boundary/hooks/useUser.js +20 -0
- package/dist/esm/boundary/hooks/useUser.js.map +1 -0
- package/dist/esm/components/background.js +41 -0
- package/dist/esm/components/background.js.map +1 -0
- package/dist/esm/components/sign-in.js +218 -0
- package/dist/esm/components/sign-in.js.map +1 -0
- package/dist/esm/components/sign-out.js +45 -0
- package/dist/esm/components/sign-out.js.map +1 -0
- package/dist/esm/components/sign-up.js +293 -0
- package/dist/esm/components/sign-up.js.map +1 -0
- package/dist/esm/components/ui/alert.js +52 -0
- package/dist/esm/components/ui/alert.js.map +1 -0
- package/dist/esm/components/ui/button.js +49 -0
- package/dist/esm/components/ui/button.js.map +1 -0
- package/dist/esm/components/ui/card.js +62 -0
- package/dist/esm/components/ui/card.js.map +1 -0
- package/dist/esm/components/ui/input.js +24 -0
- package/dist/esm/components/ui/input.js.map +1 -0
- package/dist/esm/components/ui/label.js +21 -0
- package/dist/esm/components/ui/label.js.map +1 -0
- package/dist/esm/components/ui/separator.js +25 -0
- package/dist/esm/components/ui/separator.js.map +1 -0
- package/dist/esm/components/verify.js +161 -0
- package/dist/esm/components/verify.js.map +1 -0
- package/dist/esm/errors.js +16 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.js +24 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/utils.d.js +1 -0
- package/dist/esm/lib/utils.d.js.map +1 -0
- package/dist/esm/lib/utils.js +9 -0
- package/dist/esm/lib/utils.js.map +1 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/admin-init.js +22 -0
- package/dist/esm/utils/admin-init.js.map +1 -0
- package/dist/esm/utils/client-init.js +22 -0
- package/dist/esm/utils/client-init.js.map +1 -0
- package/dist/esm/utils/config.js +84 -0
- package/dist/esm/utils/config.js.map +1 -0
- package/dist/esm/utils/construct.js +37 -0
- package/dist/esm/utils/construct.js.map +1 -0
- package/dist/esm/utils/create-styles.js +123 -0
- package/dist/esm/utils/create-styles.js.map +1 -0
- package/dist/types/app-router/client/TernSecureProvider.d.ts +26 -0
- package/dist/types/app-router/client/TernSecureProvider.d.ts.map +1 -0
- package/dist/types/app-router/client/actions.d.ts +49 -0
- package/dist/types/app-router/client/actions.d.ts.map +1 -0
- package/dist/types/app-router/route-handler/internal-route.d.ts +9 -0
- package/dist/types/app-router/route-handler/internal-route.d.ts.map +1 -0
- package/dist/types/app-router/server/auth.d.ts +7 -0
- package/dist/types/app-router/server/auth.d.ts.map +1 -0
- package/dist/types/app-router/server/index.d.ts +5 -0
- package/dist/types/app-router/server/index.d.ts.map +1 -0
- package/dist/types/app-router/server/sessionTernSecure.d.ts +37 -0
- package/dist/types/app-router/server/sessionTernSecure.d.ts.map +1 -0
- package/dist/types/app-router/server/ternSecureMiddleware.d.ts +7 -0
- package/dist/types/app-router/server/ternSecureMiddleware.d.ts.map +1 -0
- package/dist/types/boundary/TernSecureClientProvider.d.ts +11 -0
- package/dist/types/boundary/TernSecureClientProvider.d.ts.map +1 -0
- package/dist/types/boundary/TernSecureCtx.d.ts +17 -0
- package/dist/types/boundary/TernSecureCtx.d.ts.map +1 -0
- package/dist/types/boundary/hooks/useAuth.d.ts +11 -0
- package/dist/types/boundary/hooks/useAuth.d.ts.map +1 -0
- package/dist/types/boundary/hooks/useSignUp.d.ts +5 -0
- package/dist/types/boundary/hooks/useSignUp.d.ts.map +1 -0
- package/dist/types/boundary/hooks/useUser.d.ts +7 -0
- package/dist/types/boundary/hooks/useUser.d.ts.map +1 -0
- package/dist/types/components/background.d.ts +2 -0
- package/dist/types/components/background.d.ts.map +1 -0
- package/dist/types/components/sign-in.d.ts +18 -0
- package/dist/types/components/sign-in.d.ts.map +1 -0
- package/dist/types/components/sign-out.d.ts +10 -0
- package/dist/types/components/sign-out.d.ts.map +1 -0
- package/dist/types/components/sign-up.d.ts +7 -0
- package/dist/types/components/sign-up.d.ts.map +1 -0
- package/dist/types/components/ui/alert.d.ts +9 -0
- package/dist/types/components/ui/alert.d.ts.map +1 -0
- package/dist/types/components/ui/button.d.ts +12 -0
- package/dist/types/components/ui/button.d.ts.map +1 -0
- package/dist/types/components/ui/card.d.ts +9 -0
- package/dist/types/components/ui/card.d.ts.map +1 -0
- package/dist/types/components/ui/input.d.ts +4 -0
- package/dist/types/components/ui/input.d.ts.map +1 -0
- package/dist/types/components/ui/label.d.ts +6 -0
- package/dist/types/components/ui/label.d.ts.map +1 -0
- package/dist/types/components/ui/separator.d.ts +5 -0
- package/dist/types/components/ui/separator.d.ts.map +1 -0
- package/dist/types/components/verify.d.ts +2 -0
- package/dist/types/components/verify.d.ts.map +1 -0
- package/dist/types/errors.d.ts +9 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/utils.d.ts +3 -0
- package/dist/types/lib/utils.d.ts.map +1 -0
- package/dist/types/types.d.ts +63 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils/admin-init.d.ts +4 -0
- package/dist/types/utils/admin-init.d.ts.map +1 -0
- package/dist/types/utils/client-init.d.ts +5 -0
- package/dist/types/utils/client-init.d.ts.map +1 -0
- package/dist/types/utils/config.d.ts +35 -0
- package/dist/types/utils/config.d.ts.map +1 -0
- package/dist/types/utils/construct.d.ts +22 -0
- package/dist/types/utils/construct.d.ts.map +1 -0
- package/dist/types/utils/create-styles.d.ts +99 -0
- package/dist/types/utils/create-styles.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var errors_exports = {};
|
|
20
|
+
__export(errors_exports, {
|
|
21
|
+
ERRORS: () => ERRORS,
|
|
22
|
+
TernSecureError: () => TernSecureError
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(errors_exports);
|
|
25
|
+
const ERRORS = {
|
|
26
|
+
SERVER_SIDE_INITIALIZATION: "TernSecure must be initialized on the client side",
|
|
27
|
+
NOT_INITIALIZED: "TernSecure services are not initialized. Call initializeTernSecure() first",
|
|
28
|
+
HOOK_CONTEXT: (hookName) => `${hookName} must be used within TernSecureProvider`
|
|
29
|
+
};
|
|
30
|
+
class TernSecureError extends Error {
|
|
31
|
+
constructor(message) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.name = "TernSecureError";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
ERRORS,
|
|
39
|
+
TernSecureError
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/errors.ts"],"sourcesContent":["export const ERRORS = {\n SERVER_SIDE_INITIALIZATION: 'TernSecure must be initialized on the client side',\n NOT_INITIALIZED: 'TernSecure services are not initialized. Call initializeTernSecure() first',\n HOOK_CONTEXT: (hookName: string) => `${hookName} must be used within TernSecureProvider`,\n } as const;\n \n export class TernSecureError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'TernSecureError';\n }\n }"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,SAAS;AAAA,EAClB,4BAA4B;AAAA,EAC5B,iBAAiB;AAAA,EACjB,cAAc,CAAC,aAAqB,GAAG,QAAQ;AACjD;AAEO,MAAM,wBAAwB,MAAM;AAAA,EACzC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
__export(index_exports, {
|
|
21
|
+
SignIn: () => import_sign_in.SignIn,
|
|
22
|
+
SignOut: () => import_sign_out.SignOut,
|
|
23
|
+
SignUp: () => import_sign_up.SignUp,
|
|
24
|
+
TernSecureAuth: () => import_client_init.TernSecureAuth,
|
|
25
|
+
TernSecureFirestore: () => import_client_init.TernSecureFirestore,
|
|
26
|
+
TernSecureProvider: () => import_TernSecureProvider.TernSecureProvider,
|
|
27
|
+
loadFireConfig: () => import_config.loadFireConfig,
|
|
28
|
+
signInWithEmail: () => import_actions.signInWithEmail,
|
|
29
|
+
ternSecureAuth: () => import_client_init.ternSecureAuth,
|
|
30
|
+
useAuth: () => import_useAuth.useAuth,
|
|
31
|
+
useUser: () => import_useUser.useUser,
|
|
32
|
+
validateConfig: () => import_config.validateConfig
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(index_exports);
|
|
35
|
+
var import_client_init = require("./utils/client-init");
|
|
36
|
+
var import_config = require("./utils/config");
|
|
37
|
+
var import_actions = require("./app-router/client/actions");
|
|
38
|
+
var import_TernSecureProvider = require("./app-router/client/TernSecureProvider");
|
|
39
|
+
var import_useAuth = require("./boundary/hooks/useAuth");
|
|
40
|
+
var import_useUser = require("./boundary/hooks/useUser");
|
|
41
|
+
var import_sign_in = require("./components/sign-in");
|
|
42
|
+
var import_sign_out = require("./components/sign-out");
|
|
43
|
+
var import_sign_up = require("./components/sign-up");
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
SignIn,
|
|
47
|
+
SignOut,
|
|
48
|
+
SignUp,
|
|
49
|
+
TernSecureAuth,
|
|
50
|
+
TernSecureFirestore,
|
|
51
|
+
TernSecureProvider,
|
|
52
|
+
loadFireConfig,
|
|
53
|
+
signInWithEmail,
|
|
54
|
+
ternSecureAuth,
|
|
55
|
+
useAuth,
|
|
56
|
+
useUser,
|
|
57
|
+
validateConfig
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["\n//import { TernSecureServerProvider } from './app-router/server/TernSecureServerProvider'\n//import type { TernSecureState } from './app-router/client/TernSecureProvider'\nexport { TernSecureAuth, TernSecureFirestore, ternSecureAuth } from './utils/client-init'\nexport { loadFireConfig, validateConfig } from './utils/config'\nexport { signInWithEmail } from './app-router/client/actions'\n//export { useInternalContext } from './boundary/TernSecureCtx'\n//export { TernSecureClientProvider } from './app-router/client/TernSecureProvider'\nexport { TernSecureProvider } from './app-router/client/TernSecureProvider'\nexport { useAuth } from './boundary/hooks/useAuth' \nexport { useUser } from './boundary/hooks/useUser'\nexport { SignIn } from './components/sign-in'\nexport { SignOut } from './components/sign-out'\nexport { SignUp } from './components/sign-up'\n\n//export const TernSecureProvider = TernSecureServerProvider\n//export type { TernSecureState }"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAoE;AACpE,oBAA+C;AAC/C,qBAAgC;AAGhC,gCAAmC;AACnC,qBAAwB;AACxB,qBAAwB;AACxB,qBAAuB;AACvB,sBAAwB;AACxB,qBAAuB;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var utils_d_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(utils_d_exports);
|
|
17
|
+
//# sourceMappingURL=utils.d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
cn: () => cn
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
|
+
var import_clsx = require("clsx");
|
|
25
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
26
|
+
function cn(...inputs) {
|
|
27
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
cn
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["import { FirebaseOptions } from 'firebase/app'\n\n/**\n * TernSecure Firebase configuration interface\n * Extends Firebase's base configuration options\n */\nexport interface TernSecureConfig extends FirebaseOptions {\n apiKey: string\n authDomain: string\n projectId: string\n storageBucket: string\n messagingSenderId: string\n appId: string\n measurementId?: string // Optional for analytics\n}\n\n/**\n * TernSecure initialization options\n */\nexport interface TernSecureOptions {\n /** Environment setting for different configurations */\n environment?: 'development' | 'production'\n /** Geographic region for data storage */\n region?: string\n /** Custom error handler */\n onError?: (error: Error) => void\n /** Debug mode flag */\n debug?: boolean\n}\n\n/**\n * Firebase initialization state\n */\nexport interface FirebaseState {\n /** Whether Firebase has been initialized */\n initialized: boolean\n /** Any initialization errors */\n error: Error | null\n /** Timestamp of last initialization attempt */\n lastInitAttempt?: number\n}\n\n/**\n * Configuration validation result\n */\nexport interface ConfigValidationResult {\n isValid: boolean\n errors: string[]\n config: TernSecureConfig\n}\n\n/**\n * Firebase Admin configuration interface\n */\nexport interface TernSecureAdminConfig {\n projectId: string\n clientEmail: string\n privateKey: string\n}\n\n/**\n * Firebase Admin configuration validation result\n */\nexport interface AdminConfigValidationResult {\n isValid: boolean\n errors: string[]\n config: TernSecureAdminConfig\n}\n\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
var admin_init_exports = {};
|
|
30
|
+
__export(admin_init_exports, {
|
|
31
|
+
adminTernSecureAuth: () => adminTernSecureAuth,
|
|
32
|
+
adminTernSecureDb: () => adminTernSecureDb
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(admin_init_exports);
|
|
35
|
+
var import_firebase_admin = __toESM(require("firebase-admin"));
|
|
36
|
+
var import_config = require("./config");
|
|
37
|
+
if (!import_firebase_admin.default.apps.length) {
|
|
38
|
+
try {
|
|
39
|
+
const config = (0, import_config.initializeAdminConfig)();
|
|
40
|
+
import_firebase_admin.default.initializeApp({
|
|
41
|
+
credential: import_firebase_admin.default.credential.cert({
|
|
42
|
+
...config,
|
|
43
|
+
privateKey: config.privateKey.replace(/\\n/g, "\n")
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error("Firebase admin initialization error", error);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const adminTernSecureAuth = import_firebase_admin.default.auth();
|
|
51
|
+
const adminTernSecureDb = import_firebase_admin.default.firestore();
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
adminTernSecureAuth,
|
|
55
|
+
adminTernSecureDb
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=admin-init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/admin-init.ts"],"sourcesContent":["import admin from 'firebase-admin';\nimport { initializeAdminConfig } from './config';\n\nif (!admin.apps.length) {\n try {\n const config = initializeAdminConfig();\n admin.initializeApp({\n credential: admin.credential.cert({\n ...config,\n privateKey: config.privateKey.replace(/\\\\n/g, '\\n'),\n }),\n });\n } catch (error) {\n console.error('Firebase admin initialization error', error);\n }\n}\n\nexport const adminTernSecureAuth = admin.auth();\nexport const adminTernSecureDb = admin.firestore();"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAkB;AAClB,oBAAsC;AAEtC,IAAI,CAAC,sBAAAA,QAAM,KAAK,QAAQ;AACtB,MAAI;AACF,UAAM,aAAS,qCAAsB;AACrC,0BAAAA,QAAM,cAAc;AAAA,MAClB,YAAY,sBAAAA,QAAM,WAAW,KAAK;AAAA,QAChC,GAAG;AAAA,QACH,YAAY,OAAO,WAAW,QAAQ,QAAQ,IAAI;AAAA,MACpD,CAAC;AAAA,IACH,CAAC;AAAA,EACH,SAAS,OAAO;AACd,YAAQ,MAAM,uCAAuC,KAAK;AAAA,EAC5D;AACF;AAEO,MAAM,sBAAsB,sBAAAA,QAAM,KAAK;AACvC,MAAM,oBAAoB,sBAAAA,QAAM,UAAU;","names":["admin"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var client_init_exports = {};
|
|
20
|
+
__export(client_init_exports, {
|
|
21
|
+
TernSecureAuth: () => TernSecureAuth,
|
|
22
|
+
TernSecureFirestore: () => TernSecureFirestore,
|
|
23
|
+
TernSecureStorage: () => TernSecureStorage,
|
|
24
|
+
ternSecureAuth: () => ternSecureAuth
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(client_init_exports);
|
|
27
|
+
var import_app = require("firebase/app");
|
|
28
|
+
var import_auth = require("firebase/auth");
|
|
29
|
+
var import_firestore = require("firebase/firestore");
|
|
30
|
+
var import_storage = require("firebase/storage");
|
|
31
|
+
var import_config = require("./config");
|
|
32
|
+
const APP_NAME = process.env.NEXT_PUBLIC_APP_NAME;
|
|
33
|
+
const config = (0, import_config.initializeConfig)();
|
|
34
|
+
const clientApp = (0, import_app.getApps)().length === 0 ? (0, import_app.initializeApp)(config, APP_NAME) : (0, import_app.getApps)()[0];
|
|
35
|
+
const ternSecureAuth = (0, import_auth.getAuth)(clientApp);
|
|
36
|
+
(0, import_auth.setPersistence)(ternSecureAuth, import_auth.browserSessionPersistence);
|
|
37
|
+
const firestore = (0, import_firestore.getFirestore)(clientApp);
|
|
38
|
+
const storage = (0, import_storage.getStorage)(clientApp);
|
|
39
|
+
const TernSecureAuth = () => ternSecureAuth;
|
|
40
|
+
const TernSecureFirestore = () => firestore;
|
|
41
|
+
const TernSecureStorage = () => storage;
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
TernSecureAuth,
|
|
45
|
+
TernSecureFirestore,
|
|
46
|
+
TernSecureStorage,
|
|
47
|
+
ternSecureAuth
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=client-init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/client-init.ts"],"sourcesContent":["import { initializeApp, getApps } from 'firebase/app';\nimport { getAuth, setPersistence, browserSessionPersistence } from 'firebase/auth';\nimport { getFirestore } from 'firebase/firestore';\nimport { getStorage } from 'firebase/storage';\nimport { initializeConfig} from './config';\n\nconst APP_NAME = process.env.NEXT_PUBLIC_APP_NAME;\n\n// Initialize immediately\nconst config = initializeConfig();\nconst clientApp = getApps().length === 0 ? initializeApp(config, APP_NAME) : getApps()[0];\nexport const ternSecureAuth = getAuth(clientApp);\nsetPersistence(ternSecureAuth, browserSessionPersistence); //to change later user should be able to choose persistance\nconst firestore = getFirestore(clientApp);\nconst storage = getStorage(clientApp);\n\n\n\nexport const TernSecureAuth = () => ternSecureAuth;\nexport const TernSecureFirestore = () => firestore;\nexport const TernSecureStorage = () => storage;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAuC;AACvC,kBAAmE;AACnE,uBAA6B;AAC7B,qBAA2B;AAC3B,oBAAgC;AAEhC,MAAM,WAAW,QAAQ,IAAI;AAG7B,MAAM,aAAS,gCAAiB;AAChC,MAAM,gBAAY,oBAAQ,EAAE,WAAW,QAAI,0BAAc,QAAQ,QAAQ,QAAI,oBAAQ,EAAE,CAAC;AACjF,MAAM,qBAAiB,qBAAQ,SAAS;AAAA,IAC/C,4BAAe,gBAAgB,qCAAyB;AACxD,MAAM,gBAAY,+BAAa,SAAS;AACxC,MAAM,cAAU,2BAAW,SAAS;AAI7B,MAAM,iBAAiB,MAAM;AAC7B,MAAM,sBAAsB,MAAM;AAClC,MAAM,oBAAoB,MAAM;","names":[]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var config_exports = {};
|
|
20
|
+
__export(config_exports, {
|
|
21
|
+
initializeAdminConfig: () => initializeAdminConfig,
|
|
22
|
+
initializeConfig: () => initializeConfig,
|
|
23
|
+
loadAdminConfig: () => loadAdminConfig,
|
|
24
|
+
loadFireConfig: () => loadFireConfig,
|
|
25
|
+
validateAdminConfig: () => validateAdminConfig,
|
|
26
|
+
validateConfig: () => validateConfig
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(config_exports);
|
|
29
|
+
const loadFireConfig = () => ({
|
|
30
|
+
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY || "",
|
|
31
|
+
authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN || "",
|
|
32
|
+
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID || "",
|
|
33
|
+
storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET || "",
|
|
34
|
+
messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID || "",
|
|
35
|
+
appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID || "",
|
|
36
|
+
measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID || void 0
|
|
37
|
+
});
|
|
38
|
+
const validateConfig = (config) => {
|
|
39
|
+
const requiredFields = [
|
|
40
|
+
"apiKey",
|
|
41
|
+
"authDomain",
|
|
42
|
+
"projectId",
|
|
43
|
+
"storageBucket",
|
|
44
|
+
"messagingSenderId",
|
|
45
|
+
"appId"
|
|
46
|
+
];
|
|
47
|
+
const errors = [];
|
|
48
|
+
requiredFields.forEach((field) => {
|
|
49
|
+
if (!config[field]) {
|
|
50
|
+
errors.push(`Missing required field: NEXT_PUBLIC_FIREBASE_${String(field).toUpperCase()}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
isValid: errors.length === 0,
|
|
55
|
+
errors,
|
|
56
|
+
config
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const initializeConfig = () => {
|
|
60
|
+
const config = loadFireConfig();
|
|
61
|
+
const validationResult = validateConfig(config);
|
|
62
|
+
if (!validationResult.isValid) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
`Firebase configuration validation failed:
|
|
65
|
+
${validationResult.errors.join("\n")}`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return config;
|
|
69
|
+
};
|
|
70
|
+
const loadAdminConfig = () => ({
|
|
71
|
+
projectId: process.env.FIREBASE_PROJECT_ID || "",
|
|
72
|
+
clientEmail: process.env.FIREBASE_CLIENT_EMAIL || "",
|
|
73
|
+
privateKey: process.env.FIREBASE_PRIVATE_KEY || ""
|
|
74
|
+
});
|
|
75
|
+
const validateAdminConfig = (config) => {
|
|
76
|
+
const requiredFields = [
|
|
77
|
+
"projectId",
|
|
78
|
+
"clientEmail",
|
|
79
|
+
"privateKey"
|
|
80
|
+
];
|
|
81
|
+
const errors = [];
|
|
82
|
+
requiredFields.forEach((field) => {
|
|
83
|
+
if (!config[field]) {
|
|
84
|
+
errors.push(`Missing required field: FIREBASE_${String(field).toUpperCase()}`);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
isValid: errors.length === 0,
|
|
89
|
+
errors,
|
|
90
|
+
config
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const initializeAdminConfig = () => {
|
|
94
|
+
const config = loadAdminConfig();
|
|
95
|
+
const validationResult = validateAdminConfig(config);
|
|
96
|
+
if (!validationResult.isValid) {
|
|
97
|
+
throw new Error(
|
|
98
|
+
`Firebase Admin configuration validation failed:
|
|
99
|
+
${validationResult.errors.join("\n")}`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return config;
|
|
103
|
+
};
|
|
104
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
+
0 && (module.exports = {
|
|
106
|
+
initializeAdminConfig,
|
|
107
|
+
initializeConfig,
|
|
108
|
+
loadAdminConfig,
|
|
109
|
+
loadFireConfig,
|
|
110
|
+
validateAdminConfig,
|
|
111
|
+
validateConfig
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/config.ts"],"sourcesContent":["import { TernSecureConfig, ConfigValidationResult, TernSecureAdminConfig, AdminConfigValidationResult } from '../types'\n\n/**\n * Loads Firebase configuration from environment variables\n * @returns {TernSecureConfig} Firebase configuration object\n */\nexport const loadFireConfig = (): TernSecureConfig => ({\n apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY || '',\n authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN || '',\n projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID || '',\n storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET || '',\n messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID || '',\n appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID || '',\n measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID || undefined,\n})\n\n/**\n * Validates Firebase configuration\n * @param {TernSecureConfig} config - Firebase configuration object\n * @throws {Error} If required configuration values are missing\n * @returns {TernSecureConfig} Validated configuration object\n */\nexport const validateConfig = (config: TernSecureConfig): ConfigValidationResult => {\n const requiredFields: (keyof TernSecureConfig)[] = [\n 'apiKey',\n 'authDomain',\n 'projectId',\n 'storageBucket',\n 'messagingSenderId',\n 'appId'\n ]\n\n const errors: string[] = []\n \n requiredFields.forEach(field => {\n if (!config[field]) {\n errors.push(`Missing required field: NEXT_PUBLIC_FIREBASE_${String(field).toUpperCase()}`)\n }\n })\n\n return {\n isValid: errors.length === 0,\n errors,\n config\n }\n}\n\n/**\n * Initializes configuration with validation\n * @throws {Error} If configuration is invalid\n */\nexport const initializeConfig = (): TernSecureConfig => {\n const config = loadFireConfig()\n const validationResult = validateConfig(config)\n\n if (!validationResult.isValid) {\n throw new Error(\n `Firebase configuration validation failed:\\n${validationResult.errors.join('\\n')}`\n )\n }\n\n return config\n}\n\n/**\n * Loads Firebase Admin configuration from environment variables\n * @returns {AdminConfig} Firebase Admin configuration object\n */\nexport const loadAdminConfig = (): TernSecureAdminConfig => ({\n projectId: process.env.FIREBASE_PROJECT_ID || '',\n clientEmail: process.env.FIREBASE_CLIENT_EMAIL || '',\n privateKey: process.env.FIREBASE_PRIVATE_KEY || '',\n})\n\n/**\n * Validates Firebase Admin configuration\n * @param {AdminConfig} config - Firebase Admin configuration object\n * @returns {ConfigValidationResult} Validation result\n */\nexport const validateAdminConfig = (config: TernSecureAdminConfig): AdminConfigValidationResult => {\n const requiredFields: (keyof TernSecureAdminConfig)[] = [\n 'projectId',\n 'clientEmail',\n 'privateKey'\n ]\n\n const errors: string[] = []\n \n requiredFields.forEach(field => {\n if (!config[field]) {\n errors.push(`Missing required field: FIREBASE_${String(field).toUpperCase()}`)\n }\n })\n\n return {\n isValid: errors.length === 0,\n errors,\n config\n }\n}\n\n/**\n * Initializes admin configuration with validation\n * @throws {Error} If configuration is invalid\n */\nexport const initializeAdminConfig = (): TernSecureAdminConfig => {\n const config = loadAdminConfig()\n const validationResult = validateAdminConfig(config)\n\n if (!validationResult.isValid) {\n throw new Error(\n `Firebase Admin configuration validation failed:\\n${validationResult.errors.join('\\n')}`\n )\n }\n\n return config\n}"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,MAAM,iBAAiB,OAAyB;AAAA,EACrD,QAAQ,QAAQ,IAAI,gCAAgC;AAAA,EACpD,YAAY,QAAQ,IAAI,oCAAoC;AAAA,EAC5D,WAAW,QAAQ,IAAI,mCAAmC;AAAA,EAC1D,eAAe,QAAQ,IAAI,uCAAuC;AAAA,EAClE,mBAAmB,QAAQ,IAAI,4CAA4C;AAAA,EAC3E,OAAO,QAAQ,IAAI,+BAA+B;AAAA,EAClD,eAAe,QAAQ,IAAI,uCAAuC;AACpE;AAQO,MAAM,iBAAiB,CAAC,WAAqD;AAClF,QAAM,iBAA6C;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,SAAmB,CAAC;AAE1B,iBAAe,QAAQ,WAAS;AAC9B,QAAI,CAAC,OAAO,KAAK,GAAG;AAClB,aAAO,KAAK,gDAAgD,OAAO,KAAK,EAAE,YAAY,CAAC,EAAE;AAAA,IAC3F;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,SAAS,OAAO,WAAW;AAAA,IAC3B;AAAA,IACA;AAAA,EACF;AACF;AAMO,MAAM,mBAAmB,MAAwB;AACtD,QAAM,SAAS,eAAe;AAC9B,QAAM,mBAAmB,eAAe,MAAM;AAE9C,MAAI,CAAC,iBAAiB,SAAS;AAC7B,UAAM,IAAI;AAAA,MACR;AAAA,EAA8C,iBAAiB,OAAO,KAAK,IAAI,CAAC;AAAA,IAClF;AAAA,EACF;AAEA,SAAO;AACT;AAMO,MAAM,kBAAkB,OAA8B;AAAA,EAC3D,WAAW,QAAQ,IAAI,uBAAuB;AAAA,EAC9C,aAAa,QAAQ,IAAI,yBAAyB;AAAA,EAClD,YAAY,QAAQ,IAAI,wBAAwB;AAClD;AAOO,MAAM,sBAAsB,CAAC,WAA+D;AACjG,QAAM,iBAAkD;AAAA,IACtD;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,SAAmB,CAAC;AAE1B,iBAAe,QAAQ,WAAS;AAC9B,QAAI,CAAC,OAAO,KAAK,GAAG;AAClB,aAAO,KAAK,oCAAoC,OAAO,KAAK,EAAE,YAAY,CAAC,EAAE;AAAA,IAC/E;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,SAAS,OAAO,WAAW;AAAA,IAC3B;AAAA,IACA;AAAA,EACF;AACF;AAMO,MAAM,wBAAwB,MAA6B;AAChE,QAAM,SAAS,gBAAgB;AAC/B,QAAM,mBAAmB,oBAAoB,MAAM;AAEnD,MAAI,CAAC,iBAAiB,SAAS;AAC7B,UAAM,IAAI;AAAA,MACR;AAAA,EAAoD,iBAAiB,OAAO,KAAK,IAAI,CAAC;AAAA,IACxF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var construct_exports = {};
|
|
20
|
+
__export(construct_exports, {
|
|
21
|
+
constructFullUrl: () => constructFullUrl,
|
|
22
|
+
constructUrlWithRedirect: () => constructUrlWithRedirect,
|
|
23
|
+
getValidRedirectUrl: () => getValidRedirectUrl
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(construct_exports);
|
|
26
|
+
const constructFullUrl = (path) => {
|
|
27
|
+
const baseUrl = window.location.origin;
|
|
28
|
+
if (path.startsWith("http")) {
|
|
29
|
+
return path;
|
|
30
|
+
}
|
|
31
|
+
return `${baseUrl}${path.startsWith("/") ? path : `/${path}`}`;
|
|
32
|
+
};
|
|
33
|
+
const constructUrlWithRedirect = (path, redirectUrl, loginPath) => {
|
|
34
|
+
const url = new URL(path, window.location.origin);
|
|
35
|
+
if (redirectUrl && !redirectUrl.startsWith(loginPath)) {
|
|
36
|
+
const fullRedirectUrl = redirectUrl.startsWith("http") ? redirectUrl : constructFullUrl(redirectUrl);
|
|
37
|
+
url.searchParams.set("redirect_url", fullRedirectUrl);
|
|
38
|
+
}
|
|
39
|
+
return url.toString();
|
|
40
|
+
};
|
|
41
|
+
const getValidRedirectUrl = (redirectUrl, searchParams) => {
|
|
42
|
+
const redirect = redirectUrl || searchParams.get("redirect_url") || "/";
|
|
43
|
+
try {
|
|
44
|
+
if (redirect.startsWith("http")) {
|
|
45
|
+
const url = new URL(redirect);
|
|
46
|
+
if (url.origin === window.location.origin) {
|
|
47
|
+
return redirect;
|
|
48
|
+
}
|
|
49
|
+
return "/";
|
|
50
|
+
}
|
|
51
|
+
return constructFullUrl(redirect);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
console.error("Invalid redirect URL:", e);
|
|
54
|
+
return constructFullUrl("/");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
constructFullUrl,
|
|
60
|
+
constructUrlWithRedirect,
|
|
61
|
+
getValidRedirectUrl
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=construct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/construct.ts"],"sourcesContent":["/**\n * Constructs a full URL with the current origin\n * @param path - The path to construct the URL for\n * @returns The full URL with origin\n */\nexport const constructFullUrl = (path: string) => {\n const baseUrl = window.location.origin\n if (path.startsWith('http')) {\n return path\n }\n return `${baseUrl}${path.startsWith('/') ? path : `/${path}`}`\n }\n \n /**\n * Constructs a URL with redirect parameters\n * @param path - The base path (usually login path)\n * @param redirectUrl - The URL to redirect to after action completes\n * @param loginPath - The login path to check against\n * @returns The full URL with redirect parameters\n */\n export const constructUrlWithRedirect = (path: string, redirectUrl: string, loginPath: string) => {\n // Create the URL with the full origin\n const url = new URL(path, window.location.origin)\n \n // Add redirect parameter if provided and not redirecting to login\n if (redirectUrl && !redirectUrl.startsWith(loginPath)) {\n // Ensure redirect URL is also absolute if it's not already\n const fullRedirectUrl = redirectUrl.startsWith('http') \n ? redirectUrl \n : constructFullUrl(redirectUrl)\n \n url.searchParams.set('redirect_url', fullRedirectUrl)\n }\n \n return url.toString()\n }\n \n /**\n * Gets a validated redirect URL ensuring it's from the same origin\n * @param redirectUrl - The URL to validate\n * @param searchParams - The search parameters to check for redirect_url\n * @returns A validated redirect URL\n */\n export const getValidRedirectUrl = (\n redirectUrl: string | undefined,\n searchParams: URLSearchParams\n ): string => {\n const redirect = redirectUrl || searchParams.get('redirect_url') || '/'\n \n try {\n if (redirect.startsWith('http')) {\n const url = new URL(redirect)\n if (url.origin === window.location.origin) {\n return redirect\n }\n return '/'\n }\n return constructFullUrl(redirect)\n } catch (e) {\n console.error('Invalid redirect URL:', e)\n return constructFullUrl('/')\n }\n }\n \n "],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,mBAAmB,CAAC,SAAiB;AAC9C,QAAM,UAAU,OAAO,SAAS;AAChC,MAAI,KAAK,WAAW,MAAM,GAAG;AAC3B,WAAO;AAAA,EACT;AACA,SAAO,GAAG,OAAO,GAAG,KAAK,WAAW,GAAG,IAAI,OAAO,IAAI,IAAI,EAAE;AAC9D;AASO,MAAM,2BAA2B,CAAC,MAAc,aAAqB,cAAsB;AAEhG,QAAM,MAAM,IAAI,IAAI,MAAM,OAAO,SAAS,MAAM;AAGhD,MAAI,eAAe,CAAC,YAAY,WAAW,SAAS,GAAG;AAErD,UAAM,kBAAkB,YAAY,WAAW,MAAM,IACjD,cACA,iBAAiB,WAAW;AAEhC,QAAI,aAAa,IAAI,gBAAgB,eAAe;AAAA,EACtD;AAEA,SAAO,IAAI,SAAS;AACtB;AAQO,MAAM,sBAAsB,CACjC,aACA,iBACW;AACX,QAAM,WAAW,eAAe,aAAa,IAAI,cAAc,KAAK;AAEpE,MAAI;AACF,QAAI,SAAS,WAAW,MAAM,GAAG;AAC/B,YAAM,MAAM,IAAI,IAAI,QAAQ;AAC5B,UAAI,IAAI,WAAW,OAAO,SAAS,QAAQ;AACzC,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT;AACA,WAAO,iBAAiB,QAAQ;AAAA,EAClC,SAAS,GAAG;AACV,YAAQ,MAAM,yBAAyB,CAAC;AACxC,WAAO,iBAAiB,GAAG;AAAA,EAC7B;AACF;","names":[]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var create_styles_exports = {};
|
|
21
|
+
__export(create_styles_exports, {
|
|
22
|
+
defaultClassNames: () => defaultClassNames,
|
|
23
|
+
styleConfig: () => styleConfig,
|
|
24
|
+
styles: () => styles
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(create_styles_exports);
|
|
27
|
+
const PREFIX = "tern";
|
|
28
|
+
const styleInjection = {
|
|
29
|
+
isInjected: false,
|
|
30
|
+
styleElement: null
|
|
31
|
+
};
|
|
32
|
+
const defaultClassNames = {
|
|
33
|
+
container: `${PREFIX}-container`,
|
|
34
|
+
header: `${PREFIX}-header`,
|
|
35
|
+
title: `${PREFIX}-title`,
|
|
36
|
+
formWrapper: `${PREFIX}-formWrapper`,
|
|
37
|
+
formContainer: `${PREFIX}-formContainer`,
|
|
38
|
+
form: `${PREFIX}-form`,
|
|
39
|
+
label: `${PREFIX}-label`,
|
|
40
|
+
input: `${PREFIX}-input`,
|
|
41
|
+
button: `${PREFIX}-button`,
|
|
42
|
+
error: `${PREFIX}-error`
|
|
43
|
+
};
|
|
44
|
+
function createStyleSheet(styles2) {
|
|
45
|
+
if (typeof window === "undefined") return defaultClassNames;
|
|
46
|
+
if (styleInjection.isInjected) {
|
|
47
|
+
return defaultClassNames;
|
|
48
|
+
}
|
|
49
|
+
let styleElement = document.querySelector("[data-tern-secure]");
|
|
50
|
+
if (!styleElement) {
|
|
51
|
+
styleElement = document.createElement("style");
|
|
52
|
+
styleElement.setAttribute("data-tern-secure", "");
|
|
53
|
+
document.head.appendChild(styleElement);
|
|
54
|
+
styleInjection.styleElement = styleElement;
|
|
55
|
+
}
|
|
56
|
+
const cssRules = Object.entries(styles2).map(([key, rules]) => {
|
|
57
|
+
const className = defaultClassNames[key];
|
|
58
|
+
const cssProperties = Object.entries(rules).map(([prop, value]) => {
|
|
59
|
+
const cssProperty = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
60
|
+
return `${cssProperty}: ${value};`;
|
|
61
|
+
}).join(" ");
|
|
62
|
+
return `.${className} { ${cssProperties} }`;
|
|
63
|
+
}).join("\n");
|
|
64
|
+
styleElement.textContent = cssRules;
|
|
65
|
+
styleInjection.isInjected = true;
|
|
66
|
+
return defaultClassNames;
|
|
67
|
+
}
|
|
68
|
+
const styleConfig = {
|
|
69
|
+
container: {
|
|
70
|
+
display: "flex",
|
|
71
|
+
minHeight: "100%",
|
|
72
|
+
flex: "1",
|
|
73
|
+
flexDirection: "column",
|
|
74
|
+
justifyContent: "center",
|
|
75
|
+
padding: "3rem 1.5rem"
|
|
76
|
+
},
|
|
77
|
+
header: {
|
|
78
|
+
margin: "0 auto",
|
|
79
|
+
width: "100%",
|
|
80
|
+
maxWidth: "28rem"
|
|
81
|
+
},
|
|
82
|
+
title: {
|
|
83
|
+
marginTop: "1.5rem",
|
|
84
|
+
textAlign: "center",
|
|
85
|
+
fontSize: "1.875rem",
|
|
86
|
+
fontWeight: "700",
|
|
87
|
+
lineHeight: "2.25rem",
|
|
88
|
+
letterSpacing: "-0.025em",
|
|
89
|
+
color: "var(--tern-text-primary, #111827)"
|
|
90
|
+
},
|
|
91
|
+
formWrapper: {
|
|
92
|
+
marginTop: "2.5rem",
|
|
93
|
+
margin: "0 auto",
|
|
94
|
+
width: "100%",
|
|
95
|
+
maxWidth: "30rem"
|
|
96
|
+
},
|
|
97
|
+
formContainer: {
|
|
98
|
+
padding: "3rem 1.5rem",
|
|
99
|
+
boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)",
|
|
100
|
+
borderRadius: "0.5rem",
|
|
101
|
+
backgroundColor: "var(--tern-background, white)"
|
|
102
|
+
},
|
|
103
|
+
form: {
|
|
104
|
+
display: "flex",
|
|
105
|
+
flexDirection: "column",
|
|
106
|
+
gap: "1rem"
|
|
107
|
+
},
|
|
108
|
+
label: {
|
|
109
|
+
display: "block",
|
|
110
|
+
fontSize: "0.875rem",
|
|
111
|
+
fontWeight: "500",
|
|
112
|
+
color: "var(--tern-text-secondary, #374151)"
|
|
113
|
+
},
|
|
114
|
+
input: {
|
|
115
|
+
marginTop: "0.25rem",
|
|
116
|
+
display: "block",
|
|
117
|
+
width: "100%",
|
|
118
|
+
padding: "0.5rem 0.75rem",
|
|
119
|
+
borderRadius: "0.375rem",
|
|
120
|
+
border: "1px solid var(--tern-border, #D1D5DB)",
|
|
121
|
+
backgroundColor: "var(--tern-input-background, white)",
|
|
122
|
+
color: "var(--tern-text-primary, #111827)"
|
|
123
|
+
},
|
|
124
|
+
button: {
|
|
125
|
+
display: "flex",
|
|
126
|
+
width: "100%",
|
|
127
|
+
justifyContent: "center",
|
|
128
|
+
padding: "0.5rem 1rem",
|
|
129
|
+
fontSize: "0.875rem",
|
|
130
|
+
fontWeight: "500",
|
|
131
|
+
color: "white",
|
|
132
|
+
backgroundColor: "var(--tern-primary, #2563EB)",
|
|
133
|
+
border: "none",
|
|
134
|
+
borderRadius: "0.375rem",
|
|
135
|
+
cursor: "pointer"
|
|
136
|
+
},
|
|
137
|
+
error: {
|
|
138
|
+
color: "var(--tern-error, #DC2626)",
|
|
139
|
+
fontSize: "0.875rem"
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const styles = createStyleSheet(styleConfig);
|
|
143
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
144
|
+
0 && (module.exports = {
|
|
145
|
+
defaultClassNames,
|
|
146
|
+
styleConfig,
|
|
147
|
+
styles
|
|
148
|
+
});
|
|
149
|
+
//# sourceMappingURL=create-styles.js.map
|