@rxdrag/website-lib-core 0.0.127 → 0.0.129

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 (138) hide show
  1. package/README.md +1 -1
  2. package/index.ts +1 -1
  3. package/package.json +4 -4
  4. package/src/astro/animation.ts +146 -146
  5. package/src/astro/background.ts +82 -86
  6. package/src/astro/base.ts +7 -0
  7. package/src/astro/business.ts +13 -0
  8. package/src/astro/grid/consts.ts +80 -80
  9. package/src/astro/grid/index.ts +2 -2
  10. package/src/astro/grid/types.ts +35 -35
  11. package/src/astro/image.ts +239 -239
  12. package/src/astro/index.ts +12 -10
  13. package/src/astro/link.ts +20 -21
  14. package/src/astro/media.ts +123 -123
  15. package/src/astro/nav.ts +13 -13
  16. package/src/astro/section/index.ts +7 -12
  17. package/src/component-logic/index.ts +1 -1
  18. package/src/component-logic/link-client.ts +32 -32
  19. package/src/component-logic/link.ts +61 -61
  20. package/src/design-tokens.ts +160 -160
  21. package/src/entify/Entify.ts +111 -101
  22. package/src/entify/IEntify.ts +157 -177
  23. package/src/entify/index.ts +4 -4
  24. package/src/entify/lib/collectCategoryIds.ts +20 -20
  25. package/src/entify/lib/fulltextSearch.ts +63 -62
  26. package/src/entify/lib/langFields.ts +14 -14
  27. package/src/entify/lib/listToTree.ts +23 -23
  28. package/src/entify/lib/newAvatarQueryOptions.ts +4 -4
  29. package/src/entify/lib/newOgImageQueryOptions.ts +5 -5
  30. package/src/entify/lib/newQueryPostOptions.ts +42 -45
  31. package/src/entify/lib/newQueryProductOptions.ts +96 -98
  32. package/src/entify/lib/newQueryProductsMediaOptions.ts +28 -28
  33. package/src/entify/lib/queryAllProducts.ts +40 -40
  34. package/src/entify/lib/queryBulletin.ts +28 -16
  35. package/src/entify/lib/queryEntityList.ts +41 -41
  36. package/src/entify/lib/queryFeaturedProducts.ts +69 -68
  37. package/src/entify/lib/queryLangs.ts +36 -60
  38. package/src/entify/lib/queryLatestPosts.ts +92 -91
  39. package/src/entify/lib/queryOneEntity.ts +63 -63
  40. package/src/entify/lib/queryOneMedia.ts +27 -27
  41. package/src/entify/lib/queryOnePostById.ts +21 -21
  42. package/src/entify/lib/queryOnePostBySlug.ts +40 -39
  43. package/src/entify/lib/queryOnePostCategoryBySlug.ts +35 -35
  44. package/src/entify/lib/queryOneProductById.ts +20 -20
  45. package/src/entify/lib/queryOneProductBySlug.ts +53 -52
  46. package/src/entify/lib/queryOneProductCategoryBySlug.ts +50 -49
  47. package/src/entify/lib/queryOneTheme.ts +54 -72
  48. package/src/entify/lib/queryOneUser.ts +38 -38
  49. package/src/entify/lib/queryPostCategories.ts +67 -67
  50. package/src/entify/lib/queryPostSlugs.ts +37 -37
  51. package/src/entify/lib/queryPosts.ts +175 -174
  52. package/src/entify/lib/queryProductCategories.ts +59 -59
  53. package/src/entify/lib/queryProducts.ts +145 -144
  54. package/src/entify/lib/queryProductsInMenu.ts +45 -45
  55. package/src/entify/lib/queryTagCategories.ts +58 -58
  56. package/src/entify/lib/queryTags.ts +57 -57
  57. package/src/entify/lib/queryUserIds.ts +24 -24
  58. package/src/entify/lib/queryUserPosts.ts +80 -79
  59. package/src/entify/lib/queryWebSiteSettings.ts +28 -28
  60. package/src/entify/lib/queryWebsite.ts +43 -43
  61. package/src/entify/lib/sendEmail.ts +7 -7
  62. package/src/entify/lib/toQueryOptions.ts +19 -19
  63. package/src/entify/lib/upsertEntity.ts +8 -8
  64. package/src/entify/types/index.ts +1 -1
  65. package/src/entify/types/utils.ts +11 -6
  66. package/src/entify/types/variables.ts +0 -1
  67. package/src/entify/view-model/funcs.ts +230 -230
  68. package/src/entify/view-model/index.ts +1 -1
  69. package/src/entify/view-model/models.ts +135 -135
  70. package/src/global.d.ts +7 -7
  71. package/src/index.ts +8 -8
  72. package/src/lib/formatDate.ts +15 -15
  73. package/src/lib/index.ts +3 -3
  74. package/src/lib/pagination.ts +114 -114
  75. package/src/lib/utils.ts +135 -135
  76. package/src/react/components/Analytics/eventHandlers.ts +173 -173
  77. package/src/react/components/Analytics/index.tsx +21 -21
  78. package/src/react/components/Analytics/singleton.ts +214 -214
  79. package/src/react/components/Analytics/tracking.ts +221 -221
  80. package/src/react/components/Analytics/types.ts +60 -60
  81. package/src/react/components/Analytics/utils.ts +95 -95
  82. package/src/react/components/AttachmentIcon/index.tsx +53 -53
  83. package/src/react/components/BackgroundHlsVideoPlayer.tsx +97 -97
  84. package/src/react/components/BackgroundVideoPlayer.tsx +32 -32
  85. package/src/react/components/Bulletin.tsx +30 -30
  86. package/src/react/components/ContactForm/ContactForm.tsx +289 -289
  87. package/src/react/components/ContactForm/Input.tsx +48 -48
  88. package/src/react/components/ContactForm/Input2.tsx +59 -59
  89. package/src/react/components/ContactForm/Submit.tsx +48 -48
  90. package/src/react/components/ContactForm/TelInput.tsx +215 -215
  91. package/src/react/components/ContactForm/Textarea.tsx +48 -48
  92. package/src/react/components/ContactForm/Textarea2.tsx +89 -89
  93. package/src/react/components/ContactForm/funcs.ts +64 -64
  94. package/src/react/components/ContactForm/index.ts +7 -7
  95. package/src/react/components/ContactForm/types.ts +68 -68
  96. package/src/react/components/GoogleConsent/CookieItemPanel.tsx +80 -80
  97. package/src/react/components/GoogleConsent/CumtomizedModal.tsx +148 -148
  98. package/src/react/components/GoogleConsent/GoogleConsent.tsx +100 -100
  99. package/src/react/components/GoogleConsent/gtags.ts +67 -67
  100. package/src/react/components/GoogleConsent/index.ts +2 -2
  101. package/src/react/components/GoogleConsent/types.ts +18 -18
  102. package/src/react/components/GoogleConsent//345/217/202/350/200/203.md +4 -4
  103. package/src/react/components/Icon/index.tsx +19 -19
  104. package/src/react/components/Medias/MainMedia.tsx +257 -257
  105. package/src/react/components/Medias/Thumbnail.tsx +62 -62
  106. package/src/react/components/Medias/VideoPlayer.tsx +114 -114
  107. package/src/react/components/Medias/index.tsx +271 -271
  108. package/src/react/components/ProductCard/ProductCard.tsx +24 -24
  109. package/src/react/components/ProductCard/ProductCta/index.tsx +28 -28
  110. package/src/react/components/ProductCard/ProductCta/style.css +3 -3
  111. package/src/react/components/ProductCard/ProductDescription/index.tsx +12 -12
  112. package/src/react/components/ProductCard/ProductDescription/style.css +5 -5
  113. package/src/react/components/ProductCard/ProductMedia/index.tsx +35 -35
  114. package/src/react/components/ProductCard/ProductMedia/style.css +5 -5
  115. package/src/react/components/ProductCard/ProductTitle/index.tsx +7 -7
  116. package/src/react/components/ProductCard/ProductTitle/style.css +3 -3
  117. package/src/react/components/ProductCard/ProductView.tsx +36 -36
  118. package/src/react/components/ProductCard/index.ts +4 -4
  119. package/src/react/components/ProductCard/useQueryProduct.ts +32 -32
  120. package/src/react/components/ReactModalTrigger.tsx +28 -28
  121. package/src/react/components/ReactVideoPlayer.tsx +29 -52
  122. package/src/react/components/RichTextOutline/index.tsx +75 -75
  123. package/src/react/components/RichTextOutline/useAnchorScroll.ts +23 -23
  124. package/src/react/components/Scroller.tsx +39 -39
  125. package/src/react/components/SearchInput.tsx +21 -21
  126. package/src/react/components/Share/index.tsx +86 -86
  127. package/src/react/components/Share/socials.tsx +79 -77
  128. package/src/react/components/Share//350/265/204/346/226/231.md +7 -7
  129. package/src/react/components/ToTop.tsx +72 -72
  130. package/src/react/components/VideoPlayIcon.tsx +43 -0
  131. package/src/react/components/all.ts +38 -38
  132. package/src/react/components/index.ts +16 -16
  133. package/src/robots.ts +4 -4
  134. package/src/entify/lib/newPageMetaOptions.ts +0 -18
  135. package/src/entify/lib/newQueryPageOptions.ts +0 -14
  136. package/src/entify/lib/queryOneIcon.ts +0 -27
  137. package/src/entify/lib/queryPageBySlug.ts +0 -43
  138. package/src/entify/lib/queryPageByType.ts +0 -44
@@ -1,59 +1,59 @@
1
- import { ProductCategory, ProductCategoryBoolExp, ProductCategoryOrderBy, ProductCategoryDistinctExp, ProductCategoryFields, ProductCategoryQueryOptions, ProductFields, ProductQueryOptions, PublishableStatus } from "@rxdrag/rxcms-models";
2
- import { queryEntityList } from "./queryEntityList";
3
- import { ListResult } from "@rxdrag/entify-lib";
4
- import { EnvVariables } from "../types";
5
- import { TProductCategory } from "../view-model";
6
- import { listToTree } from "./listToTree";
7
-
8
- export async function queryProductCategories(envVariables: EnvVariables) {
9
-
10
- const result = await queryEntityList<ProductCategory, ProductCategoryBoolExp, ProductCategoryOrderBy, ProductCategoryDistinctExp>(
11
- new ProductCategoryQueryOptions(
12
- [
13
- ProductCategoryFields.id,
14
- ProductCategoryFields.name,
15
- ProductCategoryFields.slug,
16
- ProductCategoryFields.description,
17
- ],
18
- {
19
- where: {
20
- lang: {
21
- abbr: {
22
- _eq: envVariables.language,
23
- },
24
- },
25
- },
26
- orderBy: [
27
- { [ProductCategoryFields.seqValue]: "asc" }
28
- ]
29
- }
30
- )
31
- .parent()
32
- .products(
33
- new ProductQueryOptions(
34
- [ProductFields.id, ProductFields.title, ProductFields.slug],
35
- {
36
- where: {
37
- showInNavMenu: {
38
- "_eq": true
39
- },
40
- [ProductFields.status]: {
41
- "_eq": PublishableStatus.published
42
- }
43
- },
44
- orderBy: [
45
- { [ProductFields.seqValue]: "asc" }
46
- ]
47
- },
48
- )
49
- ),
50
- envVariables
51
- );
52
- const typedResult = result as ListResult<TProductCategory> | undefined;
53
-
54
- if (!typedResult) {
55
- return undefined;
56
- }
57
-
58
- return listToTree(typedResult.items || []);
59
- }
1
+ import { ProductCategory, ProductCategoryBoolExp, ProductCategoryOrderBy, ProductCategoryDistinctExp, ProductCategoryFields, ProductCategoryQueryOptions, ProductFields, ProductQueryOptions, PublishableStatus } from "@rxdrag/rxcms-models";
2
+ import { queryEntityList } from "./queryEntityList";
3
+ import { ListResult } from "@rxdrag/entify-lib";
4
+ import { EnvVariables } from "../types";
5
+ import { TProductCategory } from "../view-model";
6
+ import { listToTree } from "./listToTree";
7
+
8
+ export async function queryProductCategories(envVariables: EnvVariables, langAbbr: string) {
9
+
10
+ const result = await queryEntityList<ProductCategory, ProductCategoryBoolExp, ProductCategoryOrderBy, ProductCategoryDistinctExp>(
11
+ new ProductCategoryQueryOptions(
12
+ [
13
+ ProductCategoryFields.id,
14
+ ProductCategoryFields.name,
15
+ ProductCategoryFields.slug,
16
+ ProductCategoryFields.description,
17
+ ],
18
+ {
19
+ where: {
20
+ lang: {
21
+ abbr: {
22
+ _eq: langAbbr,
23
+ },
24
+ },
25
+ },
26
+ orderBy: [
27
+ { [ProductCategoryFields.seqValue]: "asc" }
28
+ ]
29
+ }
30
+ )
31
+ .parent()
32
+ .products(
33
+ new ProductQueryOptions(
34
+ [ProductFields.id, ProductFields.title, ProductFields.slug],
35
+ {
36
+ where: {
37
+ showInNavMenu: {
38
+ "_eq": true
39
+ },
40
+ [ProductFields.status]: {
41
+ "_eq": PublishableStatus.published
42
+ }
43
+ },
44
+ orderBy: [
45
+ { [ProductFields.seqValue]: "asc" }
46
+ ]
47
+ },
48
+ )
49
+ ),
50
+ envVariables
51
+ );
52
+ const typedResult = result as ListResult<TProductCategory> | undefined;
53
+
54
+ if (!typedResult) {
55
+ return undefined;
56
+ }
57
+
58
+ return listToTree(typedResult.items || []);
59
+ }
@@ -1,144 +1,145 @@
1
- import {
2
- Product,
3
- ProductBoolExp,
4
- ProductOrderBy,
5
- ProductDistinctExp,
6
- ProductFields,
7
- ProductQueryOptions,
8
- PublishableStatus,
9
- ProductAssciations,
10
- ProductCategory,
11
- ProductCategoryBoolExp,
12
- ProductCategoryOrderBy,
13
- ProductCategoryDistinctExp,
14
- ProductCategoryFields,
15
- ProductCategoryQueryOptions,
16
- TagFields,
17
- } from "@rxdrag/rxcms-models";
18
- import { ListConditions } from "./queryPosts";
19
- import { queryEntityList } from "./queryEntityList";
20
- import { newQueryProductsMediaOptions } from "./newQueryProductsMediaOptions";
21
- import { ListResult } from "@rxdrag/entify-lib";
22
- import { EnvVariables } from "../types";
23
- import { TProduct } from "../view-model";
24
- import { ImageSize } from "@rxdrag/rxcms-models";
25
- import { queryOneEntity } from "./queryOneEntity";
26
- import { CategoryNode, collectCategoryIds } from "./collectCategoryIds";
27
-
28
- export async function queryProducts(
29
- conditions: ListConditions,
30
- imageSize: ImageSize | undefined,
31
- envVariables: EnvVariables,
32
- addonFields?: (keyof Product)[]
33
- ) {
34
- const {
35
- category: categorySlug,
36
- page = 1,
37
- pageSize = 10,
38
- orderBy,
39
- } = conditions;
40
-
41
- let where = {};
42
- if (categorySlug) {
43
- //先查询分类以及其子分类
44
- const category = await queryOneEntity<
45
- ProductCategory,
46
- ProductCategoryBoolExp,
47
- ProductCategoryOrderBy,
48
- ProductCategoryDistinctExp
49
- >(
50
- new ProductCategoryQueryOptions(
51
- [
52
- ProductCategoryFields.id,
53
- ProductCategoryFields.slug,
54
- ],
55
- {
56
- where: {
57
- slug: {
58
- _eq: categorySlug,
59
- },
60
- },
61
- }
62
- //支持三级结构
63
- ).children(new ProductCategoryQueryOptions(
64
- [
65
- ProductCategoryFields.id,
66
- ProductCategoryFields.slug,
67
- ]
68
- ).children([ProductCategoryFields.id])),
69
- envVariables
70
- );
71
- if (category) {
72
- const categoryIds = collectCategoryIds(
73
- category as unknown as CategoryNode
74
- );
75
- where = {
76
- [ProductAssciations.category]: {
77
- id: {
78
- _in: categoryIds,
79
- },
80
- },
81
- };
82
- }
83
-
84
- }
85
-
86
- // 默认查询字段
87
- const defaultFields = [
88
- ProductFields.id,
89
- ProductFields.slug,
90
- ProductFields.title,
91
- ProductFields.shortTitle,
92
- ProductFields.description,
93
- ProductFields.seqValue,
94
- ProductFields.updatedAt,
95
- ];
96
-
97
- // 使用指定的字段或默认字段
98
- const fields = [...defaultFields, ...(addonFields || [])];
99
-
100
- const queryOptions = new ProductQueryOptions(fields, {
101
- offset: (page - 1) * pageSize,
102
- limit: pageSize,
103
- where: {
104
- [ProductFields.status]: {
105
- _eq: PublishableStatus.published,
106
- },
107
- lang: {
108
- abbr: {
109
- _eq: envVariables.language,
110
- },
111
- },
112
- _or: [
113
- {
114
- [ProductFields.isDeleted]: {
115
- _eq: false,
116
- },
117
- },
118
- {
119
- [ProductFields.isDeleted]: {
120
- _isNull: true,
121
- },
122
- },
123
- ],
124
- ...where,
125
- },
126
- orderBy: orderBy || [
127
- { [ProductFields.seqValue]: "asc" },
128
- { [ProductFields.updatedAt]: "desc" },
129
- ],
130
- }).tags([TagFields.id, TagFields.name, TagFields.color]);
131
-
132
- // 只有在不指定字段或需要查询媒体时才添加媒体查询
133
- if (!addonFields || !addonFields.includes("slug" as keyof Product)) {
134
- queryOptions.mediaPivots(newQueryProductsMediaOptions(imageSize));
135
- }
136
-
137
- const result = await queryEntityList<
138
- Product,
139
- ProductBoolExp,
140
- ProductOrderBy,
141
- ProductDistinctExp
142
- >(queryOptions, envVariables);
143
- return result as ListResult<TProduct> | undefined;
144
- }
1
+ import {
2
+ Product,
3
+ ProductBoolExp,
4
+ ProductOrderBy,
5
+ ProductDistinctExp,
6
+ ProductFields,
7
+ ProductQueryOptions,
8
+ PublishableStatus,
9
+ ProductAssciations,
10
+ ProductCategory,
11
+ ProductCategoryBoolExp,
12
+ ProductCategoryOrderBy,
13
+ ProductCategoryDistinctExp,
14
+ ProductCategoryFields,
15
+ ProductCategoryQueryOptions,
16
+ TagFields,
17
+ } from "@rxdrag/rxcms-models";
18
+ import { ListConditions } from "./queryPosts";
19
+ import { queryEntityList } from "./queryEntityList";
20
+ import { newQueryProductsMediaOptions } from "./newQueryProductsMediaOptions";
21
+ import { ListResult } from "@rxdrag/entify-lib";
22
+ import { EnvVariables } from "../types";
23
+ import { TProduct } from "../view-model";
24
+ import { ImageSize } from "@rxdrag/rxcms-models";
25
+ import { queryOneEntity } from "./queryOneEntity";
26
+ import { CategoryNode, collectCategoryIds } from "./collectCategoryIds";
27
+
28
+ export async function queryProducts(
29
+ conditions: ListConditions,
30
+ imageSize: ImageSize | undefined,
31
+ envVariables: EnvVariables,
32
+ addonFields: (keyof Product)[] | undefined,
33
+ langAbbr: string
34
+ ) {
35
+ const {
36
+ category: categorySlug,
37
+ page = 1,
38
+ pageSize = 10,
39
+ orderBy,
40
+ } = conditions;
41
+
42
+ let where = {};
43
+ if (categorySlug) {
44
+ //先查询分类以及其子分类
45
+ const category = await queryOneEntity<
46
+ ProductCategory,
47
+ ProductCategoryBoolExp,
48
+ ProductCategoryOrderBy,
49
+ ProductCategoryDistinctExp
50
+ >(
51
+ new ProductCategoryQueryOptions(
52
+ [
53
+ ProductCategoryFields.id,
54
+ ProductCategoryFields.slug,
55
+ ],
56
+ {
57
+ where: {
58
+ slug: {
59
+ _eq: categorySlug,
60
+ },
61
+ },
62
+ }
63
+ //支持三级结构
64
+ ).children(new ProductCategoryQueryOptions(
65
+ [
66
+ ProductCategoryFields.id,
67
+ ProductCategoryFields.slug,
68
+ ]
69
+ ).children([ProductCategoryFields.id])),
70
+ envVariables
71
+ );
72
+ if (category) {
73
+ const categoryIds = collectCategoryIds(
74
+ category as unknown as CategoryNode
75
+ );
76
+ where = {
77
+ [ProductAssciations.category]: {
78
+ id: {
79
+ _in: categoryIds,
80
+ },
81
+ },
82
+ };
83
+ }
84
+
85
+ }
86
+
87
+ // 默认查询字段
88
+ const defaultFields = [
89
+ ProductFields.id,
90
+ ProductFields.slug,
91
+ ProductFields.title,
92
+ ProductFields.shortTitle,
93
+ ProductFields.description,
94
+ ProductFields.seqValue,
95
+ ProductFields.updatedAt,
96
+ ];
97
+
98
+ // 使用指定的字段或默认字段
99
+ const fields = [...defaultFields, ...(addonFields || [])];
100
+
101
+ const queryOptions = new ProductQueryOptions(fields, {
102
+ offset: (page - 1) * pageSize,
103
+ limit: pageSize,
104
+ where: {
105
+ [ProductFields.status]: {
106
+ _eq: PublishableStatus.published,
107
+ },
108
+ lang: {
109
+ abbr: {
110
+ _eq: langAbbr,
111
+ },
112
+ },
113
+ _or: [
114
+ {
115
+ [ProductFields.isDeleted]: {
116
+ _eq: false,
117
+ },
118
+ },
119
+ {
120
+ [ProductFields.isDeleted]: {
121
+ _isNull: true,
122
+ },
123
+ },
124
+ ],
125
+ ...where,
126
+ },
127
+ orderBy: orderBy || [
128
+ { [ProductFields.seqValue]: "asc" },
129
+ { [ProductFields.updatedAt]: "desc" },
130
+ ],
131
+ }).tags([TagFields.id, TagFields.name, TagFields.color]);
132
+
133
+ // 只有在不指定字段或需要查询媒体时才添加媒体查询
134
+ if (!addonFields || !addonFields.includes("slug" as keyof Product)) {
135
+ queryOptions.mediaPivots(newQueryProductsMediaOptions(imageSize));
136
+ }
137
+
138
+ const result = await queryEntityList<
139
+ Product,
140
+ ProductBoolExp,
141
+ ProductOrderBy,
142
+ ProductDistinctExp
143
+ >(queryOptions, envVariables);
144
+ return result as ListResult<TProduct> | undefined;
145
+ }
@@ -1,45 +1,45 @@
1
- import {
2
- ProductFields,
3
- ProductQueryOptions,
4
- PublishableStatus,
5
- } from "@rxdrag/rxcms-models";
6
- import { queryEntityList } from "./queryEntityList";
7
- import { EnvVariables } from "../types";
8
- import { newQueryProductsMediaOptions } from "./newQueryProductsMediaOptions";
9
-
10
- export async function queryProductsInMenu(envVariables: EnvVariables) {
11
- const result = await queryEntityList(
12
- new ProductQueryOptions(
13
- [ProductFields.id, ProductFields.slug, ProductFields.title],
14
- {
15
- where: {
16
- lang: {
17
- abbr: {
18
- _eq: envVariables.language,
19
- },
20
- },
21
- _or: [
22
- {
23
- [ProductFields.isDeleted]: {
24
- _eq: false,
25
- },
26
- },
27
- {
28
- [ProductFields.isDeleted]: {
29
- _isNull: true,
30
- },
31
- },
32
- ],
33
- showInNavMenu: {
34
- _eq: true,
35
- },
36
- [ProductFields.status]: {
37
- _eq: PublishableStatus.published,
38
- },
39
- },
40
- }
41
- ).mediaPivots(newQueryProductsMediaOptions()),
42
- envVariables
43
- );
44
- return result;
45
- }
1
+ import {
2
+ ProductFields,
3
+ ProductQueryOptions,
4
+ PublishableStatus,
5
+ } from "@rxdrag/rxcms-models";
6
+ import { queryEntityList } from "./queryEntityList";
7
+ import { EnvVariables } from "../types";
8
+ import { newQueryProductsMediaOptions } from "./newQueryProductsMediaOptions";
9
+
10
+ export async function queryProductsInMenu(envVariables: EnvVariables, langAbbr: string) {
11
+ const result = await queryEntityList(
12
+ new ProductQueryOptions(
13
+ [ProductFields.id, ProductFields.slug, ProductFields.title],
14
+ {
15
+ where: {
16
+ lang: {
17
+ abbr: {
18
+ _eq: langAbbr,
19
+ },
20
+ },
21
+ _or: [
22
+ {
23
+ [ProductFields.isDeleted]: {
24
+ _eq: false,
25
+ },
26
+ },
27
+ {
28
+ [ProductFields.isDeleted]: {
29
+ _isNull: true,
30
+ },
31
+ },
32
+ ],
33
+ showInNavMenu: {
34
+ _eq: true,
35
+ },
36
+ [ProductFields.status]: {
37
+ _eq: PublishableStatus.published,
38
+ },
39
+ },
40
+ }
41
+ ).mediaPivots(newQueryProductsMediaOptions()),
42
+ envVariables
43
+ );
44
+ return result;
45
+ }
@@ -1,58 +1,58 @@
1
- import {
2
- TagCategory,
3
- TagCategoryBoolExp,
4
- TagCategoryOrderBy,
5
- TagCategoryDistinctExp,
6
- TagCategoryFields,
7
- TagCategoryQueryOptions,
8
- TagQueryOptions,
9
- TagFields,
10
- } from "@rxdrag/rxcms-models";
11
- import { queryEntityList } from "./queryEntityList";
12
- import { ListResult } from "@rxdrag/entify-lib";
13
- import { EnvVariables } from "../types";
14
- import { TTagCategory } from "../view-model";
15
- import { listToTree } from "./listToTree";
16
-
17
- export async function queryTagCategories(envVariables: EnvVariables) {
18
- const result = await queryEntityList<
19
- TagCategory,
20
- TagCategoryBoolExp,
21
- TagCategoryOrderBy,
22
- TagCategoryDistinctExp
23
- >(
24
- new TagCategoryQueryOptions(
25
- [
26
- TagCategoryFields.id,
27
- TagCategoryFields.name,
28
- ],
29
- {
30
- where: {
31
- lang: {
32
- abbr: {
33
- _eq: envVariables.language,
34
- },
35
- },
36
- },
37
- orderBy: [{ [TagCategoryFields.name]: "asc" }],
38
- }
39
- )
40
- .parent()
41
- .tags(
42
- new TagQueryOptions(
43
- [TagFields.id, TagFields.name, TagFields.color],
44
- {
45
- orderBy: [{ [TagFields.createdAt]: "desc" }],
46
- }
47
- )
48
- ),
49
- envVariables
50
- );
51
- const typedResult = result as ListResult<TTagCategory> | undefined;
52
-
53
- if (!typedResult) {
54
- return undefined;
55
- }
56
-
57
- return listToTree(typedResult.items || []);
58
- }
1
+ import {
2
+ TagCategory,
3
+ TagCategoryBoolExp,
4
+ TagCategoryOrderBy,
5
+ TagCategoryDistinctExp,
6
+ TagCategoryFields,
7
+ TagCategoryQueryOptions,
8
+ TagQueryOptions,
9
+ TagFields,
10
+ } from "@rxdrag/rxcms-models";
11
+ import { queryEntityList } from "./queryEntityList";
12
+ import { ListResult } from "@rxdrag/entify-lib";
13
+ import { EnvVariables } from "../types";
14
+ import { TTagCategory } from "../view-model";
15
+ import { listToTree } from "./listToTree";
16
+
17
+ export async function queryTagCategories(envVariables: EnvVariables, langAbbr: string) {
18
+ const result = await queryEntityList<
19
+ TagCategory,
20
+ TagCategoryBoolExp,
21
+ TagCategoryOrderBy,
22
+ TagCategoryDistinctExp
23
+ >(
24
+ new TagCategoryQueryOptions(
25
+ [
26
+ TagCategoryFields.id,
27
+ TagCategoryFields.name,
28
+ ],
29
+ {
30
+ where: {
31
+ lang: {
32
+ abbr: {
33
+ _eq: langAbbr,
34
+ },
35
+ },
36
+ },
37
+ orderBy: [{ [TagCategoryFields.name]: "asc" }],
38
+ }
39
+ )
40
+ .parent()
41
+ .tags(
42
+ new TagQueryOptions(
43
+ [TagFields.id, TagFields.name, TagFields.color],
44
+ {
45
+ orderBy: [{ [TagFields.createdAt]: "desc" }],
46
+ }
47
+ )
48
+ ),
49
+ envVariables
50
+ );
51
+ const typedResult = result as ListResult<TTagCategory> | undefined;
52
+
53
+ if (!typedResult) {
54
+ return undefined;
55
+ }
56
+
57
+ return listToTree(typedResult.items || []);
58
+ }