@webx-ui/module-catalog-landings 0.1.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/LICENSE +21 -0
- package/README.md +52 -0
- package/dist/GenerateDialog.d.ts +2 -0
- package/dist/LandingEditorPage.d.ts +7 -0
- package/dist/LandingProductsField.d.ts +9 -0
- package/dist/LandingSetField.d.ts +10 -0
- package/dist/LandingSlugField.d.ts +15 -0
- package/dist/LandingSortField.d.ts +9 -0
- package/dist/LandingsPage.d.ts +7 -0
- package/dist/api.d.ts +30 -0
- package/dist/editor.d.ts +22 -0
- package/dist/i18n.d.ts +4 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1903 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +7 -0
- package/dist/module.d.ts +15 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +149 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 webx-ui
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @webx-ui/module-catalog-landings
|
|
2
|
+
|
|
3
|
+
Landing pages for the catalogue of the [WebX UI](https://github.com/webx-ui/webx-ui) admin panel:
|
|
4
|
+
a category's list — or the whole catalogue's — with a set of filters chosen in advance, under an
|
|
5
|
+
address, texts and an SEO card of its own, with recommended products.
|
|
6
|
+
|
|
7
|
+
The other half is the Composer package `webx-ui/module-catalog-landings`, which owns the landings,
|
|
8
|
+
their addresses, the rewriting of the filter's links, the storefront's parts, the counts and the
|
|
9
|
+
generation. The section appears in the panel when both halves are installed, beside
|
|
10
|
+
`@webx-ui/module-catalog`.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @webx-ui/module-catalog-landings
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createAdmin } from '@webx-ui/module-admin'
|
|
20
|
+
import { catalog } from '@webx-ui/module-catalog'
|
|
21
|
+
import { catalogLandings } from '@webx-ui/module-catalog-landings'
|
|
22
|
+
import { seo } from '@webx-ui/module-seo'
|
|
23
|
+
import '@webx-ui/module-catalog/style.css'
|
|
24
|
+
import '@webx-ui/module-catalog-landings/style.css'
|
|
25
|
+
|
|
26
|
+
createAdmin({
|
|
27
|
+
basePath: '/cms',
|
|
28
|
+
modules: [...catalog(), ...catalogLandings(), seo()],
|
|
29
|
+
}).mount()
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`catalogLandings()` is one section, «Catalog» → «Landings»:
|
|
33
|
+
|
|
34
|
+
- the list — name and address, the base, the set as chips («Brand: Apple, Dell», «Price: – 50000»),
|
|
35
|
+
the products, the state and the mark of attention — filtered by the base as a tree (the whole
|
|
36
|
+
catalogue is a choice of its own), «needs attention», published, empty and the bin;
|
|
37
|
+
- the page of one landing, new at `…/landings/new`: the base, the set builder (a facet the base
|
|
38
|
+
offers, its values in the controls of the products' filter, the live number of products and a
|
|
39
|
+
warning when another landing holds the set), the address with the slug the set suggests, the
|
|
40
|
+
texts above and under the list, the default sort, the collections of the category, the
|
|
41
|
+
recommended products found by name or SKU and put in order by dragging, the SEO card and the
|
|
42
|
+
history;
|
|
43
|
+
- «Create in bulk»: bases × the values of one facet, named by templates (`{category}-{value}`),
|
|
44
|
+
previewed as a table where the rows that would clash — the address or the set taken, no
|
|
45
|
+
products — are skipped, then made at once or by the queue with its progress.
|
|
46
|
+
|
|
47
|
+
The SEO card is `@webx-ui/module-seo`'s `wx-seo`, which a panel with landings has. The catalogue's
|
|
48
|
+
`path` moves this section with it: `catalogLandings({ path: '/shop' })`.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
base?: string;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
+
base: string;
|
|
6
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_PublicProps = {
|
|
2
|
+
modelValue?: number[] | null;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
5
|
+
"update:modelValue": (value: number[] | null) => any;
|
|
6
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
7
|
+
"onUpdate:modelValue"?: ((value: number[] | null) => any) | undefined;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LandingFilters } from './types';
|
|
2
|
+
type __VLS_PublicProps = {
|
|
3
|
+
modelValue?: LandingFilters | null;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: LandingFilters | null) => any;
|
|
7
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
8
|
+
"onUpdate:modelValue"?: ((value: LandingFilters | null) => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LocalizedValue } from '@webx-ui/core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
localized?: boolean;
|
|
4
|
+
};
|
|
5
|
+
type __VLS_PublicProps = {
|
|
6
|
+
modelValue?: LocalizedValue | string | null;
|
|
7
|
+
} & __VLS_Props;
|
|
8
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (value: string | LocalizedValue | null) => any;
|
|
10
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: string | LocalizedValue | null) => any) | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
localized: boolean;
|
|
14
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_PublicProps = {
|
|
2
|
+
modelValue?: string | null;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
5
|
+
"update:modelValue": (value: string | null) => any;
|
|
6
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
7
|
+
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
base?: string;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
5
|
+
base: string;
|
|
6
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
7
|
+
export default _default;
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AdminContext } from '@webx-ui/module-admin';
|
|
2
|
+
import { BaseFacet, GenerateParams, GeneratePreview, GenerateRun, LandingDetail, LandingFilters, LandingQuery, LandingsPage, SetCount } from './types';
|
|
3
|
+
/** Where the landings answer under the panel's API (§8.4 of the landings spec). */
|
|
4
|
+
export declare const LANDINGS_API = "catalog/landings";
|
|
5
|
+
/** The list's question as a query string; a filter left unset is not sent at all. */
|
|
6
|
+
export declare function landingSearch(query: LandingQuery): URLSearchParams;
|
|
7
|
+
export interface CatalogLandingsApi {
|
|
8
|
+
list(query?: LandingQuery): Promise<LandingsPage>;
|
|
9
|
+
get(id: number): Promise<LandingDetail>;
|
|
10
|
+
create(values: Record<string, unknown>): Promise<LandingDetail>;
|
|
11
|
+
save(id: number, values: Record<string, unknown>): Promise<LandingDetail>;
|
|
12
|
+
remove(id: number): Promise<void>;
|
|
13
|
+
restore(id: number): Promise<LandingDetail>;
|
|
14
|
+
publish(id: number, on: boolean): Promise<LandingDetail>;
|
|
15
|
+
count(categoryId: number | null, filters: LandingFilters, except?: number | null): Promise<SetCount>;
|
|
16
|
+
facets(categoryId: number | null): Promise<BaseFacet[]>;
|
|
17
|
+
preview(params: GenerateParams): Promise<GeneratePreview>;
|
|
18
|
+
generate(params: GenerateParams): Promise<GenerateRun>;
|
|
19
|
+
run(id: number): Promise<GenerateRun>;
|
|
20
|
+
}
|
|
21
|
+
export declare function createLandingsApi(admin: AdminContext): CatalogLandingsApi;
|
|
22
|
+
/** The fields of the form a save sends; what the list shows beside them is not the form's. */
|
|
23
|
+
export declare const FORM_FIELDS: readonly ["category_id", "filters", "name", "slug", "h1", "text_above", "text_below", "sort", "on_category", "position", "recommended", "seo"];
|
|
24
|
+
/** A landing's values as the form holds them. */
|
|
25
|
+
export declare function formValues(detail: LandingDetail): Record<string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* A set without the facets that say nothing — a list with no value, a range with no end — so
|
|
28
|
+
* that a half-built facet neither counts nor fails a save.
|
|
29
|
+
*/
|
|
30
|
+
export declare function cleanSet(filters: LandingFilters | null | undefined): LandingFilters;
|
package/dist/editor.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { ScreenModel } from '@webx-ui/schema';
|
|
3
|
+
import { LandingDetail } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* What the landing's form shares with the fields of its screen: the set builder reads the base
|
|
6
|
+
* from the values, the address reads the set's suggestion, the recommended products read the
|
|
7
|
+
* names the server sent with the ids.
|
|
8
|
+
*/
|
|
9
|
+
export interface LandingEditorContext {
|
|
10
|
+
/** As the server last answered; `null` for a landing not created yet. */
|
|
11
|
+
landing: Ref<LandingDetail | null>;
|
|
12
|
+
values: Ref<ScreenModel>;
|
|
13
|
+
locked: Ref<boolean>;
|
|
14
|
+
/** The slugs the set suggests, per language — written by the set builder after each count. */
|
|
15
|
+
suggested: Ref<Record<string, string>>;
|
|
16
|
+
/** Where the landings' list is: `/catalog/landings`. */
|
|
17
|
+
list: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const landingEditorKey: InjectionKey<LandingEditorContext>;
|
|
20
|
+
export declare function provideLandingEditor(context: LandingEditorContext): void;
|
|
21
|
+
/** `null` outside the landing's page — a field put on another screen keeps working on its own. */
|
|
22
|
+
export declare function useLandingEditor(): LandingEditorContext | null;
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The server's dictionary for this package: `webx-catalog-landings::`. */
|
|
2
|
+
export declare const NAMESPACE = "webx-catalog-landings";
|
|
3
|
+
/** Puts this package's English under the panel's dictionary, once per panel. */
|
|
4
|
+
export declare function useCatalogLandingsMessages(): void;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { catalogLandings, type CatalogLandingsOptions } from './module';
|
|
2
|
+
export { catalogLandingsMessages } from './messages';
|
|
3
|
+
export { cleanSet, createLandingsApi, formValues, landingSearch, FORM_FIELDS, LANDINGS_API, type CatalogLandingsApi, } from './api';
|
|
4
|
+
export { landingEditorKey, provideLandingEditor, useLandingEditor, type LandingEditorContext, } from './editor';
|
|
5
|
+
export { default as WxCatalogLandingsPage } from './LandingsPage';
|
|
6
|
+
export { default as WxCatalogLandingEditor } from './LandingEditorPage';
|
|
7
|
+
export { default as WxCatalogLandingSet } from './LandingSetField';
|
|
8
|
+
export { default as WxCatalogLandingSlug } from './LandingSlugField';
|
|
9
|
+
export { default as WxCatalogLandingSort } from './LandingSortField';
|
|
10
|
+
export { default as WxCatalogLandingProducts } from './LandingProductsField';
|
|
11
|
+
export type { BaseFacet, GenerateConflict, GenerateParams, GeneratePreview, GenerateRow, GenerateRun, LandingAttention, LandingChip, LandingDetail, LandingFilters, LandingQuery, LandingRow, LandingsPage, RecommendedItem, SetChoice, SetCount, } from './types';
|