@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
@@ -102,9 +102,11 @@ type RichText = {
102
102
  };
103
103
  //#endregion
104
104
  //#region src/i18n/post-labels.types.d.ts
105
- /** Display-ready copy for the Repeater's bindable `emptyState: {title, description}` prop. */
105
+ /** Text to show in place of an empty list of posts. */
106
106
  interface EmptyStateLabels {
107
+ /** Heading to show in place of the empty list, in the site's language. */
107
108
  title: string;
109
+ /** Sentence to show under the heading, in the site's language. */
108
110
  description: string;
109
111
  }
110
112
  //#endregion
@@ -174,160 +176,254 @@ declare global {
174
176
  }
175
177
  //#endregion
176
178
  //#region src/lib/parse-post-cover-media.d.ts
177
- /** One playable rendition of a Wix-hosted cover video (a raw REST `VideoResolution`). */
179
+ /** Playable file of a cover video uploaded to Wix. */
178
180
  interface VideoSource {
181
+ /** URL of the video file. */
179
182
  url: string;
183
+ /** Width of the video, in pixels. `undefined` when it isn't known. */
180
184
  width?: number;
185
+ /** Height of the video, in pixels. `undefined` when it isn't known. */
181
186
  height?: number;
182
187
  }
183
- type EmbedProvider = 'youtube' | 'vimeo' | 'unknown';
188
+ /** Site that hosts an embedded cover video. */
189
+ type EmbedProvider =
184
190
  /**
185
- * The post cover as the Cover Media widget consumes it — a discriminated union over the
186
- * `post.media` oneof: a Wix-hosted image, a Wix-hosted video (`wixMedia.videoV2`), or an
187
- * externally hosted embed (`embedMedia`, YouTube/Vimeo).
191
+ * YouTube. `embedUrl` is the video in YouTube's player, set to play as soon as it loads,
192
+ * so load it only after a site visitor clicks to play.
193
+ */
194
+ 'youtube'
195
+ /**
196
+ * Vimeo. `embedUrl` is the video in Vimeo's player, set to play as soon as it loads, so
197
+ * load it only after a site visitor clicks to play.
198
+ */
199
+ | 'vimeo' /** Any other site. There's no `embedUrl`, so show the thumbnail instead of a player. */ | 'unknown';
200
+ /**
201
+ * Post's cover. It's an image, a video uploaded to Wix, or a video from another site, such as
202
+ * YouTube, embedded by its URL.
188
203
  */
189
204
  type CoverMedia = {
190
- kind: 'image';
205
+ /** Image cover. */kind: 'image'; /** Cover image, with its URL, size, and alt text. */
191
206
  image: Image;
192
207
  } | {
193
- kind: 'wixVideo'; /** The WixMedia video id — the `wix:video://v1/<id>/...` path segment. */
208
+ /** Cover video uploaded to Wix. */kind: 'wixVideo'; /** Video ID. */
194
209
  id: string;
195
- posterUrl?: string;
196
- posterWidth?: number;
210
+ /**
211
+ * URL of the video's poster image, the image shown before the video plays.
212
+ *
213
+ * `undefined` when the video has no poster image.
214
+ */
215
+ posterUrl?: string; /** Width of the poster image, in pixels. `undefined` when it isn't known. */
216
+ posterWidth?: number; /** Height of the poster image, in pixels. `undefined` when it isn't known. */
197
217
  posterHeight?: number;
198
218
  /**
199
- * Playable mp4 renditions, optimal-first. Empty when the raw REST join was
200
- * unavailable — the widget then renders the poster alone (see post-video-api.ts
201
- * for why the SDK's `videoV2` string cannot carry these).
219
+ * Playable files of the video, the recommended one first.
220
+ *
221
+ * Empty when the video's files couldn't be loaded. Show the poster image instead.
202
222
  */
203
- sources: VideoSource[];
223
+ sources: VideoSource[]; /** Alt text for the cover. The post's title when the cover has no alt text. */
204
224
  altText: string;
205
225
  } | {
206
- kind: 'embed';
207
- provider: EmbedProvider; /** The author-supplied external video URL, as the Blog API stores it. */
208
- videoUrl: string; /** Provider player URL for click-to-play; absent for an unrecognized provider. */
226
+ /** Cover video embedded from another site, such as YouTube. */kind: 'embed'; /** Site that hosts the video. */
227
+ provider: EmbedProvider; /** URL of the video on its own site. */
228
+ videoUrl: string;
229
+ /**
230
+ * URL of the video in its site's player, set to play as soon as it loads.
231
+ *
232
+ * `undefined` when `provider` is `'unknown'`.
233
+ */
209
234
  embedUrl?: string;
210
- thumbnailUrl?: string;
211
- thumbnailWidth?: number;
212
- thumbnailHeight?: number;
235
+ /**
236
+ * URL of the video's thumbnail image.
237
+ *
238
+ * `undefined` when the video has no thumbnail.
239
+ */
240
+ thumbnailUrl?: string; /** Width of the thumbnail image, in pixels. `undefined` when it isn't known. */
241
+ thumbnailWidth?: number; /** Height of the thumbnail image, in pixels. `undefined` when it isn't known. */
242
+ thumbnailHeight?: number; /** Alt text for the cover. The post's title when the cover has no alt text. */
213
243
  altText: string;
214
244
  };
215
245
  //#endregion
216
246
  //#region src/extensions/post-list-context-provider/utils.d.ts
217
- /**
218
- * One item of the `postsList` array — the object the platform hands the Post Item
219
- * context provider as its `postData` prop (via the manifest's `contextImplementor`).
220
- * The `item*`/`recentPostItem` keys must match the Post Item context manifest's
221
- * `context.items` keys — the runtime resolves an element's binding by looking the key
222
- * up on the per-item hook's return value.
223
- */
247
+ /** Post with its fields ready to show in a repeater item. */
224
248
  interface PostListItem {
225
- /** Repeater item identity; also the manifest contract's `_id`. */
249
+ /** Post ID. */
226
250
  _id: string;
227
- /** The manifest contract's `title` (plain text, non-bindable — see `itemTitle` below). */
251
+ /** Post's title, as plain text. */
228
252
  title: string;
253
+ /**
254
+ * Post's title, as rich text. Its `text` field holds the plain text, and its `html` field
255
+ * holds the text as an HTML paragraph.
256
+ */
229
257
  itemTitle: RichText;
258
+ /** Post's excerpt, as rich text. Empty when the post has no excerpt. */
230
259
  itemExcerpt: RichText;
260
+ /**
261
+ * Post's cover image, with its URL, size, and alt text. For a post whose cover is a video
262
+ * uploaded to Wix, the video's poster image.
263
+ *
264
+ * `undefined` when there's no image to show, such as when the cover is an embedded video.
265
+ *
266
+ * It holds the cover image even when the post's author hid the cover. To leave out a hidden
267
+ * cover, check `itemCoverMedia`, which is `undefined` then.
268
+ */
231
269
  itemCoverImage: Image | undefined;
232
270
  /**
233
- * The cover as the Cover Media widget renders it — image OR playable video, where
234
- * `itemCoverImage` above can only ever be the image. Runtime-only by design: deliberately
235
- * absent from `POST_ITEM_CONTRACT_ITEMS` and the Post Item manifest (the runtime injects
236
- * the full item object regardless, and the manifest contract must stay text-scalars-only —
237
- * see post-item-contract.ts). Not bindable in Connect Value; consumed via
238
- * `usePostItemContext()` only.
271
+ * Post's cover as an image or a playable video. Use it to play a video cover, which
272
+ * `itemCoverImage` holds only as its poster image.
273
+ *
274
+ * `undefined` when the post has no cover, or the post's author hid it.
239
275
  */
240
276
  itemCoverMedia: CoverMedia | undefined;
277
+ /**
278
+ * Link to the post's page. `href` is the page's URL, and `target` is `'_self'`, so the link
279
+ * opens in the same tab.
280
+ *
281
+ * `undefined` when the post has no slug and no URL.
282
+ */
241
283
  itemLink: Link | undefined;
284
+ /**
285
+ * Date the post was first published, as rich text in the site's regional format. In the
286
+ * week after publishing, it's relative, such as "3 days ago". After that, it's a date, such
287
+ * as "Aug 5", with the year when it isn't the current year.
288
+ */
242
289
  itemPublishedDate: RichText;
243
290
  /**
244
- * Raw values for the compact widgets (Metadata, Counters), which format for themselves
245
- * (a design-panel date/number format) instead of parsing the richText labels above.
246
- * Runtime-only like `itemCoverMedia` — never bindable items. JSON-safe on purpose (ISO
247
- * string, numbers): the item crosses the platform's per-cell prop injection, and a `Date`
248
- * would not survive the round-trip.
291
+ * Date the post was first published, as an
292
+ * [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) string.
293
+ *
294
+ * `undefined` when the post has no publish date.
249
295
  */
250
- /** ISO 8601; `undefined` for a post without `firstPublishedDate`. */
251
296
  publishedDateValue: string | undefined;
252
297
  /**
253
- * The clock `itemPublishedDate` was formatted from (`useHydrationClock`) — the compact
254
- * widgets format `publishedDateValue` for themselves and must use the same one, or their
255
- * label would hydrate against a different "now" than the bound text did.
298
+ * Current time that `itemPublishedDate` is relative to, in milliseconds since the Unix
299
+ * epoch.
300
+ *
301
+ * When you format `publishedDateValue` as a relative date yourself, use this value as the
302
+ * current time, so your text matches `itemPublishedDate`.
256
303
  */
257
304
  clockValue: number;
258
- /** `undefined` when absent OR 0 — the same API-artifact rule as `timeToRead` below. */
305
+ /**
306
+ * Estimated reading time, in minutes.
307
+ *
308
+ * `undefined` when the post has no estimate.
309
+ */
259
310
  minutesToReadValue: number | undefined;
260
311
  /**
261
- * The server-side METRICS counters as raw numbers, the seed the Post Item provider
262
- * publishes as `viewCountValue`/`commentCountValue` until its client-only metrics read
263
- * lands (and for good in the editor, where that read is skipped). Same three-way rule as
264
- * the `viewCount`/`commentCount` labels: metric → canvas stand-in → `undefined`, never 0.
312
+ * Number of times the post was viewed, as loaded with the post.
313
+ *
314
+ * `undefined` when the count wasn't loaded with the post. In the editor, but not in Preview,
315
+ * a sample number instead.
265
316
  */
266
317
  initialViewCount: number | undefined;
267
- initialCommentCount: number | undefined;
268
318
  /**
269
- * The remaining keys reuse the Post context's names verbatim — the registry is per app and
270
- * keyed by item path, so re-declaring a key at the same dataType on the Post Item context
271
- * costs no new registry rows (the same trick `likeCount` already relies on).
319
+ * Number of comments on the post, as loaded with the post.
320
+ *
321
+ * `undefined` when the count wasn't loaded with the post. In the editor, but not in Preview,
322
+ * a sample number instead.
272
323
  */
324
+ initialCommentCount: number | undefined;
325
+ /** Name of the post's author, as rich text. Empty when the author isn't found. */
273
326
  authorName: RichText;
327
+ /**
328
+ * Author's profile photo, with its URL, size, and alt text. The alt text is the author's
329
+ * name, or a generic author-photo label when the author has no name.
330
+ *
331
+ * `undefined` when the author has no photo.
332
+ */
274
333
  authorImage: Image | undefined;
334
+ /**
335
+ * Estimated reading time as rich text in the site's language, such as "5 min read".
336
+ *
337
+ * Empty when the post has no estimate.
338
+ */
275
339
  timeToRead: RichText;
276
340
  /**
277
- * Resolved in priority order by `counterLabel`:
278
- * 1. the post's own `metrics` (the `METRICS` fieldset) — renders everywhere, including
279
- * the editor canvas and inside SSR HTML;
280
- * 2. an editor stand-in, when the API answers without metrics;
281
- * 3. blank, for the Post Item provider to fill in from its per-cell metrics read.
341
+ * Number of views as rich text in the site's language, such as "1,234 views".
282
342
  *
283
- * Blank rather than zero at step 3 because a seeded "0 views" reads as a confident wrong
284
- * number until that read lands. Step 1 exists because step 3 alone is not enough: the
285
- * per-cell read is client-only by design (personal data must never bake into SSR HTML the
286
- * host caches for days) AND is skipped outright in the editor, which left a bound counter
287
- * permanently blank on the canvas.
343
+ * Empty when the count wasn't loaded with the post. In the editor, but not in Preview, a
344
+ * sample count instead.
288
345
  */
289
346
  viewCount: RichText;
347
+ /**
348
+ * Number of comments as rich text in the site's language.
349
+ *
350
+ * Empty when the count wasn't loaded with the post. In the editor, but not in Preview, a
351
+ * sample count instead.
352
+ */
290
353
  commentCount: RichText;
291
354
  /**
292
- * The post's MAIN category label — one, not a list. blog-client's feed card renders a single
293
- * category (`post.categoryIds[0]`); its multi-category `CategoryLabelList` was built for the
294
- * feed and never shipped, and the 3-chip list lives on the post page only.
355
+ * Name of the post's main category, as rich text. It's the first of the post's categories
356
+ * that still exists.
357
+ *
358
+ * Empty when none of the post's categories exists. In the editor, but not in Preview, a
359
+ * sample name instead.
295
360
  */
296
361
  itemCategoryLabel: RichText;
297
- /** Mirrors the Post Item manifest's nested (non-bindable) `recentPostItem` data item. */
362
+ /** Post's title and slug, as plain text. */
298
363
  recentPostItem: {
299
- title: string;
364
+ /** Post's title. */title: string; /** Post's slug, the last part of the post page's URL. */
300
365
  slug: string;
301
366
  };
302
367
  /**
303
- * Whether the post takes new comments — the Comments widget's lock in a cell. Runtime-only
304
- * like `itemCoverMedia`; `undefined` (partial fieldset, canvas stand-in) reads as unlocked.
368
+ * Whether site visitors can comment on the post.
369
+ *
370
+ * `undefined` when it isn't known, such as for the sample posts in the editor.
305
371
  */
306
372
  commentingEnabled: boolean | undefined;
307
373
  }
308
- /** Display-ready copy for the Repeater's bindable `emptyState: {title, description}`
309
- * prop (the manifest's `emptyState` item). The provider never renders it — the
310
- * Repeater shows it (editor stage) when its bound items array is empty. The copy comes
311
- * from the site-language labels (`PostLabels.noPostsEmptyState`). */
374
+ /** Text to show in place of an empty list of posts. */
312
375
  type EmptyStateContent = EmptyStateLabels;
313
376
  //#endregion
314
377
  //#region src/extensions/related-posts-context-provider/related-posts-context-provider.d.ts
315
- /** Posts related to the current post, as read through {@link useRelatedPostsContext}. */
378
+ /** Value of the Related Posts context, with the posts related to the current blog post. */
316
379
  interface RelatedPostsContextType {
380
+ /**
381
+ * Posts related to the current post.
382
+ *
383
+ * When the current post's writer picked related posts for it, and at least one of them still
384
+ * exists, these are the picked posts that still exist, in the order the writer picked them.
385
+ * Otherwise, they're the most recently published posts in the site's language that share a
386
+ * category with the current post, newest first. When the current post has no categories,
387
+ * they're the blog's most recently published posts in the site's language. The current post
388
+ * is never one of them.
389
+ *
390
+ * Limited to the number in the **Related Posts** Data Source's **Number of Posts** setting,
391
+ * up to 12. When the setting is empty, limited to 3.
392
+ *
393
+ * Empty while the posts load for the first time, and when they fail to load. To tell those
394
+ * apart from a post with no related posts, check `isLoadingRelatedPosts` and `hasError`. In
395
+ * the editor, but not in Preview, it holds sample posts whenever there are no posts to show,
396
+ * including when they fail to load, but not when an error stops them from rendering.
397
+ */
317
398
  relatedPosts: PostListItem[];
318
- /** The Repeater's bindable `emptyState` source (the manifest's `emptyState` item) —
319
- * null while loading or while the strip has posts, same contract as the feed's. */
399
+ /**
400
+ * Text to show in place of the list when the current post has no related posts.
401
+ *
402
+ * `null` while the posts load, when they fail to load, and when there are related posts. In
403
+ * the editor, but not in Preview, it's also set while `relatedPosts` holds sample posts,
404
+ * unless the posts failed to load.
405
+ */
320
406
  emptyState: EmptyStateContent | null;
321
- /** True only while the strip's first fetch is pending — the manifest's bindable
322
- * visibility condition (guidelines' Option 1). */
407
+ /**
408
+ * Whether the related posts are loading for the first time.
409
+ *
410
+ * When the current post changes, it stays `false`, and `relatedPosts` keeps the previous
411
+ * post's related posts until the new ones load.
412
+ */
323
413
  isLoadingRelatedPosts: boolean;
324
414
  /**
325
- * The strip's read failed. Bindable (see the manifest), and told apart from an empty
326
- * strip on purpose: `emptyState` goes null while this is true.
415
+ * Whether the related posts failed to load.
416
+ *
417
+ * When it's `true`, `emptyState` is `null`, so show an error message rather than an empty
418
+ * state. `relatedPosts` is empty, except after a failed load in the editor, but not in
419
+ * Preview, where it holds sample posts.
327
420
  */
328
421
  hasError: boolean;
329
422
  }
330
- /** Reads the related posts from the nearest Related Posts context provider; throws outside one. */
423
+ /**
424
+ * The Related Posts context provides access to a list of blog posts related to the current
425
+ * post. Use it to show related posts, and the list's empty, loading, and error states.
426
+ */
331
427
  declare function useRelatedPostsContext(): RelatedPostsContextType;
332
428
  /** Loads the posts related to the current post and supplies them to its children. */
333
429
  declare function RelatedPostsProvider({
@@ -130,23 +130,24 @@ type RichText = {
130
130
  };
131
131
  //#endregion
132
132
  //#region src/extensions/post-context-provider/utils.d.ts
133
- /**
134
- * One item of the `postTags` array — the object the platform hands the Tag Item context
135
- * provider as its `tagData` prop. The `PostCategoryItem` twin, same contract rules:
136
- * `_id`/`label` are the manifest contract (`TAG_ITEM_CONTRACT_ITEMS`, plain text and
137
- * non-bindable), the remaining keys must match the Tag Item context manifest's `context.items`.
138
- */
133
+ /** A tag on the post. */
139
134
  interface PostTagItem {
140
- /** Repeater item identity; also the manifest contract's `_id`. */
135
+ /** The tag's ID. */
141
136
  _id: string;
142
- /** The manifest contract's `label` (plain text, non-bindable — see the richText label below). */
137
+ /** The tag's name, as plain text. */
143
138
  label: string;
139
+ /**
140
+ * The tag's name, as rich text: `text` is the plain text, and `html` is an HTML paragraph.
141
+ */
144
142
  itemTagLabel: RichText;
145
- /** The tag's feed view; `undefined` (unlinked) without a resolvable base or slug. */
143
+ /**
144
+ * Link to the blog page that lists the tag's posts, with its URL in `href`. `undefined`
145
+ * when the site has no such page.
146
+ */
146
147
  itemTagLink: Link | undefined;
147
- /** Mirrors the Tag Item manifest's nested (non-bindable) `tagItem` data item. */
148
+ /** The tag's name and slug. */
148
149
  tagItem: {
149
- label: string;
150
+ /** The tag's name. */label: string; /** The tag's slug, the part of its page's URL that identifies it. */
150
151
  slug: string;
151
152
  };
152
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/blog",
3
- "version": "1.0.692",
3
+ "version": "1.0.693",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -181,5 +181,5 @@
181
181
  "optional": true
182
182
  }
183
183
  },
184
- "falconPackageHash": "4c1dd8ae1e8356c90902ec913dbd842494869971096e08673e07f38d"
184
+ "falconPackageHash": "aaffc0494d1b7e0b3b844267be239a4ee4a956f0e35e3e32e52a7bea"
185
185
  }