Align user-product links and chart copy with id+slug URLs.

Support pathSlug in types/website helpers and note that product views include customer listings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-15 15:35:46 +03:30
co-authored by Cursor
parent c2ede07e73
commit 9ce93b0b48
6 changed files with 30 additions and 4 deletions
+4 -2
View File
@@ -278,7 +278,8 @@ const en = {
'home.chart.blogViews.error': 'Unable to load blog view activity.',
'home.chart.blogViews.bar': '{day}: {count} views',
'home.chart.productViews.title': 'Product views',
'home.chart.productViews.subtitle': 'Product page views in the last 30 days · {from} – {to}',
'home.chart.productViews.subtitle':
'Catalog + customer product page views in the last 30 days · {from} – {to}',
'home.chart.productViews.legend': 'Views ({count})',
'home.chart.productViews.loading': 'Loading chart...',
'home.chart.productViews.error': 'Unable to load product view activity.',
@@ -2788,7 +2789,8 @@ const fa: Record<MessageKey, string> = {
'home.chart.blogViews.error': 'بارگذاری بازدید مقالات ممکن نشد.',
'home.chart.blogViews.bar': '{day}: {count} بازدید',
'home.chart.productViews.title': 'بازدید محصولات',
'home.chart.productViews.subtitle': 'بازدید صفحات محصول در ۳۰ روز گذشته از {from} تا {to}',
'home.chart.productViews.subtitle':
'بازدید صفحات محصول و محصولات کاربران در ۳۰ روز گذشته از {from} تا {to}',
'home.chart.productViews.legend': 'بازدید ({count})',
'home.chart.productViews.loading': 'در حال بارگذاری نمودار...',
'home.chart.productViews.error': 'بارگذاری بازدید محصولات ممکن نشد.',
@@ -53,6 +53,8 @@ export type WebsiteViewKind =
| 'blog_detail'
| 'video_list'
| 'video_detail'
| 'user_product_list'
| 'user_product_detail'
/** @deprecated aliases still accepted by API */
| 'website'
| 'product'
+3
View File
@@ -7,6 +7,9 @@ export interface UserProductListItem {
title: string
titleFa?: string | null
titleEn?: string | null
/** SEO path segment for `/user-products/{id}/{pathSlug}` (from titleFa/titleEn). */
pathSlug?: string | null
slug?: string | null
description?: string | null
price: number | null
priceCurrency?: UserProductPriceCurrency | string | null
+16
View File
@@ -4,6 +4,7 @@ export type WebsiteLinkKind = 'product' | 'storeItem' | 'blog' | 'portfolio' | '
export type WebsiteContentKind =
| 'product'
| 'userProduct'
| 'blog'
| 'portfolio'
| 'video'
@@ -61,8 +62,10 @@ export function buildWebsiteContentUrl(
item: {
id: string
slug?: string | null
pathSlug?: string | null
title?: string | null
titleFa?: string | null
titleEn?: string | null
nameFa?: string | null
nameEn?: string | null
},
@@ -80,6 +83,19 @@ export function buildWebsiteContentUrl(
)
return `${origin}/products/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
}
case 'userProduct': {
const pathSlug =
item.pathSlug?.trim() ||
slugifyForWebsitePath(
item.titleFa?.trim() ||
item.title?.trim() ||
item.titleEn?.trim() ||
item.nameEn?.trim() ||
'',
'user-product',
)
return `${origin}/user-products/${encodeURIComponent(id)}/${encodeURIComponent(pathSlug)}`
}
case 'blog': {
const slug = item.slug?.trim()
return slug ? `${origin}/blog/${encodeURIComponent(slug)}` : ''