create-nextblock 0.10.9 → 0.11.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.
Files changed (64) hide show
  1. package/package.json +1 -1
  2. package/templates/nextblock-template/app/actions/interactions.test.ts +301 -0
  3. package/templates/nextblock-template/app/actions/interactions.ts +372 -0
  4. package/templates/nextblock-template/app/api/ai/cortex/build-widget/route.ts +4 -4
  5. package/templates/nextblock-template/app/api/ai/generate-blocks/route.ts +2 -2
  6. package/templates/nextblock-template/app/api/ai/global-agent/route.ts +56 -57
  7. package/templates/nextblock-template/app/api/cron/reset-sandbox/route.ts +1 -1
  8. package/templates/nextblock-template/app/api/cron/reset-sandbox/sandboxResetSql.ts +837 -0
  9. package/templates/nextblock-template/app/article/[slug]/PostClientContent.tsx +6 -0
  10. package/templates/nextblock-template/app/cms/CmsClientLayout.tsx +4 -0
  11. package/templates/nextblock-template/app/cms/components/ConnectGitHubButton.tsx +122 -0
  12. package/templates/nextblock-template/app/cms/components/github-connect-actions.ts +102 -0
  13. package/templates/nextblock-template/app/cms/dashboard/components/DashboardOnboarding.tsx +18 -13
  14. package/templates/nextblock-template/app/cms/interactions/InteractionsModerationClient.tsx +408 -0
  15. package/templates/nextblock-template/app/cms/interactions/page.tsx +51 -0
  16. package/templates/nextblock-template/app/cms/settings/cortex-ai/SandboxCortexAiSettingsClient.tsx +4 -3
  17. package/templates/nextblock-template/app/cms/settings/cortex-ai/StoredCortexAiSettingsClient.tsx +1 -1
  18. package/templates/nextblock-template/app/cms/settings/cortex-ai/actions.ts +3 -5
  19. package/templates/nextblock-template/app/cms/settings/cortex-ai/page.tsx +1 -1
  20. package/templates/nextblock-template/app/page.tsx +2 -2
  21. package/templates/nextblock-template/app/product/[slug]/page.tsx +2 -0
  22. package/templates/nextblock-template/components/AppShell.tsx +1 -1
  23. package/templates/nextblock-template/components/PostCommentsSection.tsx +369 -0
  24. package/templates/nextblock-template/components/ProductReviewsSection.tsx +419 -0
  25. package/templates/nextblock-template/components/blocks/renderers/ProductDetailsBlockRenderer.tsx +2 -0
  26. package/templates/nextblock-template/components/privacy/ConsentBanner.tsx +62 -19
  27. package/templates/nextblock-template/docs/08-NEXTBLOCK-CORTEX-AI-ARCHITECTURE.md +19 -19
  28. package/templates/nextblock-template/docs/10-CUSTOM-BLOCKS.md +4 -4
  29. package/templates/nextblock-template/docs/12-VERCEL-DEPLOYMENT.md +9 -8
  30. package/templates/nextblock-template/docs/13-STAYING-UP-TO-DATE.md +38 -9
  31. package/templates/nextblock-template/lib/blocks/ProductGridBlock.tsx +2 -0
  32. package/templates/nextblock-template/lib/onboarding/status.ts +13 -6
  33. package/templates/nextblock-template/lib/setup/actions.ts +3 -1
  34. package/templates/nextblock-template/lib/setup/migrations-bundle.ts +30 -0
  35. package/templates/nextblock-template/lib/updates/check-upstream.ts +44 -7
  36. package/templates/nextblock-template/lib/updates/github-device.ts +206 -0
  37. package/templates/nextblock-template/lib/updates/repo-identity.ts +11 -1
  38. package/templates/nextblock-template/package.json +2 -1
  39. package/templates/nextblock-template/scripts/verify-cortex-ai-build-widget.tsx +2 -4
  40. package/templates/nextblock-template/scripts/verify-cortex-ai-generate-blocks.ts +1 -1
  41. package/templates/nextblock-template/scripts/verify-cortex-ai-global-tools.ts +1 -1
  42. package/templates/nextblock-template/scripts/verify-cortex-ai-routing.ts +1 -1
  43. package/templates/nextblock-template/tsconfig.tsbuildinfo +1 -1
  44. package/templates/nextblock-template/lib/ai-block-generation.ts +0 -339
  45. package/templates/nextblock-template/lib/ai-client.ts +0 -247
  46. package/templates/nextblock-template/lib/ai-config.ts +0 -98
  47. package/templates/nextblock-template/lib/ai-cortex-widget-builder.ts +0 -125
  48. package/templates/nextblock-template/lib/ai-global-agent-custom-block-tools.ts +0 -363
  49. package/templates/nextblock-template/lib/ai-global-agent-db-tools.test.ts +0 -405
  50. package/templates/nextblock-template/lib/ai-global-agent-db-tools.ts +0 -1228
  51. package/templates/nextblock-template/lib/ai-global-agent-ecommerce.ts +0 -5
  52. package/templates/nextblock-template/lib/ai-global-agent-tools-stats.test.ts +0 -223
  53. package/templates/nextblock-template/lib/ai-global-agent-tools.test.ts +0 -2183
  54. package/templates/nextblock-template/lib/ai-global-agent-tools.ts +0 -4807
  55. package/templates/nextblock-template/lib/ai-key-crypto.test.ts +0 -70
  56. package/templates/nextblock-template/lib/ai-key-crypto.ts +0 -132
  57. package/templates/nextblock-template/lib/ai-model-catalog.test.ts +0 -49
  58. package/templates/nextblock-template/lib/ai-model-catalog.ts +0 -41
  59. package/templates/nextblock-template/lib/ai-model-registry.test.ts +0 -231
  60. package/templates/nextblock-template/lib/ai-model-registry.ts +0 -522
  61. package/templates/nextblock-template/lib/cortex-widget-registry.test.ts +0 -199
  62. package/templates/nextblock-template/lib/cortex-widget-registry.ts +0 -88
  63. package/templates/nextblock-template/lib/cortex-widget-schema.test.tsx +0 -237
  64. package/templates/nextblock-template/lib/cortex-widget-schema.ts +0 -393
@@ -0,0 +1,408 @@
1
+ "use client";
2
+
3
+ import React, { useState, useTransition } from "react";
4
+ import { Button } from "@nextblock-cms/ui";
5
+ import { Avatar, AvatarFallback, AvatarImage } from "@nextblock-cms/ui";
6
+ import { Badge } from "@nextblock-cms/ui";
7
+ import { updateInteractionStatus, saveNotificationEmails } from "../../actions/interactions";
8
+ import { cn } from "@nextblock-cms/utils";
9
+ import {
10
+ MessageSquare,
11
+ Check,
12
+ X,
13
+ Star,
14
+ Inbox,
15
+ Filter,
16
+ ExternalLink,
17
+ ThumbsUp,
18
+ AlertCircle,
19
+ Mail
20
+ } from "lucide-react";
21
+ import Link from "next/link";
22
+
23
+ interface InteractionsModerationClientProps {
24
+ initialInteractions: any[];
25
+ isAdmin: boolean;
26
+ }
27
+
28
+ export default function InteractionsModerationClient({
29
+ initialInteractions,
30
+ isAdmin,
31
+ }: InteractionsModerationClientProps) {
32
+ const [interactions, setInteractions] = useState<any[]>(initialInteractions);
33
+
34
+ // Notification settings states
35
+ const [emailsInput, setEmailsInput] = useState("");
36
+ const [isSettingsOpen, setIsSettingsOpen] = useState(false);
37
+ const [savingEmails, setSavingEmails] = useState(false);
38
+ const [settingsError, setSettingsError] = useState<string | null>(null);
39
+ const [settingsSuccess, setSettingsSuccess] = useState<string | null>(null);
40
+
41
+ React.useEffect(() => {
42
+ if (isAdmin) {
43
+ import("../../actions/interactions").then(({ getNotificationEmails }) => {
44
+ getNotificationEmails().then((res) => {
45
+ if (res.success && res.emails) {
46
+ setEmailsInput(res.emails);
47
+ }
48
+ });
49
+ });
50
+ }
51
+ }, [isAdmin]);
52
+
53
+ const handleSaveEmails = async () => {
54
+ setSavingEmails(true);
55
+ setSettingsError(null);
56
+ setSettingsSuccess(null);
57
+
58
+ const res = await saveNotificationEmails(emailsInput);
59
+ setSavingEmails(false);
60
+
61
+ if (res.error) {
62
+ setSettingsError(res.error);
63
+ } else {
64
+ setSettingsSuccess("Notification settings saved successfully.");
65
+ if (res.emails) {
66
+ setEmailsInput(res.emails);
67
+ }
68
+ setTimeout(() => {
69
+ setSettingsSuccess(null);
70
+ setIsSettingsOpen(false);
71
+ }, 1500);
72
+ }
73
+ };
74
+ const [filterType, setFilterType] = useState<"all" | "review" | "comment">("all");
75
+ const [filterStatus, setFilterStatus] = useState<"pending" | "approved" | "denied">("pending");
76
+ const [, startTransition] = useTransition();
77
+ const [moderatingId, setModeratingId] = useState<string | null>(null);
78
+ const [actionError, setActionError] = useState<string | null>(null);
79
+
80
+ // Counter helper
81
+ const getCount = (status: "pending" | "approved" | "denied") => {
82
+ return interactions.filter((i) => i.status === status).length;
83
+ };
84
+
85
+ // Filtered interactions
86
+ const filteredInteractions = interactions.filter((item) => {
87
+ const matchesStatus = item.status === filterStatus;
88
+ const matchesType = filterType === "all" ? true : item.type === filterType;
89
+ return matchesStatus && matchesType;
90
+ });
91
+
92
+ const handleModerate = async (interactionId: string, status: "approved" | "denied") => {
93
+ if (!isAdmin) {
94
+ setActionError("Only administrators can moderate reviews and comments.");
95
+ return;
96
+ }
97
+
98
+ setModeratingId(interactionId);
99
+ setActionError(null);
100
+
101
+ startTransition(async () => {
102
+ const res = await updateInteractionStatus(interactionId, status);
103
+ setModeratingId(null);
104
+
105
+ if (res.error) {
106
+ setActionError(res.error);
107
+ } else {
108
+ // Update local state
109
+ setInteractions((prev) =>
110
+ prev.map((item) => (item.id === interactionId ? { ...item, status } : item))
111
+ );
112
+ }
113
+ });
114
+ };
115
+
116
+ const getInitials = (profile: any) => {
117
+ if (profile?.full_name) {
118
+ return profile.full_name
119
+ .split(" ")
120
+ .map((n: string) => n[0])
121
+ .join("")
122
+ .toUpperCase()
123
+ .slice(0, 2);
124
+ }
125
+ return "U";
126
+ };
127
+
128
+ return (
129
+ <div className="space-y-6 max-w-7xl mx-auto p-4 sm:p-6 lg:p-8">
130
+ {/* Header */}
131
+ <div className="flex flex-col md:flex-row md:items-center md:justify-between border-b pb-6 gap-4">
132
+ <div>
133
+ <h1 className="text-3xl font-bold tracking-tight text-foreground flex items-center gap-2.5">
134
+ <MessageSquare className="h-8 w-8 text-primary" />
135
+ Interactions Moderation
136
+ </h1>
137
+ <p className="text-sm text-muted-foreground mt-1.5">
138
+ Review and moderate customer reviews and blog comments.
139
+ </p>
140
+ </div>
141
+ {isAdmin && (
142
+ <div className="flex items-center gap-2 self-start md:self-auto">
143
+ <Button
144
+ onClick={() => setIsSettingsOpen(true)}
145
+ className="flex items-center gap-2 text-xs"
146
+ variant="outline"
147
+ >
148
+ <Mail className="h-4 w-4" />
149
+ Notifications
150
+ </Button>
151
+ </div>
152
+ )}
153
+ </div>
154
+
155
+ {/* Tabs / Filters Bar */}
156
+ <div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 bg-card border border-border/60 rounded-2xl p-4 shadow-sm">
157
+ {/* Status Tabs */}
158
+ <div className="flex flex-wrap items-center gap-2">
159
+ {(["pending", "approved", "denied"] as const).map((status) => {
160
+ const count = getCount(status);
161
+ const isActive = filterStatus === status;
162
+ return (
163
+ <button
164
+ key={status}
165
+ onClick={() => setFilterStatus(status)}
166
+ className={cn(
167
+ "flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-xl transition-all border",
168
+ isActive
169
+ ? "bg-primary text-primary-foreground border-primary shadow-sm"
170
+ : "bg-background border-border text-muted-foreground hover:text-foreground hover:border-border/100"
171
+ )}
172
+ >
173
+ <span className="capitalize">{status}</span>
174
+ <Badge
175
+ variant={isActive ? "secondary" : "outline"}
176
+ className={cn(
177
+ "text-xs font-semibold px-2 py-0.5",
178
+ isActive ? "bg-white/20 text-white" : "text-muted-foreground border-border/80"
179
+ )}
180
+ >
181
+ {count}
182
+ </Badge>
183
+ </button>
184
+ );
185
+ })}
186
+ </div>
187
+
188
+ {/* Type Filter */}
189
+ <div className="flex items-center gap-2">
190
+ <Filter className="h-4 w-4 text-muted-foreground hidden sm:block" />
191
+ <select
192
+ value={filterType}
193
+ onChange={(e: any) => setFilterType(e.target.value)}
194
+ className="bg-background border border-border rounded-xl px-3 py-2 text-sm font-medium text-foreground focus:ring-1 focus:ring-primary focus:outline-none"
195
+ >
196
+ <option value="all">All Types</option>
197
+ <option value="review">Reviews Only</option>
198
+ <option value="comment">Comments Only</option>
199
+ </select>
200
+ </div>
201
+ </div>
202
+
203
+ {/* Error Banner */}
204
+ {actionError && (
205
+ <div className="bg-destructive/10 border border-destructive/20 text-destructive text-sm rounded-xl p-4 flex items-center gap-2.5">
206
+ <AlertCircle className="h-5 w-5 shrink-0" />
207
+ <span className="font-medium">{actionError}</span>
208
+ </div>
209
+ )}
210
+
211
+ {/* Interactions List */}
212
+ <div className="space-y-4">
213
+ {filteredInteractions.length > 0 ? (
214
+ filteredInteractions.map((item) => {
215
+ const authorName = item.profiles?.full_name || item.profiles?.github_username || "Anonymous";
216
+ const dateStr = new Date(item.created_at).toLocaleString();
217
+ const targetName = item.products?.title || item.posts?.title || "Unknown Target";
218
+ const targetUrl = item.product_id
219
+ ? `/product/${item.products?.slug}`
220
+ : `/article/${item.posts?.slug}`;
221
+ const targetLabel = item.product_id ? "Product" : "Article";
222
+
223
+ return (
224
+ <div
225
+ key={item.id}
226
+ className={cn(
227
+ "bg-card border rounded-2xl p-5 shadow-sm space-y-4 hover:border-border/100 transition-all duration-300 relative",
228
+ item.status === "pending" && "border-amber-200/60 dark:border-amber-900/30"
229
+ )}
230
+ >
231
+ {/* Header */}
232
+ <div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 border-b border-border/40 pb-4">
233
+ <div className="flex items-center gap-3">
234
+ <Avatar className="h-10 w-10 border">
235
+ <AvatarImage src={item.profiles?.avatar_url || undefined} alt={authorName} />
236
+ <AvatarFallback className="bg-primary/5 text-primary text-xs font-semibold">
237
+ {getInitials(item.profiles)}
238
+ </AvatarFallback>
239
+ </Avatar>
240
+ <div>
241
+ <div className="flex items-center gap-2">
242
+ <h3 className="text-sm font-semibold text-foreground leading-none">
243
+ {authorName}
244
+ </h3>
245
+ <Badge
246
+ variant="outline"
247
+ className={cn(
248
+ "text-[10px] font-bold uppercase py-0 px-2",
249
+ item.type === "review"
250
+ ? "border-amber-500/20 bg-amber-500/5 text-amber-600"
251
+ : "border-sky-500/20 bg-sky-500/5 text-sky-600"
252
+ )}
253
+ >
254
+ {item.type}
255
+ </Badge>
256
+ </div>
257
+ <span className="text-[10px] text-muted-foreground mt-1.5 block" suppressHydrationWarning>
258
+ {dateStr}
259
+ </span>
260
+ </div>
261
+ </div>
262
+
263
+ {/* Target Link */}
264
+ <div className="flex items-center text-xs">
265
+ <span className="text-muted-foreground mr-1.5 font-medium">{targetLabel}:</span>
266
+ <Link
267
+ href={targetUrl}
268
+ target="_blank"
269
+ className="text-primary hover:underline font-semibold flex items-center gap-1 group"
270
+ >
271
+ {targetName}
272
+ <ExternalLink className="h-3 w-3 opacity-60 group-hover:opacity-100 transition-opacity" />
273
+ </Link>
274
+ </div>
275
+ </div>
276
+
277
+ {/* Rating if Review */}
278
+ {item.type === "review" && item.rating && (
279
+ <div className="flex items-center gap-0.5 text-amber-500">
280
+ {Array.from({ length: 5 }).map((_, i) => (
281
+ <Star
282
+ key={i}
283
+ className={cn(
284
+ "h-4.5 w-4.5",
285
+ i < item.rating ? "fill-amber-500 text-amber-500" : "text-slate-200 dark:text-slate-800"
286
+ )}
287
+ />
288
+ ))}
289
+ </div>
290
+ )}
291
+
292
+ {/* Body Content */}
293
+ <p className="text-sm text-slate-700 dark:text-slate-300 leading-relaxed whitespace-pre-line text-left">
294
+ {item.content}
295
+ </p>
296
+
297
+ {/* Reactions Count */}
298
+ {Object.keys(item.reactions || {}).length > 0 && (
299
+ <div className="flex items-center gap-1.5 text-xs text-muted-foreground bg-slate-50 dark:bg-slate-900/20 px-3 py-1.5 rounded-xl w-fit">
300
+ <ThumbsUp className="h-3.5 w-3.5" />
301
+ <span>Likes:</span>
302
+ <span className="font-semibold text-foreground">
303
+ {item.reactions.likes || 0}
304
+ </span>
305
+ </div>
306
+ )}
307
+
308
+ {/* Moderation Actions */}
309
+ {isAdmin && (
310
+ <div className="flex items-center justify-end gap-2.5 pt-2">
311
+ {item.status !== "approved" && (
312
+ <Button
313
+ size="sm"
314
+ onClick={() => handleModerate(item.id, "approved")}
315
+ disabled={moderatingId === item.id}
316
+ className="bg-emerald-600 hover:bg-emerald-700 text-white flex items-center gap-1.5 rounded-xl shadow-sm transition-all"
317
+ >
318
+ <Check className="h-3.5 w-3.5" />
319
+ Approve
320
+ </Button>
321
+ )}
322
+ {item.status !== "denied" && (
323
+ <Button
324
+ size="sm"
325
+ variant="outline"
326
+ onClick={() => handleModerate(item.id, "denied")}
327
+ disabled={moderatingId === item.id}
328
+ className="border-destructive/30 hover:border-destructive hover:bg-destructive/5 text-destructive flex items-center gap-1.5 rounded-xl transition-all"
329
+ >
330
+ <X className="h-3.5 w-3.5" />
331
+ Deny
332
+ </Button>
333
+ )}
334
+ </div>
335
+ )}
336
+ </div>
337
+ );
338
+ })
339
+ ) : (
340
+ <div className="text-center py-20 border border-dashed rounded-2xl bg-slate-50/50 dark:bg-slate-900/10">
341
+ <Inbox className="mx-auto h-10 w-10 text-slate-300 dark:text-slate-700" />
342
+ <h3 className="mt-4 text-sm font-semibold text-foreground">All caught up!</h3>
343
+ <p className="mt-1.5 text-xs text-muted-foreground">
344
+ No interactions matching status <span className="font-semibold">&quot;{filterStatus}&quot;</span> and type <span className="font-semibold">&quot;{filterType}&quot;</span>.
345
+ </p>
346
+ </div>
347
+ )}
348
+ </div>
349
+
350
+ {/* Settings Modal */}
351
+ {isSettingsOpen && (
352
+ <div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/45 backdrop-blur-sm animate-in fade-in duration-200">
353
+ <div className="bg-background border border-border rounded-2xl max-w-md w-full p-6 shadow-xl space-y-4 animate-in zoom-in-95 duration-200">
354
+ <div className="flex items-center justify-between">
355
+ <h3 className="text-lg font-semibold text-foreground flex items-center gap-2">
356
+ <Mail className="h-5 w-5 text-primary" />
357
+ Notification Settings
358
+ </h3>
359
+ <button
360
+ onClick={() => setIsSettingsOpen(false)}
361
+ className="text-muted-foreground hover:text-foreground transition-colors"
362
+ >
363
+ <X className="h-5 w-5" />
364
+ </button>
365
+ </div>
366
+ <p className="text-sm text-muted-foreground text-left">
367
+ Configure which email addresses receive notification alerts when new pending reviews or comments are submitted.
368
+ </p>
369
+ <div className="space-y-1.5 text-left">
370
+ <label className="text-xs font-semibold text-muted-foreground uppercase tracking-wider block">
371
+ Email Recipients
372
+ </label>
373
+ <textarea
374
+ value={emailsInput}
375
+ onChange={(e) => setEmailsInput(e.target.value)}
376
+ placeholder="admin@example.com, moderator@example.com"
377
+ className="w-full min-h-[80px] bg-background border border-border rounded-xl px-3 py-2 text-sm text-foreground focus:ring-1 focus:ring-primary focus:outline-none"
378
+ />
379
+ <span className="text-[10px] text-muted-foreground">
380
+ Enter a comma-separated list of email addresses.
381
+ </span>
382
+ </div>
383
+
384
+ {settingsError && <div className="text-xs font-medium text-destructive text-left">{settingsError}</div>}
385
+ {settingsSuccess && <div className="text-xs font-medium text-emerald-600 text-left">{settingsSuccess}</div>}
386
+
387
+ <div className="flex justify-end gap-3 pt-2">
388
+ <Button
389
+ variant="ghost"
390
+ onClick={() => setIsSettingsOpen(false)}
391
+ disabled={savingEmails}
392
+ >
393
+ Cancel
394
+ </Button>
395
+ <Button
396
+ onClick={handleSaveEmails}
397
+ disabled={savingEmails}
398
+ className="min-w-[100px]"
399
+ >
400
+ {savingEmails ? "Saving..." : "Save Settings"}
401
+ </Button>
402
+ </div>
403
+ </div>
404
+ </div>
405
+ )}
406
+ </div>
407
+ );
408
+ }
@@ -0,0 +1,51 @@
1
+ import { redirect } from "next/navigation";
2
+ import { createClient, getProfileWithRoleServerSide } from "@nextblock-cms/db/server";
3
+ import InteractionsModerationClient from "./InteractionsModerationClient";
4
+
5
+ export const dynamic = "force-dynamic";
6
+
7
+ export default async function InteractionsPage() {
8
+ const supabase = createClient();
9
+
10
+ // 1. Authenticate user
11
+ const { data: { user } } = await supabase.auth.getUser();
12
+ if (!user) {
13
+ redirect("/login?redirect_to=/cms/interactions");
14
+ }
15
+
16
+ // 2. Authorize user (requires ADMIN or WRITER roles to access CMS)
17
+ const profile = await getProfileWithRoleServerSide(user.id);
18
+ if (!profile || (profile.role !== "ADMIN" && profile.role !== "WRITER")) {
19
+ redirect("/cms/dashboard");
20
+ }
21
+
22
+ // 3. Fetch initial interactions (reviews and comments)
23
+ const { data: interactions, error } = await supabase
24
+ .from("cms_interactions" as any)
25
+ .select(`
26
+ id,
27
+ type,
28
+ status,
29
+ content,
30
+ rating,
31
+ reactions,
32
+ created_at,
33
+ product_id,
34
+ post_id,
35
+ profiles(full_name, avatar_url, github_username),
36
+ products(title, slug),
37
+ posts(title, slug)
38
+ `)
39
+ .order("created_at", { ascending: false });
40
+
41
+ if (error) {
42
+ console.error("Error fetching initial interactions:", error);
43
+ }
44
+
45
+ return (
46
+ <InteractionsModerationClient
47
+ initialInteractions={interactions || []}
48
+ isAdmin={profile.role === "ADMIN"}
49
+ />
50
+ );
51
+ }
@@ -27,14 +27,15 @@ import {
27
27
  Trash2,
28
28
  Info,
29
29
  } from 'lucide-react';
30
+ import {
31
+ createCortexAiStoredModelSelection,
32
+ type CortexAiStoredModelSelection,
33
+ } from '@nextblock/cortex/client';
30
34
 
31
35
  const CORTEX_AI_SANDBOX_KEY_LOCAL_STORAGE = 'cortex_ai_sandbox_openrouter_api_key';
32
36
  const CORTEX_AI_SANDBOX_MODEL_LOCAL_STORAGE = 'cortex_ai_sandbox_openrouter_model_selection';
33
37
  const CORTEX_AI_SETTINGS_CHANGED_EVENT = 'nextblock:cortex-ai-settings-changed';
34
38
 
35
- import type { CortexAiStoredModelSelection } from '../../../../lib/ai-model-registry';
36
- import { createCortexAiStoredModelSelection } from '../../../../lib/ai-model-registry';
37
-
38
39
  type SandboxCortexAiSettingsClientProps = {
39
40
  compatibleModels: Array<{
40
41
  id: string;
@@ -27,7 +27,7 @@ import {
27
27
  Trash2,
28
28
  } from 'lucide-react';
29
29
 
30
- import type { CortexAiStoredModelSelection } from '../../../../lib/ai-model-registry';
30
+ import type { CortexAiStoredModelSelection } from '@nextblock/cortex/client';
31
31
  import {
32
32
  clearCortexAiModelSelectionAction,
33
33
  clearOpenRouterApiKeyAction,
@@ -9,17 +9,15 @@ import {
9
9
  CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY,
10
10
  CORTEX_AI_OPENROUTER_SETTING_KEY,
11
11
  CORTEX_AI_PACKAGE_ID,
12
+ createCortexAiStoredModelSelection,
12
13
  encryptStoredOpenRouterApiKey,
13
14
  getCortexAiEnvConfig,
14
15
  getEnvOpenRouterKeyStatus,
15
16
  getStoredOpenRouterKeyStatus,
16
- } from '../../../../lib/ai-config';
17
- import { listCortexAiCompatibleOpenRouterModels } from '../../../../lib/ai-model-catalog';
18
- import {
19
- createCortexAiStoredModelSelection,
17
+ listCortexAiCompatibleOpenRouterModels,
20
18
  safeParseCortexAiModelSelection,
21
19
  type CortexAiStoredModelSelection,
22
- } from '../../../../lib/ai-model-registry';
20
+ } from '@nextblock/cortex';
23
21
 
24
22
  const CORTEX_AI_SETTINGS_PATH = '/cms/settings/cortex-ai';
25
23
 
@@ -1,4 +1,4 @@
1
- import { listCortexAiCompatibleOpenRouterModels } from '../../../../lib/ai-model-catalog';
1
+ import { listCortexAiCompatibleOpenRouterModels } from '@nextblock/cortex';
2
2
  import { getCortexAiSettingsStatus } from './actions';
3
3
  import { SandboxCortexAiSettingsClient } from './SandboxCortexAiSettingsClient';
4
4
  import { StoredCortexAiSettingsClient } from './StoredCortexAiSettingsClient';
@@ -113,14 +113,14 @@ export async function generateMetadata(): Promise<Metadata> {
113
113
  ...buildSocialMetadata({
114
114
  title,
115
115
  description,
116
- url: `${siteUrl}/`,
116
+ url: `${siteUrl}`,
117
117
  siteTitle,
118
118
  imageUrl: pageData.feature_image_url,
119
119
  type: 'website',
120
120
  locale: toOpenGraphLocale(pageData.language_code),
121
121
  }),
122
122
  alternates: {
123
- canonical: `${siteUrl}/`,
123
+ canonical: `${siteUrl}`,
124
124
  languages: Object.keys(alternates).length > 0 ? alternates : undefined,
125
125
  },
126
126
  };
@@ -326,6 +326,8 @@ export default async function ProductPage({ params }: ProductPageProps) {
326
326
  title: productRecord.title,
327
327
  slug: productRecord.slug,
328
328
  sku: productRecord.sku,
329
+ average_rating: productRecord.average_rating,
330
+ total_reviews: productRecord.total_reviews,
329
331
  upc: productRecord.upc || undefined,
330
332
  price: productRecord.price,
331
333
  prices: normalizePriceMap(productRecord.prices),
@@ -128,7 +128,7 @@ export function AppShell({
128
128
  (corporateFooter.legalName ||
129
129
  corporateFooter.address ||
130
130
  corporateFooter.supportEmail) && (
131
- <p className="max-w-2xl text-[11px] leading-relaxed text-muted-foreground/80">
131
+ <p className="max-w-2xl text-[11px] leading-relaxed text-slate-600">
132
132
  {[corporateFooter.legalName, corporateFooter.address]
133
133
  .filter(Boolean)
134
134
  .join(' · ')}