@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.
- package/_sdk-exports/context-blog-feed-context-provider/runtime.d.ts +280 -99
- package/_sdk-exports/context-category-item-context-provider/runtime.d.ts +13 -14
- package/_sdk-exports/context-post-context-provider/runtime.d.ts +257 -81
- package/_sdk-exports/context-post-item-context-provider/runtime.d.ts +201 -78
- package/_sdk-exports/context-related-posts-context-provider/runtime.d.ts +178 -82
- package/_sdk-exports/context-tag-item-context-provider/runtime.d.ts +12 -11
- package/build/cjs/context-blog-feed-context-provider.d.ts +280 -99
- package/build/cjs/context-category-item-context-provider.d.ts +13 -14
- package/build/cjs/context-post-context-provider.d.ts +257 -81
- package/build/cjs/context-post-item-context-provider.d.ts +201 -78
- package/build/cjs/context-related-posts-context-provider.d.ts +178 -82
- package/build/cjs/context-tag-item-context-provider.d.ts +12 -11
- package/build/es/context-blog-feed-context-provider.d.mts +280 -99
- package/build/es/context-category-item-context-provider.d.mts +13 -14
- package/build/es/context-post-context-provider.d.mts +257 -81
- package/build/es/context-post-item-context-provider.d.mts +201 -78
- package/build/es/context-related-posts-context-provider.d.mts +178 -82
- package/build/es/context-tag-item-context-provider.d.mts +12 -11
- package/build/internal/cjs/context-blog-feed-context-provider.d.ts +280 -99
- package/build/internal/cjs/context-category-item-context-provider.d.ts +13 -14
- package/build/internal/cjs/context-post-context-provider.d.ts +257 -81
- package/build/internal/cjs/context-post-item-context-provider.d.ts +201 -78
- package/build/internal/cjs/context-related-posts-context-provider.d.ts +178 -82
- package/build/internal/cjs/context-tag-item-context-provider.d.ts +12 -11
- package/build/internal/es/context-blog-feed-context-provider.d.mts +280 -99
- package/build/internal/es/context-category-item-context-provider.d.mts +13 -14
- package/build/internal/es/context-post-context-provider.d.mts +257 -81
- package/build/internal/es/context-post-item-context-provider.d.mts +201 -78
- package/build/internal/es/context-related-posts-context-provider.d.mts +178 -82
- package/build/internal/es/context-tag-item-context-provider.d.mts +12 -11
- package/package.json +2 -2
|
@@ -28,17 +28,76 @@ interface PostLikes {
|
|
|
28
28
|
}
|
|
29
29
|
/** What `LiveLikes` reports — the `PostLikes` fields a widget renders. */
|
|
30
30
|
type LiveLikeSnapshot = Pick<PostLikes, 'isLiked' | 'likeCount' | 'isLikeCountLoaded' | 'viewCount' | 'commentCount'>;
|
|
31
|
-
/**
|
|
32
|
-
* Why the like state exists twice: on a hydrating post page, a provider state update that is
|
|
33
|
-
* NOT a transition makes React discard the server HTML of every child boundary still waiting
|
|
34
|
-
* on its module load or the viewport gate (React #421 — thunderbolt logs "SSR HTML discard").
|
|
35
|
-
* So the provider's own state updates only in transitions — but a transition is held until
|
|
36
|
-
* every boundary below has hydrated, which for a viewport-gated one means until the visitor
|
|
37
|
-
* scrolls to it. The Counters and Actions widgets subscribe here instead, after their own
|
|
38
|
-
* mount, and show the fresh numbers right away (`usePostWidgetContext`).
|
|
39
|
-
*/
|
|
31
|
+
/** The site visitor's like state and the post's counts, without delay. */
|
|
40
32
|
interface LiveLikes {
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves the current like state and counts.
|
|
35
|
+
*
|
|
36
|
+
* @returns An object with `isLiked`, `likeCount`, `isLikeCountLoaded`, `viewCount`, and
|
|
37
|
+
* `commentCount`. `likeCount` is the number the context's `likeCountValue` holds, and
|
|
38
|
+
* `isLiked` and `isLikeCountLoaded` match the context properties with the same names.
|
|
39
|
+
*
|
|
40
|
+
* `viewCount` and `commentCount` are numbers, or `undefined` until the current counts load
|
|
41
|
+
* in the browser, and when they can't be loaded, such as in the editor's Preview mode.
|
|
42
|
+
*
|
|
43
|
+
* @example Thank the site visitor after they like the post
|
|
44
|
+
* ```tsx
|
|
45
|
+
* import { useState } from 'react';
|
|
46
|
+
* import { usePostByIdContext } from '@wix/blog/post-by-id-context-provider';
|
|
47
|
+
*
|
|
48
|
+
* function LikeButton() {
|
|
49
|
+
* const { isEmpty, isLiked, liveLikes, toggleLike } = usePostByIdContext();
|
|
50
|
+
* const [isThanked, setIsThanked] = useState(false);
|
|
51
|
+
*
|
|
52
|
+
* if (isEmpty || !liveLikes) {
|
|
53
|
+
* return null;
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* const handleClick = async () => {
|
|
57
|
+
* await toggleLike();
|
|
58
|
+
* // `isLiked` in this function is from before the click. `get()` has the current state.
|
|
59
|
+
* setIsThanked(liveLikes.get().isLiked);
|
|
60
|
+
* };
|
|
61
|
+
*
|
|
62
|
+
* return (
|
|
63
|
+
* <>
|
|
64
|
+
* <button aria-pressed={isLiked} onClick={handleClick}>
|
|
65
|
+
* {isLiked ? 'Liked' : 'Like'}
|
|
66
|
+
* </button>
|
|
67
|
+
* {isThanked && <span>Thanks for liking this post</span>}
|
|
68
|
+
* </>
|
|
69
|
+
* );
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
41
73
|
get(): LiveLikeSnapshot;
|
|
74
|
+
/**
|
|
75
|
+
* Calls a listener each time the like state or the counts change.
|
|
76
|
+
*
|
|
77
|
+
* @param listener Callback that runs after each change, with no arguments. Call `get()` in
|
|
78
|
+
* it to read the new values.
|
|
79
|
+
* @returns Function that removes the listener. Call it when your component unmounts.
|
|
80
|
+
*
|
|
81
|
+
* @example Show the like count as soon as it changes
|
|
82
|
+
* ```tsx
|
|
83
|
+
* import { useSyncExternalStore } from 'react';
|
|
84
|
+
* import { usePostByIdContext } from '@wix/blog/post-by-id-context-provider';
|
|
85
|
+
*
|
|
86
|
+
* const noLikes = () => () => {};
|
|
87
|
+
*
|
|
88
|
+
* function LiveLikeCount() {
|
|
89
|
+
* const { liveLikes } = usePostByIdContext();
|
|
90
|
+
* const readLikeCount = () => liveLikes?.get().likeCount;
|
|
91
|
+
* const likeCount = useSyncExternalStore(
|
|
92
|
+
* liveLikes ? liveLikes.subscribe : noLikes,
|
|
93
|
+
* readLikeCount,
|
|
94
|
+
* readLikeCount,
|
|
95
|
+
* );
|
|
96
|
+
*
|
|
97
|
+
* return likeCount === undefined ? null : <span>{likeCount} likes</span>;
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
42
101
|
subscribe(listener: () => void): () => void;
|
|
43
102
|
}
|
|
44
103
|
//#endregion
|
|
@@ -3027,164 +3086,281 @@ type RichText = {
|
|
|
3027
3086
|
};
|
|
3028
3087
|
//#endregion
|
|
3029
3088
|
//#region src/lib/blog-api.d.ts
|
|
3030
|
-
/**
|
|
3089
|
+
/** IDs from a post that choose its related posts. */
|
|
3031
3090
|
interface RelatedPostsSource {
|
|
3091
|
+
/** The post's ID. `undefined` when there's no post. */
|
|
3032
3092
|
currentPostId: string | undefined;
|
|
3093
|
+
/** IDs of the categories the post belongs to. `undefined` when there's no post. */
|
|
3033
3094
|
categoryIds: string[] | undefined;
|
|
3034
3095
|
/** Writer-curated related posts (max 3, ordered as set in the Blog dashboard). */
|
|
3035
3096
|
relatedPostIds: string[] | undefined;
|
|
3036
3097
|
}
|
|
3037
3098
|
//#endregion
|
|
3038
3099
|
//#region src/extensions/post-context-provider/utils.d.ts
|
|
3039
|
-
/**
|
|
3040
|
-
* One item of the `postCategories` array — the object the platform hands the Category Item
|
|
3041
|
-
* context provider as its `categoryData` prop (via the manifest's `contextImplementor`).
|
|
3042
|
-
*
|
|
3043
|
-
* `_id`/`label` are the manifest contract (`CATEGORY_ITEM_CONTRACT_ITEMS`, plain text and
|
|
3044
|
-
* non-bindable); the remaining keys must match the Category Item context manifest's
|
|
3045
|
-
* `context.items` keys, because the runtime resolves an element's binding by looking the
|
|
3046
|
-
* key up on that provider's hook return value.
|
|
3047
|
-
*/
|
|
3100
|
+
/** A category the post belongs to. */
|
|
3048
3101
|
interface PostCategoryItem {
|
|
3049
|
-
/**
|
|
3102
|
+
/** The category's ID. */
|
|
3050
3103
|
_id: string;
|
|
3051
|
-
/** The
|
|
3104
|
+
/** The category's name, as plain text. */
|
|
3052
3105
|
label: string;
|
|
3106
|
+
/**
|
|
3107
|
+
* The category's name, as rich text: `text` is the plain text, and `html` is an HTML
|
|
3108
|
+
* paragraph.
|
|
3109
|
+
*/
|
|
3053
3110
|
itemCategoryLabel: RichText;
|
|
3054
|
-
/**
|
|
3111
|
+
/**
|
|
3112
|
+
* Link to the blog page that lists the category's posts, with its URL in `href`.
|
|
3113
|
+
* `undefined` when the site has no such page.
|
|
3114
|
+
*/
|
|
3055
3115
|
itemCategoryLink: Link | undefined;
|
|
3056
|
-
/**
|
|
3116
|
+
/** The category's name and slug. */
|
|
3057
3117
|
categoryItem: {
|
|
3058
|
-
label: string;
|
|
3118
|
+
/** The category's name. */label: string; /** The category's slug, the part of its page's URL that identifies it. */
|
|
3059
3119
|
slug: string;
|
|
3060
3120
|
};
|
|
3061
3121
|
}
|
|
3062
|
-
/**
|
|
3063
|
-
* One item of the `postTags` array — the object the platform hands the Tag Item context
|
|
3064
|
-
* provider as its `tagData` prop. The `PostCategoryItem` twin, same contract rules:
|
|
3065
|
-
* `_id`/`label` are the manifest contract (`TAG_ITEM_CONTRACT_ITEMS`, plain text and
|
|
3066
|
-
* non-bindable), the remaining keys must match the Tag Item context manifest's `context.items`.
|
|
3067
|
-
*/
|
|
3122
|
+
/** A tag on the post. */
|
|
3068
3123
|
interface PostTagItem {
|
|
3069
|
-
/**
|
|
3124
|
+
/** The tag's ID. */
|
|
3070
3125
|
_id: string;
|
|
3071
|
-
/** The
|
|
3126
|
+
/** The tag's name, as plain text. */
|
|
3072
3127
|
label: string;
|
|
3128
|
+
/**
|
|
3129
|
+
* The tag's name, as rich text: `text` is the plain text, and `html` is an HTML paragraph.
|
|
3130
|
+
*/
|
|
3073
3131
|
itemTagLabel: RichText;
|
|
3074
|
-
/**
|
|
3132
|
+
/**
|
|
3133
|
+
* Link to the blog page that lists the tag's posts, with its URL in `href`. `undefined`
|
|
3134
|
+
* when the site has no such page.
|
|
3135
|
+
*/
|
|
3075
3136
|
itemTagLink: Link | undefined;
|
|
3076
|
-
/**
|
|
3137
|
+
/** The tag's name and slug. */
|
|
3077
3138
|
tagItem: {
|
|
3078
|
-
label: string;
|
|
3139
|
+
/** The tag's name. */label: string; /** The tag's slug, the part of its page's URL that identifies it. */
|
|
3079
3140
|
slug: string;
|
|
3080
3141
|
};
|
|
3081
3142
|
}
|
|
3082
3143
|
/** Keys must match the manifest's `context.items` keys. */
|
|
3083
3144
|
interface PostDerivedData {
|
|
3145
|
+
/**
|
|
3146
|
+
* The post's title, as rich text: `title.text` is the plain text, and `title.html` is the
|
|
3147
|
+
* same text in an HTML paragraph.
|
|
3148
|
+
*/
|
|
3084
3149
|
title: RichText;
|
|
3150
|
+
/** A short summary of the post, as rich text. To check whether there is one, use `hasExcerpt`. */
|
|
3085
3151
|
excerpt: RichText;
|
|
3152
|
+
/**
|
|
3153
|
+
* The post's cover image, or the poster image of its video cover, as an `Image` from
|
|
3154
|
+
* `@wix/editor-react-types`. `undefined` when the post has neither.
|
|
3155
|
+
*
|
|
3156
|
+
* It holds the image even when the post's author hid the cover, so check `hasCoverImage`
|
|
3157
|
+
* before you show it.
|
|
3158
|
+
*/
|
|
3086
3159
|
coverImage: Image | undefined;
|
|
3087
3160
|
/**
|
|
3088
|
-
* The
|
|
3089
|
-
*
|
|
3161
|
+
* The post's full body, as a Ricos rich content document. Show it with a rich content
|
|
3162
|
+
* viewer.
|
|
3163
|
+
*
|
|
3164
|
+
* When the post is for paying subscribers only and the site visitor can't read all of it,
|
|
3165
|
+
* the body ends where the free part ends, followed by the post's paywall message.
|
|
3090
3166
|
*/
|
|
3091
3167
|
richContent: RichContent;
|
|
3168
|
+
/** The display name of the post's author, as rich text. */
|
|
3092
3169
|
authorName: RichText;
|
|
3170
|
+
/**
|
|
3171
|
+
* The profile picture of the post's author, as an `Image` from `@wix/editor-react-types`.
|
|
3172
|
+
* `undefined` when the author has none.
|
|
3173
|
+
*/
|
|
3093
3174
|
authorImage: Image | undefined;
|
|
3175
|
+
/**
|
|
3176
|
+
* The post's estimated reading time with its unit, such as `3 min read`, as rich text in the
|
|
3177
|
+
* site's language. Empty when the post has no estimate.
|
|
3178
|
+
*/
|
|
3094
3179
|
timeToRead: RichText;
|
|
3180
|
+
/**
|
|
3181
|
+
* The date the post was first published, as rich text in the site's regional format: a
|
|
3182
|
+
* relative date in the last week, such as `3 days ago`, and the calendar date after that,
|
|
3183
|
+
* such as `May 12`, with the year when it isn't the current year, such as `May 12, 2024`.
|
|
3184
|
+
*/
|
|
3095
3185
|
publishedDate: RichText;
|
|
3186
|
+
/**
|
|
3187
|
+
* The post's view count with its unit, such as `340 views`, as rich text. Empty when there's
|
|
3188
|
+
* no count to show.
|
|
3189
|
+
*/
|
|
3096
3190
|
viewCount: RichText;
|
|
3191
|
+
/**
|
|
3192
|
+
* The post's comment count with its unit, such as `4 comments`, as rich text. Empty when
|
|
3193
|
+
* there's no count to show.
|
|
3194
|
+
*/
|
|
3097
3195
|
commentCount: RichText;
|
|
3196
|
+
/**
|
|
3197
|
+
* The post's like count with its unit, such as `12 likes`, as rich text. Includes a like or
|
|
3198
|
+
* unlike from `toggleLike()`. Empty when there's no count to show.
|
|
3199
|
+
*/
|
|
3098
3200
|
likeCount: RichText;
|
|
3201
|
+
/** The categories the post belongs to, in the post's order. Empty when it has none. */
|
|
3099
3202
|
postCategories: PostCategoryItem[];
|
|
3203
|
+
/** The post's tags, in the post's order. Empty when it has none. */
|
|
3100
3204
|
postTags: PostTagItem[];
|
|
3101
3205
|
/**
|
|
3102
|
-
*
|
|
3103
|
-
*
|
|
3104
|
-
*
|
|
3105
|
-
* on a post-less canvas, whose stand-ins should stay visible.
|
|
3206
|
+
* Whether the post shows a cover image, or a video cover with a poster image. `false` when
|
|
3207
|
+
* the post's author hid the cover. `true` in the editor when there's no post, so that
|
|
3208
|
+
* sample content stays visible.
|
|
3106
3209
|
*/
|
|
3107
3210
|
hasCoverImage: boolean;
|
|
3211
|
+
/**
|
|
3212
|
+
* Whether the post has an excerpt that isn't empty. `true` in the editor when there's no
|
|
3213
|
+
* post.
|
|
3214
|
+
*/
|
|
3108
3215
|
hasExcerpt: boolean;
|
|
3216
|
+
/** Whether the post has at least one tag. `true` in the editor when there's no post. */
|
|
3109
3217
|
hasTags: boolean;
|
|
3110
3218
|
/**
|
|
3111
|
-
*
|
|
3112
|
-
*
|
|
3113
|
-
*
|
|
3219
|
+
* The date and time the post was first published, as an ISO 8601 string. `undefined` when
|
|
3220
|
+
* there's no date to show. To format it as a relative date, use `clockValue` as the current
|
|
3221
|
+
* time.
|
|
3114
3222
|
*/
|
|
3115
|
-
/** ISO 8601 `firstPublishedDate`. */
|
|
3116
3223
|
publishedDateValue: string | undefined;
|
|
3117
|
-
/**
|
|
3224
|
+
/** The post's estimated reading time, in minutes. `undefined` when the post has no estimate. */
|
|
3118
3225
|
minutesToReadValue: number | undefined;
|
|
3119
|
-
/**
|
|
3226
|
+
/**
|
|
3227
|
+
* The post's view count. `undefined` when there's no count to show.
|
|
3228
|
+
* Updates when the current count loads in the browser.
|
|
3229
|
+
*/
|
|
3120
3230
|
viewCountValue: number | undefined;
|
|
3231
|
+
/**
|
|
3232
|
+
* The number of comments on the post. `undefined` when there's no count to show. Updates
|
|
3233
|
+
* when the current count loads in the browser.
|
|
3234
|
+
*/
|
|
3121
3235
|
commentCountValue: number | undefined;
|
|
3122
3236
|
}
|
|
3123
3237
|
//#endregion
|
|
3124
3238
|
//#region src/extensions/post-context-provider/post-context-provider.d.ts
|
|
3125
3239
|
/** Fields and like state of the current blog post, as read through {@link usePostContext}. */
|
|
3126
3240
|
type PostContextType = PostDerivedData & {
|
|
3241
|
+
/**
|
|
3242
|
+
* Whether the site visitor liked the post. `false` until the visitor's like state loads in
|
|
3243
|
+
* the browser. Changes when you call `toggleLike()`. To read the change without delay, use
|
|
3244
|
+
* `liveLikes`.
|
|
3245
|
+
*/
|
|
3127
3246
|
isLiked: boolean;
|
|
3128
3247
|
/**
|
|
3129
|
-
*
|
|
3130
|
-
*
|
|
3248
|
+
* Number of likes the post has, including a like or unlike from `toggleLike()`. Until
|
|
3249
|
+
* `isLikeCountLoaded` is `true`, this is the count the page rendered with, which can be out
|
|
3250
|
+
* of date, or `0` when that count isn't available.
|
|
3251
|
+
*
|
|
3252
|
+
* For the count with its unit, such as `12 likes`, use `likeCount`.
|
|
3131
3253
|
*/
|
|
3132
3254
|
likeCountValue: number;
|
|
3133
3255
|
/**
|
|
3134
|
-
*
|
|
3135
|
-
*
|
|
3136
|
-
*
|
|
3256
|
+
* Whether `likeCountValue` is final. `false` on the server, and in the browser while the
|
|
3257
|
+
* current count loads. `true` once the count loads or fails to load, and when there's no
|
|
3258
|
+
* count to load, such as when there's no post or in the editor's Preview mode.
|
|
3259
|
+
*
|
|
3260
|
+
* It stays `false` after an error that stops the post from rendering. `isEmpty` is then
|
|
3261
|
+
* `true`, so check `isEmpty` first.
|
|
3262
|
+
*
|
|
3263
|
+
* @example Show the like count once it's final
|
|
3264
|
+
* ```tsx
|
|
3265
|
+
* import { usePostByIdContext } from '@wix/blog/post-by-id-context-provider';
|
|
3266
|
+
*
|
|
3267
|
+
* function LikeCount() {
|
|
3268
|
+
* const { isEmpty, likeCountValue, isLikeCountLoaded } = usePostByIdContext();
|
|
3269
|
+
*
|
|
3270
|
+
* if (isEmpty) {
|
|
3271
|
+
* return null;
|
|
3272
|
+
* }
|
|
3273
|
+
*
|
|
3274
|
+
* if (!isLikeCountLoaded) {
|
|
3275
|
+
* return <span className="like-count-placeholder" />;
|
|
3276
|
+
* }
|
|
3277
|
+
*
|
|
3278
|
+
* return <span>{likeCountValue} likes</span>;
|
|
3279
|
+
* }
|
|
3280
|
+
* ```
|
|
3137
3281
|
*/
|
|
3138
3282
|
isLikeCountLoaded: boolean;
|
|
3283
|
+
/**
|
|
3284
|
+
* Likes the post for the site visitor, or removes their like if they already liked it.
|
|
3285
|
+
*
|
|
3286
|
+
* `isLiked`, `likeCountValue`, and `likeCount` change, and so do the values of other
|
|
3287
|
+
* components on the page that show the same post. If saving the change fails, they change
|
|
3288
|
+
* back. In the editor's Preview mode, the change isn't saved.
|
|
3289
|
+
*
|
|
3290
|
+
* Does nothing when there's no post, or while a previous call is still saving.
|
|
3291
|
+
*
|
|
3292
|
+
* @param pointerEvent The click that triggered the call. It isn't used, so you can leave it
|
|
3293
|
+
* out.
|
|
3294
|
+
* @returns A promise that resolves when saving the change succeeds or fails. It never
|
|
3295
|
+
* rejects.
|
|
3296
|
+
*
|
|
3297
|
+
* @example Add a like button
|
|
3298
|
+
* ```tsx
|
|
3299
|
+
* import { usePostByIdContext } from '@wix/blog/post-by-id-context-provider';
|
|
3300
|
+
*
|
|
3301
|
+
* function LikeButton() {
|
|
3302
|
+
* const { isEmpty, isLiked, toggleLike } = usePostByIdContext();
|
|
3303
|
+
*
|
|
3304
|
+
* if (isEmpty) {
|
|
3305
|
+
* return null;
|
|
3306
|
+
* }
|
|
3307
|
+
*
|
|
3308
|
+
* return (
|
|
3309
|
+
* <button aria-pressed={isLiked} onClick={() => toggleLike()}>
|
|
3310
|
+
* {isLiked ? 'Liked' : 'Like'}
|
|
3311
|
+
* </button>
|
|
3312
|
+
* );
|
|
3313
|
+
* }
|
|
3314
|
+
* ```
|
|
3315
|
+
*/
|
|
3139
3316
|
toggleLike: (pointerEvent?: PointerEvent) => Promise<void>;
|
|
3140
3317
|
/**
|
|
3141
|
-
* The like state
|
|
3142
|
-
*
|
|
3318
|
+
* The site visitor's like state and the post's counts, without delay.
|
|
3319
|
+
*
|
|
3320
|
+
* `isLiked`, `likeCountValue`, `isLikeCountLoaded`, `viewCountValue`, and
|
|
3321
|
+
* `commentCountValue` update in a React transition, so they can lag behind while other
|
|
3322
|
+
* parts of the page are still loading. To show changes without that delay, read the values
|
|
3323
|
+
* with `liveLikes.get()`, and listen for changes with `liveLikes.subscribe()`.
|
|
3324
|
+
*
|
|
3325
|
+
* `undefined` while the post loads, and after an error that stops the post from rendering.
|
|
3143
3326
|
*/
|
|
3144
3327
|
liveLikes: LiveLikes | undefined;
|
|
3145
3328
|
/**
|
|
3146
|
-
* The
|
|
3147
|
-
*
|
|
3148
|
-
*
|
|
3149
|
-
* `0` on the placeholder, which publishes no date.
|
|
3329
|
+
* The time `publishedDate` measures relative dates from, such as `3 days ago`, in
|
|
3330
|
+
* milliseconds since the Unix epoch. When you format `publishedDateValue` yourself, use it
|
|
3331
|
+
* as the current time, so that your text matches `publishedDate`. `0` while the post loads.
|
|
3150
3332
|
*/
|
|
3151
3333
|
clockValue: number;
|
|
3152
3334
|
/**
|
|
3153
|
-
* Absolute URL of the
|
|
3154
|
-
*
|
|
3155
|
-
* `post.url` first, never the BM preview URL" knowledge stays in one place (`postLink`).
|
|
3156
|
-
* `undefined` in BM draft preview (the current URL carries the instance JWT) and until the
|
|
3157
|
-
* post resolves — the widget disables Share on `undefined`.
|
|
3335
|
+
* Absolute URL of the post's page on the site, such as for a share button. `undefined`
|
|
3336
|
+
* when there's no URL to share, such as while the post loads or when there's no post.
|
|
3158
3337
|
*/
|
|
3159
3338
|
postUrl: string | undefined;
|
|
3160
3339
|
/**
|
|
3161
|
-
*
|
|
3162
|
-
*
|
|
3163
|
-
*
|
|
3164
|
-
*
|
|
3165
|
-
* Note the Related Posts provider does NOT read this: it needs to start its queries
|
|
3166
|
-
* before the post resolves, so it takes the same ids as a promise from
|
|
3167
|
-
* `useOptionalPostSourcePromise`, which is published above the Suspense boundary.
|
|
3340
|
+
* IDs used to pick the posts related to this post: the post's own ID, its category IDs,
|
|
3341
|
+
* and the related posts its author chose. The object stays the same when
|
|
3342
|
+
* the like state changes, so you can use it as an effect dependency.
|
|
3168
3343
|
*/
|
|
3169
3344
|
relatedPostsSource: RelatedPostsSource;
|
|
3170
3345
|
/**
|
|
3171
|
-
*
|
|
3172
|
-
*
|
|
3173
|
-
* consumers that want to render a placeholder rather than blank while the post loads.
|
|
3346
|
+
* Whether the post is still loading. While it's `true`, the other properties are empty.
|
|
3347
|
+
* Use it to show a placeholder instead of empty content.
|
|
3174
3348
|
*/
|
|
3175
3349
|
isLoadingPost: boolean;
|
|
3176
3350
|
/**
|
|
3177
|
-
*
|
|
3178
|
-
*
|
|
3179
|
-
*
|
|
3180
|
-
*
|
|
3351
|
+
* Whether an error stopped the post from rendering. When it's `true`, the properties don't
|
|
3352
|
+
* hold the post's content, and `isEmpty` is `true`. A post that fails to load isn't an
|
|
3353
|
+
* error: `hasError` is `false`, and `isEmpty` is `true`, except in the editor, but not in
|
|
3354
|
+
* Preview, where the properties hold sample values.
|
|
3181
3355
|
*/
|
|
3182
3356
|
hasError: boolean;
|
|
3183
3357
|
/**
|
|
3184
|
-
*
|
|
3185
|
-
*
|
|
3186
|
-
*
|
|
3187
|
-
*
|
|
3358
|
+
* Whether there's no post to show, such as when the Wix user hasn't chosen a post in the
|
|
3359
|
+
* **Selected Post** Data Source's settings, or the chosen post isn't published or couldn't
|
|
3360
|
+
* be loaded. Use it to hide the component, instead of showing empty text and a `0` count.
|
|
3361
|
+
*
|
|
3362
|
+
* `false` while the post loads. Also `false` in the editor outside Preview mode, where the
|
|
3363
|
+
* properties hold sample values, unless an error stopped the post from rendering.
|
|
3188
3364
|
*/
|
|
3189
3365
|
isEmpty: boolean;
|
|
3190
3366
|
};
|