diff --git a/src/app/api/stores/[storeId]/route.ts b/src/app/api/stores/[storeId]/route.ts
index c5932f5..7f8d5aa 100644
--- a/src/app/api/stores/[storeId]/route.ts
+++ b/src/app/api/stores/[storeId]/route.ts
@@ -1,5 +1,5 @@
import { NextResponse } from "next/server"
-import { auth } from "@/auth"
+import { auth } from "@/auth.vendor"
import { prisma } from "@/lib/prisma"
import { Prisma } from "@prisma/client"
import { storeSelectPatchStorefrontAi } from "@/lib/prisma/storeSelects"
@@ -547,17 +547,43 @@ export async function GET(
return NextResponse.json({ message: "Store ID is required" }, { status: 400 })
}
- const store = await prisma.store.findFirst({
- where: { id: storeId, userId: session.user.id },
- select: {
- id: true,
- businessName: true,
- categoryMetadetailsEnabled: true,
- aiModules: true,
- modulePolicies: true,
- sharedFieldAnswers: true,
- },
- })
+ type StoreGetRow = {
+ id: string
+ businessName: string
+ categoryMetadetailsEnabled: boolean
+ aiModules: unknown
+ modulePolicies?: unknown
+ sharedFieldAnswers?: unknown
+ }
+
+ let store: StoreGetRow | null = null
+ try {
+ store = await prisma.store.findFirst({
+ where: { id: storeId, userId: session.user.id },
+ select: {
+ id: true,
+ businessName: true,
+ categoryMetadetailsEnabled: true,
+ aiModules: true,
+ modulePolicies: true,
+ sharedFieldAnswers: true,
+ },
+ })
+ } catch (firstErr) {
+ console.warn(
+ "[STORE_GET] full select failed (run migrations if modulePolicies/sharedFieldAnswers are missing); retrying minimal",
+ firstErr,
+ )
+ store = await prisma.store.findFirst({
+ where: { id: storeId, userId: session.user.id },
+ select: {
+ id: true,
+ businessName: true,
+ categoryMetadetailsEnabled: true,
+ aiModules: true,
+ },
+ })
+ }
if (!store) {
return NextResponse.json({ message: "Store not found" }, { status: 404 })
@@ -568,8 +594,8 @@ export async function GET(
businessName: store.businessName,
categoryMetadetailsEnabled: store.categoryMetadetailsEnabled,
aiModules: store.aiModules,
- modulePolicies: parseModulePoliciesJson(store.modulePolicies),
- sharedFieldAnswers: parseSharedFieldAnswersJson(store.sharedFieldAnswers),
+ modulePolicies: parseModulePoliciesJson(store.modulePolicies ?? null),
+ sharedFieldAnswers: parseSharedFieldAnswersJson(store.sharedFieldAnswers ?? null),
})
} catch (error) {
console.error("Error reading store settings:", error)
diff --git a/src/app/api/stores/route.ts b/src/app/api/stores/route.ts
index cd9af58..b9658b8 100644
--- a/src/app/api/stores/route.ts
+++ b/src/app/api/stores/route.ts
@@ -1,5 +1,5 @@
import { NextResponse } from "next/server"
-import { auth } from "@/auth"
+import { auth } from "@/auth.vendor"
import { prisma } from "@/lib/prisma"
/**
diff --git a/src/app/api/stores/switch/route.ts b/src/app/api/stores/switch/route.ts
index 116d8a7..bd72802 100644
--- a/src/app/api/stores/switch/route.ts
+++ b/src/app/api/stores/switch/route.ts
@@ -1,5 +1,5 @@
import { NextResponse } from "next/server"
-import { auth } from "@/auth"
+import { auth } from "@/auth.vendor"
import { prisma } from "@/lib/prisma"
import { storeSwitchSchema, validationErrorResponse } from "@/lib/api-schemas"
diff --git a/src/app/dashboard/juno-engine/layout.tsx b/src/app/dashboard/juno-engine/layout.tsx
index 64de0e0..424b351 100644
--- a/src/app/dashboard/juno-engine/layout.tsx
+++ b/src/app/dashboard/juno-engine/layout.tsx
@@ -6,7 +6,8 @@ import {
Flag,
Mail,
Layers,
- HelpCircle
+ HelpCircle,
+ MessageCircle,
} from "lucide-react"
export default function JunoEngineLayout({
@@ -28,6 +29,11 @@ export default function JunoEngineLayout({
href: "/dashboard/juno-engine/modules",
icon: Layers
},
+ {
+ label: "Storefront Chat",
+ href: "/dashboard/juno-engine/storefront-chat",
+ icon: MessageCircle
+ },
{
label: "Tickets",
href: "/dashboard/juno-engine/tickets",
diff --git a/src/app/dashboard/juno-engine/modules/page.tsx b/src/app/dashboard/juno-engine/modules/page.tsx
index b26d8ba..73ba249 100644
--- a/src/app/dashboard/juno-engine/modules/page.tsx
+++ b/src/app/dashboard/juno-engine/modules/page.tsx
@@ -128,8 +128,18 @@ export default function JunoEngineModulesPage() {
const load = useCallback(async (storeId: string) => {
const res = await fetch(`/api/stores/${encodeURIComponent(storeId)}`)
- if (!res.ok) throw new Error("Failed to load store settings")
- const data = (await res.json()) as {
+ const raw = await res.json().catch(() => ({}))
+ const errBody = raw as { message?: string }
+ if (!res.ok) {
+ throw new Error(
+ typeof errBody.message === "string" && errBody.message.trim()
+ ? errBody.message
+ : res.status === 401
+ ? "Sign in again to load store settings."
+ : "Failed to load store settings",
+ )
+ }
+ const data = raw as {
aiModules?: unknown
sharedFieldAnswers?: unknown
categoryMetadetailsEnabled?: boolean
@@ -852,7 +862,7 @@ export default function JunoEngineModulesPage() {
>
Widget appearance:{" "}
Storefront Chat Inbox
diff --git a/src/app/dashboard/juno-engine/storefront-chat/page.tsx b/src/app/dashboard/juno-engine/storefront-chat/page.tsx
new file mode 100644
index 0000000..a63c95a
--- /dev/null
+++ b/src/app/dashboard/juno-engine/storefront-chat/page.tsx
@@ -0,0 +1,5 @@
+import StorefrontChatInbox from "@/components/storefront/StorefrontChatInbox"
+
+export default function JunoEngineStorefrontChatPage() {
+ return
- {store.businessName} · {store.shopifyDomain} -
-{conversations.length} visitors
-{sorted.length} messages
-- {customerCount} customer · {aiCount} AI -
-- L1 AI modules and catalog metafields:{" "} - - JUNO Engine → Modules - - . -
- - {sorted.length === 0 ? ( -No storefront chat messages yet.
-When customers send a message from the widget, it will show here.
-Recent activity
-Read-only
-- {m.conversation?.visitorId || "visitor"} -
-{m.conversation.customerEmail}
- ) : null} -- {new Date(m.createdAt).toLocaleString()} -
-+ {store.businessName} · {store.shopifyDomain} +
+{conversations.length} visitors
+{sorted.length} messages
++ {customerCount} customer · {aiCount} AI +
++ L1 AI modules and catalog metafields:{" "} + + JUNO Engine → Modules + + . +
+ + {sorted.length === 0 ? ( +No storefront chat messages yet.
++ When customers send a message from the widget, it will show here. +
+Recent activity
+Read-only
++ {m.conversation?.visitorId || "visitor"} +
++ {m.conversation.customerEmail} +
+ ) : null} ++ {new Date(m.createdAt).toLocaleString()} +
+