Load site meta tags and trust badges from Meshkee business info.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-10-03 18:23:38 +03:30
co-authored by Cursor
parent cd88e0ce46
commit b4d6b30243
6 changed files with 74 additions and 28 deletions
+29
View File
@@ -26,3 +26,32 @@ export async function getBusinessId() {
const tenant = await getTenant();
return tenant?.id != null ? String(tenant.id) : "";
}
export type BusinessMetaTag = {
name: string;
content: string;
};
export type BusinessTrustBadge = {
kind: "enamad" | "samandehi";
embedHtml: string;
};
export type BusinessInfo = {
metaTags?: BusinessMetaTag[];
trustBadges?: BusinessTrustBadge[];
};
export async function getBusinessInfo() {
return meshkeeGet<BusinessInfo | null>(tenantPath("/website/business-info"), null);
}
export function metaTagsToOther(tags: BusinessMetaTag[] | undefined) {
const other: Record<string, string> = {};
for (const tag of tags ?? []) {
const name = tag.name?.trim();
const content = tag.content?.trim();
if (name && content) other[name] = content;
}
return Object.keys(other).length > 0 ? other : undefined;
}