@select-org/select-post-builder 1.1.45 → 1.1.47

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
@@ -39,16 +39,21 @@ declare type BaseProps = {
39
39
  hideGroupSelector?: boolean;
40
40
  isSubmitting?: boolean;
41
41
  clearOnSuccess?: boolean;
42
- onCreatePost: (params: {
43
- payload: Partial<PostCreationData>;
44
- html: string;
45
- json: JSONContent;
46
- text: string;
47
- }) => void;
42
+ onCreatePost: (params: CreatePostCallbackPayload) => void;
48
43
  onVoiceComment?: (params: {
49
44
  voiceUrl: string;
50
45
  voiceTime: number;
51
46
  }) => void;
47
+ /**
48
+ * Optional voice handoff for hosts that want to upload voice in their
49
+ * own pipeline. When provided AND `allowSendWhileUploading` is on, the
50
+ * comments-toolbar emits the recorded Blob via this callback instead of
51
+ * uploading sync via Filestore.uploadVoiceV2.
52
+ */
53
+ onVoiceRecord?: (params: {
54
+ blob: Blob;
55
+ voiceTime: number;
56
+ }) => void;
52
57
  onGroupSelect?: (groupId: string) => void;
53
58
  onDirtyStateChange?: (isDirty: boolean) => void;
54
59
  onReady?: (controls: PostBuilderControls) => void;
@@ -61,6 +66,27 @@ declare type BaseProps = {
61
66
  onEditorTabChange?: (tab: EditorTypes) => void;
62
67
  };
63
68
 
69
+ declare type CreatePostCallbackPayload = {
70
+ payload: Partial<PostCreationData> & {
71
+ error?: string;
72
+ };
73
+ html: string;
74
+ json: JSONContent;
75
+ text: string;
76
+ /**
77
+ * Per-item upload state for in-flight media. Only populated when
78
+ * `allowSendWhileUploading` is on AND there are items with blob: URLs at
79
+ * submit time. Each entry: blob (the source File for host persistence),
80
+ * promise (resolves to the final hosted item), abort (cancel the underlying
81
+ * axios request).
82
+ */
83
+ pendingUploads?: Map<string, {
84
+ blob: File | Blob;
85
+ promise: Promise<PostCreationMediaItem | PollPostMediaOptionItem>;
86
+ abort: () => void;
87
+ }>;
88
+ };
89
+
64
90
  export declare enum EditorPlacement {
65
91
  Feed = "Feed",
66
92
  Modal = "Modal",
@@ -144,6 +170,14 @@ export declare interface PostBuilderConfig {
144
170
  toI18N: (key: string) => string;
145
171
  i18nKeys?: Partial<PostBuilderI18nKeys>;
146
172
  logEvent: (name: string, properties: Record<string, unknown>) => void;
173
+ /**
174
+ * When true, allows Send to fire while media uploads are still in flight.
175
+ * The host must provide an `onCreatePost` handler that consumes the new
176
+ * `pendingUploads` field on the payload, and an `onVoiceRecord` prop on
177
+ * the editor for the voice handoff. Defaults to false; existing consumers
178
+ * are unaffected.
179
+ */
180
+ allowSendWhileUploading?: boolean;
147
181
  }
148
182
 
149
183
  export declare interface PostBuilderControls {
@@ -236,7 +270,7 @@ declare interface PostBuilderI18nKeys {
236
270
  uploadsInProgressKey: string;
237
271
  }
238
272
 
239
- export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, logEvent, }: PostBuilderConfig) => JSX_2.Element;
273
+ export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, }: PostBuilderConfig) => JSX_2.Element;
240
274
 
241
275
  declare type PostCreationData = {
242
276
  body: string;
@@ -388,21 +422,6 @@ declare module '@tiptap/core' {
388
422
  }
389
423
 
390
424
 
391
- declare module '@tiptap/core' {
392
- interface Commands<ReturnType> {
393
- smartMediaUpload: {
394
- insertMediaWithUpload: (params: {
395
- source: File | Blob | string;
396
- type: MediaNodeTypes;
397
- mediaType?: MediaItemType;
398
- caption?: string;
399
- searchFrom?: ImageSearchFrom;
400
- }) => ReturnType;
401
- };
402
- }
403
- }
404
-
405
-
406
425
  declare module '@tiptap/core' {
407
426
  interface Commands<ReturnType> {
408
427
  linkPreview: {
@@ -430,3 +449,18 @@ declare module '@tiptap/core' {
430
449
  };
431
450
  }
432
451
  }
452
+
453
+
454
+ declare module '@tiptap/core' {
455
+ interface Commands<ReturnType> {
456
+ smartMediaUpload: {
457
+ insertMediaWithUpload: (params: {
458
+ source: File | Blob | string;
459
+ type: MediaNodeTypes;
460
+ mediaType?: MediaItemType;
461
+ caption?: string;
462
+ searchFrom?: ImageSearchFrom;
463
+ }) => ReturnType;
464
+ };
465
+ }
466
+ }