@luxfi/ui 5.5.0 → 5.5.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.
@@ -14,12 +14,15 @@ import { Loader2 } from 'lucide-react'
14
14
  import {
15
15
  Button,
16
16
  Input,
17
+ } from '@hanzo/ui/primitives'
18
+
19
+ import {
17
20
  Form,
18
21
  FormControl,
19
22
  FormField,
20
23
  FormItem,
21
24
  FormMessage,
22
- } from '@hanzo/ui/primitives'
25
+ } from '@hanzo/ui/form'
23
26
 
24
27
  import type { SubmitServerAction } from '@hanzo/ui/types'
25
28
  import type { ContactInfo } from '../../types'
@@ -1,8 +1,8 @@
1
1
  'use client'
2
-
2
+ import React, { useEffect, useState } from 'react'
3
3
  import { usePathname } from 'next/navigation'
4
4
  import Script from 'next/script'
5
- import { useEffect, useState } from 'react'
5
+
6
6
  import * as fbq from './fpixel'
7
7
 
8
8
  const FacebookPixelHead = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxfi/ui",
3
- "version": "5.5.0",
3
+ "version": "5.5.2",
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/",
@@ -37,7 +37,6 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@next/third-parties": "^14.1.0",
40
- "@types/validator": "^13.12.1",
41
40
  "cookies-next": "^4.1.1",
42
41
  "date-fns": "^3.6.0",
43
42
  "embla-carousel-autoplay": "^8.1.6",
@@ -53,7 +52,7 @@
53
52
  "@hanzo/auth": "catalog:",
54
53
  "@hanzo/commerce": "catalog:",
55
54
  "@hanzo/ui": "catalog:",
56
- "@luxfi/menu-icons": "1.0.1",
55
+ "@luxfi/menu-icons": "1.0.2",
57
56
  "@hookform/resolvers": "^3.3.2",
58
57
  "lucide-react": "catalog:",
59
58
  "mobx": "^6.12.3",
@@ -76,6 +75,7 @@
76
75
  "@types/node": "catalog:",
77
76
  "@types/react": "catalog:",
78
77
  "@types/react-dom": "catalog:",
78
+ "@types/validator": "^13.12.1",
79
79
  "tailwindcss": "catalog:",
80
80
  "typescript": "catalog:"
81
81
  }
@@ -3,7 +3,7 @@ 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 { getUserServerSide } from '@hanzo/auth/server'
6
+ import { getUserServerSideSafe } from '../server/auth-wrapper'
7
7
  import type { AuthServiceConf } from '@hanzo/auth/types'
8
8
  import { CommerceProvider } from '@hanzo/commerce'
9
9
 
@@ -58,7 +58,7 @@ async function RootLayout({
58
58
  chatbot?: boolean
59
59
  } & PropsWithChildren) {
60
60
 
61
- const currentUser = await getUserServerSide()
61
+ const currentUser = await getUserServerSideSafe()
62
62
 
63
63
  const Guts: React.FC = () => (<>
64
64
  {showHeader && <Header siteDef={siteDef}/>}
@@ -0,0 +1,24 @@
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
+ }
@@ -1,4 +1,4 @@
1
- import { initializeApp, getApps } from 'firebase/app'
1
+ import { initializeApp, getApps, type FirebaseApp } from 'firebase/app'
2
2
 
3
3
  const firebaseConfig = {
4
4
  apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
@@ -10,5 +10,20 @@ const firebaseConfig = {
10
10
  measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID,
11
11
  }
12
12
 
13
- // Initialize Firebase instance if there isn't one already
14
- export default getApps().length === 0 ? initializeApp(firebaseConfig) : getApps()[0]
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
@@ -14,7 +14,11 @@ import type { ContactInfo } from '../types'
14
14
 
15
15
  let dbInstance: Firestore | undefined = undefined
16
16
 
17
- const getDBInstance = (name: string): Firestore => {
17
+ const getDBInstance = (name: string): Firestore | null => {
18
+ if (!firebaseApp) {
19
+ console.warn('Firebase not initialized, cannot get database instance');
20
+ return null;
21
+ }
18
22
  if (!dbInstance) {
19
23
  dbInstance = getFirestore(firebaseApp, name)
20
24
  }
@@ -27,8 +31,19 @@ const storeContact = async ( formData: ContactInfo, enclosure: any ) => {
27
31
  const dbName = enclosure?.dbId
28
32
  const tableName = enclosure?.listId
29
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
+
30
40
  let error: any | null = null
31
- const tableRef = collection(getDBInstance(dbName), tableName)
41
+ const db = getDBInstance(dbName);
42
+ if (!db) {
43
+ return { success: false, error: 'Database not available' };
44
+ }
45
+
46
+ const tableRef = collection(db, tableName)
32
47
 
33
48
  try {
34
49
  await setDoc(doc(tableRef, email), {