@wix/blog 1.0.692 → 1.0.693

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 (31) hide show
  1. package/_sdk-exports/context-blog-feed-context-provider/runtime.d.ts +280 -99
  2. package/_sdk-exports/context-category-item-context-provider/runtime.d.ts +13 -14
  3. package/_sdk-exports/context-post-context-provider/runtime.d.ts +257 -81
  4. package/_sdk-exports/context-post-item-context-provider/runtime.d.ts +201 -78
  5. package/_sdk-exports/context-related-posts-context-provider/runtime.d.ts +178 -82
  6. package/_sdk-exports/context-tag-item-context-provider/runtime.d.ts +12 -11
  7. package/build/cjs/context-blog-feed-context-provider.d.ts +280 -99
  8. package/build/cjs/context-category-item-context-provider.d.ts +13 -14
  9. package/build/cjs/context-post-context-provider.d.ts +257 -81
  10. package/build/cjs/context-post-item-context-provider.d.ts +201 -78
  11. package/build/cjs/context-related-posts-context-provider.d.ts +178 -82
  12. package/build/cjs/context-tag-item-context-provider.d.ts +12 -11
  13. package/build/es/context-blog-feed-context-provider.d.mts +280 -99
  14. package/build/es/context-category-item-context-provider.d.mts +13 -14
  15. package/build/es/context-post-context-provider.d.mts +257 -81
  16. package/build/es/context-post-item-context-provider.d.mts +201 -78
  17. package/build/es/context-related-posts-context-provider.d.mts +178 -82
  18. package/build/es/context-tag-item-context-provider.d.mts +12 -11
  19. package/build/internal/cjs/context-blog-feed-context-provider.d.ts +280 -99
  20. package/build/internal/cjs/context-category-item-context-provider.d.ts +13 -14
  21. package/build/internal/cjs/context-post-context-provider.d.ts +257 -81
  22. package/build/internal/cjs/context-post-item-context-provider.d.ts +201 -78
  23. package/build/internal/cjs/context-related-posts-context-provider.d.ts +178 -82
  24. package/build/internal/cjs/context-tag-item-context-provider.d.ts +12 -11
  25. package/build/internal/es/context-blog-feed-context-provider.d.mts +280 -99
  26. package/build/internal/es/context-category-item-context-provider.d.mts +13 -14
  27. package/build/internal/es/context-post-context-provider.d.mts +257 -81
  28. package/build/internal/es/context-post-item-context-provider.d.mts +201 -78
  29. package/build/internal/es/context-related-posts-context-provider.d.mts +178 -82
  30. package/build/internal/es/context-tag-item-context-provider.d.mts +12 -11
  31. package/package.json +2 -2
@@ -183,9 +183,11 @@ interface PostPickerFilter {
183
183
  }
184
184
  //#endregion
185
185
  //#region src/i18n/post-labels.types.d.ts
186
- /** Display-ready copy for the Repeater's bindable `emptyState: {title, description}` prop. */
186
+ /** Text to show in place of an empty list of posts. */
187
187
  interface EmptyStateLabels {
188
+ /** Heading to show in place of the empty list, in the site's language. */
188
189
  title: string;
190
+ /** Sentence to show under the heading, in the site's language. */
189
191
  description: string;
190
192
  }
191
193
  //#endregion
@@ -255,196 +257,375 @@ declare global {
255
257
  }
256
258
  //#endregion
257
259
  //#region src/lib/parse-post-cover-media.d.ts
258
- /** One playable rendition of a Wix-hosted cover video (a raw REST `VideoResolution`). */
260
+ /** Playable file of a cover video uploaded to Wix. */
259
261
  interface VideoSource {
262
+ /** URL of the video file. */
260
263
  url: string;
264
+ /** Width of the video, in pixels. `undefined` when it isn't known. */
261
265
  width?: number;
266
+ /** Height of the video, in pixels. `undefined` when it isn't known. */
262
267
  height?: number;
263
268
  }
264
- type EmbedProvider = 'youtube' | 'vimeo' | 'unknown';
269
+ /** Site that hosts an embedded cover video. */
270
+ type EmbedProvider =
265
271
  /**
266
- * The post cover as the Cover Media widget consumes it — a discriminated union over the
267
- * `post.media` oneof: a Wix-hosted image, a Wix-hosted video (`wixMedia.videoV2`), or an
268
- * externally hosted embed (`embedMedia`, YouTube/Vimeo).
272
+ * YouTube. `embedUrl` is the video in YouTube's player, set to play as soon as it loads,
273
+ * so load it only after a site visitor clicks to play.
274
+ */
275
+ 'youtube'
276
+ /**
277
+ * Vimeo. `embedUrl` is the video in Vimeo's player, set to play as soon as it loads, so
278
+ * load it only after a site visitor clicks to play.
279
+ */
280
+ | 'vimeo' /** Any other site. There's no `embedUrl`, so show the thumbnail instead of a player. */ | 'unknown';
281
+ /**
282
+ * Post's cover. It's an image, a video uploaded to Wix, or a video from another site, such as
283
+ * YouTube, embedded by its URL.
269
284
  */
270
285
  type CoverMedia = {
271
- kind: 'image';
286
+ /** Image cover. */kind: 'image'; /** Cover image, with its URL, size, and alt text. */
272
287
  image: Image;
273
288
  } | {
274
- kind: 'wixVideo'; /** The WixMedia video id — the `wix:video://v1/<id>/...` path segment. */
289
+ /** Cover video uploaded to Wix. */kind: 'wixVideo'; /** Video ID. */
275
290
  id: string;
276
- posterUrl?: string;
277
- posterWidth?: number;
291
+ /**
292
+ * URL of the video's poster image, the image shown before the video plays.
293
+ *
294
+ * `undefined` when the video has no poster image.
295
+ */
296
+ posterUrl?: string; /** Width of the poster image, in pixels. `undefined` when it isn't known. */
297
+ posterWidth?: number; /** Height of the poster image, in pixels. `undefined` when it isn't known. */
278
298
  posterHeight?: number;
279
299
  /**
280
- * Playable mp4 renditions, optimal-first. Empty when the raw REST join was
281
- * unavailable — the widget then renders the poster alone (see post-video-api.ts
282
- * for why the SDK's `videoV2` string cannot carry these).
300
+ * Playable files of the video, the recommended one first.
301
+ *
302
+ * Empty when the video's files couldn't be loaded. Show the poster image instead.
283
303
  */
284
- sources: VideoSource[];
304
+ sources: VideoSource[]; /** Alt text for the cover. The post's title when the cover has no alt text. */
285
305
  altText: string;
286
306
  } | {
287
- kind: 'embed';
288
- provider: EmbedProvider; /** The author-supplied external video URL, as the Blog API stores it. */
289
- videoUrl: string; /** Provider player URL for click-to-play; absent for an unrecognized provider. */
307
+ /** Cover video embedded from another site, such as YouTube. */kind: 'embed'; /** Site that hosts the video. */
308
+ provider: EmbedProvider; /** URL of the video on its own site. */
309
+ videoUrl: string;
310
+ /**
311
+ * URL of the video in its site's player, set to play as soon as it loads.
312
+ *
313
+ * `undefined` when `provider` is `'unknown'`.
314
+ */
290
315
  embedUrl?: string;
291
- thumbnailUrl?: string;
292
- thumbnailWidth?: number;
293
- thumbnailHeight?: number;
316
+ /**
317
+ * URL of the video's thumbnail image.
318
+ *
319
+ * `undefined` when the video has no thumbnail.
320
+ */
321
+ thumbnailUrl?: string; /** Width of the thumbnail image, in pixels. `undefined` when it isn't known. */
322
+ thumbnailWidth?: number; /** Height of the thumbnail image, in pixels. `undefined` when it isn't known. */
323
+ thumbnailHeight?: number; /** Alt text for the cover. The post's title when the cover has no alt text. */
294
324
  altText: string;
295
325
  };
296
326
  //#endregion
297
327
  //#region src/extensions/post-list-context-provider/utils.d.ts
298
- /**
299
- * One item of the `postsList` array — the object the platform hands the Post Item
300
- * context provider as its `postData` prop (via the manifest's `contextImplementor`).
301
- * The `item*`/`recentPostItem` keys must match the Post Item context manifest's
302
- * `context.items` keys — the runtime resolves an element's binding by looking the key
303
- * up on the per-item hook's return value.
304
- */
328
+ /** Post with its fields ready to show in a repeater item. */
305
329
  interface PostListItem {
306
- /** Repeater item identity; also the manifest contract's `_id`. */
330
+ /** Post ID. */
307
331
  _id: string;
308
- /** The manifest contract's `title` (plain text, non-bindable — see `itemTitle` below). */
332
+ /** Post's title, as plain text. */
309
333
  title: string;
334
+ /**
335
+ * Post's title, as rich text. Its `text` field holds the plain text, and its `html` field
336
+ * holds the text as an HTML paragraph.
337
+ */
310
338
  itemTitle: RichText;
339
+ /** Post's excerpt, as rich text. Empty when the post has no excerpt. */
311
340
  itemExcerpt: RichText;
341
+ /**
342
+ * Post's cover image, with its URL, size, and alt text. For a post whose cover is a video
343
+ * uploaded to Wix, the video's poster image.
344
+ *
345
+ * `undefined` when there's no image to show, such as when the cover is an embedded video.
346
+ *
347
+ * It holds the cover image even when the post's author hid the cover. To leave out a hidden
348
+ * cover, check `itemCoverMedia`, which is `undefined` then.
349
+ */
312
350
  itemCoverImage: Image | undefined;
313
351
  /**
314
- * The cover as the Cover Media widget renders it — image OR playable video, where
315
- * `itemCoverImage` above can only ever be the image. Runtime-only by design: deliberately
316
- * absent from `POST_ITEM_CONTRACT_ITEMS` and the Post Item manifest (the runtime injects
317
- * the full item object regardless, and the manifest contract must stay text-scalars-only —
318
- * see post-item-contract.ts). Not bindable in Connect Value; consumed via
319
- * `usePostItemContext()` only.
352
+ * Post's cover as an image or a playable video. Use it to play a video cover, which
353
+ * `itemCoverImage` holds only as its poster image.
354
+ *
355
+ * `undefined` when the post has no cover, or the post's author hid it.
320
356
  */
321
357
  itemCoverMedia: CoverMedia | undefined;
358
+ /**
359
+ * Link to the post's page. `href` is the page's URL, and `target` is `'_self'`, so the link
360
+ * opens in the same tab.
361
+ *
362
+ * `undefined` when the post has no slug and no URL.
363
+ */
322
364
  itemLink: Link | undefined;
365
+ /**
366
+ * Date the post was first published, as rich text in the site's regional format. In the
367
+ * week after publishing, it's relative, such as "3 days ago". After that, it's a date, such
368
+ * as "Aug 5", with the year when it isn't the current year.
369
+ */
323
370
  itemPublishedDate: RichText;
324
371
  /**
325
- * Raw values for the compact widgets (Metadata, Counters), which format for themselves
326
- * (a design-panel date/number format) instead of parsing the richText labels above.
327
- * Runtime-only like `itemCoverMedia` — never bindable items. JSON-safe on purpose (ISO
328
- * string, numbers): the item crosses the platform's per-cell prop injection, and a `Date`
329
- * would not survive the round-trip.
372
+ * Date the post was first published, as an
373
+ * [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) string.
374
+ *
375
+ * `undefined` when the post has no publish date.
330
376
  */
331
- /** ISO 8601; `undefined` for a post without `firstPublishedDate`. */
332
377
  publishedDateValue: string | undefined;
333
378
  /**
334
- * The clock `itemPublishedDate` was formatted from (`useHydrationClock`) — the compact
335
- * widgets format `publishedDateValue` for themselves and must use the same one, or their
336
- * label would hydrate against a different "now" than the bound text did.
379
+ * Current time that `itemPublishedDate` is relative to, in milliseconds since the Unix
380
+ * epoch.
381
+ *
382
+ * When you format `publishedDateValue` as a relative date yourself, use this value as the
383
+ * current time, so your text matches `itemPublishedDate`.
337
384
  */
338
385
  clockValue: number;
339
- /** `undefined` when absent OR 0 — the same API-artifact rule as `timeToRead` below. */
386
+ /**
387
+ * Estimated reading time, in minutes.
388
+ *
389
+ * `undefined` when the post has no estimate.
390
+ */
340
391
  minutesToReadValue: number | undefined;
341
392
  /**
342
- * The server-side METRICS counters as raw numbers, the seed the Post Item provider
343
- * publishes as `viewCountValue`/`commentCountValue` until its client-only metrics read
344
- * lands (and for good in the editor, where that read is skipped). Same three-way rule as
345
- * the `viewCount`/`commentCount` labels: metric → canvas stand-in → `undefined`, never 0.
393
+ * Number of times the post was viewed, as loaded with the post.
394
+ *
395
+ * `undefined` when the count wasn't loaded with the post. In the editor, but not in Preview,
396
+ * a sample number instead.
346
397
  */
347
398
  initialViewCount: number | undefined;
348
- initialCommentCount: number | undefined;
349
399
  /**
350
- * The remaining keys reuse the Post context's names verbatim — the registry is per app and
351
- * keyed by item path, so re-declaring a key at the same dataType on the Post Item context
352
- * costs no new registry rows (the same trick `likeCount` already relies on).
400
+ * Number of comments on the post, as loaded with the post.
401
+ *
402
+ * `undefined` when the count wasn't loaded with the post. In the editor, but not in Preview,
403
+ * a sample number instead.
353
404
  */
405
+ initialCommentCount: number | undefined;
406
+ /** Name of the post's author, as rich text. Empty when the author isn't found. */
354
407
  authorName: RichText;
408
+ /**
409
+ * Author's profile photo, with its URL, size, and alt text. The alt text is the author's
410
+ * name, or a generic author-photo label when the author has no name.
411
+ *
412
+ * `undefined` when the author has no photo.
413
+ */
355
414
  authorImage: Image | undefined;
415
+ /**
416
+ * Estimated reading time as rich text in the site's language, such as "5 min read".
417
+ *
418
+ * Empty when the post has no estimate.
419
+ */
356
420
  timeToRead: RichText;
357
421
  /**
358
- * Resolved in priority order by `counterLabel`:
359
- * 1. the post's own `metrics` (the `METRICS` fieldset) — renders everywhere, including
360
- * the editor canvas and inside SSR HTML;
361
- * 2. an editor stand-in, when the API answers without metrics;
362
- * 3. blank, for the Post Item provider to fill in from its per-cell metrics read.
422
+ * Number of views as rich text in the site's language, such as "1,234 views".
363
423
  *
364
- * Blank rather than zero at step 3 because a seeded "0 views" reads as a confident wrong
365
- * number until that read lands. Step 1 exists because step 3 alone is not enough: the
366
- * per-cell read is client-only by design (personal data must never bake into SSR HTML the
367
- * host caches for days) AND is skipped outright in the editor, which left a bound counter
368
- * permanently blank on the canvas.
424
+ * Empty when the count wasn't loaded with the post. In the editor, but not in Preview, a
425
+ * sample count instead.
369
426
  */
370
427
  viewCount: RichText;
428
+ /**
429
+ * Number of comments as rich text in the site's language.
430
+ *
431
+ * Empty when the count wasn't loaded with the post. In the editor, but not in Preview, a
432
+ * sample count instead.
433
+ */
371
434
  commentCount: RichText;
372
435
  /**
373
- * The post's MAIN category label — one, not a list. blog-client's feed card renders a single
374
- * category (`post.categoryIds[0]`); its multi-category `CategoryLabelList` was built for the
375
- * feed and never shipped, and the 3-chip list lives on the post page only.
436
+ * Name of the post's main category, as rich text. It's the first of the post's categories
437
+ * that still exists.
438
+ *
439
+ * Empty when none of the post's categories exists. In the editor, but not in Preview, a
440
+ * sample name instead.
376
441
  */
377
442
  itemCategoryLabel: RichText;
378
- /** Mirrors the Post Item manifest's nested (non-bindable) `recentPostItem` data item. */
443
+ /** Post's title and slug, as plain text. */
379
444
  recentPostItem: {
380
- title: string;
445
+ /** Post's title. */title: string; /** Post's slug, the last part of the post page's URL. */
381
446
  slug: string;
382
447
  };
383
448
  /**
384
- * Whether the post takes new comments — the Comments widget's lock in a cell. Runtime-only
385
- * like `itemCoverMedia`; `undefined` (partial fieldset, canvas stand-in) reads as unlocked.
449
+ * Whether site visitors can comment on the post.
450
+ *
451
+ * `undefined` when it isn't known, such as for the sample posts in the editor.
386
452
  */
387
453
  commentingEnabled: boolean | undefined;
388
454
  }
389
- /** Display-ready copy for the Repeater's bindable `emptyState: {title, description}`
390
- * prop (the manifest's `emptyState` item). The provider never renders it — the
391
- * Repeater shows it (editor stage) when its bound items array is empty. The copy comes
392
- * from the site-language labels (`PostLabels.noPostsEmptyState`). */
455
+ /** Text to show in place of an empty list of posts. */
393
456
  type EmptyStateContent = EmptyStateLabels;
394
457
  //#endregion
395
458
  //#region src/extensions/post-list-context-provider/post-list-context-provider.d.ts
396
- /**
397
- * Which feed view the page is showing, resolved from the URL and the fetched page — the
398
- * Category Header widget's whole input (runtime-only, never a bindable `context.items` entry,
399
- * so it freezes no manifest keys).
400
- *
401
- * `pending` is the Suspense fallback's value, NOT `all`: the fallback renders before the page
402
- * resolves, and claiming `all` there would flash the "All Posts" label on a category URL.
403
- * A slug that matched nothing resolves to `all` — a truthful empty feed makes no header claim.
404
- *
405
- * Only a category has a description and a cover; a tag carries a label alone (the Blog API's
406
- * `BlogTag` has no such fields).
407
- */
459
+ /** View of the feed that the page's URL shows. It's all posts, one category, or one tag. */
408
460
  type FilteredFeedView = {
461
+ /**
462
+ * Loading state, while the first page of posts loads.
463
+ *
464
+ * Also `'pending'` when the posts failed to show, with `hasError` set to `true`.
465
+ */
409
466
  kind: 'pending';
410
467
  } | {
468
+ /**
469
+ * Unfiltered feed. The URL isn't a category or tag page.
470
+ *
471
+ * Also `'all'` when no category or tag matches the URL, and the feed is then empty, and
472
+ * when the first page of posts failed to load.
473
+ */
411
474
  kind: 'all';
412
475
  } | {
413
- kind: 'category';
414
- title: string;
476
+ /** Category's posts, on a category page such as `/blog/category/<slug>`. */kind: 'category'; /** Category's name. */
477
+ title: string; /** Category's description. Empty when the category has none. */
415
478
  description: string;
479
+ /**
480
+ * Category's cover image, with its URL, size, and alt text.
481
+ *
482
+ * `undefined` when the category has no cover image.
483
+ */
416
484
  coverImage: Image | undefined;
417
485
  } | {
418
- kind: 'tag';
486
+ /** Tag's posts, on a tag page such as `/blog/tag/<slug>`. */kind: 'tag'; /** Tag's name. */
419
487
  title: string;
420
488
  };
421
489
  /** The blog feed: its posts, loading and error state, and paging, as read through {@link useBlogFeedContext}. */
422
490
  interface PostListContextType {
491
+ /**
492
+ * Posts in the feed, one item per post, in the order the feed shows them.
493
+ *
494
+ * The list starts with the first page of posts, and `loadMorePosts()` adds each later page
495
+ * to its end. It's empty while the first page loads, and when the first page failed to
496
+ * load.
497
+ *
498
+ * In the editor, but not in Preview, the list holds three sample posts to design with when
499
+ * the feed has no posts, the page isn't a category or tag page, and none of the
500
+ * **Category**, **Posts**, and **Featured Posts Only** settings is set. Preview and the live
501
+ * site show the empty list.
502
+ */
423
503
  postsList: PostListItem[];
424
504
  /**
425
- * The manifest's `postGalleryItems` — the same posts as Fast Gallery `VisualMedia`
426
- * items (cover + title + excerpt + post-page link). Coverless posts are filtered out:
427
- * a bound gallery is a media wall, and a cell with no media is a broken cell.
505
+ * Posts in the feed as gallery media items, in the same order as `postsList`. Each item
506
+ * holds the post's cover image or video, the post's title and excerpt, and a link to the
507
+ * post's page.
508
+ *
509
+ * Posts with no cover, or whose author hid the cover, are left out. A post whose cover is an
510
+ * embedded video, such as a YouTube video, appears as the video's thumbnail image, and is
511
+ * left out when the video has no thumbnail.
512
+ *
513
+ * In the editor, but not in Preview, the list holds three sample items to design with when
514
+ * no post in the feed has a cover, the page isn't a category or tag page, and none of the
515
+ * **Category**, **Posts**, and **Featured Posts Only** settings is set.
428
516
  */
429
517
  postGalleryItems: VisualMedia[];
518
+ /**
519
+ * Title and description to show in place of the posts when the feed has no posts, in the
520
+ * site's language.
521
+ *
522
+ * `null` while the feed has posts, while the first page of posts loads, and when posts
523
+ * failed to load. In the editor, it's set for an empty feed even while `postsList` holds
524
+ * sample posts, so check that `postsList` is empty before you show it.
525
+ */
430
526
  emptyState: EmptyStateContent | null;
431
527
  /**
432
- * The posts read failed and this feed is showing nothing it fetched — a bindable
433
- * signal so a builder can put an error message (or a retry link) where the cards
434
- * would be. Distinct from an empty feed on purpose: `emptyState` stays null while
435
- * this is true, because "No posts yet" is a lie about a failed request.
528
+ * Whether posts failed to load.
529
+ *
530
+ * While it's `true`, `emptyState` is `null`, so show an error message instead of a message
531
+ * that the blog has no posts.
532
+ *
533
+ * A failed `loadMorePosts()` call sets it to `true` and keeps the posts already loaded. The
534
+ * next successful `loadMorePosts()` call sets it back to `false`.
535
+ *
536
+ * When the first page of posts failed to load, `hasMorePosts` is `false`, so
537
+ * `loadMorePosts()` does nothing and `hasError` stays `true`. Reloading the page tries
538
+ * again.
436
539
  */
437
540
  hasError: boolean;
541
+ /**
542
+ * Whether `loadMorePosts()` can load more posts.
543
+ *
544
+ * `false` when the feed shows hand-picked posts, because they all load at once. When the
545
+ * number of posts is an exact multiple of the number loaded at a time, it stays `true`
546
+ * until a `loadMorePosts()` call finds no more posts.
547
+ *
548
+ * Also `false` while the first page of posts loads, and when it failed to load.
549
+ */
438
550
  hasMorePosts: boolean;
551
+ /**
552
+ * Whether posts are loading. `true` while the first page of posts loads, and while
553
+ * `loadMorePosts()` loads another page.
554
+ */
439
555
  isLoadingPosts: boolean;
556
+ /**
557
+ * Loads the next page of posts and adds it to the end of `postsList` and `postGalleryItems`.
558
+ *
559
+ * A page holds the number of posts set in the **Posts** Data Source's **Posts Per Load**
560
+ * setting, up to 100, or 6 when it isn't set.
561
+ *
562
+ * Does nothing when `hasMorePosts` is `false`. A call made while a page is loading returns
563
+ * the promise of the call in progress, so each page loads once.
564
+ *
565
+ * When the page fails to load, the promise still resolves. `hasError` becomes `true`, and
566
+ * the next call tries the same page again.
567
+ *
568
+ * @returns Promise that resolves when the page has loaded, or has failed to load.
569
+ *
570
+ * @example Add a button that loads more posts
571
+ * ```tsx
572
+ * import { useBlogFeedContext } from '@wix/blog/blog-feed-context-provider';
573
+ *
574
+ * function LoadMoreButton() {
575
+ * const { hasMorePosts, isLoadingPosts, loadMorePosts } = useBlogFeedContext();
576
+ *
577
+ * if (!hasMorePosts) {
578
+ * return null;
579
+ * }
580
+ *
581
+ * return (
582
+ * <button disabled={isLoadingPosts} onClick={() => loadMorePosts()}>
583
+ * {isLoadingPosts ? 'Loading...' : 'Load more posts'}
584
+ * </button>
585
+ * );
586
+ * }
587
+ * ```
588
+ */
440
589
  loadMorePosts: () => Promise<void>;
441
590
  /**
442
- * Runtime-only (the Category Header widget reads it through this hook) — deliberately not a
443
- * `context.items` entry: item keys and dataTypes freeze per app once pushed (error 6001).
591
+ * View of the feed that the page's URL shows, with the category's or tag's details. It's
592
+ * all posts, one category, or one tag.
593
+ *
594
+ * It's set from the URL when the first page of posts loads, and doesn't change when
595
+ * `loadMorePosts()` loads more posts.
596
+ *
597
+ * @example Show the category's or tag's name above the posts
598
+ * ```tsx
599
+ * import { useBlogFeedContext } from '@wix/blog/blog-feed-context-provider';
600
+ *
601
+ * function FeedHeading() {
602
+ * const { filteredView } = useBlogFeedContext();
603
+ *
604
+ * switch (filteredView.kind) {
605
+ * case 'category':
606
+ * return (
607
+ * <header>
608
+ * <h1>{filteredView.title}</h1>
609
+ * <p>{filteredView.description}</p>
610
+ * </header>
611
+ * );
612
+ * case 'tag':
613
+ * return <h1>Posts tagged {filteredView.title}</h1>;
614
+ * case 'all':
615
+ * return <h1>All posts</h1>;
616
+ * default:
617
+ * return null;
618
+ * }
619
+ * }
620
+ * ```
444
621
  */
445
622
  filteredView: FilteredFeedView;
446
623
  }
447
- /** Reads the blog feed from the nearest feed context provider; throws outside one. */
624
+ /**
625
+ * The Blog Feed context provides access to a list of the site's published blog posts, loaded
626
+ * a page at a time. Use it to show posts, load more of them, and show the feed's empty,
627
+ * loading, and error states.
628
+ */
448
629
  declare function useBlogFeedContext(): PostListContextType;
449
630
  /** Loads a page of blog posts, filtered by the URL view or the picked category or posts, and supplies them as a feed. */
450
631
  declare function PostListProvider({
@@ -130,26 +130,25 @@ type RichText = {
130
130
  };
131
131
  //#endregion
132
132
  //#region src/extensions/post-context-provider/utils.d.ts
133
- /**
134
- * One item of the `postCategories` array — the object the platform hands the Category Item
135
- * context provider as its `categoryData` prop (via the manifest's `contextImplementor`).
136
- *
137
- * `_id`/`label` are the manifest contract (`CATEGORY_ITEM_CONTRACT_ITEMS`, plain text and
138
- * non-bindable); the remaining keys must match the Category Item context manifest's
139
- * `context.items` keys, because the runtime resolves an element's binding by looking the
140
- * key up on that provider's hook return value.
141
- */
133
+ /** A category the post belongs to. */
142
134
  interface PostCategoryItem {
143
- /** Repeater item identity; also the manifest contract's `_id`. */
135
+ /** The category's ID. */
144
136
  _id: string;
145
- /** The manifest contract's `label` (plain text, non-bindable — see the richText label below). */
137
+ /** The category's name, as plain text. */
146
138
  label: string;
139
+ /**
140
+ * The category's name, as rich text: `text` is the plain text, and `html` is an HTML
141
+ * paragraph.
142
+ */
147
143
  itemCategoryLabel: RichText;
148
- /** The category's feed view; `undefined` (unlinked) without a resolvable base or slug. */
144
+ /**
145
+ * Link to the blog page that lists the category's posts, with its URL in `href`.
146
+ * `undefined` when the site has no such page.
147
+ */
149
148
  itemCategoryLink: Link | undefined;
150
- /** Mirrors the Category Item manifest's nested (non-bindable) `categoryItem` data item. */
149
+ /** The category's name and slug. */
151
150
  categoryItem: {
152
- label: string;
151
+ /** The category's name. */label: string; /** The category's slug, the part of its page's URL that identifies it. */
153
152
  slug: string;
154
153
  };
155
154
  }