@rxdrag/website-lib-core 0.0.25 → 0.0.27
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdrag/website-lib-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.ts"
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"@types/react-dom": "^18.2.7",
|
|
25
25
|
"eslint": "^7.32.0",
|
|
26
26
|
"typescript": "^5",
|
|
27
|
-
"@rxdrag/
|
|
28
|
-
"@rxdrag/tsconfig": "0.2.0",
|
|
27
|
+
"@rxdrag/entify-hooks": "0.2.46",
|
|
29
28
|
"@rxdrag/slate-preview": "1.2.57",
|
|
30
|
-
"@rxdrag/
|
|
29
|
+
"@rxdrag/eslint-config-custom": "0.2.12",
|
|
30
|
+
"@rxdrag/tsconfig": "0.2.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"clsx": "^2.1.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"lodash-es": "^4.17.21",
|
|
36
36
|
"react": "^18.2.0",
|
|
37
37
|
"react-dom": "^18.2.0",
|
|
38
|
-
"@rxdrag/rxcms-models": "0.3.
|
|
38
|
+
"@rxdrag/rxcms-models": "0.3.54"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"astro": "^4.0.0 || ^5.0.0"
|
|
@@ -9,17 +9,23 @@ export type LinkType =
|
|
|
9
9
|
| "products"
|
|
10
10
|
| "posts";
|
|
11
11
|
|
|
12
|
-
export function toHref(
|
|
12
|
+
export function toHref(
|
|
13
|
+
type: LinkType | string,
|
|
14
|
+
to: string,
|
|
15
|
+
options?: { productsSlug?: string; postsSlug?: string }
|
|
16
|
+
) {
|
|
17
|
+
const { productsSlug = "products", postsSlug = "posts" } = options || {};
|
|
18
|
+
|
|
13
19
|
if (type === "link" || !type) {
|
|
14
20
|
return to;
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
if (type === "products") {
|
|
18
|
-
return
|
|
24
|
+
return `${productsSlug}/page/1`;
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
if (type === "posts") {
|
|
22
|
-
return
|
|
28
|
+
return `${postsSlug}/page/1`;
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
if (type === "page") {
|
|
@@ -27,11 +33,11 @@ export function toHref(type: LinkType | string, to: string) {
|
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
if (type === "post") {
|
|
30
|
-
return
|
|
36
|
+
return `${postsSlug}/${to}`;
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
if (type === "product") {
|
|
34
|
-
return
|
|
40
|
+
return `${productsSlug}/${to}`;
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
if (type === "user") {
|
|
@@ -39,11 +45,11 @@ export function toHref(type: LinkType | string, to: string) {
|
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
if (type === "product-category") {
|
|
42
|
-
return
|
|
48
|
+
return `${productsSlug}/categories/${to}/1`;
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
if (type === "post-category") {
|
|
46
|
-
return
|
|
52
|
+
return `${postsSlug}/categories/${to}/1`;
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
return `/${type}/${to}`;
|
package/src/entify/Entify.ts
CHANGED
|
@@ -68,8 +68,8 @@ export class Entify implements IEntify {
|
|
|
68
68
|
return (await queryLangs(this.envVariables))?.items;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
public async getFeaturedProducts(count?: number) {
|
|
72
|
-
return await queryFeaturedProducts(count, this.envVariables);
|
|
71
|
+
public async getFeaturedProducts(count?: number, imageSize?: TSize) {
|
|
72
|
+
return await queryFeaturedProducts(count, imageSize, this.envVariables);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
public async getLatestPosts(count?: number, coverSize?: TSize) {
|
package/src/entify/IEntify.ts
CHANGED
|
@@ -41,7 +41,7 @@ export interface IEntify {
|
|
|
41
41
|
|
|
42
42
|
getLangs(): Promise<Lang[] | undefined>;
|
|
43
43
|
|
|
44
|
-
getFeaturedProducts(count?: number): Promise<TProduct[] | undefined>;
|
|
44
|
+
getFeaturedProducts(count?: number, imageSize?: TSize): Promise<TProduct[] | undefined>;
|
|
45
45
|
|
|
46
46
|
getLatestPosts(count?: number, coverSize?: TSize): Promise<TPost[] | undefined>;
|
|
47
47
|
|
|
@@ -8,12 +8,13 @@ import {
|
|
|
8
8
|
} from "@rxdrag/rxcms-models";
|
|
9
9
|
import { queryEntityList } from "./queryEntityList";
|
|
10
10
|
import { newQueryProductsMediaOptions } from "./newQueryProductsMediaOptions";
|
|
11
|
-
import { EnvVariables } from "../types";
|
|
11
|
+
import { EnvVariables, TSize } from "../types";
|
|
12
12
|
import { ListResult } from "@rxdrag/entify-hooks";
|
|
13
13
|
import { TProduct } from "../view-model";
|
|
14
14
|
|
|
15
15
|
export async function queryFeaturedProducts(
|
|
16
16
|
count: number = 8,
|
|
17
|
+
imageSize: TSize|undefined,
|
|
17
18
|
envVariables: EnvVariables
|
|
18
19
|
) {
|
|
19
20
|
const result = await queryEntityList<
|
|
@@ -45,7 +46,7 @@ export async function queryFeaturedProducts(
|
|
|
45
46
|
},
|
|
46
47
|
orderBy: [{ [ProductFields.seqValue]: "asc" }],
|
|
47
48
|
}
|
|
48
|
-
).mediaPivots(newQueryProductsMediaOptions()),
|
|
49
|
+
).mediaPivots(newQueryProductsMediaOptions(imageSize)),
|
|
49
50
|
envVariables
|
|
50
51
|
);
|
|
51
52
|
return (result as ListResult<TProduct> | undefined)?.items;
|