@doswiftly/storefront-sdk 4.7.1 → 4.7.2
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 +149 -0
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 4.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7846bdb: Fix `doswiftly dev` port pre-flight on Windows (and any host where another
|
|
8
|
+
process binds the port on IPv6 `::` only): the probe now checks IPv4 and
|
|
9
|
+
IPv6 in parallel and requires BOTH free before marking a port as available.
|
|
10
|
+
Previously an IPv6-only conflict (common on Windows, where Next.js binds
|
|
11
|
+
`::` by default) slipped past the IPv4-only probe — the banner advertised
|
|
12
|
+
`http://localhost:3000` and the framework immediately crashed with
|
|
13
|
+
`EADDRINUSE :::3000`. With this fix `doswiftly dev` falls back to the next
|
|
14
|
+
free port (3001, 3002, …) as documented.
|
|
15
|
+
|
|
16
|
+
Also ship `CHANGELOG.md` inside the npm tarball. Previous releases packed
|
|
17
|
+
only `dist`/`bin`/`templates` (and `schema.graphql`/operations for
|
|
18
|
+
`storefront-operations`, `dist` for `storefront-sdk`), so consumers who
|
|
19
|
+
`npm install @doswiftly/cli` got a version number with no user-visible
|
|
20
|
+
release notes.
|
|
21
|
+
|
|
22
|
+
Wszystkie istotne zmiany w `@doswiftly/storefront-sdk` sa dokumentowane w tym pliku.
|
|
23
|
+
Format oparty na [Keep a Changelog](https://keepachangelog.com/pl/1.1.0/).
|
|
24
|
+
Wersjonowanie zgodne z [Semantic Versioning](https://semver.org/).
|
|
25
|
+
|
|
26
|
+
## [4.7.1] - 2026-04-17
|
|
27
|
+
|
|
28
|
+
### Security
|
|
29
|
+
|
|
30
|
+
- Bump `next` devDependency range to `^16.2.3` (GHSA-q4gf-8mx6-v5v3 — Next.js DoS via Server Components). Brak zmian API SDK.
|
|
31
|
+
|
|
32
|
+
## [4.7.0] - 2026-04-14
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- **`CartAttributeSelectionInput`** — nowy typ mirrorujący GraphQL `AttributeSelectionInput` dla konfiguratorów produktu (Faza 1 Unified Product Configurator).
|
|
37
|
+
- **`CartLineInput.attributeSelections`** — opcjonalne customer-filled atrybuty (Finiszer, nr telefonu serwisu itp.). Backend waliduje i snapshotuje pole `surcharge_amount` / `tax_rate`.
|
|
38
|
+
- **`CartLineUpdateInput.attributeSelections`** — update selekcji po stronie koszyka (`null` = preserve, `[]` = clear, tablica = replace).
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- Mutacje `cartLinesAdd` / `cartLinesUpdate` przekazują teraz `attributeSelections` przez GraphQL variables (bez zmian w treści mutacji — typ po stronie schematu backendu).
|
|
43
|
+
|
|
44
|
+
## [4.6.0] - 2026-04-11
|
|
45
|
+
|
|
46
|
+
### Breaking Changes
|
|
47
|
+
|
|
48
|
+
- **Image fragment**: `url` field now includes `transform: { maxWidth: 300 }` argument — cart images return CDN-resized thumbnails instead of full-size originals
|
|
49
|
+
- **ImageData interface**: added `thumbhash?: string | null` field
|
|
50
|
+
- **CartLineMerchandise.image**: added `thumbhash` field to image shape
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- **Image transforms in cart operations**: CDN serves correctly-sized thumbnails (300px) instead of full originals. Reduces bandwidth ~10x for cart page.
|
|
55
|
+
- **ThumbHash support**: `Image` fragment now requests `thumbhash` field — base64-encoded perceptual placeholder (~40 chars). Decode with `thumbHashToDataURL()` for instant blur previews.
|
|
56
|
+
- **`thumbHashToDataURL(base64Hash)`**: New export from core — decodes ThumbHash to `data:image/bmp;base64,...` URL for Next.js `blurDataURL` prop. Pure math, zero deps, framework-agnostic.
|
|
57
|
+
- **AVIF auto-negotiation**: No `preferredContentType` hardcoded — imgproxy auto-serves AVIF/WEBP based on browser `Accept` header.
|
|
58
|
+
|
|
59
|
+
## [4.5.0] - 2026-04-11
|
|
60
|
+
|
|
61
|
+
### Breaking Changes
|
|
62
|
+
|
|
63
|
+
- **CartClient types**: `CartCost` and `CartLineCost` price fields changed from `Money` to `PriceMoney` (adds `baseAmount`, `baseCurrencyCode`, `exchangeRate`, `marginApplied`, `rateTimestamp`, `isConverted`)
|
|
64
|
+
- **Cart.lines**: changed from `{ edges: Array<{ node: CartLine }> }` to `CartLine[]` (flat array — matches backend schema)
|
|
65
|
+
- **CartDiscountAllocation**: field `discountedAmount` renamed to `amount`, added `discountCode` field
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- CartClient GraphQL operations now match SSOT (backend `storefront-graphql/operations/`)
|
|
70
|
+
- Cart fragment no longer uses `edges`/`nodes` connection pattern for `lines` — backend returns flat array
|
|
71
|
+
- `CartDiscountAllocation` uses correct field name `amount` (was `discountedAmount`) and includes `discountCode`
|
|
72
|
+
- `CartCost` and `CartLineCost` use `PriceMoney` fragment (was `Money`) — enables currency conversion transparency
|
|
73
|
+
- `CartLineCost` includes `subtotalAmount` field (was missing)
|
|
74
|
+
- `CartLine` includes `productType` field (was missing)
|
|
75
|
+
- `CartLineMerchandise` now uses full `ProductVariant` fragment (was inline subset) — includes `originalPrice`, `originalCompareAtPrice`, `available`, `quantityAvailable`, `selectedOptions`, `barcode`, `weight`, `position`
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
|
|
79
|
+
- `PriceMoney` interface in cart types — full currency conversion metadata
|
|
80
|
+
- `SelectedOption` interface in cart types
|
|
81
|
+
- `scripts/validate-cart-operations.cjs` — validates SDK cart fragments match SSOT
|
|
82
|
+
- `pnpm validate:cart` script — runs validation in strict mode
|
|
83
|
+
- Contract test `cart-operations-drift.test.ts` — 40 tests verifying fragment fields, spreads, and structural invariants
|
|
84
|
+
|
|
85
|
+
## [4.4.0] - 2026-03-29
|
|
86
|
+
|
|
87
|
+
### Removed
|
|
88
|
+
|
|
89
|
+
- **Image loader usuniety**: `storefrontImageLoader`, `createImageLoader`, `ImageLoaderParams`, `ImageFormat`, `PRESET_WIDTHS` — GraphQL API zwraca gotowe CDN URL-e z `url(transform: { maxWidth: 800 })`. Client-side loader zbedny.
|
|
90
|
+
- Zachowany: `ImageData` type (uzywany przez template do typowania danych z GraphQL)
|
|
91
|
+
|
|
92
|
+
## [4.3.0] - 2026-03-29
|
|
93
|
+
|
|
94
|
+
### Changed
|
|
95
|
+
|
|
96
|
+
- **Image loader**: imgproxy path-based URLs zamiast query params
|
|
97
|
+
- `createImageLoader()` przyjmuje konfigurowalny `format` (webp/avif/jpeg/auto)
|
|
98
|
+
- `storefrontImageLoader` uzywa nowego path-based schematu
|
|
99
|
+
|
|
100
|
+
## [4.2.0] - 2026-03-28
|
|
101
|
+
|
|
102
|
+
### Added
|
|
103
|
+
|
|
104
|
+
- `storefrontImageLoader` jako globalny image loader dla Next.js (`next.config.ts loaderFile`)
|
|
105
|
+
- Kwantyzacja szerokosc do presetow [150, 320, 640, 750, 828, 1080, 1200, 1600, 1920, 2048]
|
|
106
|
+
|
|
107
|
+
## [4.1.0] - 2026-03-27
|
|
108
|
+
|
|
109
|
+
### Added
|
|
110
|
+
|
|
111
|
+
- `createImageLoader()` — factory do custom image loaderow z konfiguracja baseUrl/format
|
|
112
|
+
- Usunieto HMAC signing (Shopify pattern — imgproxy nie wymaga podpisu w path-based mode)
|
|
113
|
+
|
|
114
|
+
## [4.0.0] - 2026-03-20
|
|
115
|
+
|
|
116
|
+
### Breaking Changes
|
|
117
|
+
|
|
118
|
+
- **Layered architecture**: split na `core/` (framework-agnostic) + `react/` (adapter)
|
|
119
|
+
- Nowe export paths: `.`, `./react`, `./react/server`, `./cache`
|
|
120
|
+
- ESM-only (usuniete CJS)
|
|
121
|
+
- Usuniety re-export `@tanstack/react-query` — hooki React Query generowane lokalnie w template
|
|
122
|
+
- Store pattern zmieniony na Context-based (zustand/vanilla + React Context)
|
|
123
|
+
- Usuniety module-level singleton pattern
|
|
124
|
+
|
|
125
|
+
### Added
|
|
126
|
+
|
|
127
|
+
- `createStorefrontClient()` — transport factory z composable middleware pipeline
|
|
128
|
+
- Middleware: `authMiddleware`, `currencyMiddleware`, `languageMiddleware`, `botProtectionMiddleware`, `retryMiddleware`, `timeoutMiddleware`, `errorMiddleware`
|
|
129
|
+
- `CartClient`, `AuthClient` — plain async clients (0 deps, framework-agnostic)
|
|
130
|
+
- `StorefrontError` — zunifikowana klasa bledow z ErrorCodes
|
|
131
|
+
- `StorefrontProvider` — root kompozycji (tworzy store instances via useRef)
|
|
132
|
+
- `createStoreContext()` — generyczny helper Context+Zustand
|
|
133
|
+
- `createCartStore()` z DI pattern (`getActions` getter)
|
|
134
|
+
- `useAuth()`, `useCartManager()`, `useCurrency()`, `useStorefrontClient()`
|
|
135
|
+
- `useHydrated()`, `useAuthHydrated()`, `useDebouncedValue()`
|
|
136
|
+
- `createSetTokenHandler()`, `createClearTokenHandler()` — Web API fabryki
|
|
137
|
+
- `createAuthTokenClient()` — client-side fetch helpers
|
|
138
|
+
- `matchesRoute()` — route protection utility
|
|
139
|
+
- `formatPrice`, `formatPriceRange`, `formatAmount`, `formatDate`, `formatDateTime`, `formatNumber`, `formatPercentage`, `getCurrencySymbol`
|
|
140
|
+
- `sanitizeHtml`, `normalizeConnection`, `assertNoUserErrors`
|
|
141
|
+
- Cache strategies: `cacheNone`, `cacheShort`, `cacheLong`, `cachePrivate`, `cacheCustom`
|
|
142
|
+
- Bot protection: `createBotProtectionManager`, `FallbackBotProtectionManager`, `TurnstileManager`, `EuCaptchaManager`
|
|
143
|
+
- Cookie configs: `AUTH_COOKIE_NAME`, `CURRENCY_COOKIE_NAME`, `LANGUAGE_COOKIE_NAME`, `CART_COOKIE_NAME`
|
|
144
|
+
- `getStorefrontClient()` — server-side factory (react/server)
|
|
145
|
+
|
|
146
|
+
### Removed
|
|
147
|
+
|
|
148
|
+
- Runtime deps: `graphql-request`, `graphql`, `graphql-tag`, `@graphql-typed-document-node/core`, `@tanstack/react-query`
|
|
149
|
+
- Module-level store singletons (zastapione Context pattern)
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doswiftly/storefront-sdk",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.2",
|
|
4
4
|
"description": "Storefront runtime SDK for DoSwiftly Commerce — layered transport, middleware pipeline, React providers, Zustand stores, cache strategies. 0 runtime dependencies in core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
|
-
"README.md"
|
|
8
|
+
"README.md",
|
|
9
|
+
"CHANGELOG.md"
|
|
9
10
|
],
|
|
10
11
|
"types": "dist/core/index.d.ts",
|
|
11
12
|
"exports": {
|