@select-org/select-post-builder 1.0.0 → 1.0.2

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.
@@ -0,0 +1,287 @@
1
+ import { default as default_2 } from 'react';
2
+ import { JSONContent } from '@tiptap/react';
3
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
4
+ import { ReactNode } from 'react';
5
+
6
+ declare type AppUserPayload = {
7
+ users: Array<UserPayload>;
8
+ background: string;
9
+ username: string;
10
+ relationship: 2;
11
+ refresh_token: string;
12
+ name: string;
13
+ new_user: boolean;
14
+ longitude: number;
15
+ latitude: number;
16
+ jwtoken: string;
17
+ id: string;
18
+ gender: string;
19
+ birthday: string;
20
+ avatar: string;
21
+ avatarPlaceholder: string;
22
+ highResolutionAvatar: string;
23
+ twitterUsername: string;
24
+ email: string;
25
+ description: string;
26
+ email_verified: boolean;
27
+ featured_groups: string[];
28
+ };
29
+
30
+ declare type BasePollOptionItem = {
31
+ key: string;
32
+ option_id: string;
33
+ option_color: string;
34
+ };
35
+
36
+ declare interface ImageInfo {
37
+ width: number;
38
+ height: number;
39
+ url: string;
40
+ isBase64: boolean;
41
+ }
42
+
43
+ declare enum MediaItemType {
44
+ MEDIA_ITEM = "mediaItem",
45
+ IMAGE_ITEM = "imageItem"
46
+ }
47
+
48
+ declare type MentionData = {
49
+ id: string;
50
+ selectId: string;
51
+ matchStartPosition: number;
52
+ name: string;
53
+ avatar: string;
54
+ type: MentionType;
55
+ inThisThread: number;
56
+ from?: PostType;
57
+ isCrossExposureEnable?: boolean;
58
+ };
59
+
60
+ declare enum MentionType {
61
+ User = "mention",
62
+ Group = "hashtag"
63
+ }
64
+
65
+ declare type PollChoiceItem = PollPostTextOptionItem | PollPostMediaOptionItem;
66
+
67
+ declare type PollPostMediaOptionItem = BasePollOptionItem & PostCreationMediaItem;
68
+
69
+ declare type PollPostTextOptionItem = BasePollOptionItem & {
70
+ type: PollType;
71
+ text: string;
72
+ };
73
+
74
+ declare enum PollType {
75
+ POLL_TEXT_ITEM = "pollTextItem",
76
+ POLL_IMAGE_ITEM = "pollImageItem",
77
+ POLL_MEDIA_ITEM = "pollMediaItem"
78
+ }
79
+
80
+ export declare interface PostBuilderConfig {
81
+ children: ReactNode;
82
+ apiBaseURL: {
83
+ core: string;
84
+ mfs: string;
85
+ fileStore: string;
86
+ };
87
+ authToken: string;
88
+ toI18N: (key: string) => string;
89
+ i18nKeys?: PostBuilderI18nKeys;
90
+ }
91
+
92
+ export declare const PostBuilderEditor: default_2.FC<PostBuilderEditorProps>;
93
+
94
+ declare type PostBuilderEditorProps = {
95
+ groupId?: string;
96
+ postId?: string;
97
+ user?: AppUserPayload;
98
+ hideGroupSelector?: boolean;
99
+ showModal?: boolean;
100
+ isSubmitting?: boolean;
101
+ onCreatePost: (params: {
102
+ payload: Partial<PostCreationData>;
103
+ html: string;
104
+ json: JSONContent;
105
+ text: string;
106
+ }) => void;
107
+ clearOnSuccess?: boolean;
108
+ };
109
+
110
+ declare interface PostBuilderI18nKeys {
111
+ addImageKey: string;
112
+ boldMarkKey: string;
113
+ italicMarkKey: string;
114
+ }
115
+
116
+ export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, }: PostBuilderConfig) => JSX_2.Element;
117
+
118
+ declare type PostCreationData = {
119
+ body: string;
120
+ htmlBody?: string;
121
+ items: Array<PostCreationMediaItem | PollChoiceItem>;
122
+ mentionData: MentionData[];
123
+ specialType: SpecialType;
124
+ sendCrossMention?: boolean;
125
+ type: string;
126
+ postId: string;
127
+ timestamp: number;
128
+ };
129
+
130
+ declare type PostCreationMediaItem = {
131
+ key: string;
132
+ type: MediaItemType | PollType;
133
+ imageType: string;
134
+ compressVideoPath?: string;
135
+ playableDuration?: number | null;
136
+ preloadUrl?: boolean;
137
+ size?: number;
138
+ searchFrom?: string | null;
139
+ sources: {
140
+ original: ImageInfo;
141
+ thumbnail: ImageInfo;
142
+ placeholder?: ImageInfo;
143
+ };
144
+ };
145
+
146
+ declare enum PostType {
147
+ Post = "post",
148
+ Comment = "comment"
149
+ }
150
+
151
+ declare enum SpecialType {
152
+ POST = 0,
153
+ FEATURED_POST = 1
154
+ }
155
+
156
+ declare type UserPayload = {
157
+ id: string;
158
+ username: string;
159
+ name: string;
160
+ avatar: string;
161
+ avatarPlaceholder: string;
162
+ highResolutionAvatar: string;
163
+ gender: string;
164
+ birthday: string;
165
+ description?: string;
166
+ type?: string;
167
+ latitude?: number;
168
+ longitude?: number;
169
+ relationship?: number;
170
+ interactionIds?: Array<string>;
171
+ };
172
+
173
+ export { }
174
+
175
+
176
+ declare module '@tiptap/core' {
177
+ interface Commands<ReturnType> {
178
+ media: {
179
+ /**
180
+ * Insert a media node (image, video, or audio)
181
+ */
182
+ insertMedia: (options: MediaAttrs) => ReturnType;
183
+ /**
184
+ * Update media node attributes by uid
185
+ */
186
+ updateMediaByUid: (uid: string, attrs: Partial<MediaAttrs>) => ReturnType;
187
+ /**
188
+ * Delete media node by uid
189
+ */
190
+ deleteMediaByUid: (uid: string) => ReturnType;
191
+ /**
192
+ * Update media upload progress by uid
193
+ */
194
+ updateMediaProgress: (uid: string, progress: number) => ReturnType;
195
+ };
196
+ }
197
+ }
198
+
199
+
200
+ declare module '@tiptap/core' {
201
+ interface Commands<ReturnType> {
202
+ poll: {
203
+ insertPoll: (attrs: {
204
+ choices: PollChoiceItem[];
205
+ }) => ReturnType;
206
+ };
207
+ }
208
+ }
209
+
210
+
211
+ declare module '@tiptap/core' {
212
+ interface Commands<ReturnType> {
213
+ customLink: {
214
+ /**
215
+ * Insert a new link mark with preview
216
+ */
217
+ insertLink: (attrs: LinkMarkAttrs) => ReturnType;
218
+ /**
219
+ * Update an existing link mark with its preview
220
+ */
221
+ updateLink: (uid: string, attrs: Partial<Omit<LinkMarkAttrs, 'uid'>>) => ReturnType;
222
+ /**
223
+ * Update media node attributes by uid
224
+ */
225
+ updateLinkByUid: (uid: string, attrs: Partial<LinkMarkAttrs>) => ReturnType;
226
+ /**
227
+ * Delete link preview node by uid
228
+ */
229
+ deleteLinkByUid: (uid: string) => ReturnType;
230
+ };
231
+ }
232
+ }
233
+
234
+
235
+ declare module '@tiptap/core' {
236
+ interface Commands<ReturnType> {
237
+ iframe: {
238
+ /**
239
+ * Insert an iframe node into the document
240
+ */
241
+ setIframe: (options: {
242
+ src: string;
243
+ width?: string;
244
+ height?: string;
245
+ }) => ReturnType;
246
+ };
247
+ }
248
+ }
249
+
250
+
251
+ declare module '@tiptap/core' {
252
+ interface Commands<ReturnType> {
253
+ smartMediaUpload: {
254
+ insertMediaWithUpload: (params: {
255
+ source: File | Blob | string;
256
+ type: MediaNodeTypes;
257
+ mediaType?: MediaItemType;
258
+ caption?: string;
259
+ searchFrom?: ImageSearchFrom;
260
+ }) => ReturnType;
261
+ };
262
+ }
263
+ }
264
+
265
+
266
+ declare module '@tiptap/core' {
267
+ interface Commands<ReturnType> {
268
+ linkPreview: {
269
+ /**
270
+ * Insert a new link preview node
271
+ */
272
+ setLinkPreview: (attributes: LinkPreviewAttributes) => ReturnType;
273
+ /**
274
+ * Update an existing link preview node
275
+ */
276
+ updateLinkPreview: (attributes: LinkPreviewAttributes) => ReturnType;
277
+ /**
278
+ * Update media node attributes by uid
279
+ */
280
+ updateLinkPreviewByUid: (uid: string, attrs: Partial<LinkPreviewAttributes>) => ReturnType;
281
+ /**
282
+ * Delete link preview node by uid
283
+ */
284
+ deleteLinkPreviewByUid: (uid: string) => ReturnType;
285
+ };
286
+ }
287
+ }