@zenky/storefront-vue 0.9.46 → 0.10.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.
Files changed (93) hide show
  1. package/LICENSE.md +2 -2
  2. package/README.md +163 -6
  3. package/dist/cart/index.d.ts +559 -0
  4. package/dist/cart/index.js +13 -0
  5. package/dist/cart/index.js.map +1 -0
  6. package/dist/catalog/index.d.ts +73 -0
  7. package/dist/catalog/index.js +4 -0
  8. package/dist/catalog/index.js.map +1 -0
  9. package/dist/chunk-2OD7CLKD.js +102 -0
  10. package/dist/chunk-2OD7CLKD.js.map +1 -0
  11. package/dist/chunk-4MJKN7PL.js +111 -0
  12. package/dist/chunk-4MJKN7PL.js.map +1 -0
  13. package/dist/chunk-5QCUH3FF.js +15 -0
  14. package/dist/chunk-5QCUH3FF.js.map +1 -0
  15. package/dist/chunk-AL5W5JSD.js +41 -0
  16. package/dist/chunk-AL5W5JSD.js.map +1 -0
  17. package/dist/chunk-BIGTKVC6.js +38 -0
  18. package/dist/chunk-BIGTKVC6.js.map +1 -0
  19. package/dist/chunk-BWUKMWHL.js +45 -0
  20. package/dist/chunk-BWUKMWHL.js.map +1 -0
  21. package/dist/chunk-DKWDKVXQ.js +91 -0
  22. package/dist/chunk-DKWDKVXQ.js.map +1 -0
  23. package/dist/chunk-EMGQXBU3.js +3 -0
  24. package/dist/chunk-EMGQXBU3.js.map +1 -0
  25. package/dist/chunk-EYRCAUUP.js +45 -0
  26. package/dist/chunk-EYRCAUUP.js.map +1 -0
  27. package/dist/chunk-GW2QNTAD.js +327 -0
  28. package/dist/chunk-GW2QNTAD.js.map +1 -0
  29. package/dist/chunk-IGDDWGS4.js +557 -0
  30. package/dist/chunk-IGDDWGS4.js.map +1 -0
  31. package/dist/chunk-OQLU7FSR.js +1841 -0
  32. package/dist/chunk-OQLU7FSR.js.map +1 -0
  33. package/dist/chunk-PJ2LEKW6.js +229 -0
  34. package/dist/chunk-PJ2LEKW6.js.map +1 -0
  35. package/dist/chunk-PWHIDGKW.js +97 -0
  36. package/dist/chunk-PWHIDGKW.js.map +1 -0
  37. package/dist/chunk-RO25KNM5.js +36 -0
  38. package/dist/chunk-RO25KNM5.js.map +1 -0
  39. package/dist/chunk-V3VVDQIR.js +27 -0
  40. package/dist/chunk-V3VVDQIR.js.map +1 -0
  41. package/dist/chunk-VL3T36VM.js +386 -0
  42. package/dist/chunk-VL3T36VM.js.map +1 -0
  43. package/dist/chunk-XUGXLJZB.js +14 -0
  44. package/dist/chunk-XUGXLJZB.js.map +1 -0
  45. package/dist/chunk-Z3IW4ODZ.js +36 -0
  46. package/dist/chunk-Z3IW4ODZ.js.map +1 -0
  47. package/dist/index.d.ts +26 -0
  48. package/dist/index.js +21 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/layout/index.d.ts +54 -0
  51. package/dist/layout/index.js +102 -0
  52. package/dist/layout/index.js.map +1 -0
  53. package/dist/money/index.d.ts +26 -0
  54. package/dist/money/index.js +3 -0
  55. package/dist/money/index.js.map +1 -0
  56. package/dist/order/index.d.ts +34 -0
  57. package/dist/order/index.js +209 -0
  58. package/dist/order/index.js.map +1 -0
  59. package/dist/pagination/index.d.ts +87 -0
  60. package/dist/pagination/index.js +97 -0
  61. package/dist/pagination/index.js.map +1 -0
  62. package/dist/ports/index.d.ts +124 -0
  63. package/dist/ports/index.js +3 -0
  64. package/dist/ports/index.js.map +1 -0
  65. package/dist/products/index.d.ts +105 -0
  66. package/dist/products/index.js +7 -0
  67. package/dist/products/index.js.map +1 -0
  68. package/dist/promotions/index.d.ts +10 -0
  69. package/dist/promotions/index.js +7 -0
  70. package/dist/promotions/index.js.map +1 -0
  71. package/dist/schedule-Dd3zwHEb.d.ts +27 -0
  72. package/dist/seo/index.d.ts +91 -0
  73. package/dist/seo/index.js +289 -0
  74. package/dist/seo/index.js.map +1 -0
  75. package/dist/snippets/index.d.ts +17 -0
  76. package/dist/snippets/index.js +3 -0
  77. package/dist/snippets/index.js.map +1 -0
  78. package/dist/snippets-BC5bkSjm.d.ts +23 -0
  79. package/dist/stores/index.d.ts +196 -0
  80. package/dist/stores/index.js +8 -0
  81. package/dist/stores/index.js.map +1 -0
  82. package/dist/theme/index.d.ts +60 -0
  83. package/dist/theme/index.js +3 -0
  84. package/dist/theme/index.js.map +1 -0
  85. package/dist/utils/index.d.ts +66 -0
  86. package/dist/utils/index.js +4 -0
  87. package/dist/utils/index.js.map +1 -0
  88. package/dist/website-settings/index.d.ts +38 -0
  89. package/dist/website-settings/index.js +3 -0
  90. package/dist/website-settings/index.js.map +1 -0
  91. package/package.json +122 -41
  92. package/dist/esm/index.js +0 -3642
  93. package/dist/zenky.d.ts +0 -10377
@@ -0,0 +1,60 @@
1
+ import { ComputedRef } from 'vue';
2
+
3
+ interface ThemeColorConfig {
4
+ primary: string;
5
+ secondary: string;
6
+ accent: string;
7
+ background: string;
8
+ text: string;
9
+ success?: string;
10
+ danger?: string;
11
+ warning?: string;
12
+ info?: string;
13
+ /** Цвет текста поверх primary-фона. Если не задан — рассчитывается автоматически. */
14
+ onPrimary?: string;
15
+ headerBg?: string;
16
+ footerBg?: string;
17
+ footerText?: string;
18
+ footerTextMuted?: string;
19
+ }
20
+ interface PrimaryShades {
21
+ lightest: string;
22
+ lighter: string;
23
+ light: string;
24
+ base: string;
25
+ dark: string;
26
+ darker: string;
27
+ darkest: string;
28
+ tint: string;
29
+ tintHover: string;
30
+ tintPressed: string;
31
+ ink: string;
32
+ }
33
+ /** Универсальный генератор 11-ступенчатой шкалы от одного hex. */
34
+ declare function generateShades(hex: string, bg?: string, text?: string): PrimaryShades;
35
+ declare function generatePrimaryShades(hex: string, bg?: string, text?: string): PrimaryShades;
36
+ declare function buildCssVariableMap(config: ThemeColorConfig): Record<string, string>;
37
+
38
+ interface FontConfig {
39
+ family: string;
40
+ url: string;
41
+ }
42
+ interface ThemeData {
43
+ cssVariables: ComputedRef<Record<string, string>>;
44
+ fontFamily: ComputedRef<string | null>;
45
+ fontUrl: ComputedRef<string | null>;
46
+ }
47
+ /** CSS-переменные темы + шрифт из цвето-/шрифто-конфига (инъекция в head — на стороне app). */
48
+ declare function useTheme(colorConfig: ThemeColorConfig, fontConfig: FontConfig): ThemeData;
49
+
50
+ interface ThemePreset {
51
+ id: string;
52
+ label: string;
53
+ description: string;
54
+ colors: ThemeColorConfig;
55
+ }
56
+ declare const THEME_PRESETS: ThemePreset[];
57
+ /** Тёмные версии пресетов — инвертированные background/text */
58
+ declare const DARK_THEME_PRESETS: ThemePreset[];
59
+
60
+ export { DARK_THEME_PRESETS, type FontConfig, type PrimaryShades, THEME_PRESETS, type ThemeColorConfig, type ThemeData, type ThemePreset, buildCssVariableMap, generatePrimaryShades, generateShades, useTheme };
@@ -0,0 +1,3 @@
1
+ export { DARK_THEME_PRESETS, THEME_PRESETS, buildCssVariableMap, generatePrimaryShades, generateShades, useTheme } from '../chunk-GW2QNTAD.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,66 @@
1
+ import { Phone } from '@zenky/storefront-api';
2
+ export { D as DayScheduleInfo, S as SocialLink, T as TodayScheduleInfo, f as formatScheduleStatus, g as getEmailLink, a as getSocialLinks, b as getTodayInfo, c as getWebsiteLink, d as getWeeklySchedule } from '../schedule-Dd3zwHEb.js';
3
+
4
+ declare function createDebounce(fn: () => void, delay: number): () => void;
5
+
6
+ interface OperationChain {
7
+ execute: (key: string, fn: () => Promise<void>) => Promise<void>;
8
+ readonly size: number;
9
+ }
10
+ declare function createOperationChain(): OperationChain;
11
+
12
+ declare function formatPhoneNational(phone: Phone | null | undefined): string | null;
13
+ declare function getPhoneTelLink(phone: Phone | null | undefined): string | null;
14
+ /**
15
+ * «Воздушный» формат номера: `+7 (999) 999-99-99` → `+7 999 999 99 99`.
16
+ * Скобки и дефисы заменяются на пробелы, лишние пробелы схлопываются.
17
+ */
18
+ declare function formatPhoneSpaced(formatted: string | null | undefined): string;
19
+
20
+ /**
21
+ * Генерирует URL картинки QR-кода через Zenky media API.
22
+ *
23
+ * Контент кодируется в base64 и передаётся в query `content`.
24
+ * `btoa` работает только с Latin-1 — для юникода предварительно прогоняем через
25
+ * `encodeURIComponent` + `unescape`. На сервере используем Buffer.
26
+ */
27
+ declare function buildQrCodeUrl(target: string, apiBaseUrl: string, size?: number): string;
28
+
29
+ declare function formatDate(date: string): string;
30
+ declare function formatDateTime(date: string): string;
31
+ /**
32
+ * Извлекает YYYY-MM-DD из ISO-строки (например "1998-06-02T03:00:00+03:00" → "1998-06-02").
33
+ * Для использования в <input type="date">.
34
+ */
35
+ declare function toDateInputValue(value: string | null): string;
36
+ /**
37
+ * Сегодняшняя дата в указанном часовом поясе в формате YYYY-MM-DD.
38
+ * Если TZ невалидный или не передан — возвращает дату в локальном TZ браузера.
39
+ *
40
+ * Используется, когда нужно сопоставить «сегодня» с датой из бэка, которая
41
+ * приходит относительно TZ магазина (а не TZ пользователя).
42
+ */
43
+ declare function todayInTimezone(timezone?: string | null): string;
44
+
45
+ /**
46
+ * Склонение существительных по числу (русский язык).
47
+ *
48
+ * @example
49
+ * pluralize(1, 'позиция', 'позиции', 'позиций') // 'позиция'
50
+ * pluralize(3, 'позиция', 'позиции', 'позиций') // 'позиции'
51
+ * pluralize(5, 'позиция', 'позиции', 'позиций') // 'позиций'
52
+ */
53
+ declare function pluralize(count: number, one: string, few: string, many: string): string;
54
+
55
+ /** Сообщение из ZenkyError (или fallback). */
56
+ declare function getApiErrorMessage(e: unknown, fallback: string): string;
57
+ /** Field-level ошибки из `meta.errors` ответа API (422 validation). */
58
+ declare function getApiFieldErrors(e: unknown): Record<string, string[]> | null;
59
+
60
+ /**
61
+ * Переносит город в конец строки адреса.
62
+ * "г Улан-Удэ, ул Ленина, д 29" → "ул Ленина, д 29, г Улан-Удэ"
63
+ */
64
+ declare function formatAddressCityLast(raw: string): string;
65
+
66
+ export { type OperationChain, buildQrCodeUrl, createDebounce, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, getApiErrorMessage, getApiFieldErrors, getPhoneTelLink, pluralize, toDateInputValue, todayInTimezone };
@@ -0,0 +1,4 @@
1
+ export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getEmailLink, getPhoneTelLink, getSocialLinks, getTodayInfo, getWebsiteLink, getWeeklySchedule, pluralize, toDateInputValue, todayInTimezone } from '../chunk-PJ2LEKW6.js';
2
+ export { createDebounce } from '../chunk-XUGXLJZB.js';
3
+ //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,38 @@
1
+ import { Media } from '@zenky/storefront-api';
2
+ import { ZenkyIntegration } from '@zenky/integrations-sdk';
3
+ import { a as SnippetGroup } from '../snippets-BC5bkSjm.js';
4
+
5
+ type SettingValue = string | number | boolean | null;
6
+ interface WebsiteSettingsValues {
7
+ [key: string]: SettingValue | {
8
+ [key: string]: SettingValue | {
9
+ [key: string]: SettingValue;
10
+ };
11
+ };
12
+ }
13
+ type WebsitePageType = 'about_us' | 'delivery_and_payments' | 'contacts' | 'custom';
14
+ interface WebsitePageSeo {
15
+ title?: string | null;
16
+ description?: string | null;
17
+ og_image?: string | null;
18
+ }
19
+ interface WebsitePageListItem {
20
+ id: string;
21
+ type: WebsitePageType;
22
+ path: string | null;
23
+ title?: string;
24
+ }
25
+ interface WebsitePage extends WebsitePageListItem {
26
+ content: string | null;
27
+ cover: Media | null;
28
+ seo: WebsitePageSeo | null;
29
+ }
30
+ interface Website {
31
+ id: string;
32
+ settings: WebsiteSettingsValues;
33
+ pages?: WebsitePageListItem[];
34
+ snippets?: SnippetGroup[];
35
+ integrations?: ZenkyIntegration[];
36
+ }
37
+
38
+ export type { SettingValue, Website, WebsitePage, WebsitePageListItem, WebsitePageSeo, WebsitePageType, WebsiteSettingsValues };
@@ -0,0 +1,3 @@
1
+ import '../chunk-EMGQXBU3.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/package.json CHANGED
@@ -1,43 +1,124 @@
1
1
  {
2
- "name": "@zenky/storefront-vue",
3
- "version": "0.9.46",
4
- "description": "Zenky Storefront library for Vue 3.",
5
- "author": "Timur Zurbaev <hello@zurbaev.ru>",
6
- "license": "MIT",
7
- "main": "dist/esm/index.js",
8
- "files": [
9
- "dist/*"
10
- ],
11
- "scripts": {
12
- "build": "rimraf dist && rimraf build && tsc && rollup -c rollup.config.js",
13
- "lint": "eslint \"./src/**/*.ts\"",
14
- "fix": "eslint --fix \"./src/**/*.ts\""
15
- },
16
- "types": "./dist/zenky.d.ts",
17
- "keywords": [
18
- "Zenky"
19
- ],
20
- "peerDependencies": {
21
- "@zenky/api": "^0.9.52",
22
- "@zenky/events": "^1.0.3",
23
- "date-fns": "^2.29.2",
24
- "lodash-es": "^4.17.21",
25
- "pinia": "^2.0.14",
26
- "pusher-js": "^7.1.1-beta",
27
- "vue": "^3.2.36"
28
- },
29
- "devDependencies": {
30
- "@types/lodash-es": "^4.17.6",
31
- "@typescript-eslint/eslint-plugin": "^5.26.0",
32
- "@typescript-eslint/parser": "^5.26.0",
33
- "eslint": "^8.16.0",
34
- "eslint-config-airbnb": "^19.0.4",
35
- "eslint-config-airbnb-base": "^15.0.0",
36
- "eslint-config-airbnb-typescript": "^17.0.0",
37
- "eslint-plugin-import": "^2.26.0",
38
- "rimraf": "^3.0.2",
39
- "rollup": "^2.75.0",
40
- "rollup-plugin-dts": "^4.2.2",
41
- "typescript": "^4.7.2"
42
- }
2
+ "name": "@zenky/storefront-vue",
3
+ "version": "0.10.0",
4
+ "description": "Zenky Storefront SDK for Vue 3.",
5
+ "keywords": [
6
+ "zenky",
7
+ "storefront",
8
+ "headless",
9
+ "vue",
10
+ "pinia",
11
+ "ecommerce"
12
+ ],
13
+ "author": "Zenky",
14
+ "license": "MIT",
15
+ "type": "module",
16
+ "sideEffects": false,
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "LICENSE.md"
21
+ ],
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js"
26
+ },
27
+ "./ports": {
28
+ "types": "./dist/ports/index.d.ts",
29
+ "import": "./dist/ports/index.js"
30
+ },
31
+ "./money": {
32
+ "types": "./dist/money/index.d.ts",
33
+ "import": "./dist/money/index.js"
34
+ },
35
+ "./theme": {
36
+ "types": "./dist/theme/index.d.ts",
37
+ "import": "./dist/theme/index.js"
38
+ },
39
+ "./utils": {
40
+ "types": "./dist/utils/index.d.ts",
41
+ "import": "./dist/utils/index.js"
42
+ },
43
+ "./products": {
44
+ "types": "./dist/products/index.d.ts",
45
+ "import": "./dist/products/index.js"
46
+ },
47
+ "./catalog": {
48
+ "types": "./dist/catalog/index.d.ts",
49
+ "import": "./dist/catalog/index.js"
50
+ },
51
+ "./cart": {
52
+ "types": "./dist/cart/index.d.ts",
53
+ "import": "./dist/cart/index.js"
54
+ },
55
+ "./order": {
56
+ "types": "./dist/order/index.d.ts",
57
+ "import": "./dist/order/index.js"
58
+ },
59
+ "./seo": {
60
+ "types": "./dist/seo/index.d.ts",
61
+ "import": "./dist/seo/index.js"
62
+ },
63
+ "./layout": {
64
+ "types": "./dist/layout/index.d.ts",
65
+ "import": "./dist/layout/index.js"
66
+ },
67
+ "./pagination": {
68
+ "types": "./dist/pagination/index.d.ts",
69
+ "import": "./dist/pagination/index.js"
70
+ },
71
+ "./promotions": {
72
+ "types": "./dist/promotions/index.d.ts",
73
+ "import": "./dist/promotions/index.js"
74
+ },
75
+ "./snippets": {
76
+ "types": "./dist/snippets/index.d.ts",
77
+ "import": "./dist/snippets/index.js"
78
+ },
79
+ "./website-settings": {
80
+ "types": "./dist/website-settings/index.d.ts",
81
+ "import": "./dist/website-settings/index.js"
82
+ },
83
+ "./stores": {
84
+ "types": "./dist/stores/index.d.ts",
85
+ "import": "./dist/stores/index.js"
86
+ },
87
+ "./package.json": "./package.json"
88
+ },
89
+ "scripts": {
90
+ "build": "tsup",
91
+ "dev": "tsup --watch",
92
+ "typecheck": "tsc --noEmit",
93
+ "test": "vitest run",
94
+ "test:watch": "vitest",
95
+ "check:exports": "publint --strict && attw --pack . --profile esm-only",
96
+ "prepublishOnly": "npm run typecheck && npm run test && npm run build && npm run check:exports"
97
+ },
98
+ "peerDependencies": {
99
+ "@zenky/integrations-sdk": ">=0.1.3",
100
+ "@zenky/storefront-api": ">=0.0.64",
101
+ "pinia": "^3.0.0",
102
+ "vue": "^3.5.0"
103
+ },
104
+ "devDependencies": {
105
+ "@arethetypeswrong/cli": "^0.18.2",
106
+ "@types/node": "^22.10.0",
107
+ "@zenky/integrations-sdk": "^0.1.3",
108
+ "@zenky/storefront-api": "^0.0.64",
109
+ "pinia": "^3.0.4",
110
+ "publint": "^0.3.21",
111
+ "tsup": "^8.3.5",
112
+ "typescript": "^5.9.3",
113
+ "vitest": "^4.0.18",
114
+ "vue": "^3.5.28"
115
+ },
116
+ "publishConfig": {
117
+ "access": "public",
118
+ "registry": "https://registry.npmjs.org"
119
+ },
120
+ "repository": {
121
+ "type": "git",
122
+ "url": "git+https://github.com/zenky/storefront-vue.git"
123
+ }
43
124
  }