feat: Include direct product URLs in Market Research - Updated MarketResearchResult type to include optional URLs - Enhanced AI prompts to extract competitor product links - Added 'View Product' links to the Price Matrix UI - Responsive links with protocol verification
This commit is contained in:
@@ -10,7 +10,7 @@ import { Badge } from "@/components/ui/badge";
|
||||
import useStore from "@/lib/store";
|
||||
import { translations } from "@/lib/i18n/translations";
|
||||
import modelAdapter from "@/lib/services/adapter-instance";
|
||||
import { Search, Globe, Plus, Trash2, ShieldAlert, BarChart3, TrendingUp, Target, Rocket, Lightbulb, CheckCircle2, AlertCircle, Loader2, X } from "lucide-react";
|
||||
import { Search, Globe, Plus, Trash2, ShieldAlert, BarChart3, TrendingUp, Target, Rocket, Lightbulb, CheckCircle2, AlertCircle, Loader2, X, ExternalLink } from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const MarketResearcher = () => {
|
||||
@@ -170,8 +170,21 @@ const MarketResearcher = () => {
|
||||
{marketResearchResult.competitors.map((comp) => {
|
||||
const compPrice = item.competitorPrices.find(cp => cp.competitor === comp || comp.includes(cp.competitor));
|
||||
return (
|
||||
<td key={comp} className="px-4 py-4 font-medium text-slate-600">
|
||||
{compPrice ? compPrice.price : "N/A"}
|
||||
<td key={comp} className="px-4 py-4">
|
||||
<div className="flex flex-col gap-1">
|
||||
<span className="font-medium text-slate-600">{compPrice ? compPrice.price : "N/A"}</span>
|
||||
{compPrice?.url && (
|
||||
<a
|
||||
href={compPrice.url.startsWith('http') ? compPrice.url : `https://${compPrice.url}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-[10px] text-indigo-500 hover:text-indigo-700 font-bold transition-colors group/link"
|
||||
>
|
||||
<ExternalLink className="h-2.5 w-2.5" />
|
||||
View Product
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -632,7 +632,7 @@ OUTPUT FORMAT - Return ONLY valid JSON with this structure:
|
||||
"product": "Product Name",
|
||||
"userPrice": "$XX.XX",
|
||||
"competitorPrices": [
|
||||
{ "competitor": "Competitor Name", "price": "$XX.XX" }
|
||||
{ "competitor": "Competitor Name", "price": "$XX.XX", "url": "https://competitor.com/product-page" }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -954,7 +954,7 @@ OUTPUT FORMAT - JSON:
|
||||
{
|
||||
"executiveSummary": "findings",
|
||||
"priceComparisonMatrix": [
|
||||
{ "product": "P", "userPrice": "$", "competitorPrices": [{ "competitor": "C", "price": "$" }] }
|
||||
{ "product": "P", "userPrice": "$", "competitorPrices": [{ "competitor": "C", "price": "$", "url": "link" }] }
|
||||
],
|
||||
"featureComparisonTable": [
|
||||
{ "feature": "F", "userStatus": "status", "competitorStatus": [{ "competitor": "C", "status": "status" }] }
|
||||
|
||||
@@ -713,7 +713,7 @@ OUTPUT FORMAT - Return ONLY valid JSON with this structure:
|
||||
"product": "Product Name",
|
||||
"userPrice": "$XX.XX",
|
||||
"competitorPrices": [
|
||||
{ "competitor": "Competitor Name", "price": "$XX.XX" }
|
||||
{ "competitor": "Competitor Name", "price": "$XX.XX", "url": "https://competitor.com/product-page" }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -272,7 +272,7 @@ export interface MarketResearchResult {
|
||||
priceComparisonMatrix: {
|
||||
product: string;
|
||||
userPrice: string;
|
||||
competitorPrices: { competitor: string; price: string }[];
|
||||
competitorPrices: { competitor: string; price: string; url?: string }[];
|
||||
}[];
|
||||
featureComparisonTable: {
|
||||
feature: string;
|
||||
|
||||
Reference in New Issue
Block a user