@zenky/storefront-vue 0.9.47 → 0.10.3

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 (98) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/LICENSE.md +2 -2
  3. package/README.md +213 -6
  4. package/dist/cart/index.d.ts +588 -0
  5. package/dist/cart/index.js +12 -0
  6. package/dist/cart/index.js.map +1 -0
  7. package/dist/catalog/index.d.ts +73 -0
  8. package/dist/catalog/index.js +4 -0
  9. package/dist/catalog/index.js.map +1 -0
  10. package/dist/chunk-57IOMDAM.js +38 -0
  11. package/dist/chunk-57IOMDAM.js.map +1 -0
  12. package/dist/chunk-5QCUH3FF.js +15 -0
  13. package/dist/chunk-5QCUH3FF.js.map +1 -0
  14. package/dist/chunk-7FRMMCR5.js +93 -0
  15. package/dist/chunk-7FRMMCR5.js.map +1 -0
  16. package/dist/chunk-BWUKMWHL.js +45 -0
  17. package/dist/chunk-BWUKMWHL.js.map +1 -0
  18. package/dist/chunk-E3G7NGCH.js +45 -0
  19. package/dist/chunk-E3G7NGCH.js.map +1 -0
  20. package/dist/chunk-EMGQXBU3.js +3 -0
  21. package/dist/chunk-EMGQXBU3.js.map +1 -0
  22. package/dist/chunk-FFBZKQRV.js +393 -0
  23. package/dist/chunk-FFBZKQRV.js.map +1 -0
  24. package/dist/chunk-G2X4SBCO.js +2011 -0
  25. package/dist/chunk-G2X4SBCO.js.map +1 -0
  26. package/dist/chunk-GLTOJTZO.js +41 -0
  27. package/dist/chunk-GLTOJTZO.js.map +1 -0
  28. package/dist/chunk-GW2QNTAD.js +327 -0
  29. package/dist/chunk-GW2QNTAD.js.map +1 -0
  30. package/dist/chunk-JLFBAAFT.js +566 -0
  31. package/dist/chunk-JLFBAAFT.js.map +1 -0
  32. package/dist/chunk-MZ66ARDL.js +244 -0
  33. package/dist/chunk-MZ66ARDL.js.map +1 -0
  34. package/dist/chunk-N3NOTJUC.js +111 -0
  35. package/dist/chunk-N3NOTJUC.js.map +1 -0
  36. package/dist/chunk-RO25KNM5.js +36 -0
  37. package/dist/chunk-RO25KNM5.js.map +1 -0
  38. package/dist/chunk-RYYY7MVP.js +102 -0
  39. package/dist/chunk-RYYY7MVP.js.map +1 -0
  40. package/dist/chunk-TEG7EL4N.js +106 -0
  41. package/dist/chunk-TEG7EL4N.js.map +1 -0
  42. package/dist/chunk-V3VVDQIR.js +27 -0
  43. package/dist/chunk-V3VVDQIR.js.map +1 -0
  44. package/dist/chunk-XUGXLJZB.js +14 -0
  45. package/dist/chunk-XUGXLJZB.js.map +1 -0
  46. package/dist/chunk-Z3IW4ODZ.js +36 -0
  47. package/dist/chunk-Z3IW4ODZ.js.map +1 -0
  48. package/dist/index.d.ts +26 -0
  49. package/dist/index.js +21 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/layout/index.d.ts +54 -0
  52. package/dist/layout/index.js +106 -0
  53. package/dist/layout/index.js.map +1 -0
  54. package/dist/money/index.d.ts +26 -0
  55. package/dist/money/index.js +3 -0
  56. package/dist/money/index.js.map +1 -0
  57. package/dist/order/index.d.ts +34 -0
  58. package/dist/order/index.js +209 -0
  59. package/dist/order/index.js.map +1 -0
  60. package/dist/pagination/index.d.ts +87 -0
  61. package/dist/pagination/index.js +97 -0
  62. package/dist/pagination/index.js.map +1 -0
  63. package/dist/ports/index.d.ts +124 -0
  64. package/dist/ports/index.js +3 -0
  65. package/dist/ports/index.js.map +1 -0
  66. package/dist/products/index.d.ts +105 -0
  67. package/dist/products/index.js +7 -0
  68. package/dist/products/index.js.map +1 -0
  69. package/dist/promotions/index.d.ts +10 -0
  70. package/dist/promotions/index.js +7 -0
  71. package/dist/promotions/index.js.map +1 -0
  72. package/dist/schedule-Dd3zwHEb.d.ts +27 -0
  73. package/dist/seo/index.d.ts +91 -0
  74. package/dist/seo/index.js +289 -0
  75. package/dist/seo/index.js.map +1 -0
  76. package/dist/snippets/index.d.ts +17 -0
  77. package/dist/snippets/index.js +3 -0
  78. package/dist/snippets/index.js.map +1 -0
  79. package/dist/snippets-BC5bkSjm.d.ts +23 -0
  80. package/dist/stores/index.d.ts +196 -0
  81. package/dist/stores/index.js +8 -0
  82. package/dist/stores/index.js.map +1 -0
  83. package/dist/theme/index.d.ts +60 -0
  84. package/dist/theme/index.js +3 -0
  85. package/dist/theme/index.js.map +1 -0
  86. package/dist/utils/index.d.ts +66 -0
  87. package/dist/utils/index.js +4 -0
  88. package/dist/utils/index.js.map +1 -0
  89. package/dist/website-settings/index.d.ts +38 -0
  90. package/dist/website-settings/index.js +3 -0
  91. package/dist/website-settings/index.js.map +1 -0
  92. package/docs/consumer-setup.md +275 -0
  93. package/docs/ports.md +144 -0
  94. package/docs/releasing.md +46 -0
  95. package/package.json +143 -47
  96. package/dist/cjs/index.cjs +0 -3742
  97. package/dist/esm/index.mjs +0 -3642
  98. package/dist/zenky.d.ts +0 -10377
package/docs/ports.md ADDED
@@ -0,0 +1,144 @@
1
+ # Runtime Ports
2
+
3
+ `@zenky/storefront-vue` follows Ports & Adapters. Domain composables declare the external
4
+ capabilities they need; a storefront supplies concrete adapters once at its composition
5
+ root. This keeps the package portable across Vue SPA, Nuxt SSR, embedded menus, edge
6
+ runtimes, tests, and future storefront templates.
7
+
8
+ ## Dependency direction
9
+
10
+ ```text
11
+ Vue/Nuxt storefront ── creates adapters ──▶ StorefrontRuntime
12
+ │
13
+ UI/components ── call composables ──▶ domain logic ── calls ports ──▶ Zenky SDK/services
14
+ ```
15
+
16
+ The core may know a port interface. It must not know which router, cookie library, toast
17
+ system, WebSocket provider, analytics vendor, or server framework implements that port.
18
+
19
+ ## Runtime contract
20
+
21
+ Install one runtime per Vue application:
22
+
23
+ ```ts
24
+ import { createStorefront } from '@zenky/storefront-vue'
25
+ import type { StorefrontRuntime } from '@zenky/storefront-vue/ports'
26
+
27
+ const runtime: StorefrontRuntime = {
28
+ sdk,
29
+ config: {
30
+ baseUrl: 'https://shop.example.com',
31
+ baseAuthUrl: 'https://auth.example.com',
32
+ salesChannelId: 'web',
33
+ },
34
+ storage,
35
+ notifier,
36
+ activity,
37
+ }
38
+
39
+ app.use(pinia)
40
+ app.use(createStorefront(runtime))
41
+ ```
42
+
43
+ For a locally isolated widget, `provideStorefront(runtime)` can be called inside its setup
44
+ scope instead of installing the plugin globally.
45
+
46
+ ## Required ports
47
+
48
+ | Port | Contract | Responsibility |
49
+ | --- | --- | --- |
50
+ | `sdk` | `ZenkyStorefront` | Typed access to Zenky Storefront API resources. The consumer owns configuration and request transport. |
51
+ | `config` | `StorefrontConfig` | Public storefront and auth base URLs plus an optional sales channel id. |
52
+ | `storage` | `StorageAdapter` | Synchronous key/value persistence used for order/auth state and lightweight preferences. |
53
+ | `notifier` | `Notifier` | User-facing `error`, `success`, `warning`, and generic message notifications. |
54
+ | `activity` | `ActivityReporter` | Balanced `begin(kind)` / `end(kind)` signals for long-running operations. |
55
+
56
+ Required ports are intentionally small. If an application has no UI for notifications or
57
+ activity, use `NOOP_NOTIFIER` and `NOOP_ACTIVITY_REPORTER` explicitly.
58
+
59
+ ## Optional ports
60
+
61
+ | Port | Contract | Behavior when absent |
62
+ | --- | --- | --- |
63
+ | `events` | Lazy `EventsPort.get()` returning `ZenkyIntegrationsSDK` | Integration events are skipped. |
64
+ | `realtime` | Lazy `RealtimePort.get()` returning `RealtimeAdapter` | Realtime order updates are skipped. |
65
+ | `catalogReloader` | `CatalogReloader.reload()` | Stock changes do not trigger an external catalog reload. |
66
+ | `rum` | `RumReporter.mark()` / `measure()` | Performance instrumentation is skipped. |
67
+ | `commerceEvents` | Commerce tracking plus anonymous/session identity | Commerce events and checkout identity enrichment are skipped. |
68
+
69
+ `events` and `realtime` are providers rather than captured values because integrations can
70
+ be initialized after the storefront runtime. The core resolves them at the moment an event
71
+ is emitted or a subscription is needed.
72
+
73
+ ## Storage adapter
74
+
75
+ The adapter is synchronous because cart credentials are needed while composables are being
76
+ created. Browser applications can wrap cookies or `localStorage`; SSR applications should
77
+ wrap request/response cookies. `createMemoryStorage()` is intended for tests and isolated,
78
+ request-scoped SSR work only.
79
+
80
+ ```ts
81
+ import type { StorageAdapter } from '@zenky/storefront-vue/ports'
82
+
83
+ export function createCookieStorage(cookies: CookieStore): StorageAdapter {
84
+ return {
85
+ get: (key) => cookies.get(key) ?? null,
86
+ set: (key, value, options) => {
87
+ cookies.set(key, value, {
88
+ path: options?.path ?? '/',
89
+ maxAge: options?.maxAge,
90
+ sameSite: options?.sameSite ?? 'lax',
91
+ secure: options?.secure ?? true,
92
+ })
93
+ },
94
+ remove: (key, options) => cookies.remove(key, { path: options?.path ?? '/' }),
95
+ }
96
+ }
97
+ ```
98
+
99
+ Do not use one in-memory adapter across users. Do not log storage values. Where the host
100
+ framework permits it, prefer secure, same-site cookies and narrowly scoped paths. Whether a
101
+ cookie can be `httpOnly` depends on where the browser-side SDK needs access to the value.
102
+
103
+ ## SSR and multi-app isolation
104
+
105
+ For every SSR request, create all three together:
106
+
107
+ 1. a new Pinia instance;
108
+ 2. a new `StorefrontRuntime` with request-scoped adapters;
109
+ 3. a new Vue application using those instances.
110
+
111
+ Runtime-owned mutation versions, request deduplication, and related-product state are held
112
+ per runtime. Reusing a runtime or Pinia across requests defeats that isolation and can leak
113
+ state between users.
114
+
115
+ Public entries are verified by CI through an import in a Node environment without browser
116
+ globals. Built output is also rejected if it contains CommonJS, Node built-in imports,
117
+ `Buffer`, or `process` references. Browser-only actions such as online-payment retry either
118
+ guard `window` access or accept the required URL from the consumer.
119
+
120
+ ## Security boundary
121
+
122
+ Ports can carry sensitive data even when their types look generic. Adapter implementations
123
+ must not log complete requests, orders, storage records, analytics payloads, or errors from
124
+ unknown SDK transports. The cart/checkout logger redacts common credential shapes as a
125
+ second line of defense, but callers should still pass allow-listed context such as
126
+ `orderId`, operation kind, counts, and booleans.
127
+
128
+ Never put these values in diagnostic context:
129
+
130
+ - order or API tokens;
131
+ - `Authorization` and `Cookie` headers;
132
+ - reCAPTCHA payloads and confirmation codes;
133
+ - payment/card token identifiers;
134
+ - customer names, phones, addresses, or free-form order comments.
135
+
136
+ ## Adding or changing a port
137
+
138
+ Before adding a port, verify that the capability cannot be represented by an existing one.
139
+ Keep the interface vendor-neutral and minimal, document absence/failure behavior, provide a
140
+ no-op implementation when that behavior is meaningful, and add an isolation test.
141
+
142
+ Adding an optional method is usually backward-compatible. Adding a required port or method,
143
+ changing semantics, or widening when sensitive data is emitted is a breaking change and
144
+ requires a major-version release note.
@@ -0,0 +1,46 @@
1
+ # Release Process
2
+
3
+ Releases are driven by GitHub Releases. Source control keeps
4
+ `"version": "0.0.0-development"`; the publish workflow derives the immutable npm version
5
+ from the release tag.
6
+
7
+ ## Before creating a release
8
+
9
+ 1. Confirm all required CI checks pass on `master`.
10
+ 2. Review Dependabot and security alerts.
11
+ 3. Move relevant `Unreleased` changelog entries into a new `X.Y.Z - YYYY-MM-DD` section.
12
+ 4. Choose the version using Semantic Versioning:
13
+ - patch for compatible fixes and security hardening;
14
+ - minor for backward-compatible public features;
15
+ - major for breaking exports, port contracts, behavior, or support changes.
16
+ 5. Verify migrations and compatibility notes are explicit for any consumer-visible change.
17
+ 6. Run `npm run check:release` and inspect `npm pack --dry-run` locally.
18
+
19
+ ## Publish
20
+
21
+ 1. Create a GitHub Release for the exact commit to publish.
22
+ 2. Tag it `vX.Y.Z`; prereleases may use `vX.Y.Z-beta.N` or `vX.Y.Z-rc.N`.
23
+ 3. Generate release notes, then edit them into a consumer-focused summary: outcome first,
24
+ migrations second, implementation detail last.
25
+ 4. Publish the GitHub Release.
26
+
27
+ The workflow validates the tag, installs with `npm ci`, injects the tag version without
28
+ creating a Git commit, runs the release quality gate, checks package contents, and publishes
29
+ through npm trusted publishing. Stable versions receive the `latest` dist-tag; prereleases
30
+ receive `next`.
31
+
32
+ The npm package must have a trusted publisher configured for this GitHub repository and the
33
+ `publish-npm.yml` workflow. No long-lived `NPM_TOKEN` should be added.
34
+
35
+ ## Verify
36
+
37
+ - Confirm the workflow completed and the package has npm provenance.
38
+ - Inspect `npm view @zenky/storefront-vue@X.Y.Z` metadata and dist-tags.
39
+ - Install the exact version into a clean consumer and import both the root and one subpath.
40
+ - Confirm the GitHub release links to the correct tag and changelog section.
41
+
42
+ ## Recovery
43
+
44
+ Never reuse or move a published version tag. npm versions are immutable. If a release is
45
+ bad, deprecate it with a clear message, fix forward, and publish a new patch or prerelease.
46
+ Reserve unpublishing for exceptional security/legal cases and follow npm policy.
package/package.json CHANGED
@@ -1,50 +1,146 @@
1
1
  {
2
- "name": "@zenky/storefront-vue",
3
- "version": "0.9.47",
4
- "description": "Zenky Storefront library for Vue 3.",
5
- "author": "Timur Zurbaev <hello@zurbaev.ru>",
6
- "license": "MIT",
7
- "exports": {
8
- ".": {
9
- "require": "./dist/cjs/index.cjs",
10
- "import": "./dist/esm/index.mjs"
2
+ "name": "@zenky/storefront-vue",
3
+ "version": "0.10.3",
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
+ "homepage": "https://github.com/zenky/storefront-vue#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/zenky/storefront-vue/issues"
18
+ },
19
+ "engines": {
20
+ "node": ">=20.19.0",
21
+ "npm": ">=10"
22
+ },
23
+ "type": "module",
24
+ "sideEffects": false,
25
+ "files": [
26
+ "dist",
27
+ "docs",
28
+ "README.md",
29
+ "CHANGELOG.md",
30
+ "LICENSE.md"
31
+ ],
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "import": "./dist/index.js"
36
+ },
37
+ "./ports": {
38
+ "types": "./dist/ports/index.d.ts",
39
+ "import": "./dist/ports/index.js"
40
+ },
41
+ "./money": {
42
+ "types": "./dist/money/index.d.ts",
43
+ "import": "./dist/money/index.js"
44
+ },
45
+ "./theme": {
46
+ "types": "./dist/theme/index.d.ts",
47
+ "import": "./dist/theme/index.js"
48
+ },
49
+ "./utils": {
50
+ "types": "./dist/utils/index.d.ts",
51
+ "import": "./dist/utils/index.js"
52
+ },
53
+ "./products": {
54
+ "types": "./dist/products/index.d.ts",
55
+ "import": "./dist/products/index.js"
56
+ },
57
+ "./catalog": {
58
+ "types": "./dist/catalog/index.d.ts",
59
+ "import": "./dist/catalog/index.js"
60
+ },
61
+ "./cart": {
62
+ "types": "./dist/cart/index.d.ts",
63
+ "import": "./dist/cart/index.js"
64
+ },
65
+ "./order": {
66
+ "types": "./dist/order/index.d.ts",
67
+ "import": "./dist/order/index.js"
68
+ },
69
+ "./seo": {
70
+ "types": "./dist/seo/index.d.ts",
71
+ "import": "./dist/seo/index.js"
72
+ },
73
+ "./layout": {
74
+ "types": "./dist/layout/index.d.ts",
75
+ "import": "./dist/layout/index.js"
76
+ },
77
+ "./pagination": {
78
+ "types": "./dist/pagination/index.d.ts",
79
+ "import": "./dist/pagination/index.js"
80
+ },
81
+ "./promotions": {
82
+ "types": "./dist/promotions/index.d.ts",
83
+ "import": "./dist/promotions/index.js"
84
+ },
85
+ "./snippets": {
86
+ "types": "./dist/snippets/index.d.ts",
87
+ "import": "./dist/snippets/index.js"
88
+ },
89
+ "./website-settings": {
90
+ "types": "./dist/website-settings/index.d.ts",
91
+ "import": "./dist/website-settings/index.js"
92
+ },
93
+ "./stores": {
94
+ "types": "./dist/stores/index.d.ts",
95
+ "import": "./dist/stores/index.js"
96
+ },
97
+ "./package.json": "./package.json"
98
+ },
99
+ "scripts": {
100
+ "build": "tsup",
101
+ "dev": "tsup --watch",
102
+ "format": "biome format --write .",
103
+ "format:check": "biome format .",
104
+ "lint": "biome lint .",
105
+ "lint:fix": "biome lint --write .",
106
+ "typecheck": "tsc --noEmit",
107
+ "test": "vitest run",
108
+ "test:coverage": "vitest run --coverage",
109
+ "test:watch": "vitest",
110
+ "check:exports": "publint --strict && attw --pack . --profile esm-only",
111
+ "check:runtime": "node scripts/check-runtime-compat.mjs",
112
+ "check:size": "node scripts/check-bundle-size.mjs",
113
+ "check": "npm run format:check && npm run lint && npm run typecheck && npm run test && npm run build && npm run check:exports && npm run check:runtime && npm run check:size",
114
+ "check:ci": "npm run format:check && npm run lint && npm run typecheck && npm run test:coverage && npm run build && npm run check:exports && npm run check:runtime && npm run check:size",
115
+ "check:release": "npm run typecheck && npm run test && npm run build && npm run check:exports && npm run check:runtime && npm run check:size",
116
+ "prepublishOnly": "npm run check:release"
117
+ },
118
+ "peerDependencies": {
119
+ "@zenky/integrations-sdk": ">=0.1.3",
120
+ "@zenky/storefront-api": ">=0.0.68",
121
+ "pinia": "^3.0.0",
122
+ "vue": "^3.5.0"
123
+ },
124
+ "devDependencies": {
125
+ "@arethetypeswrong/cli": "^0.18.2",
126
+ "@biomejs/biome": "^2.5.5",
127
+ "@types/node": "^22.10.0",
128
+ "@vitest/coverage-v8": "^4.1.10",
129
+ "@zenky/integrations-sdk": "^0.1.3",
130
+ "@zenky/storefront-api": "^0.0.68",
131
+ "pinia": "^3.0.4",
132
+ "publint": "^0.3.21",
133
+ "tsup": "^8.3.5",
134
+ "typescript": "^5.9.3",
135
+ "vitest": "^4.0.18",
136
+ "vue": "^3.5.28"
137
+ },
138
+ "publishConfig": {
139
+ "access": "public",
140
+ "registry": "https://registry.npmjs.org"
141
+ },
142
+ "repository": {
143
+ "type": "git",
144
+ "url": "git+https://github.com/zenky/storefront-vue.git"
11
145
  }
12
- },
13
- "main": "./dist/cjs/index.cjs",
14
- "module": "./dist/esm/index.mjs",
15
- "types": "./dist/zenky.d.ts",
16
- "files": [
17
- "dist/*"
18
- ],
19
- "scripts": {
20
- "build": "rimraf dist && rimraf build && tsc && rollup -c rollup.config.js",
21
- "lint": "eslint \"./src/**/*.ts\"",
22
- "fix": "eslint --fix \"./src/**/*.ts\""
23
- },
24
- "keywords": [
25
- "Zenky"
26
- ],
27
- "peerDependencies": {
28
- "@zenky/api": "^0.9.55",
29
- "@zenky/events": "^1.0.3",
30
- "date-fns": "^2.29.2",
31
- "lodash-es": "^4.17.21",
32
- "pinia": "^2.0.14",
33
- "pusher-js": "^7.1.1-beta",
34
- "vue": "^3.2.36"
35
- },
36
- "devDependencies": {
37
- "@types/lodash-es": "^4.17.6",
38
- "@typescript-eslint/eslint-plugin": "^5.26.0",
39
- "@typescript-eslint/parser": "^5.26.0",
40
- "eslint": "^8.16.0",
41
- "eslint-config-airbnb": "^19.0.4",
42
- "eslint-config-airbnb-base": "^15.0.0",
43
- "eslint-config-airbnb-typescript": "^17.0.0",
44
- "eslint-plugin-import": "^2.26.0",
45
- "rimraf": "^3.0.2",
46
- "rollup": "^2.75.0",
47
- "rollup-plugin-dts": "^4.2.2",
48
- "typescript": "^4.7.2"
49
- }
50
146
  }