@wix/blog 1.0.691 → 1.0.692
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 +483 -0
- package/_sdk-exports/context-blog-feed-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-category-item-context-provider/runtime.d.ts +189 -0
- package/_sdk-exports/context-category-item-context-provider/runtime.js +2 -0
- package/_sdk-exports/context-post-by-id-context-provider/runtime.d.ts +31 -0
- package/_sdk-exports/context-post-by-id-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-post-context-provider/runtime.d.ts +3213 -0
- package/_sdk-exports/context-post-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-post-item-context-provider/runtime.d.ts +386 -0
- package/_sdk-exports/context-post-item-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-related-posts-context-provider/runtime.d.ts +341 -0
- package/_sdk-exports/context-related-posts-context-provider/runtime.js +5 -0
- package/_sdk-exports/context-tag-item-context-provider/runtime.d.ts +185 -0
- package/_sdk-exports/context-tag-item-context-provider/runtime.js +2 -0
- package/blog-feed-context-provider/package.json +3 -0
- package/build/cjs/context-blog-feed-context-provider.d.ts +483 -0
- package/build/cjs/context-blog-feed-context-provider.js +4601 -0
- package/build/cjs/context-blog-feed-context-provider.js.map +1 -0
- package/build/cjs/context-category-item-context-provider.d.ts +189 -0
- package/build/cjs/context-category-item-context-provider.js +578 -0
- package/build/cjs/context-category-item-context-provider.js.map +1 -0
- package/build/cjs/context-post-by-id-context-provider.d.ts +31 -0
- package/build/cjs/context-post-by-id-context-provider.js +4531 -0
- package/build/cjs/context-post-by-id-context-provider.js.map +1 -0
- package/build/cjs/context-post-context-provider.d.ts +3213 -0
- package/build/cjs/context-post-context-provider.js +5404 -0
- package/build/cjs/context-post-context-provider.js.map +1 -0
- package/build/cjs/context-post-item-context-provider.d.ts +386 -0
- package/build/cjs/context-post-item-context-provider.js +3682 -0
- package/build/cjs/context-post-item-context-provider.js.map +1 -0
- package/build/cjs/context-related-posts-context-provider.d.ts +341 -0
- package/build/cjs/context-related-posts-context-provider.js +4355 -0
- package/build/cjs/context-related-posts-context-provider.js.map +1 -0
- package/build/cjs/context-tag-item-context-provider.d.ts +185 -0
- package/build/cjs/context-tag-item-context-provider.js +578 -0
- package/build/cjs/context-tag-item-context-provider.js.map +1 -0
- package/build/es/context-blog-feed-context-provider.d.mts +483 -0
- package/build/es/context-blog-feed-context-provider.mjs +4571 -0
- package/build/es/context-blog-feed-context-provider.mjs.map +1 -0
- package/build/es/context-category-item-context-provider.d.mts +189 -0
- package/build/es/context-category-item-context-provider.mjs +549 -0
- package/build/es/context-category-item-context-provider.mjs.map +1 -0
- package/build/es/context-post-by-id-context-provider.d.mts +31 -0
- package/build/es/context-post-by-id-context-provider.mjs +4491 -0
- package/build/es/context-post-by-id-context-provider.mjs.map +1 -0
- package/build/es/context-post-context-provider.d.mts +3213 -0
- package/build/es/context-post-context-provider.mjs +5374 -0
- package/build/es/context-post-context-provider.mjs.map +1 -0
- package/build/es/context-post-item-context-provider.d.mts +386 -0
- package/build/es/context-post-item-context-provider.mjs +3652 -0
- package/build/es/context-post-item-context-provider.mjs.map +1 -0
- package/build/es/context-related-posts-context-provider.d.mts +341 -0
- package/build/es/context-related-posts-context-provider.mjs +4325 -0
- package/build/es/context-related-posts-context-provider.mjs.map +1 -0
- package/build/es/context-tag-item-context-provider.d.mts +185 -0
- package/build/es/context-tag-item-context-provider.mjs +549 -0
- package/build/es/context-tag-item-context-provider.mjs.map +1 -0
- package/build/internal/cjs/context-blog-feed-context-provider.d.ts +483 -0
- package/build/internal/cjs/context-category-item-context-provider.d.ts +189 -0
- package/build/internal/cjs/context-post-by-id-context-provider.d.ts +31 -0
- package/build/internal/cjs/context-post-context-provider.d.ts +3213 -0
- package/build/internal/cjs/context-post-item-context-provider.d.ts +386 -0
- package/build/internal/cjs/context-related-posts-context-provider.d.ts +341 -0
- package/build/internal/cjs/context-tag-item-context-provider.d.ts +185 -0
- package/build/internal/es/context-blog-feed-context-provider.d.mts +483 -0
- package/build/internal/es/context-category-item-context-provider.d.mts +189 -0
- package/build/internal/es/context-post-by-id-context-provider.d.mts +31 -0
- package/build/internal/es/context-post-context-provider.d.mts +3213 -0
- package/build/internal/es/context-post-item-context-provider.d.mts +386 -0
- package/build/internal/es/context-related-posts-context-provider.d.mts +341 -0
- package/build/internal/es/context-tag-item-context-provider.d.mts +185 -0
- package/category-item-context-provider/package.json +3 -0
- package/context/blog-feed-context-provider/package.json +3 -0
- package/context/category-item-context-provider/package.json +3 -0
- package/context/post-by-id-context-provider/package.json +3 -0
- package/context/post-context-provider/package.json +3 -0
- package/context/post-item-context-provider/package.json +3 -0
- package/context/related-posts-context-provider/package.json +3 -0
- package/context/tag-item-context-provider/package.json +3 -0
- package/package.json +103 -4
- package/post-by-id-context-provider/package.json +3 -0
- package/post-context-provider/package.json +3 -0
- package/post-item-context-provider/package.json +3 -0
- package/related-posts-context-provider/package.json +3 -0
- package/tag-item-context-provider/package.json +3 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import React from "react";
|
|
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 = {
|
|
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 = 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 = {
|
|
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; /** 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
|
+
* A standard email address according to RFC 5321, section 4.1.2.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx
|
|
82
|
+
* import type { Email } from '@wix/editor-react-types';
|
|
83
|
+
*
|
|
84
|
+
* interface MyComponentProps {
|
|
85
|
+
* contactEmail?: Email;
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
type Email = string;
|
|
90
|
+
/**
|
|
91
|
+
* A phone number string, accepting common phone number characters.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* import type { Phone } from '@wix/editor-react-types';
|
|
96
|
+
*
|
|
97
|
+
* interface MyComponentProps {
|
|
98
|
+
* phoneNumber?: Phone;
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
type Phone = string;
|
|
103
|
+
/**
|
|
104
|
+
* Rich text content with resolved links.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* import type { RichText } from '@wix/editor-react-types';
|
|
109
|
+
*
|
|
110
|
+
* interface MyComponentProps {
|
|
111
|
+
* description?: RichText;
|
|
112
|
+
* }
|
|
113
|
+
*
|
|
114
|
+
* const MyComponent = ({ description }: MyComponentProps) => (
|
|
115
|
+
* <div>
|
|
116
|
+
* {description?.html}
|
|
117
|
+
* {description?.linkList.map((link) => (
|
|
118
|
+
* <a key={link.href} href={link.href}>{link.href}</a>
|
|
119
|
+
* ))}
|
|
120
|
+
* </div>
|
|
121
|
+
* );
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
type RichText = {
|
|
125
|
+
/** The original rich text content. */text: string; /** The HTML content with all links resolved. */
|
|
126
|
+
html: string; /** All links present in the rich text content. */
|
|
127
|
+
linkList: Array<Link>;
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region ../../node_modules/@wix/editor-react-types/dist/visualMedia.d.ts
|
|
131
|
+
interface VisualMediaBase {
|
|
132
|
+
/** The URL of the media file */
|
|
133
|
+
src: string;
|
|
134
|
+
/** The slug for the media */
|
|
135
|
+
slug?: string;
|
|
136
|
+
/** Description of the media for accessibility purposes */
|
|
137
|
+
description?: string | RichText;
|
|
138
|
+
/** The title of the media */
|
|
139
|
+
title?: string | RichText;
|
|
140
|
+
/** The height of the media in pixels */
|
|
141
|
+
height?: number;
|
|
142
|
+
/** The width of the media in pixels */
|
|
143
|
+
width?: number;
|
|
144
|
+
/** An action when the item is clicked */
|
|
145
|
+
action?: {
|
|
146
|
+
/** The URL to navigate to when the media is clicked */link: Link | Phone | Email;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
type VisualMedia = (VisualMediaBase & {
|
|
150
|
+
type: 'image'; /** Additional parameters specific to images, such as focal point and alt text. */
|
|
151
|
+
parameters?: ImageParameters;
|
|
152
|
+
}) | (VisualMediaBase & {
|
|
153
|
+
type: 'video'; /** Additional parameters specific to videos, such as thumbnail, alt text, and whether the video has audio. */
|
|
154
|
+
parameters?: VideoParameters;
|
|
155
|
+
});
|
|
156
|
+
type VideoParameters = {
|
|
157
|
+
/** The URL of the video thumbnail */thumbnail?: string; /** Alternative text for the video */
|
|
158
|
+
alt?: string; /** Whether the video has audio */
|
|
159
|
+
hasAudio?: boolean;
|
|
160
|
+
};
|
|
161
|
+
type ImageParameters = {
|
|
162
|
+
/** The focal point for the image */focalPoint?: [number, number]; /** The alt text for the image */
|
|
163
|
+
alt?: string;
|
|
164
|
+
};
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/lib/category-picker.d.ts
|
|
167
|
+
/** The inline filter field name, and therefore the key on the stored value. */
|
|
168
|
+
declare const CATEGORY_PICKER_FIELD = "categoryId";
|
|
169
|
+
/** A WQL clause the filter picker stores for one inline field. */
|
|
170
|
+
type PickerClause = {
|
|
171
|
+
$eq?: string;
|
|
172
|
+
$in?: string[];
|
|
173
|
+
};
|
|
174
|
+
interface CategoryPickerFilter {
|
|
175
|
+
[CATEGORY_PICKER_FIELD]?: PickerClause;
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/lib/post-picker.d.ts
|
|
179
|
+
/** The inline filter field name, and therefore the key on the stored value. */
|
|
180
|
+
declare const POST_PICKER_FIELD = "postId";
|
|
181
|
+
interface PostPickerFilter {
|
|
182
|
+
[POST_PICKER_FIELD]?: PickerClause;
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/i18n/post-labels.types.d.ts
|
|
186
|
+
/** Display-ready copy for the Repeater's bindable `emptyState: {title, description}` prop. */
|
|
187
|
+
interface EmptyStateLabels {
|
|
188
|
+
title: string;
|
|
189
|
+
description: string;
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region ../../node_modules/type-fest/source/observable-like.d.ts
|
|
193
|
+
declare global {
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
195
|
+
interface SymbolConstructor {
|
|
196
|
+
readonly observable: symbol;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
@remarks
|
|
201
|
+
The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
|
|
202
|
+
As well, some guidance on making an `Observable` to not include `closed` property.
|
|
203
|
+
@see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
|
|
204
|
+
@see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
|
|
205
|
+
@see https://github.com/benlesh/symbol-observable#making-an-object-observable
|
|
206
|
+
|
|
207
|
+
@category Observable
|
|
208
|
+
*/
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region ../../node_modules/@wix/sdk-types/build/index.d.ts
|
|
211
|
+
declare global {
|
|
212
|
+
interface ContextualClient {}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Creates concrete types from SDK descriptors when a contextual client is
|
|
216
|
+
* available.
|
|
217
|
+
*
|
|
218
|
+
* For a REST descriptor the built (bound) API is intersected with the original
|
|
219
|
+
* descriptor, matching what `contextualizeRESTModuleV2` returns at runtime — a
|
|
220
|
+
* value callable as the bound API and still usable as a descriptor. Keeping the
|
|
221
|
+
* descriptor half lets contextual modules be passed to descriptor-constrained
|
|
222
|
+
* helpers such as `elevate` from `@wix/sdk/context` (FEDINF-14092).
|
|
223
|
+
*
|
|
224
|
+
* The `& T` is scoped to REST descriptors — the only shape codegen wraps in
|
|
225
|
+
* `MaybeContext` — so `BuildDescriptors` (used by `createClient().use`) is left
|
|
226
|
+
* unchanged and stays bound-only. The fix lives here rather than in `elevate`,
|
|
227
|
+
* which is kept strict on purpose (see #941) so it still rejects bound-only
|
|
228
|
+
* functions that are unsafe through `createRESTModule`.
|
|
229
|
+
*/
|
|
230
|
+
declare global {
|
|
231
|
+
/**
|
|
232
|
+
* A global interface to set the exposure toggle for the SDK.
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* declare global {
|
|
236
|
+
* interface SDKExposureToggle {
|
|
237
|
+
* alpha: true;
|
|
238
|
+
* }
|
|
239
|
+
* }
|
|
240
|
+
*/
|
|
241
|
+
interface SDKExposureToggle {}
|
|
242
|
+
}
|
|
243
|
+
declare global {
|
|
244
|
+
/**
|
|
245
|
+
* A global interface to set the type mode for the SDK.
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* declare global {
|
|
249
|
+
* interface SDKTypeMode {
|
|
250
|
+
* strict: true;
|
|
251
|
+
* }
|
|
252
|
+
* }
|
|
253
|
+
*/
|
|
254
|
+
interface SDKTypeMode {}
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/lib/parse-post-cover-media.d.ts
|
|
258
|
+
/** One playable rendition of a Wix-hosted cover video (a raw REST `VideoResolution`). */
|
|
259
|
+
interface VideoSource {
|
|
260
|
+
url: string;
|
|
261
|
+
width?: number;
|
|
262
|
+
height?: number;
|
|
263
|
+
}
|
|
264
|
+
type EmbedProvider = 'youtube' | 'vimeo' | 'unknown';
|
|
265
|
+
/**
|
|
266
|
+
* The post cover as the Cover Media widget consumes it — a discriminated union over the
|
|
267
|
+
* `post.media` oneof: a Wix-hosted image, a Wix-hosted video (`wixMedia.videoV2`), or an
|
|
268
|
+
* externally hosted embed (`embedMedia`, YouTube/Vimeo).
|
|
269
|
+
*/
|
|
270
|
+
type CoverMedia = {
|
|
271
|
+
kind: 'image';
|
|
272
|
+
image: Image;
|
|
273
|
+
} | {
|
|
274
|
+
kind: 'wixVideo'; /** The WixMedia video id — the `wix:video://v1/<id>/...` path segment. */
|
|
275
|
+
id: string;
|
|
276
|
+
posterUrl?: string;
|
|
277
|
+
posterWidth?: number;
|
|
278
|
+
posterHeight?: number;
|
|
279
|
+
/**
|
|
280
|
+
* Playable mp4 renditions, optimal-first. Empty when the raw REST join was
|
|
281
|
+
* unavailable — the widget then renders the poster alone (see post-video-api.ts
|
|
282
|
+
* for why the SDK's `videoV2` string cannot carry these).
|
|
283
|
+
*/
|
|
284
|
+
sources: VideoSource[];
|
|
285
|
+
altText: string;
|
|
286
|
+
} | {
|
|
287
|
+
kind: 'embed';
|
|
288
|
+
provider: EmbedProvider; /** The author-supplied external video URL, as the Blog API stores it. */
|
|
289
|
+
videoUrl: string; /** Provider player URL for click-to-play; absent for an unrecognized provider. */
|
|
290
|
+
embedUrl?: string;
|
|
291
|
+
thumbnailUrl?: string;
|
|
292
|
+
thumbnailWidth?: number;
|
|
293
|
+
thumbnailHeight?: number;
|
|
294
|
+
altText: string;
|
|
295
|
+
};
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/extensions/post-list-context-provider/utils.d.ts
|
|
298
|
+
/**
|
|
299
|
+
* One item of the `postsList` array — the object the platform hands the Post Item
|
|
300
|
+
* context provider as its `postData` prop (via the manifest's `contextImplementor`).
|
|
301
|
+
* The `item*`/`recentPostItem` keys must match the Post Item context manifest's
|
|
302
|
+
* `context.items` keys — the runtime resolves an element's binding by looking the key
|
|
303
|
+
* up on the per-item hook's return value.
|
|
304
|
+
*/
|
|
305
|
+
interface PostListItem {
|
|
306
|
+
/** Repeater item identity; also the manifest contract's `_id`. */
|
|
307
|
+
_id: string;
|
|
308
|
+
/** The manifest contract's `title` (plain text, non-bindable — see `itemTitle` below). */
|
|
309
|
+
title: string;
|
|
310
|
+
itemTitle: RichText;
|
|
311
|
+
itemExcerpt: RichText;
|
|
312
|
+
itemCoverImage: Image | undefined;
|
|
313
|
+
/**
|
|
314
|
+
* The cover as the Cover Media widget renders it — image OR playable video, where
|
|
315
|
+
* `itemCoverImage` above can only ever be the image. Runtime-only by design: deliberately
|
|
316
|
+
* absent from `POST_ITEM_CONTRACT_ITEMS` and the Post Item manifest (the runtime injects
|
|
317
|
+
* the full item object regardless, and the manifest contract must stay text-scalars-only —
|
|
318
|
+
* see post-item-contract.ts). Not bindable in Connect Value; consumed via
|
|
319
|
+
* `usePostItemContext()` only.
|
|
320
|
+
*/
|
|
321
|
+
itemCoverMedia: CoverMedia | undefined;
|
|
322
|
+
itemLink: Link | undefined;
|
|
323
|
+
itemPublishedDate: RichText;
|
|
324
|
+
/**
|
|
325
|
+
* Raw values for the compact widgets (Metadata, Counters), which format for themselves
|
|
326
|
+
* (a design-panel date/number format) instead of parsing the richText labels above.
|
|
327
|
+
* Runtime-only like `itemCoverMedia` — never bindable items. JSON-safe on purpose (ISO
|
|
328
|
+
* string, numbers): the item crosses the platform's per-cell prop injection, and a `Date`
|
|
329
|
+
* would not survive the round-trip.
|
|
330
|
+
*/
|
|
331
|
+
/** ISO 8601; `undefined` for a post without `firstPublishedDate`. */
|
|
332
|
+
publishedDateValue: string | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* The clock `itemPublishedDate` was formatted from (`useHydrationClock`) — the compact
|
|
335
|
+
* widgets format `publishedDateValue` for themselves and must use the same one, or their
|
|
336
|
+
* label would hydrate against a different "now" than the bound text did.
|
|
337
|
+
*/
|
|
338
|
+
clockValue: number;
|
|
339
|
+
/** `undefined` when absent OR 0 — the same API-artifact rule as `timeToRead` below. */
|
|
340
|
+
minutesToReadValue: number | undefined;
|
|
341
|
+
/**
|
|
342
|
+
* The server-side METRICS counters as raw numbers, the seed the Post Item provider
|
|
343
|
+
* publishes as `viewCountValue`/`commentCountValue` until its client-only metrics read
|
|
344
|
+
* lands (and for good in the editor, where that read is skipped). Same three-way rule as
|
|
345
|
+
* the `viewCount`/`commentCount` labels: metric → canvas stand-in → `undefined`, never 0.
|
|
346
|
+
*/
|
|
347
|
+
initialViewCount: number | undefined;
|
|
348
|
+
initialCommentCount: number | undefined;
|
|
349
|
+
/**
|
|
350
|
+
* The remaining keys reuse the Post context's names verbatim — the registry is per app and
|
|
351
|
+
* keyed by item path, so re-declaring a key at the same dataType on the Post Item context
|
|
352
|
+
* costs no new registry rows (the same trick `likeCount` already relies on).
|
|
353
|
+
*/
|
|
354
|
+
authorName: RichText;
|
|
355
|
+
authorImage: Image | undefined;
|
|
356
|
+
timeToRead: RichText;
|
|
357
|
+
/**
|
|
358
|
+
* Resolved in priority order by `counterLabel`:
|
|
359
|
+
* 1. the post's own `metrics` (the `METRICS` fieldset) — renders everywhere, including
|
|
360
|
+
* the editor canvas and inside SSR HTML;
|
|
361
|
+
* 2. an editor stand-in, when the API answers without metrics;
|
|
362
|
+
* 3. blank, for the Post Item provider to fill in from its per-cell metrics read.
|
|
363
|
+
*
|
|
364
|
+
* Blank rather than zero at step 3 because a seeded "0 views" reads as a confident wrong
|
|
365
|
+
* number until that read lands. Step 1 exists because step 3 alone is not enough: the
|
|
366
|
+
* per-cell read is client-only by design (personal data must never bake into SSR HTML the
|
|
367
|
+
* host caches for days) AND is skipped outright in the editor, which left a bound counter
|
|
368
|
+
* permanently blank on the canvas.
|
|
369
|
+
*/
|
|
370
|
+
viewCount: RichText;
|
|
371
|
+
commentCount: RichText;
|
|
372
|
+
/**
|
|
373
|
+
* The post's MAIN category label — one, not a list. blog-client's feed card renders a single
|
|
374
|
+
* category (`post.categoryIds[0]`); its multi-category `CategoryLabelList` was built for the
|
|
375
|
+
* feed and never shipped, and the 3-chip list lives on the post page only.
|
|
376
|
+
*/
|
|
377
|
+
itemCategoryLabel: RichText;
|
|
378
|
+
/** Mirrors the Post Item manifest's nested (non-bindable) `recentPostItem` data item. */
|
|
379
|
+
recentPostItem: {
|
|
380
|
+
title: string;
|
|
381
|
+
slug: string;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Whether the post takes new comments — the Comments widget's lock in a cell. Runtime-only
|
|
385
|
+
* like `itemCoverMedia`; `undefined` (partial fieldset, canvas stand-in) reads as unlocked.
|
|
386
|
+
*/
|
|
387
|
+
commentingEnabled: boolean | undefined;
|
|
388
|
+
}
|
|
389
|
+
/** Display-ready copy for the Repeater's bindable `emptyState: {title, description}`
|
|
390
|
+
* prop (the manifest's `emptyState` item). The provider never renders it — the
|
|
391
|
+
* Repeater shows it (editor stage) when its bound items array is empty. The copy comes
|
|
392
|
+
* from the site-language labels (`PostLabels.noPostsEmptyState`). */
|
|
393
|
+
type EmptyStateContent = EmptyStateLabels;
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/extensions/post-list-context-provider/post-list-context-provider.d.ts
|
|
396
|
+
/**
|
|
397
|
+
* Which feed view the page is showing, resolved from the URL and the fetched page — the
|
|
398
|
+
* Category Header widget's whole input (runtime-only, never a bindable `context.items` entry,
|
|
399
|
+
* so it freezes no manifest keys).
|
|
400
|
+
*
|
|
401
|
+
* `pending` is the Suspense fallback's value, NOT `all`: the fallback renders before the page
|
|
402
|
+
* resolves, and claiming `all` there would flash the "All Posts" label on a category URL.
|
|
403
|
+
* A slug that matched nothing resolves to `all` — a truthful empty feed makes no header claim.
|
|
404
|
+
*
|
|
405
|
+
* Only a category has a description and a cover; a tag carries a label alone (the Blog API's
|
|
406
|
+
* `BlogTag` has no such fields).
|
|
407
|
+
*/
|
|
408
|
+
type FilteredFeedView = {
|
|
409
|
+
kind: 'pending';
|
|
410
|
+
} | {
|
|
411
|
+
kind: 'all';
|
|
412
|
+
} | {
|
|
413
|
+
kind: 'category';
|
|
414
|
+
title: string;
|
|
415
|
+
description: string;
|
|
416
|
+
coverImage: Image | undefined;
|
|
417
|
+
} | {
|
|
418
|
+
kind: 'tag';
|
|
419
|
+
title: string;
|
|
420
|
+
};
|
|
421
|
+
/** The blog feed: its posts, loading and error state, and paging, as read through {@link useBlogFeedContext}. */
|
|
422
|
+
interface PostListContextType {
|
|
423
|
+
postsList: PostListItem[];
|
|
424
|
+
/**
|
|
425
|
+
* The manifest's `postGalleryItems` — the same posts as Fast Gallery `VisualMedia`
|
|
426
|
+
* items (cover + title + excerpt + post-page link). Coverless posts are filtered out:
|
|
427
|
+
* a bound gallery is a media wall, and a cell with no media is a broken cell.
|
|
428
|
+
*/
|
|
429
|
+
postGalleryItems: VisualMedia[];
|
|
430
|
+
emptyState: EmptyStateContent | null;
|
|
431
|
+
/**
|
|
432
|
+
* The posts read failed and this feed is showing nothing it fetched — a bindable
|
|
433
|
+
* signal so a builder can put an error message (or a retry link) where the cards
|
|
434
|
+
* would be. Distinct from an empty feed on purpose: `emptyState` stays null while
|
|
435
|
+
* this is true, because "No posts yet" is a lie about a failed request.
|
|
436
|
+
*/
|
|
437
|
+
hasError: boolean;
|
|
438
|
+
hasMorePosts: boolean;
|
|
439
|
+
isLoadingPosts: boolean;
|
|
440
|
+
loadMorePosts: () => Promise<void>;
|
|
441
|
+
/**
|
|
442
|
+
* Runtime-only (the Category Header widget reads it through this hook) — deliberately not a
|
|
443
|
+
* `context.items` entry: item keys and dataTypes freeze per app once pushed (error 6001).
|
|
444
|
+
*/
|
|
445
|
+
filteredView: FilteredFeedView;
|
|
446
|
+
}
|
|
447
|
+
/** Reads the blog feed from the nearest feed context provider; throws outside one. */
|
|
448
|
+
declare function useBlogFeedContext(): PostListContextType;
|
|
449
|
+
/** Loads a page of blog posts, filtered by the URL view or the picked category or posts, and supplies them as a feed. */
|
|
450
|
+
declare function PostListProvider({
|
|
451
|
+
children,
|
|
452
|
+
categoryPicker,
|
|
453
|
+
postsPicker,
|
|
454
|
+
pageSize,
|
|
455
|
+
postOffset,
|
|
456
|
+
sortOrder,
|
|
457
|
+
featuredOnly,
|
|
458
|
+
liveRefreshGeneration
|
|
459
|
+
}: {
|
|
460
|
+
children?: React.ReactNode;
|
|
461
|
+
/**
|
|
462
|
+
* The manifest's `data.categoryPicker` filter — `{ categoryId: { $eq: '<id>' } }` as the
|
|
463
|
+
* editor's Items Selection picker stores it; absent/empty means unfiltered.
|
|
464
|
+
*/
|
|
465
|
+
categoryPicker?: CategoryPickerFilter;
|
|
466
|
+
/**
|
|
467
|
+
* The manifest's `data.postsPicker` filter — `{ postId: { $in: ['<id>', ...] } }`; absent/empty
|
|
468
|
+
* means no hand-picked posts.
|
|
469
|
+
*/
|
|
470
|
+
postsPicker?: PostPickerFilter; /** The manifest's `data.pageSize` input — unset/invalid falls back to 6. */
|
|
471
|
+
pageSize?: number; /** The manifest's `data.postOffset` input — unset/invalid falls back to 0 (no skip). */
|
|
472
|
+
postOffset?: number; /** The manifest's `data.sortOrder` select — unset/unknown falls back to 'newest'. */
|
|
473
|
+
sortOrder?: string; /** The manifest's `data.featuredOnly` toggle — unset means all posts. */
|
|
474
|
+
featuredOnly?: boolean;
|
|
475
|
+
/**
|
|
476
|
+
* Not a manifest input: the editor entry bumps it when the dashboard changes a post
|
|
477
|
+
* (`post-list-context-provider.editor.tsx`). Above 0 the first page skips the warmup
|
|
478
|
+
* slot (`key: null`), because a live refetch must never be answered from it.
|
|
479
|
+
*/
|
|
480
|
+
liveRefreshGeneration?: number;
|
|
481
|
+
}): React.ReactNode;
|
|
482
|
+
//#endregion
|
|
483
|
+
export { type EmptyStateContent, FilteredFeedView, PostListContextType, type PostListItem, PostListProvider, PostListProvider as default, useBlogFeedContext };
|