@select-org/select-post-builder 1.4.1 → 1.5.0
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/dist/index-8pZEwyr_.js +247 -0
- package/dist/{index-C2R4ewDG.mjs → index-D7pfEQso.mjs} +10617 -10532
- package/dist/index.d.ts +41 -9
- package/dist/post-builder.cjs.js +1 -1
- package/dist/post-builder.js +7 -6
- package/dist/{voice-recording-overlay-B_bP08If.js → voice-recording-overlay-B7d7qKr_.js} +1 -1
- package/dist/{voice-recording-overlay-BmgjIOMZ.mjs → voice-recording-overlay-DyKu9vgo.mjs} +1 -1
- package/package.json +1 -1
- package/dist/index-BQv-TaVA.js +0 -247
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,15 @@ declare type AppUserPayload = {
|
|
|
41
41
|
email?: string;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* `rejected` is the token the API just answered 401 to. Resolve a different
|
|
46
|
+
* token to replay that request once, or the same token or `null` to fail it.
|
|
47
|
+
* Concurrent 401s each ask, so share one refresh between them.
|
|
48
|
+
*/
|
|
49
|
+
export declare type AuthTokenRequest = {
|
|
50
|
+
readonly rejected?: string;
|
|
51
|
+
};
|
|
52
|
+
|
|
44
53
|
declare type BasePollOptionItem = {
|
|
45
54
|
key: string;
|
|
46
55
|
option_id: string;
|
|
@@ -135,8 +144,10 @@ declare type CreatePostCallbackPayload = {
|
|
|
135
144
|
/**
|
|
136
145
|
* Per-item upload state for media the host may need to persist. Populated
|
|
137
146
|
* when `allowSendWhileUploading` is on OR `unauthenticatedMode` is on, for
|
|
138
|
-
*
|
|
139
|
-
*
|
|
147
|
+
* media still uploading (or deferred) at submit time, keyed by the payload
|
|
148
|
+
* item's `key`. `blob` is the source File for host persistence; it is absent
|
|
149
|
+
* for a remote-URL upload (GIF or image search, pasted image URL), whose
|
|
150
|
+
* placeholder item uses the remote URL. For in-flight uploads
|
|
140
151
|
* (allowSendWhileUploading), `promise` resolves to the final hosted item and
|
|
141
152
|
* `abort` cancels the underlying axios request. For deferred blobs
|
|
142
153
|
* (unauthenticatedMode) both `promise` and `abort` are undefined — the bytes
|
|
@@ -144,10 +155,18 @@ declare type CreatePostCallbackPayload = {
|
|
|
144
155
|
* via `resumeDeferredUploads`.
|
|
145
156
|
*/
|
|
146
157
|
pendingUploads?: Map<string, {
|
|
147
|
-
blob
|
|
158
|
+
blob?: File | Blob;
|
|
148
159
|
promise?: Promise<PostCreationMediaItem | PollPostMediaOptionItem>;
|
|
149
160
|
abort?: () => void;
|
|
150
161
|
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Present only for a Blog post sent while a link preview card is still loading.
|
|
164
|
+
* `payload.htmlBody` has those cards removed; this resolves, within about 5 s, to
|
|
165
|
+
* the HTML with each card filled from its resolved metadata, and cards that failed
|
|
166
|
+
* or timed out removed. It never rejects. A host that ignores it saves the link
|
|
167
|
+
* without a card instead of an empty box.
|
|
168
|
+
*/
|
|
169
|
+
pendingHtmlBody?: Promise<string>;
|
|
151
170
|
};
|
|
152
171
|
|
|
153
172
|
export declare interface DraftRehydrateRequestDetail {
|
|
@@ -181,6 +200,12 @@ export declare enum EditorTypes {
|
|
|
181
200
|
*/
|
|
182
201
|
export declare const ensurePollMinimum: (items: PollChoiceItem[]) => PollChoiceItem[];
|
|
183
202
|
|
|
203
|
+
/**
|
|
204
|
+
* The host's token source. The post builder calls it before every API request.
|
|
205
|
+
* Resolve `null` to send the request without credentials.
|
|
206
|
+
*/
|
|
207
|
+
export declare type GetAuthToken = (request: AuthTokenRequest) => Promise<string | null>;
|
|
208
|
+
|
|
184
209
|
declare interface ImageInfo {
|
|
185
210
|
width: number;
|
|
186
211
|
height: number;
|
|
@@ -224,6 +249,9 @@ declare enum NewPostType {
|
|
|
224
249
|
NEW_COMMENT_MEDIA = "new:comment:media"
|
|
225
250
|
}
|
|
226
251
|
|
|
252
|
+
/** Uids of the media nodes `stripPendingMediaFromJsonBody` removes. */
|
|
253
|
+
export declare function pendingMediaUids(jsonBody: JSONContent_2 | undefined): Set<string>;
|
|
254
|
+
|
|
227
255
|
declare type PollChoiceItem = PollPostTextOptionItem | PollPostMediaOptionItem;
|
|
228
256
|
|
|
229
257
|
declare type PollPostMediaOptionItem = BasePollOptionItem & PostCreationMediaItem;
|
|
@@ -246,7 +274,10 @@ export declare interface PostBuilderConfig {
|
|
|
246
274
|
mfs: string;
|
|
247
275
|
fileStore: string;
|
|
248
276
|
};
|
|
249
|
-
|
|
277
|
+
/** Ignored when `getAuthToken` is given. */
|
|
278
|
+
authToken?: string;
|
|
279
|
+
/** A new function takes effect on the next request, without remounting editors. */
|
|
280
|
+
getAuthToken?: GetAuthToken;
|
|
250
281
|
toI18N: (key: string) => string;
|
|
251
282
|
i18nKeys?: Partial<PostBuilderI18nKeys>;
|
|
252
283
|
logEvent: (name: string, properties: Record<string, unknown>) => void;
|
|
@@ -382,7 +413,7 @@ declare interface PostBuilderI18nKeys {
|
|
|
382
413
|
uploadsInProgressKey: string;
|
|
383
414
|
}
|
|
384
415
|
|
|
385
|
-
export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, unauthenticatedMode, }: PostBuilderConfig) => JSX_2.Element;
|
|
416
|
+
export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, getAuthToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, unauthenticatedMode, }: PostBuilderConfig) => JSX_2.Element;
|
|
386
417
|
|
|
387
418
|
declare type PostCreationData = {
|
|
388
419
|
body: string;
|
|
@@ -446,11 +477,12 @@ declare enum SpecialType {
|
|
|
446
477
|
|
|
447
478
|
/**
|
|
448
479
|
* Walks a serialized htmlBody string and removes media wrappers whose upload
|
|
449
|
-
* did not complete (data-src missing or blob:-prefixed
|
|
450
|
-
* `[data-media-group]`
|
|
480
|
+
* did not complete (data-src missing or blob:-prefixed, or data-uid in
|
|
481
|
+
* `pendingUids` from `pendingMediaUids`). Empty `[data-media-group]`
|
|
482
|
+
* wrappers left behind are also removed. Mirrors
|
|
451
483
|
* `stripPendingMediaFromJsonBody` for the JSON form.
|
|
452
484
|
*/
|
|
453
|
-
export declare function stripPendingMediaFromHtml(html: string | undefined): string | undefined;
|
|
485
|
+
export declare function stripPendingMediaFromHtml(html: string | undefined, pendingUids?: ReadonlySet<string>): string | undefined;
|
|
454
486
|
|
|
455
487
|
/**
|
|
456
488
|
* Walks the editor JSON and removes media nodes whose upload did not complete
|
|
@@ -583,7 +615,7 @@ declare module '@tiptap/core' {
|
|
|
583
615
|
* (`attrs.deferred === true`). Map key = node uid; value = the raw
|
|
584
616
|
* File/Blob for file-kind nodes, which the host persists from
|
|
585
617
|
* `pendingUploads` across the auth redirect. URL-kind deferred nodes are
|
|
586
|
-
* NOT surfaced via `pendingUploads` (
|
|
618
|
+
* NOT surfaced via `pendingUploads` (no blob and no upload in flight) —
|
|
587
619
|
* their remote URL rides in the doc JSON on `attrs.src`, so the host
|
|
588
620
|
* supplies that string here from the persisted node. Nodes with no entry
|
|
589
621
|
* in the map are deleted (bytes unrecoverable — the host toasts separately).
|
package/dist/post-builder.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-8pZEwyr_.js");require("react");exports.EditorPlacement=e.EditorPlacement;exports.EditorTypes=e.EditorTypes;exports.PostBuilderEditor=e.PostBuilderEditor;exports.PostBuilderEvents=e.PostBuilderEvents;exports.PostBuilderProvider=e.PostBuilderProvider;exports.applyResolvedMediaItem=e.applyResolvedMediaItem;exports.applyResolvedMediaItemToHtml=e.applyResolvedMediaItemToHtml;exports.ensurePollMinimum=e.ensurePollMinimum;exports.pendingMediaUids=e.pendingMediaUids;exports.stripPendingMediaFromHtml=e.stripPendingMediaFromHtml;exports.stripPendingMediaFromJsonBody=e.stripPendingMediaFromJsonBody;
|
package/dist/post-builder.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { E as
|
|
1
|
+
import { E as a, a as d, P as o, b as r, c as t, d as l, e as m, f as n, p, s as P, h as M } from "./index-D7pfEQso.mjs";
|
|
2
2
|
import "react";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
a as EditorPlacement,
|
|
5
|
+
d as EditorTypes,
|
|
6
|
+
o as PostBuilderEditor,
|
|
7
7
|
r as PostBuilderEvents,
|
|
8
8
|
t as PostBuilderProvider,
|
|
9
9
|
l as applyResolvedMediaItem,
|
|
10
10
|
m as applyResolvedMediaItemToHtml,
|
|
11
11
|
n as ensurePollMinimum,
|
|
12
|
-
p as
|
|
13
|
-
P as
|
|
12
|
+
p as pendingMediaUids,
|
|
13
|
+
P as stripPendingMediaFromHtml,
|
|
14
|
+
M as stripPendingMediaFromJsonBody
|
|
14
15
|
};
|