@wix/blog 1.0.699 → 1.0.701

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.
@@ -419,6 +419,14 @@ interface RelatedPostsContextType {
419
419
  * Preview, where it holds sample posts.
420
420
  */
421
421
  hasError: boolean;
422
+ /**
423
+ * Whether there are related posts to show: `true` exactly when `relatedPosts` isn't empty.
424
+ *
425
+ * `false` while the posts load for the first time, when they fail to load, and when the
426
+ * current post has no related posts. In the editor, but not in Preview, it's `true` while
427
+ * `relatedPosts` holds sample posts.
428
+ */
429
+ hasRelatedPosts: boolean;
422
430
  }
423
431
  /**
424
432
  * The Related Posts context provides access to a list of blog posts related to the current
@@ -4307,7 +4307,7 @@ var fu = (e6, t2, n2) => {
4307
4307
  let a2 = n2();
4308
4308
  return r2.set(t2, a2), a2;
4309
4309
  };
4310
- var pu = { relatedPosts: [], emptyState: null, isLoadingRelatedPosts: true, hasError: false };
4310
+ var pu = { relatedPosts: [], emptyState: null, isLoadingRelatedPosts: true, hasError: false, hasRelatedPosts: false };
4311
4311
  var mu = { ...pu, isLoadingRelatedPosts: false, hasError: true };
4312
4312
  var hu = (e6) => ({ strip: e6, hasError: false });
4313
4313
  var gu = () => ({ strip: { posts: [], authorsByMemberId: {}, categoryLabelsById: {}, videoSourcesByPostId: {}, fetchedAt: Date.now() }, hasError: true });
@@ -4316,8 +4316,8 @@ var _u = (e6) => {
4316
4316
  };
4317
4317
  var vu = ({ children: e6, stripLoadPromise: t2, slug: n2, language: r2 }) => {
4318
4318
  let { strip: { posts: i2, authorsByMemberId: a2, categoryLabelsById: o2, videoSourcesByPostId: s2, fetchedAt: l2, demoPosts: u2 }, hasError: d2 } = zn(t2), f2 = Un(l2), m2 = ol(), h2 = or(n2), { t: g2 } = So(), _2 = hr(), v2 = c(() => ts(g2, _2), [g2, _2]), y2 = c(() => {
4319
- let e7 = (i2.length === 0 && m2 ? u2 ?? [] : i2).map((e8) => eu(e8, v2, _2, h2, a2, o2, m2, s2, f2));
4320
- return { relatedPosts: e7.length === 0 && m2 ? au(v2, _2, h2, f2) : e7, emptyState: i2.length === 0 && !d2 ? v2.noRelatedPostsEmptyState() : null, isLoadingRelatedPosts: false, hasError: d2 };
4319
+ let e7 = (i2.length === 0 && m2 ? u2 ?? [] : i2).map((e8) => eu(e8, v2, _2, h2, a2, o2, m2, s2, f2)), t3 = e7.length === 0 && m2 ? au(v2, _2, h2, f2) : e7;
4320
+ return { relatedPosts: t3, emptyState: i2.length === 0 && !d2 ? v2.noRelatedPostsEmptyState() : null, isLoadingRelatedPosts: false, hasError: d2, hasRelatedPosts: t3.length > 0 };
4321
4321
  }, [i2, u2, a2, o2, s2, v2, _2, r2, h2, m2, f2, d2]);
4322
4322
  return dr(lr.relatedPostsProvider, d2 ? `error` : i2.length > 0 ? `data` : `empty`), p(ou.Provider, { value: y2, children: e6 });
4323
4323
  };