@wix/blog 1.0.711 → 1.0.713

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 (41) hide show
  1. package/_sdk-exports/context-category-item/runtime.d.ts +6 -2
  2. package/_sdk-exports/context-post/runtime.d.ts +9 -1
  3. package/_sdk-exports/context-post-by-id/runtime.d.ts +8 -1
  4. package/_sdk-exports/context-post-by-id/runtime.js +2 -2
  5. package/_sdk-exports/context-post-by-slug/runtime.d.ts +7 -1
  6. package/_sdk-exports/context-post-by-slug/runtime.js +3 -3
  7. package/_sdk-exports/context-post-list-item/runtime.d.ts +6 -2
  8. package/_sdk-exports/context-tag-item/runtime.d.ts +5 -2
  9. package/build/cjs/context-category-item.d.ts +6 -2
  10. package/build/cjs/context-post-by-id.d.ts +9 -2
  11. package/build/cjs/context-post-by-id.js +15 -12
  12. package/build/cjs/context-post-by-id.js.map +1 -1
  13. package/build/cjs/context-post-by-slug.d.ts +8 -2
  14. package/build/cjs/context-post-by-slug.js +423 -420
  15. package/build/cjs/context-post-by-slug.js.map +1 -1
  16. package/build/cjs/context-post-list-item.d.ts +6 -2
  17. package/build/cjs/context-post.d.ts +9 -1
  18. package/build/cjs/context-tag-item.d.ts +5 -2
  19. package/build/es/context-category-item.d.mts +6 -2
  20. package/build/es/context-post-by-id.d.mts +9 -2
  21. package/build/es/context-post-by-id.mjs +15 -12
  22. package/build/es/context-post-by-id.mjs.map +1 -1
  23. package/build/es/context-post-by-slug.d.mts +8 -2
  24. package/build/es/context-post-by-slug.mjs +423 -420
  25. package/build/es/context-post-by-slug.mjs.map +1 -1
  26. package/build/es/context-post-list-item.d.mts +6 -2
  27. package/build/es/context-post.d.mts +9 -1
  28. package/build/es/context-tag-item.d.mts +5 -2
  29. package/build/internal/cjs/context-category-item.d.ts +6 -2
  30. package/build/internal/cjs/context-post-by-id.d.ts +9 -2
  31. package/build/internal/cjs/context-post-by-slug.d.ts +8 -2
  32. package/build/internal/cjs/context-post-list-item.d.ts +6 -2
  33. package/build/internal/cjs/context-post.d.ts +9 -1
  34. package/build/internal/cjs/context-tag-item.d.ts +5 -2
  35. package/build/internal/es/context-category-item.d.mts +6 -2
  36. package/build/internal/es/context-post-by-id.d.mts +9 -2
  37. package/build/internal/es/context-post-by-slug.d.mts +8 -2
  38. package/build/internal/es/context-post-list-item.d.mts +6 -2
  39. package/build/internal/es/context-post.d.mts +9 -1
  40. package/build/internal/es/context-tag-item.d.mts +5 -2
  41. package/package.json +2 -2
@@ -484,8 +484,12 @@ type PostItemContextType = PostListItem & Omit<PostLikes, 'likeCount' | 'viewCou
484
484
  commentCount: RichText;
485
485
  };
486
486
  /**
487
- * Nullable rather than throwing: the hook runs for every element inside the repeater
488
- * cell, including on the editor stage before the cell is populated.
487
+ * The Post List Item context provides access to the post in one item of a repeater connected to
488
+ * the **Posts** list in the Posts Data Source or the **Related Posts** list in the Related Posts
489
+ * Data Source. Use it to show the post's title, excerpt, cover, author, publish date, and counts,
490
+ * and to let a site visitor like the post.
491
+ *
492
+ * Returns `null` outside such a repeater item, and in the editor before the item holds a post.
489
493
  */
490
494
  declare function usePostListItemContext(): PostItemContextType | null;
491
495
  /** Props accepted by {@link PostItemContextProvider}. */
@@ -3501,7 +3501,15 @@ type PostContextType = PostDerivedData & {
3501
3501
  */
3502
3502
  isEmpty: boolean;
3503
3503
  };
3504
- /** Reads the current post from the nearest Post context provider; throws outside one. */
3504
+ /**
3505
+ * The Post context provides access to a blog post: the post on a blog post page, the one a Wix
3506
+ * user chooses in the Selected Post Data Source, or the one in a repeater item of a post list.
3507
+ * Use it to show the post's content, author, publish date, counts, categories, and tags, and to
3508
+ * let a site visitor like the post.
3509
+ *
3510
+ * When the component is in more than one of these, such as a repeater item on a blog post page,
3511
+ * it returns the post of the innermost one. Anywhere else, it throws an error.
3512
+ */
3505
3513
  declare function usePostContext(): PostContextType;
3506
3514
  /** Props accepted by {@link PostProvider}. */
3507
3515
  interface PostProviderProps {
@@ -163,8 +163,11 @@ interface PostTagItem {
163
163
  */
164
164
  type TagItemContextType = PostTagItem;
165
165
  /**
166
- * Nullable rather than throwing: the hook runs for every element inside the repeater cell,
167
- * including on the editor stage before the cell is populated.
166
+ * The Tag Item context provides access to one of a blog post's tags, in an item of a repeater
167
+ * connected to the post's **Post Tags** list. Use it to show the tag's name and link to the blog
168
+ * page that lists its posts.
169
+ *
170
+ * Returns `null` outside such a repeater item, and in the editor before the item holds a tag.
168
171
  */
169
172
  declare function useTagItemContext(): TagItemContextType | null;
170
173
  /** Props accepted by {@link TagItemContextProvider}. */
@@ -165,8 +165,12 @@ interface PostCategoryItem {
165
165
  */
166
166
  type CategoryItemContextType = PostCategoryItem;
167
167
  /**
168
- * Nullable rather than throwing: the hook runs for every element inside the repeater cell,
169
- * including on the editor stage before the cell is populated.
168
+ * The Category Item context provides access to one of a blog post's categories, in an item of a
169
+ * repeater connected to the post's **Post Categories** list. Use it to show the category's name
170
+ * and link to the blog page that lists its posts.
171
+ *
172
+ * Returns `null` outside such a repeater item, and in the editor before the item holds a
173
+ * category.
170
174
  */
171
175
  declare function useCategoryItemContext(): CategoryItemContextType | null;
172
176
  /** Props accepted by {@link CategoryItemContextProvider}. */
@@ -1,5 +1,5 @@
1
+ import { PostContextType } from '@wix/blog/post-context-provider';
1
2
  import React from 'react';
2
- export { usePostContext as usePostByIdContext } from '@wix/blog/post-context-provider';
3
3
 
4
4
  //#region src/lib/category-picker.d.ts
5
5
  /** A WQL clause the filter picker stores for one inline field. */
@@ -16,6 +16,13 @@ interface PostPickerFilter {
16
16
  }
17
17
  //#endregion
18
18
  //#region src/extensions/post-by-id-context-provider/post-by-id-context-provider.d.ts
19
+ /**
20
+ * The Post by ID context provides access to a blog post: the one a Wix user chooses in the
21
+ * Selected Post Data Source, the one on a blog post page, or the one in a repeater item of a post
22
+ * list. Use it to show the post's content, author, publish date, counts, categories, and tags,
23
+ * and to let a site visitor like the post.
24
+ */
25
+ declare function usePostByIdContext(): PostContextType;
19
26
  /** Props accepted by {@link PostByIdProvider}. */
20
27
  interface PostByIdProviderProps {
21
28
  children?: React.ReactNode;
@@ -28,4 +35,4 @@ declare function PostByIdProvider({
28
35
  postPicker
29
36
  }: PostByIdProviderProps): React.ReactNode;
30
37
 
31
- export { PostByIdProvider, type PostByIdProviderProps, PostByIdProvider as default };
38
+ export { PostByIdProvider, type PostByIdProviderProps, PostByIdProvider as default, usePostByIdContext };
@@ -4569,24 +4569,27 @@ var cd = (e6) => {
4569
4569
  var ld = { ...rd(), isLiked: false, likeCountValue: 0, isLikeCountLoaded: false, toggleLike: async () => {
4570
4570
  }, liveLikes: void 0, postUrl: void 0, itemLink: void 0, clockValue: 0, relatedPostsSource: { currentPostId: void 0, categoryIds: void 0, relatedPostIds: void 0 }, commentingEnabled: void 0, isLoadingPost: true, hasError: false, isEmpty: false };
4571
4571
  var ud = { ...ld, isLoadingPost: false, hasError: true, isEmpty: true };
4572
- var dd = 2500;
4573
- var fd = Promise.resolve(od({ post: void 0, author: void 0, metrics: void 0, categories: [], tags: [], fetchedAt: 0 }));
4574
- var pd = ({ children: t2, postId: n2, postLoadPromise: r2, monitoringClient: i2 }) => {
4572
+ function dd() {
4573
+ return t();
4574
+ }
4575
+ var fd = 2500;
4576
+ var pd = Promise.resolve(od({ post: void 0, author: void 0, metrics: void 0, categories: [], tags: [], fetchedAt: 0 }));
4577
+ var md = ({ children: t2, postId: n2, postLoadPromise: r2, monitoringClient: i2 }) => {
4575
4578
  let { post: a2, hasError: o2 } = Vn(r2), c2 = Xn(a2, s(() => n2 ? El(n2) : Promise.resolve(void 0), [n2])), l2 = ad({ postWithAuthor: c2, hasError: o2, monitoringClient: i2, isPostInPreview: false, postPageBase: dr() });
4576
4579
  return mr(fr.postByIdProvider, o2 ? `error` : c2.post ? `data` : `empty`), h(e, { value: l2, children: t2 });
4577
4580
  };
4578
- function md({ children: t2, postPicker: n2 }) {
4581
+ function hd({ children: t2, postPicker: n2 }) {
4579
4582
  let i2 = zl(n2), a2 = Gn(), o2 = gr(), s2 = u(() => jl(zn), []), { i18n: c2, locale: l2 } = Go($o), d2 = qn(() => i2 ? Un(Mo({ key: `blog-builder:post-by-id:${i2}`, warmupData: o2, fetchData: () => {
4580
4583
  let e6 = Dl(i2, a2);
4581
- return Il(Pl(s2, `post-by-id-read`, { feature: Al.post }, a2 ? fl(e6, dd, `post-by-id`) : e6));
4582
- } }), od, a2 ? cd : sd) : fd, [i2, a2, o2, s2]);
4583
- return h(bo, { i18n: c2, children: g(r, { fallback: h(e, { value: ld, children: t2 }), children: [h(Wo, { i18n: c2, locale: l2 }), h(Fl, { fallback: h(e, { value: ud, children: t2 }), feature: Al.post, monitoringClient: s2, rethrow: a2, children: h(pd, { postId: i2, postLoadPromise: d2, monitoringClient: s2, children: t2 }, i2 ?? ``) })] }) });
4584
+ return Il(Pl(s2, `post-by-id-read`, { feature: Al.post }, a2 ? fl(e6, fd, `post-by-id`) : e6));
4585
+ } }), od, a2 ? cd : sd) : pd, [i2, a2, o2, s2]);
4586
+ return h(bo, { i18n: c2, children: g(r, { fallback: h(e, { value: ld, children: t2 }), children: [h(Wo, { i18n: c2, locale: l2 }), h(Fl, { fallback: h(e, { value: ud, children: t2 }), feature: Al.post, monitoringClient: s2, rethrow: a2, children: h(md, { postId: i2, postLoadPromise: d2, monitoringClient: s2, children: t2 }, i2 ?? ``) })] }) });
4584
4587
  }
4585
- var hd = Mn(`474ee948-702b-4c0f-970e-b5319eff6d8b`);
4588
+ var gd = Mn(`474ee948-702b-4c0f-970e-b5319eff6d8b`);
4586
4589
  export {
4587
- md as PostByIdProvider,
4588
- md as default,
4589
- hd as injectAccessTokenGetter,
4590
- t as usePostByIdContext
4590
+ hd as PostByIdProvider,
4591
+ hd as default,
4592
+ gd as injectAccessTokenGetter,
4593
+ dd as usePostByIdContext
4591
4594
  };
4592
4595
  //# sourceMappingURL=context-post-by-id.mjs.map