@tern-secure/nextjs 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-router/client/index.js +1 -0
- package/dist/app-router/server/index.js +1 -0
- package/dist/chunk-2ENCFXUN.js +1 -0
- package/dist/chunk-2NA7K5TN.js +2 -0
- package/dist/chunk-64G22XTD.js +1 -0
- package/dist/chunk-ASFHFC2I.js +1 -0
- package/dist/chunk-DLMCL4UP.js +1 -0
- package/dist/chunk-LHW3RBUN.js +1 -0
- package/dist/components/index.js +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/index.js +1 -2
- package/dist/ternSecureClientProvider-IGH5T42M.js +1 -0
- package/dist/types/index.js +0 -0
- package/dist/utils/create-styles.js +1 -0
- package/package.json +16 -6
- package/dist/utils/index.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f}from"../../chunk-LHW3RBUN.js";import{a as g,b as h,c as i}from"../../chunk-ASFHFC2I.js";export{a as TernSecureAuth,i as TernSecureClientProvider,g as TernSecureContext,b as TernSecureFirestore,c as TernSecureStorage,e as loadFireConfig,d as signInWithEmail,h as useTernSecure,f as validateConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-DLMCL4UP.js";export{a as TernSecureProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s}from"./chunk-LHW3RBUN.js";import{b as a}from"./chunk-ASFHFC2I.js";import{useEffect as o}from"react";function l(){let[i,r]=a("useAuth");return o(()=>{try{let t=s();r(e=>({...e,firebase:{initialized:!0,error:null}}));let u=t.onAuthStateChanged(e=>{r(n=>({...n,auth:{user:e,loading:!1,error:null,isSignedIn:!!e}}))},e=>{r(n=>({...n,auth:{user:null,loading:!1,error:e,isSignedIn:!1}}))});return()=>u()}catch(t){r(u=>({...u,firebase:{initialized:!1,error:t},auth:{user:null,loading:!1,error:t,isSignedIn:!1}}))}},[]),i.auth}export{l as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e="tern",n={isInjected:!1,styleElement:null},t={container:`${e}-container`,header:`${e}-header`,title:`${e}-title`,formWrapper:`${e}-formWrapper`,formContainer:`${e}-formContainer`,form:`${e}-form`,label:`${e}-label`,input:`${e}-input`,button:`${e}-button`,error:`${e}-error`};function p(o){if(typeof window>"u"||n.isInjected)return t;let r=document.querySelector("[data-tern-secure]");r||(r=document.createElement("style"),r.setAttribute("data-tern-secure",""),document.head.appendChild(r),n.styleElement=r);let i=Object.entries(o).map(([a,l])=>{let s=t[a],c=Object.entries(l).map(([m,d])=>`${m.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${d};`).join(" ");return`.${s} { ${c} }`}).join(`
|
|
2
|
+
`);return r.textContent=i,n.isInjected=!0,t}var u={container:{display:"flex",minHeight:"100%",flex:"1",flexDirection:"column",justifyContent:"center",padding:"3rem 1.5rem"},header:{margin:"0 auto",width:"100%",maxWidth:"28rem"},title:{marginTop:"1.5rem",textAlign:"center",fontSize:"1.875rem",fontWeight:"700",lineHeight:"2.25rem",letterSpacing:"-0.025em",color:"var(--tern-text-primary, #111827)"},formWrapper:{marginTop:"2.5rem",margin:"0 auto",width:"100%",maxWidth:"30rem"},formContainer:{padding:"3rem 1.5rem",boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1)",borderRadius:"0.5rem",backgroundColor:"var(--tern-background, white)"},form:{display:"flex",flexDirection:"column",gap:"1rem"},label:{display:"block",fontSize:"0.875rem",fontWeight:"500",color:"var(--tern-text-secondary, #374151)"},input:{marginTop:"0.25rem",display:"block",width:"100%",padding:"0.5rem 0.75rem",borderRadius:"0.375rem",border:"1px solid var(--tern-border, #D1D5DB)",backgroundColor:"var(--tern-input-background, white)",color:"var(--tern-text-primary, #111827)"},button:{display:"flex",width:"100%",justifyContent:"center",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:"500",color:"white",backgroundColor:"var(--tern-primary, #2563EB)",border:"none",borderRadius:"0.375rem",cursor:"pointer"},error:{color:"var(--tern-error, #DC2626)",fontSize:"0.875rem"}},y=p(u);export{t as a,u as b,y as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as f}from"./chunk-LHW3RBUN.js";import{c as r}from"./chunk-2NA7K5TN.js";import{useState as s}from"react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function C({onSuccess:u,onError:v,redirectUrl:d,className:$="",style:b,customStyles:e={}}){let[m,h]=s(""),[p,N]=s(""),[n,g]=s(!1),[t,c]=s(""),E=async i=>{i.preventDefault(),g(!0),c("");try{await f({email:m,password:p}),u?.(),d&&(window.location.href=d)}catch(o){let w=o instanceof Error?o.message:"Failed to sign in";c(w),v?.(o instanceof Error?o:new Error("Failed to sign in"))}finally{g(!1)}};return l("div",{className:`${r.container} ${e.container||""}`,style:b,children:[a("div",{className:`${r.header} ${e.header||""}`,children:a("h2",{className:`${r.title} ${e.title||""}`,children:"Sign in to your account"})}),a("div",{className:`${r.formWrapper} ${e.formWrapper||""}`,children:a("div",{className:`${r.formContainer} ${e.formContainer||""}`,children:l("form",{onSubmit:E,className:`${r.form} ${e.form||""} ${$}`,role:"form","aria-label":"Sign in form",children:[t&&a("div",{className:`${r.error} ${e.errorText||""}`,role:"alert","aria-live":"polite",children:t}),l("div",{children:[a("label",{htmlFor:"email",className:`${r.label} ${e.label||""}`,children:"Email"}),a("input",{id:"email",type:"email",value:m,onChange:i=>h(i.target.value),placeholder:"Enter your email",required:!0,className:`${r.input} ${e.input||""}`,disabled:n,"aria-required":"true","aria-invalid":!!t})]}),l("div",{children:[a("label",{htmlFor:"password",className:`${r.label} ${e.label||""}`,children:"Password"}),a("input",{id:"password",type:"password",value:p,onChange:i=>N(i.target.value),placeholder:"Enter your password",required:!0,className:`${r.input} ${e.input||""}`,disabled:n,"aria-required":"true","aria-invalid":!!t})]}),a("button",{type:"submit",disabled:n,className:`${r.button} ${e.button||""}`,"data-testid":"sign-in-submit",children:n?"Signing in...":"Sign in"})]})})})]})}export{C as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as u}from"react";import{createContext as i,useContext as o}from"react";var a=()=>i([{firebase:{initialized:!1,error:null},auth:{user:null,loading:!0,error:null,isSignedIn:!1}},()=>{}]),r=a(),s=e=>{let t=o(r);if(!t)throw new Error(`${e} must be used within TernSecureProvider`);return t},n={firebase:{initialized:!1,error:null},auth:{user:null,loading:!0,error:null,isSignedIn:!1}};import{jsx as c}from"react/jsx-runtime";function m({children:e}){let t=u(n);return c(r.Provider,{value:t,children:e})}export{r as a,s as b,m as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"react";import u from"next/dynamic";import{jsx as i}from"react/jsx-runtime";var o=u(()=>import("./ternSecureClientProvider-IGH5T42M.js").then(n=>n.TernSecureClientProvider),{loading:()=>null});function c({children:n}){return r.Children.toArray(n).some(e=>r.isValidElement(e)&&e.type==="html")?r.Children.map(n,e=>r.isValidElement(e)&&e.type==="html"?r.cloneElement(e,{},r.Children.map(e.props.children,t=>{if(r.isValidElement(t)&&t.type==="body"){let p=t.props;return r.cloneElement(t,{},i(o,{children:p.children}))}return t})):e):i(o,{children:n})}export{c as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getApps as a,initializeApp as c}from"firebase/app";import{getAuth as E,setPersistence as g,browserSessionPersistence as S}from"firebase/auth";import{getFirestore as I}from"firebase/firestore";import{getStorage as m}from"firebase/storage";var n=(()=>{let e=i(s());return a().length?a()[0]:c(e)})(),p=E(n);g(p,S);var _=I(n),f=m(n),o=()=>p,u=()=>_,C=()=>f;import{signInWithEmailAndPassword as T}from"firebase/auth";async function A({email:e,password:r}){let t=o();return T(t,e,r)}var s=()=>({apiKey:process.env.NEXT_PUBLIC_FIREBASE_API_KEY,authDomain:process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,projectId:process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,storageBucket:process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,messagingSenderId:process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,appId:process.env.NEXT_PUBLIC_FIREBASE_APP_ID,measurementId:process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID}),i=e=>(Object.entries(e).forEach(([r,t])=>{if(!t)throw new Error(`Missing environment variable: NEXT_PUBLIC_FIREBASE_${r.toUpperCase()}`)}),e);export{o as a,u as b,C as c,A as d,s as e,i as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-64G22XTD.js";import"../chunk-LHW3RBUN.js";import"../chunk-2NA7K5TN.js";import"../chunk-ASFHFC2I.js";export{a as SignIn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-2ENCFXUN.js";import"../chunk-LHW3RBUN.js";import"../chunk-ASFHFC2I.js";export{a as useAuth};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
`);return r.textContent=t,N.isInjected=!0,x}var pe={container:{display:"flex",minHeight:"100%",flex:"1",flexDirection:"column",justifyContent:"center",padding:"3rem 1.5rem"},header:{margin:"0 auto",width:"100%",maxWidth:"28rem"},title:{marginTop:"1.5rem",textAlign:"center",fontSize:"1.875rem",fontWeight:"700",lineHeight:"2.25rem",letterSpacing:"-0.025em",color:"var(--tern-text-primary, #111827)"},formWrapper:{marginTop:"2.5rem",margin:"0 auto",width:"100%",maxWidth:"30rem"},formContainer:{padding:"3rem 1.5rem",boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1)",borderRadius:"0.5rem",backgroundColor:"var(--tern-background, white)"},form:{display:"flex",flexDirection:"column",gap:"1rem"},label:{display:"block",fontSize:"0.875rem",fontWeight:"500",color:"var(--tern-text-secondary, #374151)"},input:{marginTop:"0.25rem",display:"block",width:"100%",padding:"0.5rem 0.75rem",borderRadius:"0.375rem",border:"1px solid var(--tern-border, #D1D5DB)",backgroundColor:"var(--tern-input-background, white)",color:"var(--tern-text-primary, #111827)"},button:{display:"flex",width:"100%",justifyContent:"center",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:"500",color:"white",backgroundColor:"var(--tern-primary, #2563EB)",border:"none",borderRadius:"0.375rem",cursor:"pointer"},error:{color:"var(--tern-error, #DC2626)",fontSize:"0.875rem"}},i=de(pe);import{jsx as l,jsxs as I}from"react/jsx-runtime";function q({onSuccess:e,onError:r,redirectUrl:t,className:o="",style:a,customStyles:n={}}){let[p,P]=b(""),[f,_]=b(""),[g,w]=b(!1),[S,F]=b(""),H=async m=>{m.preventDefault(),w(!0),F("");try{await T({email:p,password:f}),e?.(),t&&(window.location.href=t)}catch(h){let G=h instanceof Error?h.message:"Failed to sign in";F(G),r?.(h instanceof Error?h:new Error("Failed to sign in"))}finally{w(!1)}};return I("div",{className:`${i.container} ${n.container||""}`,style:a,children:[l("div",{className:`${i.header} ${n.header||""}`,children:l("h2",{className:`${i.title} ${n.title||""}`,children:"Sign in to your account"})}),l("div",{className:`${i.formWrapper} ${n.formWrapper||""}`,children:l("div",{className:`${i.formContainer} ${n.formContainer||""}`,children:I("form",{onSubmit:H,className:`${i.form} ${n.form||""} ${o}`,role:"form","aria-label":"Sign in form",children:[S&&l("div",{className:`${i.error} ${n.errorText||""}`,role:"alert","aria-live":"polite",children:S}),I("div",{children:[l("label",{htmlFor:"email",className:`${i.label} ${n.label||""}`,children:"Email"}),l("input",{id:"email",type:"email",value:p,onChange:m=>P(m.target.value),placeholder:"Enter your email",required:!0,className:`${i.input} ${n.input||""}`,disabled:g,"aria-required":"true","aria-invalid":!!S})]}),I("div",{children:[l("label",{htmlFor:"password",className:`${i.label} ${n.label||""}`,children:"Password"}),l("input",{id:"password",type:"password",value:f,onChange:m=>_(m.target.value),placeholder:"Enter your password",required:!0,className:`${i.input} ${n.input||""}`,disabled:g,"aria-required":"true","aria-invalid":!!S})]}),l("button",{type:"submit",disabled:g,className:`${i.button} ${n.button||""}`,"data-testid":"sign-in-submit",children:g?"Signing in...":"Sign in"})]})})})]})}export{q as SignIn,u as TernSecureAuth,A as TernSecureClientProvider,d as TernSecureContext,U as TernSecureFirestore,M as TernSecureProvider,L as TernSecureStorage,E as loadFireConfig,T as signInWithEmail,O as useAuth,v as useTernSecure,C as validateConfig};
|
|
1
|
+
import{a as T}from"./chunk-DLMCL4UP.js";import{a}from"./chunk-64G22XTD.js";import{a as f}from"./chunk-2ENCFXUN.js";import{a as e,b as r,c as o,d as n,e as t,f as i}from"./chunk-LHW3RBUN.js";import"./chunk-2NA7K5TN.js";import{a as u,b as S,c}from"./chunk-ASFHFC2I.js";export{a as SignIn,e as TernSecureAuth,c as TernSecureClientProvider,u as TernSecureContext,r as TernSecureFirestore,T as TernSecureProvider,o as TernSecureStorage,t as loadFireConfig,n as signInWithEmail,f as useAuth,S as useTernSecure,i as validateConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{c as a}from"./chunk-ASFHFC2I.js";export{a as TernSecureClientProvider};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a,b,c}from"../chunk-2NA7K5TN.js";export{a as defaultClassNames,b as styleConfig,c as styles};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tern-secure/nextjs",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"homepage": "https://github.com/tern-secure/nextjs#readme",
|
|
17
17
|
"main": "./dist/index.cjs.js",
|
|
18
18
|
"module": "./dist/index.js",
|
|
19
|
-
|
|
20
|
-
"build": "npm run build:types && npm run build:js",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "rimraf dist && npm run build:types && npm run build:js",
|
|
21
21
|
"build:types": "tsc --emitDeclarationOnly",
|
|
22
22
|
"build:js": "node build.config.cjs",
|
|
23
23
|
"clean": "rimraf dist",
|
|
@@ -99,9 +99,19 @@
|
|
|
99
99
|
"require": "./dist/index.cjs.js"
|
|
100
100
|
},
|
|
101
101
|
"./server": {
|
|
102
|
-
"types": "./dist/server/index.d.ts",
|
|
103
|
-
"import": "./dist/server/index.js",
|
|
104
|
-
"require": "./dist/server/index.
|
|
102
|
+
"types": "./dist/app-router/server/index.d.ts",
|
|
103
|
+
"import": "./dist/app-router/server/index.js",
|
|
104
|
+
"require": "./dist/app-router/server/index.js"
|
|
105
|
+
},
|
|
106
|
+
"./client": {
|
|
107
|
+
"types": "./dist/app-router/client/index.d.ts",
|
|
108
|
+
"import": "./dist/app-router/client/index.js",
|
|
109
|
+
"require": "./dist/app-router/client/index.js"
|
|
110
|
+
},
|
|
111
|
+
"./components": {
|
|
112
|
+
"types": "./dist/components/index.d.ts",
|
|
113
|
+
"import": "./dist/components/index.js",
|
|
114
|
+
"require": "./dist/components/index.js"
|
|
105
115
|
}
|
|
106
116
|
}
|
|
107
117
|
}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|