@wocart/storefront 1.7.0 → 1.8.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 +22 -0
- package/USAGE.md +24 -5
- package/dist/client/products.d.ts +1 -1
- package/dist/client/products.js +2 -0
- package/dist/schemas.js +1 -0
- package/dist/types.d.ts +35 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,28 @@ follows [semantic versioning](https://semver.org/): breaking changes ship only
|
|
|
5
5
|
in a new major version, and an export is marked `@deprecated` for at least one
|
|
6
6
|
minor release before a major removes it.
|
|
7
7
|
|
|
8
|
+
## 1.8.0 — 2026-10-17
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Collections.** `products.list({ collection: "best-sellers" })` lists a
|
|
13
|
+
collection — a list of products the merchant curates by hand — in the
|
|
14
|
+
merchant's order; an unknown handle lists nothing. `products.list({ onSale:
|
|
15
|
+
true })` lists the products priced below their compare-at price. Both need
|
|
16
|
+
a server with collections.
|
|
17
|
+
|
|
18
|
+
### Deprecated
|
|
19
|
+
|
|
20
|
+
- `products.list({ featured: true })` and `ProductList.storeFeatured`: they
|
|
21
|
+
mean the `featured` collection; removed in 2.0.
|
|
22
|
+
- `StoreConfig.primaryColor`, `accentColor`, `bgColor`, `fontFamily` and
|
|
23
|
+
`fontUrl`. A store's colors and font are its theme's settings: a theme
|
|
24
|
+
declares them (`defineTheme({ settings })` in `@wocart/theme`) and reads
|
|
25
|
+
`themeSettings`. The fields still arrive — the values saved before, no
|
|
26
|
+
longer editable (`fontUrl` is always null) — and are removed in 2.0.
|
|
27
|
+
- `StoreConfig.announcementBar`: always null. An announcement is a theme's
|
|
28
|
+
own content, declared as a theme setting; removed in 2.0.
|
|
29
|
+
|
|
8
30
|
## 1.7.0 — 2026-10-17
|
|
9
31
|
|
|
10
32
|
### Added
|
package/USAGE.md
CHANGED
|
@@ -483,23 +483,25 @@ store.
|
|
|
483
483
|
## Store configuration
|
|
484
484
|
|
|
485
485
|
Use config.get() near the root of every page. It is the theme's starting point
|
|
486
|
-
for
|
|
486
|
+
for store identity and feature flags:
|
|
487
487
|
|
|
488
488
|
~~~ts
|
|
489
489
|
const config = await store.config.get();
|
|
490
490
|
|
|
491
491
|
const cartEnabled = config?.cartEnabled === true;
|
|
492
492
|
const currencySymbol = config?.currencySymbol ?? "دج";
|
|
493
|
-
const announcement = config?.announcementBar ?? null;
|
|
494
493
|
~~~
|
|
495
494
|
|
|
496
495
|
StoreConfig contains the current store identity and presentation fields,
|
|
497
496
|
including:
|
|
498
497
|
|
|
499
|
-
- name, domain, logoUrl
|
|
498
|
+
- name, domain, logoUrl and themeId (the colors, fontFamily and fontUrl
|
|
499
|
+
fields are deprecated: colors and fonts are theme settings, read from
|
|
500
|
+
themeSettings);
|
|
500
501
|
- lang (the primary language), locales, contentOverrides, themeSettings,
|
|
501
502
|
currency, currencySymbol, metaTitle, metaDescription, and ogImage;
|
|
502
|
-
- announcementBar and
|
|
503
|
+
- reviewsEnabled (announcementBar is deprecated and always null: an
|
|
504
|
+
announcement is a theme's own setting);
|
|
503
505
|
- cartEnabled, freeShippingThreshold, and cartShippingMode;
|
|
504
506
|
- checkoutForm policy;
|
|
505
507
|
- OTP and Turnstile settings;
|
|
@@ -630,11 +632,28 @@ decides whether a product is publicly available.
|
|
|
630
632
|
~~~ts
|
|
631
633
|
const products = await store.products.list({
|
|
632
634
|
categoryId: selectedCategoryId,
|
|
633
|
-
featured: true,
|
|
634
635
|
limit: 12,
|
|
635
636
|
});
|
|
636
637
|
~~~
|
|
637
638
|
|
|
639
|
+
**Collections** are lists of products the merchant curates by hand in the
|
|
640
|
+
dashboard (Products → Collections): every store starts with `featured`,
|
|
641
|
+
`best-sellers` and `new-arrivals`, and may add any other. A collection lists
|
|
642
|
+
in the merchant's order:
|
|
643
|
+
|
|
644
|
+
~~~ts
|
|
645
|
+
const bestSellers = await store.products.list({ collection: "best-sellers", limit: 8 });
|
|
646
|
+
const onSale = await store.products.list({ onSale: true, limit: 8 });
|
|
647
|
+
~~~
|
|
648
|
+
|
|
649
|
+
- Never hardcode which collection a section shows: declare a `collection`
|
|
650
|
+
field (`@wocart/theme`) with a default handle, so the merchant picks it.
|
|
651
|
+
- An empty or unknown collection lists nothing — show nothing, never the
|
|
652
|
+
whole catalog instead: "Best sellers" means the merchant's picks.
|
|
653
|
+
- `onSale` is computed: a product priced below its compare-at price.
|
|
654
|
+
- `featured: true` and `ProductList.storeFeatured` are deprecated: they mean
|
|
655
|
+
the `featured` collection.
|
|
656
|
+
|
|
638
657
|
Product lists return ProductList objects. ProductList and Product are
|
|
639
658
|
different shapes: a list item is not a detail object and must not be cast to
|
|
640
659
|
Product. ProductList carries list-oriented fields such as coverImage and
|
|
@@ -26,7 +26,7 @@ export interface ProductsNamespace {
|
|
|
26
26
|
get(handle: string): Promise<Product | null>;
|
|
27
27
|
/**
|
|
28
28
|
* List products with optional filters
|
|
29
|
-
* @param filters - Optional category,
|
|
29
|
+
* @param filters - Optional collection, category, on-sale flag, limit and offset
|
|
30
30
|
* @returns Array of products
|
|
31
31
|
*/
|
|
32
32
|
list(filters?: ProductListFilters): Promise<ProductList[]>;
|
package/dist/client/products.js
CHANGED
|
@@ -28,6 +28,8 @@ export function createProductsNamespace(core) {
|
|
|
28
28
|
try {
|
|
29
29
|
const products = await core.get(localizedPath(core.config, "/store/products", {
|
|
30
30
|
categoryId: filters?.categoryId || undefined,
|
|
31
|
+
collection: filters?.collection || undefined,
|
|
32
|
+
onSale: filters?.onSale ? "true" : undefined,
|
|
31
33
|
featured: filters?.featured ? "true" : undefined,
|
|
32
34
|
limit: filters?.limit === undefined ? undefined : String(filters.limit),
|
|
33
35
|
offset: filters?.offset ? String(filters.offset) : undefined,
|
package/dist/schemas.js
CHANGED
|
@@ -82,6 +82,7 @@ const productBaseFields = {
|
|
|
82
82
|
visibility: z.boolean(),
|
|
83
83
|
status: z.enum(["DRAFT", "ACTIVE", "ARCHIVED"]),
|
|
84
84
|
showInStore: z.boolean(),
|
|
85
|
+
/** @deprecated Whether the product is in the `featured` collection; list it with `collection: "featured"`. Removed in 2.0. */
|
|
85
86
|
storeFeatured: z.boolean(),
|
|
86
87
|
/**
|
|
87
88
|
* @deprecated Always null: the server never serves a removed product. The
|
package/dist/types.d.ts
CHANGED
|
@@ -64,10 +64,31 @@ export interface StoreConfig {
|
|
|
64
64
|
domain: string | null;
|
|
65
65
|
logoUrl: string | null;
|
|
66
66
|
themeId: string;
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated A store's colors and font are its theme's settings: declare
|
|
69
|
+
* them in `defineTheme({ settings })` and read `themeSettings`. This is the
|
|
70
|
+
* value saved before that, no longer editable; removed in 2.0.
|
|
71
|
+
*/
|
|
67
72
|
primaryColor: string;
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated A store's colors and font are its theme's settings: declare
|
|
75
|
+
* them in `defineTheme({ settings })` and read `themeSettings`. This is the
|
|
76
|
+
* value saved before that, no longer editable; removed in 2.0.
|
|
77
|
+
*/
|
|
68
78
|
accentColor: string;
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated A store's colors and font are its theme's settings: declare
|
|
81
|
+
* them in `defineTheme({ settings })` and read `themeSettings`. This is the
|
|
82
|
+
* value saved before that, no longer editable; removed in 2.0.
|
|
83
|
+
*/
|
|
69
84
|
bgColor: string;
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated A store's colors and font are its theme's settings: declare
|
|
87
|
+
* them in `defineTheme({ settings })` and read `themeSettings`. This is the
|
|
88
|
+
* value saved before that, no longer editable; removed in 2.0.
|
|
89
|
+
*/
|
|
70
90
|
fontFamily: string;
|
|
91
|
+
/** @deprecated Always null; removed in 2.0. */
|
|
71
92
|
fontUrl: string | null;
|
|
72
93
|
/** The store's primary language: a BCP 47 code such as `ar`. */
|
|
73
94
|
lang: string;
|
|
@@ -99,6 +120,10 @@ export interface StoreConfig {
|
|
|
99
120
|
metaTitle: string | null;
|
|
100
121
|
metaDescription: string | null;
|
|
101
122
|
ogImage: string | null;
|
|
123
|
+
/**
|
|
124
|
+
* @deprecated Always null. An announcement is a theme's own content: declare
|
|
125
|
+
* it as a theme setting and read `themeSettings`. Removed in 2.0.
|
|
126
|
+
*/
|
|
102
127
|
announcementBar: string | null;
|
|
103
128
|
reviewsEnabled: boolean;
|
|
104
129
|
/** When true the storefront renders the cart alongside the direct order form. */
|
|
@@ -494,6 +519,16 @@ export interface ReviewSubmitResult {
|
|
|
494
519
|
*/
|
|
495
520
|
export interface ProductListFilters {
|
|
496
521
|
categoryId?: string;
|
|
522
|
+
/**
|
|
523
|
+
* Only this collection's products, by handle (`best-sellers`), in the order
|
|
524
|
+
* the merchant gave them. A collection is a list the merchant curates in the
|
|
525
|
+
* dashboard; a theme names it through a `collection` theme setting. An
|
|
526
|
+
* unknown handle lists nothing.
|
|
527
|
+
*/
|
|
528
|
+
collection?: string;
|
|
529
|
+
/** Only products priced below their compare-at price. */
|
|
530
|
+
onSale?: boolean;
|
|
531
|
+
/** @deprecated Use `collection: "featured"`. */
|
|
497
532
|
featured?: boolean;
|
|
498
533
|
/** Server-side cap; the server clamps anything larger. */
|
|
499
534
|
limit?: number;
|
package/package.json
CHANGED