@luxfi/ui 5.5.2 → 5.5.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxfi/ui",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.3",
|
|
4
4
|
"description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
".": "./components/index.ts",
|
|
30
30
|
"./commerce": "./commerce/ui/context.tsx",
|
|
31
31
|
"./root-layout": "./root-layout/index.tsx",
|
|
32
|
-
"./server-actions": "./server-actions/index.ts",
|
|
33
32
|
"./next": "./next/index.ts",
|
|
34
33
|
"./style/": "./style/",
|
|
35
34
|
"./site-def": "./site-def/index.ts",
|
package/root-layout/index.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import type { Viewport } from 'next'
|
|
|
3
3
|
|
|
4
4
|
import { Toaster } from '@hanzo/ui/primitives'
|
|
5
5
|
import { AuthServiceProvider } from '@hanzo/auth/service'
|
|
6
|
-
import { getUserServerSideSafe } from '../server/auth-wrapper'
|
|
7
6
|
import type { AuthServiceConf } from '@hanzo/auth/types'
|
|
8
7
|
import { CommerceProvider } from '@hanzo/commerce'
|
|
9
8
|
|
|
@@ -47,7 +46,7 @@ const bodyClasses =
|
|
|
47
46
|
'bg-background text-foreground flex flex-col min-h-full ' +
|
|
48
47
|
getAppRouterBodyFontClasses()
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
function RootLayout({
|
|
51
50
|
showHeader = false,
|
|
52
51
|
chatbot = false,
|
|
53
52
|
siteDef,
|
|
@@ -58,7 +57,9 @@ async function RootLayout({
|
|
|
58
57
|
chatbot?: boolean
|
|
59
58
|
} & PropsWithChildren) {
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
// For static export, we don't have server-side auth
|
|
61
|
+
// User auth will be handled client-side via AuthListener
|
|
62
|
+
const currentUser = null
|
|
62
63
|
|
|
63
64
|
const Guts: React.FC = () => (<>
|
|
64
65
|
{showHeader && <Header siteDef={siteDef}/>}
|
|
@@ -83,7 +84,7 @@ async function RootLayout({
|
|
|
83
84
|
<body suppressHydrationWarning className={bodyClasses} style={{
|
|
84
85
|
|
|
85
86
|
// As noted above: 'overflow: hidden' on the <body> tag breaks scroll snap!
|
|
86
|
-
display: 'none', // see analytics.tsx
|
|
87
|
+
display: 'none', // see analytics.tsx
|
|
87
88
|
}}>
|
|
88
89
|
<Analytics/>
|
|
89
90
|
<AuthServiceProvider user={currentUser} conf={{} as AuthServiceConf}>
|
|
@@ -103,7 +104,7 @@ async function RootLayout({
|
|
|
103
104
|
</body>
|
|
104
105
|
</html>
|
|
105
106
|
)
|
|
106
|
-
}
|
|
107
|
+
}
|
|
107
108
|
|
|
108
109
|
export {
|
|
109
110
|
RootLayout,
|
package/server/auth-wrapper.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import 'server-only'
|
|
2
|
-
|
|
3
|
-
// Wrapper for getUserServerSide that handles Firebase not being configured
|
|
4
|
-
export async function getUserServerSideSafe() {
|
|
5
|
-
try {
|
|
6
|
-
// Check if Firebase environment variables are present
|
|
7
|
-
const hasFirebaseConfig =
|
|
8
|
-
process.env.FIREBASE_CLIENT_EMAIL &&
|
|
9
|
-
process.env.FIREBASE_PROJECT_ID &&
|
|
10
|
-
process.env.FIREBASE_PRIVATE_KEY;
|
|
11
|
-
|
|
12
|
-
if (!hasFirebaseConfig) {
|
|
13
|
-
console.log('Firebase not configured, returning null user');
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Only import and use the actual function if Firebase is configured
|
|
18
|
-
const { getUserServerSide } = await import('@hanzo/auth/server');
|
|
19
|
-
return await getUserServerSide();
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error('Error getting user server side:', error);
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
package/server-actions/TO-DO.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
move login and logout api routes here!
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { initializeApp, getApps, type FirebaseApp } from 'firebase/app'
|
|
2
|
-
|
|
3
|
-
const firebaseConfig = {
|
|
4
|
-
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
|
|
5
|
-
authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
|
|
6
|
-
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
|
|
7
|
-
storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,
|
|
8
|
-
messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
|
|
9
|
-
appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID,
|
|
10
|
-
measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Check if Firebase config is present
|
|
14
|
-
const hasFirebaseConfig = firebaseConfig.apiKey && firebaseConfig.projectId;
|
|
15
|
-
|
|
16
|
-
// Initialize Firebase instance only if config is present
|
|
17
|
-
let firebaseApp: FirebaseApp | null = null;
|
|
18
|
-
|
|
19
|
-
if (hasFirebaseConfig) {
|
|
20
|
-
try {
|
|
21
|
-
firebaseApp = getApps().length === 0 ? initializeApp(firebaseConfig) : getApps()[0]
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.warn('Failed to initialize Firebase app:', error);
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
console.log('Firebase configuration not found, skipping initialization');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default firebaseApp
|
package/server-actions/index.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use server'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getFirestore,
|
|
5
|
-
collection,
|
|
6
|
-
setDoc,
|
|
7
|
-
doc,
|
|
8
|
-
serverTimestamp,
|
|
9
|
-
type Firestore,
|
|
10
|
-
} from 'firebase/firestore'
|
|
11
|
-
|
|
12
|
-
import firebaseApp from './firebase-app'
|
|
13
|
-
import type { ContactInfo } from '../types'
|
|
14
|
-
|
|
15
|
-
let dbInstance: Firestore | undefined = undefined
|
|
16
|
-
|
|
17
|
-
const getDBInstance = (name: string): Firestore | null => {
|
|
18
|
-
if (!firebaseApp) {
|
|
19
|
-
console.warn('Firebase not initialized, cannot get database instance');
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
if (!dbInstance) {
|
|
23
|
-
dbInstance = getFirestore(firebaseApp, name)
|
|
24
|
-
}
|
|
25
|
-
return dbInstance
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const storeContact = async ( formData: ContactInfo, enclosure: any ) => {
|
|
29
|
-
const email = formData.email
|
|
30
|
-
const phone = formData.phone
|
|
31
|
-
const dbName = enclosure?.dbId
|
|
32
|
-
const tableName = enclosure?.listId
|
|
33
|
-
|
|
34
|
-
// Return early if Firebase is not configured
|
|
35
|
-
if (!firebaseApp) {
|
|
36
|
-
console.warn('Firebase not configured, skipping contact storage');
|
|
37
|
-
return { success: true, error: null, id: email };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let error: any | null = null
|
|
41
|
-
const db = getDBInstance(dbName);
|
|
42
|
-
if (!db) {
|
|
43
|
-
return { success: false, error: 'Database not available' };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const tableRef = collection(db, tableName)
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
await setDoc(doc(tableRef, email), {
|
|
50
|
-
email,
|
|
51
|
-
phone,
|
|
52
|
-
timestamp: serverTimestamp(),
|
|
53
|
-
})
|
|
54
|
-
return { success: !error, error, id: email }
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
console.error('Error writing contact info to database: ', e)
|
|
58
|
-
error = e
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return { success: !error, error }
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
storeContact as default
|
|
66
|
-
}
|