@wix/blog 1.0.701 → 1.0.703

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 (48) hide show
  1. package/_sdk-exports/context-blog-feed/runtime.js +2 -2
  2. package/_sdk-exports/context-post/runtime.d.ts +200 -115
  3. package/_sdk-exports/context-post/runtime.js +2 -5
  4. package/_sdk-exports/context-post-by-id/runtime.js +3 -3
  5. package/_sdk-exports/context-post-by-slug/runtime.d.ts +18 -0
  6. package/_sdk-exports/context-post-by-slug/runtime.js +5 -0
  7. package/_sdk-exports/context-post-item/runtime.d.ts +2 -3
  8. package/_sdk-exports/context-post-item/runtime.js +4 -4
  9. package/_sdk-exports/context-related-posts/runtime.js +2 -2
  10. package/build/cjs/context-blog-feed.js +1 -1
  11. package/build/cjs/context-blog-feed.js.map +1 -1
  12. package/build/cjs/context-post-by-id.js +534 -496
  13. package/build/cjs/context-post-by-id.js.map +1 -1
  14. package/build/cjs/context-post-by-slug.d.ts +18 -0
  15. package/build/cjs/context-post-by-slug.js +5455 -0
  16. package/build/cjs/context-post-by-slug.js.map +1 -0
  17. package/build/cjs/context-post-item.d.ts +2 -3
  18. package/build/cjs/context-post-item.js +801 -787
  19. package/build/cjs/context-post-item.js.map +1 -1
  20. package/build/cjs/context-post.d.ts +200 -115
  21. package/build/cjs/context-post.js +342 -5175
  22. package/build/cjs/context-post.js.map +1 -1
  23. package/build/cjs/context-related-posts.js +1 -1
  24. package/build/cjs/context-related-posts.js.map +1 -1
  25. package/build/es/context-blog-feed.mjs +1 -1
  26. package/build/es/context-blog-feed.mjs.map +1 -1
  27. package/build/es/context-post-by-id.mjs +534 -496
  28. package/build/es/context-post-by-id.mjs.map +1 -1
  29. package/build/es/context-post-by-slug.d.mts +18 -0
  30. package/build/es/context-post-by-slug.mjs +5415 -0
  31. package/build/es/context-post-by-slug.mjs.map +1 -0
  32. package/build/es/context-post-item.d.mts +2 -3
  33. package/build/es/context-post-item.mjs +802 -798
  34. package/build/es/context-post-item.mjs.map +1 -1
  35. package/build/es/context-post.d.mts +200 -115
  36. package/build/es/context-post.mjs +341 -5173
  37. package/build/es/context-post.mjs.map +1 -1
  38. package/build/es/context-related-posts.mjs +1 -1
  39. package/build/es/context-related-posts.mjs.map +1 -1
  40. package/build/internal/cjs/context-post-by-slug.d.ts +18 -0
  41. package/build/internal/cjs/context-post-item.d.ts +2 -3
  42. package/build/internal/cjs/context-post.d.ts +200 -115
  43. package/build/internal/es/context-post-by-slug.d.mts +18 -0
  44. package/build/internal/es/context-post-item.d.mts +2 -3
  45. package/build/internal/es/context-post.d.mts +200 -115
  46. package/context/post-by-slug/package.json +3 -0
  47. package/package.json +14 -2
  48. package/post-by-slug-context-provider/package.json +3 -0
@@ -1,5 +1,106 @@
1
1
  import React from "react";
2
2
 
3
+ //#region ../../node_modules/@wix/editor-react-types/dist/links.d.ts
4
+ type LinkTarget = '_self' | '_blank';
5
+ /**
6
+ * A link to a URL, used for navigation within components.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import type { Link } from '@wix/editor-react-types';
11
+ *
12
+ * interface MyComponentProps {
13
+ * link?: Link;
14
+ * }
15
+ * ```
16
+ */
17
+ type Link$1 = {
18
+ /**
19
+ * The link URL. For partial links (see `pageRole`), this is the router prefix
20
+ * (e.g. `https://www.my-site.com/prefix`) rather than a fully resolved URL.
21
+ */
22
+ href?: string;
23
+ /**
24
+ * Where this link should open.
25
+ * - `'_self'` — opens in the same page.
26
+ * - `'_blank'` — opens in a new tab.
27
+ */
28
+ target?: LinkTarget; /** The `rel` attribute of the link. Accepts LinkRel values separated by a space. */
29
+ rel?: string;
30
+ /**
31
+ * Page role identifier. Present only on partial links, where only the router prefix is
32
+ * known and the full URL format is owned by the Router/App. Applications can use such
33
+ * links in functions to resolve the complete URL at runtime (e.g. for binding links).
34
+ * Resolved links will not have this field.
35
+ */
36
+ pageRole?: string;
37
+ };
38
+ //#endregion
39
+ //#region ../../node_modules/@wix/editor-react-types/dist/image.d.ts
40
+ type Point = {
41
+ x: number;
42
+ y: number;
43
+ };
44
+ type Crop$1 = Point & {
45
+ width: number;
46
+ height: number;
47
+ };
48
+ /**
49
+ * An image from Wix Media.
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * import type { Image } from '@wix/editor-react-types';
54
+ *
55
+ * interface MyComponentProps {
56
+ * image?: Image;
57
+ * }
58
+ *
59
+ * const MyComponent = ({ image }: MyComponentProps) => (
60
+ * <img src={image?.url} alt={image?.alt} />
61
+ * );
62
+ * ```
63
+ */
64
+ type Image$1 = {
65
+ /** The image URI. */uri?: string; /** The image URL. */
66
+ url: string; /** The image file name. */
67
+ name?: string; /** The image height in pixels. */
68
+ height?: number; /** The image width in pixels. */
69
+ width?: number; /** Whether the image is animated (e.g. GIF). */
70
+ animated?: boolean; /** The crop region applied to the image. */
71
+ crop?: Crop$1; /** The image quality, as a percentage from 0 to 100. */
72
+ quality?: number; /** The image alt text for accessibility. */
73
+ alt?: string;
74
+ };
75
+ //#endregion
76
+ //#region ../../node_modules/@wix/editor-react-types/dist/base.d.ts
77
+ /**
78
+ * Rich text content with resolved links.
79
+ *
80
+ * @example
81
+ * ```tsx
82
+ * import type { RichText } from '@wix/editor-react-types';
83
+ *
84
+ * interface MyComponentProps {
85
+ * description?: RichText;
86
+ * }
87
+ *
88
+ * const MyComponent = ({ description }: MyComponentProps) => (
89
+ * <div>
90
+ * {description?.html}
91
+ * {description?.linkList.map((link) => (
92
+ * <a key={link.href} href={link.href}>{link.href}</a>
93
+ * ))}
94
+ * </div>
95
+ * );
96
+ * ```
97
+ */
98
+ type RichText = {
99
+ /** The original rich text content. */text: string; /** The HTML content with all links resolved. */
100
+ html: string; /** All links present in the rich text content. */
101
+ linkList: Array<Link$1>;
102
+ };
103
+ //#endregion
3
104
  //#region src/hooks/post-likes.types.d.ts
4
105
  interface PostLikes {
5
106
  isLiked: boolean;
@@ -395,7 +496,7 @@ interface ButtonData {
395
496
  /** The text to display on the button. */
396
497
  text?: string | null;
397
498
  /** Button link details. */
398
- link?: Link$1;
499
+ link?: Link;
399
500
  /** Node animation. */
400
501
  animation?: Animation;
401
502
  }
@@ -627,7 +728,7 @@ interface Styles {
627
728
  /** Background styling for hover state (color or gradient). */
628
729
  backgroundHover?: Background;
629
730
  }
630
- interface Link$1 extends LinkDataOneOf {
731
+ interface Link extends LinkDataOneOf {
631
732
  /** The absolute URL for the linked document. */
632
733
  url?: string;
633
734
  /** The target node's ID. Used for linking to another node in this object. */
@@ -1071,11 +1172,11 @@ interface V1Media {
1071
1172
  /** Media duration in seconds. Only relevant for audio and video files. */
1072
1173
  duration?: number | null;
1073
1174
  }
1074
- interface Image$1 {
1175
+ interface Image {
1075
1176
  /** Image file details. */
1076
1177
  media?: V1Media;
1077
1178
  /** Link details for images that are links. */
1078
- link?: Link$1;
1179
+ link?: Link;
1079
1180
  }
1080
1181
  interface Video {
1081
1182
  /** Video file details. */
@@ -1085,7 +1186,7 @@ interface Video {
1085
1186
  }
1086
1187
  interface Item extends ItemDataOneOf {
1087
1188
  /** An image item. */
1088
- image?: Image$1;
1189
+ image?: Image;
1089
1190
  /** A video item. */
1090
1191
  video?: Video;
1091
1192
  /** Item title. */
@@ -1096,7 +1197,7 @@ interface Item extends ItemDataOneOf {
1096
1197
  /** @oneof */
1097
1198
  interface ItemDataOneOf {
1098
1199
  /** An image item. */
1099
- image?: Image$1;
1200
+ image?: Image;
1100
1201
  /** A video item. */
1101
1202
  video?: Video;
1102
1203
  }
@@ -1140,14 +1241,14 @@ declare enum Orientation {
1140
1241
  }
1141
1242
  /** @enumType */
1142
1243
  type OrientationWithLiterals = Orientation | 'ROWS' | 'COLUMNS';
1143
- declare enum Crop$1 {
1244
+ declare enum Crop {
1144
1245
  /** Crop to fill */
1145
1246
  FILL = "FILL",
1146
1247
  /** Crop to fit */
1147
1248
  FIT = "FIT"
1148
1249
  }
1149
1250
  /** @enumType */
1150
- type CropWithLiterals = Crop$1 | 'FILL' | 'FIT';
1251
+ type CropWithLiterals = Crop | 'FILL' | 'FIT';
1151
1252
  declare enum ThumbnailsAlignment {
1152
1253
  /** Top alignment */
1153
1254
  TOP = "TOP",
@@ -1290,7 +1391,7 @@ interface ImageData {
1290
1391
  /** Image file details. */
1291
1392
  image?: V1Media;
1292
1393
  /** Link details for images that are links. */
1293
- link?: Link$1;
1394
+ link?: Link;
1294
1395
  /** Sets whether the image expands to full screen when clicked. Defaults to `false`. */
1295
1396
  disableExpand?: boolean | null;
1296
1397
  /** Image's alternative text. */
@@ -1342,7 +1443,7 @@ interface LinkPreviewData {
1342
1443
  /** Styling for the link preview's container. */
1343
1444
  containerData?: PluginContainerData;
1344
1445
  /** Link details. */
1345
- link?: Link$1;
1446
+ link?: Link;
1346
1447
  /** Preview title. */
1347
1448
  title?: string | null;
1348
1449
  /** Preview thumbnail URL. */
@@ -1752,7 +1853,7 @@ interface ColorDataBackground {
1752
1853
  }
1753
1854
  interface LinkData {
1754
1855
  /** Link details. */
1755
- link?: Link$1;
1856
+ link?: Link;
1756
1857
  }
1757
1858
  interface MentionData {
1758
1859
  /** The mentioned user's name. */
@@ -2632,7 +2733,7 @@ interface ShapeData {
2632
2733
  /** Node animation. */
2633
2734
  animation?: Animation;
2634
2735
  /** Link details for shapes that are links. */
2635
- link?: Link$1;
2736
+ link?: Link;
2636
2737
  /**
2637
2738
  * Alternate text describing the link's purpose for accessibility. Applies only when `link` is set.
2638
2739
  * @maxLength 1000
@@ -2984,105 +3085,72 @@ interface TextNodeStyle {
2984
3085
  lineHeight?: string | null;
2985
3086
  }
2986
3087
  //#endregion
2987
- //#region ../../node_modules/@wix/editor-react-types/dist/links.d.ts
2988
- type LinkTarget = '_self' | '_blank';
3088
+ //#region src/lib/parse-post-cover-media.d.ts
3089
+ /** Playable file of a cover video uploaded to Wix. */
3090
+ interface VideoSource {
3091
+ /** URL of the video file. */
3092
+ url: string;
3093
+ /** Width of the video, in pixels. `undefined` when it isn't known. */
3094
+ width?: number;
3095
+ /** Height of the video, in pixels. `undefined` when it isn't known. */
3096
+ height?: number;
3097
+ }
3098
+ /** Site that hosts an embedded cover video. */
3099
+ type EmbedProvider =
2989
3100
  /**
2990
- * A link to a URL, used for navigation within components.
2991
- *
2992
- * @example
2993
- * ```tsx
2994
- * import type { Link } from '@wix/editor-react-types';
2995
- *
2996
- * interface MyComponentProps {
2997
- * link?: Link;
2998
- * }
2999
- * ```
3101
+ * YouTube. `embedUrl` is the video in YouTube's player, set to play as soon as it loads,
3102
+ * so load it only after a site visitor clicks to play.
3103
+ */
3104
+ 'youtube'
3105
+ /**
3106
+ * Vimeo. `embedUrl` is the video in Vimeo's player, set to play as soon as it loads, so
3107
+ * load it only after a site visitor clicks to play.
3108
+ */
3109
+ | 'vimeo' /** Any other site. There's no `embedUrl`, so show the thumbnail instead of a player. */ | 'unknown';
3110
+ /**
3111
+ * Post's cover. It's an image, a video uploaded to Wix, or a video from another site, such as
3112
+ * YouTube, embedded by its URL.
3000
3113
  */
3001
- type Link = {
3114
+ type CoverMedia = {
3115
+ /** Image cover. */kind: 'image'; /** Cover image, with its URL, size, and alt text. */
3116
+ image: Image$1;
3117
+ } | {
3118
+ /** Cover video uploaded to Wix. */kind: 'wixVideo'; /** Video ID. */
3119
+ id: string;
3120
+ /**
3121
+ * URL of the video's poster image, the image shown before the video plays.
3122
+ *
3123
+ * `undefined` when the video has no poster image.
3124
+ */
3125
+ posterUrl?: string; /** Width of the poster image, in pixels. `undefined` when it isn't known. */
3126
+ posterWidth?: number; /** Height of the poster image, in pixels. `undefined` when it isn't known. */
3127
+ posterHeight?: number;
3002
3128
  /**
3003
- * The link URL. For partial links (see `pageRole`), this is the router prefix
3004
- * (e.g. `https://www.my-site.com/prefix`) rather than a fully resolved URL.
3129
+ * Playable files of the video, the recommended one first.
3130
+ *
3131
+ * Empty when the video's files couldn't be loaded. Show the poster image instead.
3005
3132
  */
3006
- href?: string;
3133
+ sources: VideoSource[]; /** Alt text for the cover. The post's title when the cover has no alt text. */
3134
+ altText: string;
3135
+ } | {
3136
+ /** Cover video embedded from another site, such as YouTube. */kind: 'embed'; /** Site that hosts the video. */
3137
+ provider: EmbedProvider; /** URL of the video on its own site. */
3138
+ videoUrl: string;
3007
3139
  /**
3008
- * Where this link should open.
3009
- * - `'_self'` — opens in the same page.
3010
- * - `'_blank'` — opens in a new tab.
3140
+ * URL of the video in its site's player, set to play as soon as it loads.
3141
+ *
3142
+ * `undefined` when `provider` is `'unknown'`.
3011
3143
  */
3012
- target?: LinkTarget; /** The `rel` attribute of the link. Accepts LinkRel values separated by a space. */
3013
- rel?: string;
3144
+ embedUrl?: string;
3014
3145
  /**
3015
- * Page role identifier. Present only on partial links, where only the router prefix is
3016
- * known and the full URL format is owned by the Router/App. Applications can use such
3017
- * links in functions to resolve the complete URL at runtime (e.g. for binding links).
3018
- * Resolved links will not have this field.
3146
+ * URL of the video's thumbnail image.
3147
+ *
3148
+ * `undefined` when the video has no thumbnail.
3019
3149
  */
3020
- pageRole?: string;
3021
- };
3022
- //#endregion
3023
- //#region ../../node_modules/@wix/editor-react-types/dist/image.d.ts
3024
- type Point = {
3025
- x: number;
3026
- y: number;
3027
- };
3028
- type Crop = Point & {
3029
- width: number;
3030
- height: number;
3031
- };
3032
- /**
3033
- * An image from Wix Media.
3034
- *
3035
- * @example
3036
- * ```tsx
3037
- * import type { Image } from '@wix/editor-react-types';
3038
- *
3039
- * interface MyComponentProps {
3040
- * image?: Image;
3041
- * }
3042
- *
3043
- * const MyComponent = ({ image }: MyComponentProps) => (
3044
- * <img src={image?.url} alt={image?.alt} />
3045
- * );
3046
- * ```
3047
- */
3048
- type Image = {
3049
- /** The image URI. */uri?: string; /** The image URL. */
3050
- url: string; /** The image file name. */
3051
- name?: string; /** The image height in pixels. */
3052
- height?: number; /** The image width in pixels. */
3053
- width?: number; /** Whether the image is animated (e.g. GIF). */
3054
- animated?: boolean; /** The crop region applied to the image. */
3055
- crop?: Crop; /** The image quality, as a percentage from 0 to 100. */
3056
- quality?: number; /** The image alt text for accessibility. */
3057
- alt?: string;
3058
- };
3059
- //#endregion
3060
- //#region ../../node_modules/@wix/editor-react-types/dist/base.d.ts
3061
- /**
3062
- * Rich text content with resolved links.
3063
- *
3064
- * @example
3065
- * ```tsx
3066
- * import type { RichText } from '@wix/editor-react-types';
3067
- *
3068
- * interface MyComponentProps {
3069
- * description?: RichText;
3070
- * }
3071
- *
3072
- * const MyComponent = ({ description }: MyComponentProps) => (
3073
- * <div>
3074
- * {description?.html}
3075
- * {description?.linkList.map((link) => (
3076
- * <a key={link.href} href={link.href}>{link.href}</a>
3077
- * ))}
3078
- * </div>
3079
- * );
3080
- * ```
3081
- */
3082
- type RichText = {
3083
- /** The original rich text content. */text: string; /** The HTML content with all links resolved. */
3084
- html: string; /** All links present in the rich text content. */
3085
- linkList: Array<Link>;
3150
+ thumbnailUrl?: string; /** Width of the thumbnail image, in pixels. `undefined` when it isn't known. */
3151
+ thumbnailWidth?: number; /** Height of the thumbnail image, in pixels. `undefined` when it isn't known. */
3152
+ thumbnailHeight?: number; /** Alt text for the cover. The post's title when the cover has no alt text. */
3153
+ altText: string;
3086
3154
  };
3087
3155
  //#endregion
3088
3156
  //#region src/lib/blog-api.d.ts
@@ -3112,7 +3180,7 @@ interface PostCategoryItem {
3112
3180
  * Link to the blog page that lists the category's posts, with its URL in `href`.
3113
3181
  * `undefined` when the site has no such page.
3114
3182
  */
3115
- itemCategoryLink: Link | undefined;
3183
+ itemCategoryLink: Link$1 | undefined;
3116
3184
  /** The category's name and slug. */
3117
3185
  categoryItem: {
3118
3186
  /** The category's name. */label: string; /** The category's slug, the part of its page's URL that identifies it. */
@@ -3133,7 +3201,7 @@ interface PostTagItem {
3133
3201
  * Link to the blog page that lists the tag's posts, with its URL in `href`. `undefined`
3134
3202
  * when the site has no such page.
3135
3203
  */
3136
- itemTagLink: Link | undefined;
3204
+ itemTagLink: Link$1 | undefined;
3137
3205
  /** The tag's name and slug. */
3138
3206
  tagItem: {
3139
3207
  /** The tag's name. */label: string; /** The tag's slug, the part of its page's URL that identifies it. */
@@ -3156,7 +3224,12 @@ interface PostDerivedData {
3156
3224
  * It holds the image even when the post's author hid the cover, so check `hasCoverImage`
3157
3225
  * before you show it.
3158
3226
  */
3159
- coverImage: Image | undefined;
3227
+ coverImage: Image$1 | undefined;
3228
+ /**
3229
+ * The post's cover as an image, an uploaded video or an embedded video, for a cover player.
3230
+ * `undefined` when the post has no cover or its author hid it.
3231
+ */
3232
+ coverMedia: CoverMedia | undefined;
3160
3233
  /**
3161
3234
  * The post's full body, as a Ricos rich content document. Show it with a rich content
3162
3235
  * viewer.
@@ -3171,7 +3244,7 @@ interface PostDerivedData {
3171
3244
  * The profile picture of the post's author, as an `Image` from `@wix/editor-react-types`.
3172
3245
  * `undefined` when the author has none.
3173
3246
  */
3174
- authorImage: Image | undefined;
3247
+ authorImage: Image$1 | undefined;
3175
3248
  /**
3176
3249
  * The post's estimated reading time with its unit, such as `3 min read`, as rich text in the
3177
3250
  * site's language. Empty when the post has no estimate.
@@ -3200,6 +3273,11 @@ interface PostDerivedData {
3200
3273
  likeCount: RichText;
3201
3274
  /** The categories the post belongs to, in the post's order. Empty when it has none. */
3202
3275
  postCategories: PostCategoryItem[];
3276
+ /**
3277
+ * The name of the post's main category, its first one, as rich text. Empty when the post has
3278
+ * no category.
3279
+ */
3280
+ itemCategoryLabel: RichText;
3203
3281
  /** The post's tags, in the post's order. Empty when it has none. */
3204
3282
  postTags: PostTagItem[];
3205
3283
  /**
@@ -3336,12 +3414,22 @@ type PostContextType = PostDerivedData & {
3336
3414
  * when there's no URL to share, such as while the post loads or when there's no post.
3337
3415
  */
3338
3416
  postUrl: string | undefined;
3417
+ /**
3418
+ * Link to the post's page, for a title, an image, or a button. `undefined` when `postUrl` is,
3419
+ * except in the editor outside Preview mode, where a post-less component gets a sample link.
3420
+ */
3421
+ itemLink: Link$1 | undefined;
3339
3422
  /**
3340
3423
  * IDs used to pick the posts related to this post: the post's own ID, its category IDs,
3341
3424
  * and the related posts its author chose. The object stays the same when
3342
3425
  * the like state changes, so you can use it as an effect dependency.
3343
3426
  */
3344
3427
  relatedPostsSource: RelatedPostsSource;
3428
+ /**
3429
+ * Whether site visitors can comment on the post, as set in the Blog dashboard. `undefined`
3430
+ * while the post loads, when there's no post, and when the post doesn't say.
3431
+ */
3432
+ commentingEnabled: boolean | undefined;
3345
3433
  /**
3346
3434
  * Whether the post is still loading. While it's `true`, the other properties are empty.
3347
3435
  * Use it to show a placeholder instead of empty content.
@@ -3370,17 +3458,14 @@ declare function usePostContext(): PostContextType;
3370
3458
  interface PostProviderProps {
3371
3459
  children?: React.ReactNode;
3372
3460
  /**
3373
- * A post resolved by another provider that lists this one in its manifest `refContexts` —
3374
- * published as-is, with no fetch, SEO, view count or translation redirect: those belong to
3375
- * the post page. Without it this provider is the post page's own (`PostBySlugProvider`).
3376
- * The same hybrid as wixstores' `category-info-context-provider`: a value-only base would
3377
- * blank every live post page, which has this provider attached and relies on it fetching.
3378
- * A caller with nothing to show must still pass a value (an empty one), or this falls back
3379
- * to fetching the page's slug.
3461
+ * The post to publish, resolved by a provider that lists this one in its manifest
3462
+ * `refContexts`: Post Page (the URL's post), Selected Post or a Post List cell. Published
3463
+ * as-is: this provider fetches nothing. Without one it renders its children bare, like
3464
+ * wixstores' `ProductContextProvider` and lite-events' `EventContextProvider`.
3380
3465
  */
3381
3466
  value?: PostContextType;
3382
3467
  }
3383
- /** Supplies the current blog post: the one a parent context hands down, or the post page's own. */
3468
+ /** Supplies the blog post a parent context hands down to descendant components. */
3384
3469
  declare function PostProvider({
3385
3470
  children,
3386
3471
  value