@zenky/storefront-vue 0.11.0 → 0.12.0
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.
- package/CHANGELOG.md +70 -0
- package/dist/cart/index.js +5 -5
- package/dist/chunk-6HOKVW4M.js +134 -0
- package/dist/chunk-6HOKVW4M.js.map +1 -0
- package/dist/{chunk-KK645XNR.js → chunk-CQDOEP6T.js} +4 -127
- package/dist/chunk-CQDOEP6T.js.map +1 -0
- package/dist/{chunk-5KCBZJV3.js → chunk-IEHN2WNU.js} +6 -6
- package/dist/{chunk-5KCBZJV3.js.map → chunk-IEHN2WNU.js.map} +1 -1
- package/dist/chunk-JY3UJRMF.js +59 -0
- package/dist/chunk-JY3UJRMF.js.map +1 -0
- package/dist/{chunk-RURXGVWW.js → chunk-UJKWKD3W.js} +4 -56
- package/dist/chunk-UJKWKD3W.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -8
- package/dist/products/index.d.ts +2 -1
- package/dist/products/index.js +2 -1
- package/dist/seo/index.d.ts +44 -16
- package/dist/seo/index.js +338 -104
- package/dist/seo/index.js.map +1 -1
- package/dist/stores/index.js +2 -2
- package/dist/utils/index.js +2 -1
- package/docs/architecture.md +5 -3
- package/docs/consumer-setup.md +1 -1
- package/package.json +1 -1
- package/dist/chunk-KK645XNR.js.map +0 -1
- package/dist/chunk-RURXGVWW.js.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ContactType } from '@zenky/storefront-api';
|
|
2
|
+
|
|
3
|
+
// src/utils/contacts.ts
|
|
4
|
+
var SOCIAL_TYPES = /* @__PURE__ */ new Set([
|
|
5
|
+
ContactType.Vk,
|
|
6
|
+
ContactType.Instagram,
|
|
7
|
+
ContactType.Facebook,
|
|
8
|
+
ContactType.Twitter,
|
|
9
|
+
ContactType.Ok,
|
|
10
|
+
ContactType.Tiktok,
|
|
11
|
+
ContactType.Telegram,
|
|
12
|
+
ContactType.Max
|
|
13
|
+
]);
|
|
14
|
+
var SOCIAL_LABELS = {
|
|
15
|
+
[ContactType.Vk]: "\u0412\u041A\u043E\u043D\u0442\u0430\u043A\u0442\u0435",
|
|
16
|
+
[ContactType.Instagram]: "Instagram",
|
|
17
|
+
[ContactType.Facebook]: "Facebook",
|
|
18
|
+
[ContactType.Twitter]: "Twitter",
|
|
19
|
+
[ContactType.Ok]: "\u041E\u0434\u043D\u043E\u043A\u043B\u0430\u0441\u0441\u043D\u0438\u043A\u0438",
|
|
20
|
+
[ContactType.Tiktok]: "TikTok",
|
|
21
|
+
[ContactType.Telegram]: "Telegram",
|
|
22
|
+
[ContactType.Max]: "Max"
|
|
23
|
+
};
|
|
24
|
+
function buildSocialUrl(type, value) {
|
|
25
|
+
if (value.startsWith("http://") || value.startsWith("https://")) {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
const bases = {
|
|
29
|
+
[ContactType.Vk]: "https://vk.com/",
|
|
30
|
+
[ContactType.Instagram]: "https://instagram.com/",
|
|
31
|
+
[ContactType.Facebook]: "https://facebook.com/",
|
|
32
|
+
[ContactType.Twitter]: "https://x.com/",
|
|
33
|
+
[ContactType.Ok]: "https://ok.ru/",
|
|
34
|
+
[ContactType.Tiktok]: "https://tiktok.com/@",
|
|
35
|
+
[ContactType.Telegram]: "https://t.me/",
|
|
36
|
+
[ContactType.Max]: "https://max.ru/"
|
|
37
|
+
};
|
|
38
|
+
const base = bases[type];
|
|
39
|
+
return base ? `${base}${value}` : value;
|
|
40
|
+
}
|
|
41
|
+
function getSocialLinks(contacts) {
|
|
42
|
+
return contacts.filter((contact) => SOCIAL_TYPES.has(contact.type)).map((contact) => ({
|
|
43
|
+
type: contact.type,
|
|
44
|
+
url: buildSocialUrl(contact.type, contact.value),
|
|
45
|
+
label: SOCIAL_LABELS[contact.type] ?? contact.type
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
function getEmailLink(contacts) {
|
|
49
|
+
const email = contacts.find((c) => c.type === ContactType.Email);
|
|
50
|
+
return email?.value ?? null;
|
|
51
|
+
}
|
|
52
|
+
function getWebsiteLink(contacts) {
|
|
53
|
+
const website = contacts.find((c) => c.type === ContactType.Website);
|
|
54
|
+
return website?.value ?? null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { getEmailLink, getSocialLinks, getWebsiteLink };
|
|
58
|
+
//# sourceMappingURL=chunk-JY3UJRMF.js.map
|
|
59
|
+
//# sourceMappingURL=chunk-JY3UJRMF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/contacts.ts"],"names":[],"mappings":";;;AAUA,IAAM,YAAA,uBAAmB,GAAA,CAAiB;AAAA,EACtC,WAAA,CAAY,EAAA;AAAA,EACZ,WAAA,CAAY,SAAA;AAAA,EACZ,WAAA,CAAY,QAAA;AAAA,EACZ,WAAA,CAAY,OAAA;AAAA,EACZ,WAAA,CAAY,EAAA;AAAA,EACZ,WAAA,CAAY,MAAA;AAAA,EACZ,WAAA,CAAY,QAAA;AAAA,EACZ,WAAA,CAAY;AAChB,CAAC,CAAA;AAED,IAAM,aAAA,GAAwC;AAAA,EAC1C,CAAC,WAAA,CAAY,EAAE,GAAG,wDAAA;AAAA,EAClB,CAAC,WAAA,CAAY,SAAS,GAAG,WAAA;AAAA,EACzB,CAAC,WAAA,CAAY,QAAQ,GAAG,UAAA;AAAA,EACxB,CAAC,WAAA,CAAY,OAAO,GAAG,SAAA;AAAA,EACvB,CAAC,WAAA,CAAY,EAAE,GAAG,gFAAA;AAAA,EAClB,CAAC,WAAA,CAAY,MAAM,GAAG,QAAA;AAAA,EACtB,CAAC,WAAA,CAAY,QAAQ,GAAG,UAAA;AAAA,EACxB,CAAC,WAAA,CAAY,GAAG,GAAG;AACvB,CAAA;AAEA,SAAS,cAAA,CAAe,MAAmB,KAAA,EAAuB;AAC9D,EAAA,IAAI,MAAM,UAAA,CAAW,SAAS,KAAK,KAAA,CAAM,UAAA,CAAW,UAAU,CA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AAA,EAAoC;AAC/D,EAAA,MAAM,OAAA,GAAU,SAAS,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,IAAA,KAAS,YAAY,OAAO,CAAA;AAEnE,EAAA,OAAO,SAAS,KAAA,IAAS,IAAA;AAC7B","file":"chunk-JY3UJRMF.js","sourcesContent":["import { ContactType } from '@zenky/storefront-api'\n\nimport type { Contact } from '@zenky/storefront-api'\n\nexport interface SocialLink {\n type: ContactType\n url: string\n label: string\n}\n\nconst SOCIAL_TYPES = new Set<ContactType>([\n ContactType.Vk,\n ContactType.Instagram,\n ContactType.Facebook,\n ContactType.Twitter,\n ContactType.Ok,\n ContactType.Tiktok,\n ContactType.Telegram,\n ContactType.Max,\n])\n\nconst SOCIAL_LABELS: Record<string, string> = {\n [ContactType.Vk]: 'ВКонтакте',\n [ContactType.Instagram]: 'Instagram',\n [ContactType.Facebook]: 'Facebook',\n [ContactType.Twitter]: 'Twitter',\n [ContactType.Ok]: 'Одноклассники',\n [ContactType.Tiktok]: 'TikTok',\n [ContactType.Telegram]: 'Telegram',\n [ContactType.Max]: 'Max',\n} as const\n\nfunction buildSocialUrl(type: ContactType, value: string): string {\n if (value.startsWith('http://') || value.startsWith('https://')) {\n return value\n }\n\n const bases: Partial<Record<ContactType, string>> = {\n [ContactType.Vk]: 'https://vk.com/',\n [ContactType.Instagram]: 'https://instagram.com/',\n [ContactType.Facebook]: 'https://facebook.com/',\n [ContactType.Twitter]: 'https://x.com/',\n [ContactType.Ok]: 'https://ok.ru/',\n [ContactType.Tiktok]: 'https://tiktok.com/@',\n [ContactType.Telegram]: 'https://t.me/',\n [ContactType.Max]: 'https://max.ru/',\n }\n\n const base = bases[type]\n\n return base ? `${base}${value}` : value\n}\n\nexport function getSocialLinks(contacts: Contact[]): SocialLink[] {\n return contacts\n .filter((contact) => SOCIAL_TYPES.has(contact.type))\n .map((contact) => ({\n type: contact.type,\n url: buildSocialUrl(contact.type, contact.value),\n label: SOCIAL_LABELS[contact.type] ?? contact.type,\n }))\n}\n\nexport function getEmailLink(contacts: Contact[]): string | null {\n const email = contacts.find((c) => c.type === ContactType.Email)\n\n return email?.value ?? null\n}\n\nexport function getWebsiteLink(contacts: Contact[]): string | null {\n const website = contacts.find((c) => c.type === ContactType.Website)\n\n return website?.value ?? null\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ZenkyError } from '@zenky/storefront-api';
|
|
2
2
|
|
|
3
3
|
// src/utils/createOperationChain.ts
|
|
4
4
|
function createOperationChain() {
|
|
@@ -37,58 +37,6 @@ function formatPhoneSpaced(formatted) {
|
|
|
37
37
|
if (!formatted) return "";
|
|
38
38
|
return formatted.replace(/[()-]/g, " ").replace(/\s+/g, " ").trim();
|
|
39
39
|
}
|
|
40
|
-
var SOCIAL_TYPES = /* @__PURE__ */ new Set([
|
|
41
|
-
ContactType.Vk,
|
|
42
|
-
ContactType.Instagram,
|
|
43
|
-
ContactType.Facebook,
|
|
44
|
-
ContactType.Twitter,
|
|
45
|
-
ContactType.Ok,
|
|
46
|
-
ContactType.Tiktok,
|
|
47
|
-
ContactType.Telegram,
|
|
48
|
-
ContactType.Max
|
|
49
|
-
]);
|
|
50
|
-
var SOCIAL_LABELS = {
|
|
51
|
-
[ContactType.Vk]: "\u0412\u041A\u043E\u043D\u0442\u0430\u043A\u0442\u0435",
|
|
52
|
-
[ContactType.Instagram]: "Instagram",
|
|
53
|
-
[ContactType.Facebook]: "Facebook",
|
|
54
|
-
[ContactType.Twitter]: "Twitter",
|
|
55
|
-
[ContactType.Ok]: "\u041E\u0434\u043D\u043E\u043A\u043B\u0430\u0441\u0441\u043D\u0438\u043A\u0438",
|
|
56
|
-
[ContactType.Tiktok]: "TikTok",
|
|
57
|
-
[ContactType.Telegram]: "Telegram",
|
|
58
|
-
[ContactType.Max]: "Max"
|
|
59
|
-
};
|
|
60
|
-
function buildSocialUrl(type, value) {
|
|
61
|
-
if (value.startsWith("http://") || value.startsWith("https://")) {
|
|
62
|
-
return value;
|
|
63
|
-
}
|
|
64
|
-
const bases = {
|
|
65
|
-
[ContactType.Vk]: "https://vk.com/",
|
|
66
|
-
[ContactType.Instagram]: "https://instagram.com/",
|
|
67
|
-
[ContactType.Facebook]: "https://facebook.com/",
|
|
68
|
-
[ContactType.Twitter]: "https://x.com/",
|
|
69
|
-
[ContactType.Ok]: "https://ok.ru/",
|
|
70
|
-
[ContactType.Tiktok]: "https://tiktok.com/@",
|
|
71
|
-
[ContactType.Telegram]: "https://t.me/",
|
|
72
|
-
[ContactType.Max]: "https://max.ru/"
|
|
73
|
-
};
|
|
74
|
-
const base = bases[type];
|
|
75
|
-
return base ? `${base}${value}` : value;
|
|
76
|
-
}
|
|
77
|
-
function getSocialLinks(contacts) {
|
|
78
|
-
return contacts.filter((contact) => SOCIAL_TYPES.has(contact.type)).map((contact) => ({
|
|
79
|
-
type: contact.type,
|
|
80
|
-
url: buildSocialUrl(contact.type, contact.value),
|
|
81
|
-
label: SOCIAL_LABELS[contact.type] ?? contact.type
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
function getEmailLink(contacts) {
|
|
85
|
-
const email = contacts.find((c) => c.type === ContactType.Email);
|
|
86
|
-
return email?.value ?? null;
|
|
87
|
-
}
|
|
88
|
-
function getWebsiteLink(contacts) {
|
|
89
|
-
const website = contacts.find((c) => c.type === ContactType.Website);
|
|
90
|
-
return website?.value ?? null;
|
|
91
|
-
}
|
|
92
40
|
|
|
93
41
|
// src/utils/schedule.ts
|
|
94
42
|
var DAY_TO_JS_INDEX = {
|
|
@@ -268,6 +216,6 @@ function formatAddressCityLast(raw) {
|
|
|
268
216
|
return match ? `${match[2]}, ${match[1]}` : raw;
|
|
269
217
|
}
|
|
270
218
|
|
|
271
|
-
export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors,
|
|
272
|
-
//# sourceMappingURL=chunk-
|
|
273
|
-
//# sourceMappingURL=chunk-
|
|
219
|
+
export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getPhoneTelLink, getTodayInfo, getWeeklySchedule, groupScheduleDays, pluralize, toDateInputValue, todayInTimezone };
|
|
220
|
+
//# sourceMappingURL=chunk-UJKWKD3W.js.map
|
|
221
|
+
//# sourceMappingURL=chunk-UJKWKD3W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/createOperationChain.ts","../src/utils/phone.ts","../src/utils/schedule.ts","../src/utils/qr.ts","../src/utils/date.ts","../src/utils/pluralize.ts","../src/utils/errors.ts","../src/utils/address.ts"],"names":[],"mappings":";;;AASO,SAAS,oBAAA,GAAuC;AACnD,EAAA,MAAM,MAAA,uBAAa,GAAA,EAA2B;AAE9C,EAAA,eAAe,OAAA,CAAQ,KAAa,EAAA,EAAwC;AACxE,IAAA,MAAM,OAAO,MAAA,CAAO,GAAA,CAAI,GAAG,CAAA,IAAK,QAAQ,OAAA,EAAQ;AAEhD,IAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,EAAE,CAAA;AAG5B,IAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,KAAA,CAAM,MAAM;AAAA,IAAC,CAAC,CAAA;AACnC,IAAA,MAAA,CAAO,GAAA,CAAI,KAAK,IAAI,CAAA;AAGpB,IAAA,IAAA,CAAK,QAAQ,MAAM;AACf,MAAA,IAAI,MAAA,CAAO,GAAA,CAAI,GAAG,CAAA,KAAM,IAAA,EAAM;AAC1B,QAAA,MAAA,CAAO,OAAO,GAAG,CAAA;AAAA,MACrB;AAAA,IACJ,CAAC,CAAA;AAED,IAAA,OAAO,OAAA;AAAA,EACX;AAEA,EAAA,OAAO;AAAA,IACH,OAAA;AAAA,IACA,IAAI,IAAA,GAAO;AACP,MAAA,OAAO,MAAA,CA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EAAA,OAAO,IAAA;AACX;;;ACdO,SAAS,sBAAsB,GAAA,EAAqB;AACvD,EAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,KAAA,CAAM,sBAAsB,CAAA;AAE9C,EAAA,OAAO,KAAA,GAAQ,GAAG,KAAA,CAAM,CAAC,CAAC,CAAA,EAAA,EAAK,KAAA,CAAM,CAAC,CAAC,CAAA,CAAA,GAAK,GAAA;AAChD","file":"chunk-UJKWKD3W.js","sourcesContent":["// Serializes async operations by key: for each key, the next operation\n// only starts after the previous one finishes. Prevents races when\n// concurrent calls target the same resource.\n\nexport interface OperationChain {\n execute: (key: string, fn: () => Promise<void>) => Promise<void>\n readonly size: number\n}\n\nexport function createOperationChain(): OperationChain {\n const chains = new Map<string, Promise<void>>()\n\n async function execute(key: string, fn: () => Promise<void>): Promise<void> {\n const prev = chains.get(key) ?? Promise.resolve()\n\n const current = prev.then(fn)\n\n // Prevents an unhandled rejection from propagating through the chain\n const safe = current.catch(() => {})\n chains.set(key, safe)\n\n // Drop the entry once nothing else chained onto it after it settled\n safe.finally(() => {\n if (chains.get(key) === safe) {\n chains.delete(key)\n }\n })\n\n return current\n }\n\n return {\n execute,\n get size() {\n return chains.size\n },\n }\n}\n","import type { Phone } from '@zenky/storefront-api'\n\nexport function formatPhoneNational(phone: Phone | null | undefined): string | null {\n if (!phone) return null\n\n return phone.national || phone.number\n}\n\nexport function getPhoneTelLink(phone: Phone | null | undefined): string | null {\n if (!phone) return null\n\n return `tel:${phone.number}`\n}\n\n/**\n * Loose-spaced phone format: `+7 (999) 999-99-99` → `+7 999 999 99 99`.\n * Parens and dashes become spaces, repeated spaces collapse to one.\n */\nexport function formatPhoneSpaced(formatted: string | null | undefined): string {\n if (!formatted) return ''\n\n return formatted.replace(/[()-]/g, ' ').replace(/\\s+/g, ' ').trim()\n}\n","import type { Schedule } from '@zenky/storefront-api'\n\nexport interface DayScheduleInfo {\n dayKey: string\n name: string\n hours: string | null\n}\n\nexport interface TodayScheduleInfo {\n isOpenNow: boolean\n todayHours: string | null\n openingAt: string | null\n closingAt: string | null\n}\n\n// API day key → JS day index (0=Sun, 1=Mon, ..., 6=Sat)\nconst DAY_TO_JS_INDEX: Record<string, number> = {\n sunday: 0,\n monday: 1,\n tuesday: 2,\n wednesday: 3,\n thursday: 4,\n friday: 5,\n saturday: 6,\n} as const\n\nconst DAY_ORDER = [\n 'monday',\n 'tuesday',\n 'wednesday',\n 'thursday',\n 'friday',\n 'saturday',\n 'sunday',\n] as const\n\nconst MAX_CACHED_FORMATTERS = 32\nconst dayNameFormatters = new Map<string, Intl.DateTimeFormat>()\n\nfunction getDayFormatter(locale: string, weekday: 'long' | 'short'): Intl.DateTimeFormat {\n const key = `${locale}:${weekday}`\n let formatter = dayNameFormatters.get(key)\n\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(locale, { weekday })\n\n if (dayNameFormatters.size >= MAX_CACHED_FORMATTERS) dayNameFormatters.clear()\n\n dayNameFormatters.set(key, formatter)\n }\n\n return formatter\n}\n\n// Reference date: January 2, 2000 is a Sunday (JS index 0).\n// For dayIndex=0 (Sun) add 0, for 1 (Mon) add 1, and so on.\nfunction getDayName(dayKey: string, locale: string, weekday: 'long' | 'short'): string {\n const index = DAY_TO_JS_INDEX[dayKey]\n\n if (index === undefined) {\n return dayKey\n }\n\n const date = new Date(2000, 0, 2 + index)\n\n return getDayFormatter(locale, weekday).format(date)\n}\n\ninterface StatusLabels {\n open: string\n closed: string\n}\n\nconst DEFAULT_STATUS_LABELS: StatusLabels = { open: 'Открыто', closed: 'Закрыто' }\n\nconst STATUS_LABELS: Record<string, StatusLabels> = {\n 'ru-RU': DEFAULT_STATUS_LABELS,\n 'en-US': { open: 'Open', closed: 'Closed' },\n}\n\nexport function getTodayInfo(schedule: Schedule | null | undefined): TodayScheduleInfo | null {\n if (!schedule) return null\n\n const todayDay = schedule.days[schedule.day_id as keyof typeof schedule.days]\n\n return {\n isOpenNow: schedule.is_open_now,\n todayHours: todayDay?.hours ?? null,\n openingAt: schedule.opening_at,\n closingAt: schedule.closing_at,\n }\n}\n\nexport function getWeeklySchedule(\n schedule: Schedule | null | undefined,\n locale = 'ru-RU'\n): DayScheduleInfo[] {\n if (!schedule) return []\n\n return DAY_ORDER.map((dayKey) => ({\n dayKey,\n name: getDayName(dayKey, locale, 'long'),\n hours: schedule.days[dayKey]?.hours ?? null,\n }))\n}\n\nexport function formatScheduleStatus(\n schedule: Schedule | null | undefined,\n locale = 'ru-RU'\n): string | null {\n if (!schedule) return null\n\n const labels = STATUS_LABELS[locale] ?? DEFAULT_STATUS_LABELS\n\n return schedule.is_open_now ? labels.open : labels.closed\n}\n\nexport interface ScheduleRow {\n label: string\n hours: string | null\n}\n\nexport function groupScheduleDays(\n schedule: Schedule | null | undefined,\n locale = 'ru-RU'\n): ScheduleRow[] {\n const days = getWeeklySchedule(schedule, locale)\n const rows: ScheduleRow[] = []\n let firstDayOfRun = ''\n\n for (let index = 0; index < days.length; index++) {\n const day = days[index]!\n const previous = index > 0 ? days[index - 1]! : null\n const short = getDayName(day.dayKey, locale, 'short')\n\n if (previous && previous.hours === day.hours) {\n rows[rows.length - 1]!.label = `${firstDayOfRun} — ${short}`\n continue\n }\n\n firstDayOfRun = short\n rows.push({ label: short, hours: day.hours })\n }\n\n return rows\n}\n","/**\n * Builds a QR code image URL through the Zenky media API.\n *\n * The content is base64-encoded and passed in the `content` query param.\n * This implementation doesn't depend on `window`, `btoa`, or Node's `Buffer`,\n * so the same code works in the browser, Node SSR, and edge runtimes.\n */\nexport function buildQrCodeUrl(target: string, apiBaseUrl: string, size = 200): string {\n if (!target) return ''\n\n const utf8 = encodeBase64(new TextEncoder().encode(target))\n\n return `${apiBaseUrl}/media/qrcode?content=${utf8}&input=base64&size=${size}`\n}\n\nconst BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n\nfunction encodeBase64(bytes: Uint8Array): string {\n let output = ''\n\n for (let index = 0; index < bytes.length; index += 3) {\n const first = bytes[index] ?? 0\n const second = bytes[index + 1]\n const third = bytes[index + 2]\n const group = (first << 16) | ((second ?? 0) << 8) | (third ?? 0)\n\n output += BASE64_ALPHABET[(group >> 18) & 63]\n output += BASE64_ALPHABET[(group >> 12) & 63]\n output += second === undefined ? '=' : BASE64_ALPHABET[(group >> 6) & 63]\n output += third === undefined ? '=' : BASE64_ALPHABET[group & 63]\n }\n\n return output\n}\n","export function formatDate(date: string): string {\n return new Date(date).toLocaleDateString('ru-RU', {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n })\n}\n\nexport function formatDateTime(date: string): string {\n const d = new Date(date)\n const datePart = d.toLocaleDateString('ru-RU', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n })\n const timePart = d.toLocaleTimeString('ru-RU', {\n hour: '2-digit',\n minute: '2-digit',\n })\n return `${datePart} ${timePart}`\n}\n\n/**\n * Extracts YYYY-MM-DD from an ISO string (e.g. \"1998-06-02T03:00:00+03:00\" → \"1998-06-02\").\n * For use in `<input type=\"date\">`.\n */\nexport function toDateInputValue(value: string | null): string {\n if (!value) return ''\n return value.slice(0, 10)\n}\n\n/**\n * Today's date in the given timezone, as YYYY-MM-DD.\n * Falls back to the browser's local timezone if `timezone` is invalid or omitted.\n *\n * Use this to match \"today\" against a backend date that's relative to the\n * store's timezone, not the user's.\n */\nexport function todayInTimezone(timezone?: string | null): string {\n const now = new Date()\n\n const options: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }\n\n // Only set timeZone when it's given: under exactOptionalPropertyTypes,\n // an optional property can't be assigned undefined.\n if (timezone) {\n options.timeZone = timezone\n }\n\n try {\n return new Intl.DateTimeFormat('en-CA', options).format(now)\n } catch {\n // Invalid timezone — fall back to the local one\n return new Intl.DateTimeFormat('en-CA').format(now)\n }\n}\n","/**\n * Noun declension by count, for Russian grammar (one/few/many forms).\n *\n * @example\n * pluralize(1, 'позиция', 'позиции', 'позиций') // 'позиция'\n * pluralize(3, 'позиция', 'позиции', 'позиций') // 'позиции'\n * pluralize(5, 'позиция', 'позиции', 'позиций') // 'позиций'\n */\nexport function pluralize(count: number, one: string, few: string, many: string): string {\n const abs = Math.abs(count)\n const mod10 = abs % 10\n const mod100 = abs % 100\n\n if (mod100 >= 11 && mod100 <= 19) return many\n if (mod10 === 1) return one\n if (mod10 >= 2 && mod10 <= 4) return few\n\n return many\n}\n","import { ZenkyError } from '@zenky/storefront-api'\n\n/** The message from a ZenkyError, or a fallback. */\nexport function getApiErrorMessage(e: unknown, fallback: string): string {\n if (e instanceof ZenkyError && e.err?.message) {\n return e.err.message\n }\n\n return fallback\n}\n\n/** Field-level errors from an API response's `meta.errors` (422 validation). */\nexport function getApiFieldErrors(e: unknown): Record<string, string[]> | null {\n if (e instanceof ZenkyError && e.err?.meta?.errors) {\n return e.err.meta.errors as Record<string, string[]>\n }\n\n return null\n}\n","/**\n * Moves the city to the end of an address string.\n * \"г Улан-Удэ, ул Ленина, д 29\" → \"ул Ленина, д 29, г Улан-Удэ\"\n */\nexport function formatAddressCityLast(raw: string): string {\n const match = raw.match(/^(г\\s[^,]+),\\s*(.+)$/)\n\n return match ? `${match[2]}, ${match[1]}` : raw\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Plugin } from 'vue';
|
|
|
4
4
|
export { Major, Minor, asMajor, asMinor, formatPrice, majorToMinor, minorToMajor, minorToMajorString } from './money/index.js';
|
|
5
5
|
export { FontConfig, PrimaryShades, ThemeColorConfig, ThemeData, buildCssVariableMap, generatePrimaryShades, generateShades, useTheme } from './theme/index.js';
|
|
6
6
|
export { DayScheduleInfo, OperationChain, ScheduleRow, SocialLink, TodayScheduleInfo, buildQrCodeUrl, createDebounce, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getEmailLink, getPhoneTelLink, getSocialLinks, getTodayInfo, getWebsiteLink, getWeeklySchedule, groupScheduleDays, pluralize, toDateInputValue, todayInTimezone } from './utils/index.js';
|
|
7
|
-
export { CatalogProductMatch, CategoryWithProducts, OrderCredentials, ProductBadgeAccent, ProductBadgeLayout, ProductBadgeView, ProductBadgeVisibility, ProductListParams, ProductVariantOptionListItem, ResolvedPrice, UseProductDetailApi, UseProductListApi, canAddDirectly, filterProductBadges, findProductInCatalog, formatWeight, getProductBadgeAccent, getProductBadgeLayout, getProductWeight, getVariantWeight, resolveVariantPrice, toGrams, toProductBadgeViews, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from './products/index.js';
|
|
7
|
+
export { CatalogProductMatch, CategoryWithProducts, OrderCredentials, ProductBadgeAccent, ProductBadgeLayout, ProductBadgeView, ProductBadgeVisibility, ProductListParams, ProductVariantOptionListItem, ResolvedPrice, UseProductDetailApi, UseProductListApi, canAddDirectly, filterProductBadges, findProductInCatalog, formatWeight, getProductBadgeAccent, getProductBadgeLayout, getProductWeight, getRequiredModifiersMinCost, getVariantWeight, resolveVariantPrice, toGrams, toProductBadgeViews, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from './products/index.js';
|
|
8
8
|
export { GroupedProducts, SubcategoryGroup, collectDescendantIds, findCategoryById, findCategoryByShortId, findRootAncestor, getCategoryPath, getCity, getRemoteCatalog, getStock, groupProductsBySubcategory, useCollections } from './catalog/index.js';
|
|
9
9
|
export { C as CatalogEntity, S as StaticCatalogItem, a as StaticRemoteCatalog, c as catalogItemEntity, i as isRenderableCatalogItem } from './catalogEntity-C2UxCFng.js';
|
|
10
10
|
export { AttachedCustomerCache, BonusesReconciliation, BonusesReconciliationDeps, CASH_DENOMINATIONS_MAJOR, CachedCustomerView, CartCredentials, CartDependencies, CartErrorScope, CartInitialization, CartItemRequest, CartLineKeyParams, CartMutationComposable, CartOperations, CartQuantities, CartRecalculation, CartRecalculationDeps, CartStockWatcher, CashChangePresetsOptions, CheckoutFlowFlags, CustomerAttachComposable, DEFAULT_ROUND_STEPS_MAJOR, MainPaymentRequestParams, MutationKind, MutationOptions, ORDER_EVENTS, ORDER_WITH, OrderBonusesComposable, OrderBonusesDeps, OrderCredentialsLike, OrderDelivery, OrderDeliveryDeps, OrderPromocodeComposable, OrderPromocodeDeps, OrderSettingsComposable, OrderTotal, PaymentSelection, PaymentSelectionComposable, RestrictedAddToCart, RestrictionGate, RestrictionGateProduct, RetryOptions, StorefrontCart, buildCartLineKey, buildCashChangePresets, buildMainPaymentRequest, getCartErrorCode, getCartErrorHttpCode, getCartErrorMessage, getCashDenominationsMinor, getDefaultRoundStepsMinor, getValidationErrors, logCartError, normalizeAddress, useBonusesReconciliation, useCartAddressSync, useCartCredentials, useCartCustomerAttachment, useCartDeliveryAttachment, useCartInitialization, useCartMutation, useCartOperations, useCartQuantities, useCartRecalculation, useCartStockWatcher, useCheckoutFlow, useCustomerAttach, useOnlinePaymentRetry, useOrderBonuses, useOrderChannel, useOrderDelivery, useOrderPromocode, useOrderSettings, useOrderTotal, usePaymentSelection, useRestrictedAddToCart, useRestrictionGate, useStorefrontCart, useVisibleCartVariants, variantLineKey } from './cart/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
export { KEY_MESSAGE_FORMATTER, NOOP_ACTIVITY_REPORTER, NOOP_NOTIFIER, NOOP_RUM, createMemoryStorage, err, ok } from './chunk-VTZYJ6OZ.js';
|
|
2
|
-
export { canAddDirectly, filterProductBadges, findProductInCatalog, formatWeight, getProductBadgeAccent, getProductBadgeLayout, getProductWeight, getVariantWeight, resolveVariantPrice, toGrams, toProductBadgeViews, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from './chunk-KK645XNR.js';
|
|
3
2
|
export { normalizeSnippets } from './chunk-GLQXTMVW.js';
|
|
4
3
|
export { RESEND_TIMER_SECONDS, useAuthFlowStore, useProductsStore, useStore, useStorefrontProfile } from './chunk-PBBVWWMI.js';
|
|
5
4
|
export { buildCssVariableMap, generatePrimaryShades, generateShades, useTheme } from './chunk-BUNI6MGH.js';
|
|
6
|
-
export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors,
|
|
7
|
-
export {
|
|
5
|
+
export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getPhoneTelLink, getTodayInfo, getWeeklySchedule, groupScheduleDays, pluralize, toDateInputValue, todayInTimezone } from './chunk-UJKWKD3W.js';
|
|
6
|
+
export { getEmailLink, getSocialLinks, getWebsiteLink } from './chunk-JY3UJRMF.js';
|
|
8
7
|
import './chunk-EMGQXBU3.js';
|
|
9
8
|
import './chunk-5B2P5W3E.js';
|
|
10
|
-
export { CASH_DENOMINATIONS_MAJOR, DEFAULT_ROUND_STEPS_MAJOR, ORDER_EVENTS, ORDER_WITH, buildCartLineKey, buildCashChangePresets, buildMainPaymentRequest, getCashDenominationsMinor, getDefaultRoundStepsMinor, normalizeAddress, useBonusesReconciliation, useCartAddressSync, useCartCustomerAttachment, useCartDeliveryAttachment, useCartInitialization, useCartMutation, useCartOperations, useCartQuantities, useCartRecalculation, useCartStockWatcher, useCheckoutFlow, useCheckoutSubmit, useCustomerAttach, useOnlinePaymentRetry, useOrderBonuses, useOrderChannel, useOrderDelivery, useOrderPromocode, useOrderSettings, useOrderTotal, usePaymentSelection, useRestrictedAddToCart, useRestrictionGate, useStorefrontCart, useVisibleCartVariants, variantLineKey } from './chunk-
|
|
11
|
-
|
|
9
|
+
export { CASH_DENOMINATIONS_MAJOR, DEFAULT_ROUND_STEPS_MAJOR, ORDER_EVENTS, ORDER_WITH, buildCartLineKey, buildCashChangePresets, buildMainPaymentRequest, getCashDenominationsMinor, getDefaultRoundStepsMinor, normalizeAddress, useBonusesReconciliation, useCartAddressSync, useCartCustomerAttachment, useCartDeliveryAttachment, useCartInitialization, useCartMutation, useCartOperations, useCartQuantities, useCartRecalculation, useCartStockWatcher, useCheckoutFlow, useCheckoutSubmit, useCustomerAttach, useOnlinePaymentRetry, useOrderBonuses, useOrderChannel, useOrderDelivery, useOrderPromocode, useOrderSettings, useOrderTotal, usePaymentSelection, useRestrictedAddToCart, useRestrictionGate, useStorefrontCart, useVisibleCartVariants, variantLineKey } from './chunk-IEHN2WNU.js';
|
|
10
|
+
export { useCartCredentials } from './chunk-QFKA2R6D.js';
|
|
12
11
|
export { getCartErrorCode, getCartErrorHttpCode, getCartErrorMessage, getValidationErrors, logCartError } from './chunk-TE42OCFK.js';
|
|
13
|
-
export {
|
|
12
|
+
export { usePromotionsStore } from './chunk-544USTPB.js';
|
|
14
13
|
import './chunk-TIQ7AJLY.js';
|
|
15
14
|
export { catalogItemEntity, collectDescendantIds, findCategoryById, findCategoryByShortId, findRootAncestor, getCategoryPath, groupProductsBySubcategory, isRenderableCatalogItem, useCollections } from './chunk-EHARSEZT.js';
|
|
16
15
|
export { getCity, getRemoteCatalog, getStock } from './chunk-FS2UNPTY.js';
|
|
17
16
|
export { asMajor, asMinor, formatPrice, majorToMinor, minorToMajor, minorToMajorString } from './chunk-2Y6QTHXI.js';
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
17
|
+
export { canAddDirectly, filterProductBadges, findProductInCatalog, getProductBadgeAccent, getProductBadgeLayout, toProductBadgeViews, usePriceRecalculation, useProductDetail, useProductList, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from './chunk-CQDOEP6T.js';
|
|
18
|
+
export { formatWeight, getProductWeight, getRequiredModifiersMinCost, getVariantWeight, resolveVariantPrice, toGrams, useProductPricing } from './chunk-6HOKVW4M.js';
|
|
19
|
+
export { createDebounce } from './chunk-XUGXLJZB.js';
|
|
20
|
+
import './chunk-5QCUH3FF.js';
|
|
21
|
+
export { useCatalogStore } from './chunk-4JCJHAL3.js';
|
|
20
22
|
export { createStorefront, provideStorefront, useAuthStore, useCartStore, useOrderSettingsStore, useRuntime } from './chunk-TXR76IDL.js';
|
|
21
23
|
export { useStoreProfileStore } from './chunk-IOYYCA75.js';
|
|
22
24
|
//# sourceMappingURL=index.js.map
|
package/dist/products/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ interface ResolvedPrice {
|
|
|
34
34
|
* Priority: prices[stockId] → prices[null] → top-level price.
|
|
35
35
|
*/
|
|
36
36
|
declare function resolveVariantPrice(variant: ProductVariant, stockId?: string | null): ResolvedPrice;
|
|
37
|
+
declare function getRequiredModifiersMinCost(product: Product): number;
|
|
37
38
|
declare function useProductPricing(product: ComputedRef<Product>, stockId?: ComputedRef<string | null | undefined>): {
|
|
38
39
|
displayPrice: ComputedRef<number>;
|
|
39
40
|
originalDisplayPrice: ComputedRef<number | null>;
|
|
@@ -161,4 +162,4 @@ declare function getProductBadgeLayout(badge: ProductBadgeView): ProductBadgeLay
|
|
|
161
162
|
declare function getProductBadgeAccent(colors: ProductBadgeColors): ProductBadgeAccent;
|
|
162
163
|
declare function filterProductBadges(badges: ProductBadgeView[], visibility: ProductBadgeVisibility): ProductBadgeView[];
|
|
163
164
|
|
|
164
|
-
export { type CatalogProductMatch, type CategoryWithProducts, type OrderCredentials, type ProductBadgeAccent, type ProductBadgeLayout, type ProductBadgeView, type ProductBadgeVisibility, type ProductListParams, type ProductVariantOptionListItem, type ResolvedPrice, type UseProductDetailApi, type UseProductListApi, canAddDirectly, filterProductBadges, findProductInCatalog, formatWeight, getProductBadgeAccent, getProductBadgeLayout, getProductWeight, getVariantWeight, resolveVariantPrice, toGrams, toProductBadgeViews, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts };
|
|
165
|
+
export { type CatalogProductMatch, type CategoryWithProducts, type OrderCredentials, type ProductBadgeAccent, type ProductBadgeLayout, type ProductBadgeView, type ProductBadgeVisibility, type ProductListParams, type ProductVariantOptionListItem, type ResolvedPrice, type UseProductDetailApi, type UseProductListApi, canAddDirectly, filterProductBadges, findProductInCatalog, formatWeight, getProductBadgeAccent, getProductBadgeLayout, getProductWeight, getRequiredModifiersMinCost, getVariantWeight, resolveVariantPrice, toGrams, toProductBadgeViews, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts };
|
package/dist/products/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { canAddDirectly, filterProductBadges, findProductInCatalog,
|
|
1
|
+
export { canAddDirectly, filterProductBadges, findProductInCatalog, getProductBadgeAccent, getProductBadgeLayout, toProductBadgeViews, usePriceRecalculation, useProductDetail, useProductList, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from '../chunk-CQDOEP6T.js';
|
|
2
|
+
export { formatWeight, getProductWeight, getRequiredModifiersMinCost, getVariantWeight, resolveVariantPrice, toGrams, useProductPricing } from '../chunk-6HOKVW4M.js';
|
|
2
3
|
import '../chunk-XUGXLJZB.js';
|
|
3
4
|
import '../chunk-5QCUH3FF.js';
|
|
4
5
|
import '../chunk-4JCJHAL3.js';
|
package/dist/seo/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Media, Store, Product, NestedCategory, ProductsCollection, Article, OfferArticle, Seo, SeoMetaTag } from '@zenky/storefront-api';
|
|
1
|
+
import { Media, Store, Product, NestedCategory, ProductsCollection, Article, OfferArticle, Stock, Seo, SeoMetaTag } from '@zenky/storefront-api';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Shared SEO types used across storefront composables.
|
|
@@ -22,6 +22,8 @@ declare function resolveStoreLogoUrl(store: Store | null | undefined): string |
|
|
|
22
22
|
* Strips HTML tags from a string.
|
|
23
23
|
*/
|
|
24
24
|
declare function stripHtml(html: string): string;
|
|
25
|
+
declare function normalizeSchemaText(value: string | null | undefined): string;
|
|
26
|
+
declare function htmlToPlainText(html: string | null | undefined): string;
|
|
25
27
|
/**
|
|
26
28
|
* Prepares a string for use as og:description or meta description:
|
|
27
29
|
* strips HTML tags and truncates to maxLength (default 160).
|
|
@@ -34,13 +36,35 @@ declare function prepareOgDescription(text: string | null | undefined, maxLength
|
|
|
34
36
|
*/
|
|
35
37
|
declare function resolveSiteOrigin(storeDomain: string | null | undefined, fallbackOrigin: string): string;
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
declare
|
|
39
|
+
declare function organizationSchemaId(origin: string): string;
|
|
40
|
+
declare function webSiteSchemaId(origin: string): string;
|
|
41
|
+
declare function locationAnchorId(stockId: string): string;
|
|
42
|
+
declare function locationSchemaId(origin: string, stockId: string): string;
|
|
43
|
+
declare function productSchemaId(productUrl: string): string;
|
|
44
|
+
|
|
45
|
+
declare const BUSINESS_TYPES: readonly ["Restaurant", "CafeOrCoffeeShop", "FastFoodRestaurant", "Bakery", "BarOrPub", "GroceryStore", "ConvenienceStore", "Florist", "Pharmacy", "PetStore", "ClothingStore", "Store", "LocalBusiness"];
|
|
46
|
+
type BusinessType = (typeof BUSINESS_TYPES)[number];
|
|
47
|
+
declare function isBusinessType(value: unknown): value is BusinessType;
|
|
48
|
+
|
|
49
|
+
interface ProductSchemaOptions {
|
|
50
|
+
url?: string | null;
|
|
51
|
+
stockId?: string | null;
|
|
52
|
+
seller?: Record<string, unknown> | null;
|
|
53
|
+
}
|
|
54
|
+
interface ProductOffer {
|
|
55
|
+
'@type': 'Offer' | 'AggregateOffer';
|
|
56
|
+
price?: string;
|
|
57
|
+
lowPrice?: string;
|
|
58
|
+
highPrice?: string;
|
|
59
|
+
offerCount?: number;
|
|
60
|
+
priceCurrency: string;
|
|
61
|
+
availability: string;
|
|
62
|
+
sku?: string;
|
|
63
|
+
}
|
|
64
|
+
declare function buildProductOffer(product: Product, currency: string, stockId?: string | null): ProductOffer | null;
|
|
65
|
+
declare function buildProductSchema(product: Product, currency: string, options?: ProductSchemaOptions): Record<string, unknown>[];
|
|
66
|
+
|
|
67
|
+
declare function buildBreadcrumbListSchema(items: BreadcrumbItem[], origin: string): Record<string, unknown>[];
|
|
44
68
|
|
|
45
69
|
/** JSON-LD for a category page. */
|
|
46
70
|
declare function buildCategorySchemas(category: NestedCategory, products: Product[], breadcrumbs: BreadcrumbItem[], origin: string): Record<string, unknown>[];
|
|
@@ -58,13 +82,17 @@ declare function buildOfferArticleSchema(article: OfferArticle, storeName: strin
|
|
|
58
82
|
*/
|
|
59
83
|
declare function buildBlogPostSchema(article: Article, storeName: string, origin: string): Record<string, unknown>[];
|
|
60
84
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
interface LocationSchemaOptions {
|
|
86
|
+
businessType?: BusinessType | null;
|
|
87
|
+
locationUrl?: ((stock: Stock) => string | null | undefined) | null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface OrganizationSchemaOptions extends LocationSchemaOptions {
|
|
91
|
+
inLanguage?: string | null;
|
|
92
|
+
}
|
|
93
|
+
declare function buildOrganizationReference(store: Store, origin: string): Record<string, unknown>;
|
|
94
|
+
declare function buildOrganizationSchema(store: Store, origin: string, options?: OrganizationSchemaOptions): Record<string, unknown>[];
|
|
95
|
+
declare function buildLocationsSchema(store: Store, origin: string, options?: LocationSchemaOptions): Record<string, unknown>[];
|
|
68
96
|
|
|
69
97
|
/** Already-resolved OG/Twitter tag values (with the consumer's defaults applied). */
|
|
70
98
|
interface OgTagsInput {
|
|
@@ -82,4 +110,4 @@ declare function mapSeoMetaTags(tags: SeoMetaTag[]): Record<string, string>[];
|
|
|
82
110
|
/** Meta tags from a `Seo` entity (description + `Seo.meta` mapping). The consumer resolves the title. */
|
|
83
111
|
declare function buildEntitySeoMeta(seo: Seo | null | undefined): Record<string, string>[];
|
|
84
112
|
|
|
85
|
-
export { type BreadcrumbItem, type OgTagsInput, buildBlogPostSchema, buildCategorySchemas, buildCollectionSchemas, buildEntitySeoMeta, buildOfferArticleSchema, buildOgTags, buildOrganizationSchema, buildProductSchema, mapSeoMetaTags, prepareOgDescription, resolveMediaUrl, resolveSiteOrigin, resolveStoreLogoUrl, stripHtml };
|
|
113
|
+
export { BUSINESS_TYPES, type BreadcrumbItem, type BusinessType, type LocationSchemaOptions, type OgTagsInput, type OrganizationSchemaOptions, type ProductOffer, type ProductSchemaOptions, buildBlogPostSchema, buildBreadcrumbListSchema, buildCategorySchemas, buildCollectionSchemas, buildEntitySeoMeta, buildLocationsSchema, buildOfferArticleSchema, buildOgTags, buildOrganizationReference, buildOrganizationSchema, buildProductOffer, buildProductSchema, htmlToPlainText, isBusinessType, locationAnchorId, locationSchemaId, mapSeoMetaTags, normalizeSchemaText, organizationSchemaId, prepareOgDescription, productSchemaId, resolveMediaUrl, resolveSiteOrigin, resolveStoreLogoUrl, stripHtml, webSiteSchemaId };
|