@select-org/select-post-builder 1.1.59 → 1.2.5

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.d.ts CHANGED
@@ -85,6 +85,16 @@ declare type BaseProps = {
85
85
  disableNavigationWarning?: boolean;
86
86
  /** Tiptap JSONContent to pre-populate the editor with (takes precedence over localStorage draft) */
87
87
  initialContent?: JSONContent;
88
+ /**
89
+ * Deferred media (uid → File/Blob/remote URL) to re-attach and upload once the
90
+ * editor is mounted with `initialContent` — used by a host restoring an
91
+ * unauthenticated composer after the auth round-trip. Resume runs per editor
92
+ * instance (not via one-shot `onReady`), so it lands on whichever instance is
93
+ * finally rendered even across the mount-time useEditor re-create. Nodes whose
94
+ * uid is absent from the map are dropped (bytes unrecoverable). Omit for all
95
+ * normal composing — it is then a no-op.
96
+ */
97
+ resumeDeferredMedia?: Map<string, File | Blob | string>;
88
98
  /**
89
99
  * Initial tab to land on when the editor first mounts. Applied on first mount
90
100
  * only — subsequent prop changes are ignored. Same semantics as `initialContent`.
@@ -112,16 +122,20 @@ declare type CreatePostCallbackPayload = {
112
122
  json: JSONContent;
113
123
  text: string;
114
124
  /**
115
- * Per-item upload state for in-flight media. Only populated when
116
- * `allowSendWhileUploading` is on AND there are items with blob: URLs at
117
- * submit time. Each entry: blob (the source File for host persistence),
118
- * promise (resolves to the final hosted item), abort (cancel the underlying
119
- * axios request).
125
+ * Per-item upload state for media the host may need to persist. Populated
126
+ * when `allowSendWhileUploading` is on OR `unauthenticatedMode` is on, for
127
+ * items with blob: URLs at submit time. Each entry always carries `blob`
128
+ * (the source File for host persistence). For in-flight uploads
129
+ * (allowSendWhileUploading), `promise` resolves to the final hosted item and
130
+ * `abort` cancels the underlying axios request. For deferred blobs
131
+ * (unauthenticatedMode) both `promise` and `abort` are undefined — the bytes
132
+ * were never uploaded; the host persists the blob and replays it after auth
133
+ * via `resumeDeferredUploads`.
120
134
  */
121
135
  pendingUploads?: Map<string, {
122
136
  blob: File | Blob;
123
- promise: Promise<PostCreationMediaItem | PollPostMediaOptionItem>;
124
- abort: () => void;
137
+ promise?: Promise<PostCreationMediaItem | PollPostMediaOptionItem>;
138
+ abort?: () => void;
125
139
  }>;
126
140
  };
127
141
 
@@ -233,6 +247,20 @@ export declare interface PostBuilderConfig {
233
247
  * are unaffected.
234
248
  */
235
249
  allowSendWhileUploading?: boolean;
250
+ /**
251
+ * When true the host has no authenticated session. The editor:
252
+ * - defers media uploads (nodes keep local previews; no filestore calls),
253
+ * - surfaces those deferred blobs via `pendingUploads` at submit regardless
254
+ * of `allowSendWhileUploading`, so the host can persist and resume them
255
+ * after auth,
256
+ * - suppresses URL resolution (no link previews / iframe resolve — the
257
+ * /v1/url/resolve endpoint requires a JWT),
258
+ * - hides the voice, quick-GIF and media-search toolbar affordances.
259
+ * The flag is fixed at editor creation and baked into the extensions;
260
+ * changing it after mount requires remounting the editor to take effect.
261
+ * Defaults to false; existing consumers are unaffected.
262
+ */
263
+ unauthenticatedMode?: boolean;
236
264
  }
237
265
 
238
266
  export declare interface PostBuilderControls {
@@ -250,6 +278,12 @@ export declare interface PostBuilderControls {
250
278
  } | null;
251
279
  /** Clear editor content and localStorage draft */
252
280
  clearEditor: () => void;
281
+ /**
282
+ * Re-enqueue uploads for nodes attached while unauthenticated (deferred: true).
283
+ * Map key = node uid; value = raw File/Blob (file-kind) or remote URL string (url-kind).
284
+ * Nodes with no map entry are deleted (bytes unrecoverable).
285
+ */
286
+ resumeDeferredUploads: (media: Map<string, File | Blob | string>) => void;
253
287
  }
254
288
 
255
289
  export declare const PostBuilderEditor: FC<PostBuilderEditorProps>;
@@ -329,7 +363,7 @@ declare interface PostBuilderI18nKeys {
329
363
  uploadsInProgressKey: string;
330
364
  }
331
365
 
332
- export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, }: PostBuilderConfig) => JSX_2.Element;
366
+ export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, unauthenticatedMode, }: PostBuilderConfig) => JSX_2.Element;
333
367
 
334
368
  declare type PostCreationData = {
335
369
  body: string;
@@ -524,6 +558,17 @@ declare module '@tiptap/core' {
524
558
  caption?: string;
525
559
  searchFrom?: ImageSearchFrom;
526
560
  }) => ReturnType;
561
+ /**
562
+ * Re-enqueue uploads for media nodes attached while unauthenticated
563
+ * (`attrs.deferred === true`). Map key = node uid; value = the raw
564
+ * File/Blob for file-kind nodes, which the host persists from
565
+ * `pendingUploads` across the auth redirect. URL-kind deferred nodes are
566
+ * NOT surfaced via `pendingUploads` (getPendingUpload requires a blob) —
567
+ * their remote URL rides in the doc JSON on `attrs.src`, so the host
568
+ * supplies that string here from the persisted node. Nodes with no entry
569
+ * in the map are deleted (bytes unrecoverable — the host toasts separately).
570
+ */
571
+ resumeDeferredUploads: (media: Map<string, File | Blob | string>) => ReturnType;
527
572
  };
528
573
  }
529
574
  }