@pronto-tools-and-more/components 11.12.0 → 12.1.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/main.js CHANGED
@@ -166,8 +166,17 @@ var getArticleListDataSource = ({
166
166
  bundleId,
167
167
  collectionName,
168
168
  limit,
169
- offset
169
+ offset,
170
+ bookmarks
170
171
  }) => {
172
+ if (bookmarks) {
173
+ const dataSource2 = {
174
+ data: "$context.bookmarks",
175
+ type: "context",
176
+ batchSize: 1e6
177
+ };
178
+ return dataSource2;
179
+ }
171
180
  if (collectionName) {
172
181
  return {
173
182
  type: "collection-content",
@@ -219,11 +228,34 @@ var getArticleListDataSource = ({
219
228
  };
220
229
 
221
230
  // src/parts/ArticleList/ArticleList.tsx
222
- var unrender2 = (element, renderElement) => {
231
+ var getContentKey = (element) => {
232
+ if (element.dataSource.type === "collection-content") {
233
+ return "'collection-content'";
234
+ }
235
+ if (element.dataSource.data === "$context.bookmarks") {
236
+ return "'context'";
237
+ }
238
+ return "'content'";
239
+ };
240
+ var getNodeInfo = (element) => {
223
241
  const { render, ...rest } = element;
224
- const isCollection = element.dataSource.type === "collection-content";
225
- const contentKey = isCollection ? "'collection-content'" : "'content'";
226
- const node = render({
242
+ const contentKey = getContentKey(element);
243
+ const isBookmarks = element.dataSource.data === "$context.bookmarks";
244
+ if (isBookmarks) {
245
+ return {
246
+ name: `$functions.id($context, ${contentKey}, 'name')`,
247
+ description: `$functions.id($context, ${contentKey}, 'description')`,
248
+ imageSrc: `$functions.id($context, ${contentKey}, 'imageSrc')`,
249
+ slug: `$functions.id($context, ${contentKey}, 'slug')`,
250
+ metadataVideoPodcast: `$functions.id($context, ${contentKey}, 'metadataVideoPodcast')`,
251
+ readTime: `$functions.id($context, ${contentKey}, 'readTime')`,
252
+ publicationDate: `$functions.id($context, ${contentKey}, 'publicationDate')`,
253
+ id: `$functions.id($context, ${contentKey}, 'id')`,
254
+ primaryCategoryName: `$functions.id($context, ${contentKey}, 'primaryCategoryName')`,
255
+ primaryCategoryId: `$functions.id($context, ${contentKey}, 'primaryCategoryId')`
256
+ };
257
+ }
258
+ return {
227
259
  name: `$functions.id($context, ${contentKey}, 'name')`,
228
260
  description: `$functions.id($context, ${contentKey}, 'description')`,
229
261
  imageSrc: `$functions.id($context, ${contentKey}, 'thumbnails', 'default')`,
@@ -231,8 +263,15 @@ var unrender2 = (element, renderElement) => {
231
263
  metadataVideoPodcast: `$functions.id($context, ${contentKey}, 'properties', 'metadataVideoPodcast')`,
232
264
  readTime: `$functions.getReadTime($functions.id($context, ${contentKey}))`,
233
265
  publicationDate: `$functions.id($context, ${contentKey}, 'publicationDate')`,
234
- id: `$functions.id($context, ${contentKey}, 'id')`
235
- });
266
+ id: `$functions.id($context, ${contentKey}, 'id')`,
267
+ primaryCategoryId: `$functions.getPrimaryCategoryProperty($context["${contentKey ?? "content"}"], 'id')`,
268
+ primaryCategoryName: `$functions.getPrimaryCategoryProperty($context["${contentKey ?? "content"}"], 'name')`
269
+ };
270
+ };
271
+ var unrender2 = (element, renderElement) => {
272
+ const { render, ...rest } = element;
273
+ const nodeInfo = getNodeInfo(element);
274
+ const node = render(nodeInfo);
236
275
  const final = renderElement(node);
237
276
  return {
238
277
  ...rest,
@@ -248,7 +287,8 @@ var ArticleList = ({
248
287
  limit,
249
288
  offset,
250
289
  collectionName,
251
- noContentFound
290
+ noContentFound,
291
+ bookmarks
252
292
  }) => {
253
293
  const dataSource = getArticleListDataSource({
254
294
  properties,
@@ -257,7 +297,8 @@ var ArticleList = ({
257
297
  bundleId,
258
298
  limit,
259
299
  offset,
260
- collectionName
300
+ collectionName,
301
+ bookmarks
261
302
  });
262
303
  const json = {
263
304
  render,
@@ -1,5 +1,5 @@
1
1
  import type { ArticleListItemRenderer } from "../ArticleListItemRenderer/ArticleListItemRenderer.ts";
2
- export declare const ArticleList: ({ properties, render, authorId, categoryId, bundleId, limit, offset, collectionName, noContentFound, }: {
2
+ export declare const ArticleList: ({ properties, render, authorId, categoryId, bundleId, limit, offset, collectionName, noContentFound, bookmarks, }: {
3
3
  properties?: any;
4
4
  authorId?: string;
5
5
  categoryId?: string;
@@ -9,4 +9,5 @@ export declare const ArticleList: ({ properties, render, authorId, categoryId, b
9
9
  offset?: number;
10
10
  collectionName?: string;
11
11
  noContentFound?: string;
12
+ bookmarks?: boolean;
12
13
  }) => import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- export declare const getArticleListDataSource: ({ properties, authorId, categoryId, bundleId, collectionName, limit, offset, }: {
1
+ export declare const getArticleListDataSource: ({ properties, authorId, categoryId, bundleId, collectionName, limit, offset, bookmarks, }: {
2
2
  properties: any;
3
3
  authorId: any;
4
4
  categoryId: any;
@@ -6,7 +6,12 @@ export declare const getArticleListDataSource: ({ properties, authorId, category
6
6
  collectionName: any;
7
7
  limit: any;
8
8
  offset: any;
9
+ bookmarks: any;
9
10
  }) => {
11
+ data: string;
12
+ type: string;
13
+ batchSize: number;
14
+ } | {
10
15
  type: string;
11
16
  filter: {
12
17
  AND: any[];
@@ -8,4 +8,6 @@ export interface IArticleListItem {
8
8
  readonly readTime?: string;
9
9
  readonly publicationDate: string;
10
10
  readonly id: string;
11
+ readonly primaryCategoryName?: string;
12
+ readonly primaryCategoryId?: string;
11
13
  }
@@ -1,5 +1,11 @@
1
1
  export interface IBookmarkInfo {
2
- readonly title: string;
3
- readonly url: string;
2
+ readonly name: string;
3
+ readonly description: string;
4
+ readonly imageSrc: string;
5
+ readonly properties: any;
6
+ readonly slug: string;
7
+ readonly metadataVideoPodcast?: string;
8
+ readonly readTime?: string;
9
+ readonly publicationDate: string;
4
10
  readonly id: string;
5
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/components",
3
- "version": "11.12.0",
3
+ "version": "12.1.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",