@codingfactory/socialkit-vue 0.4.0 → 0.5.1

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,274 @@
1
+ /**
2
+ * Discussion-domain types and store contracts shared across SocialKit frontends.
3
+ */
4
+
5
+ import type { AxiosInstance } from 'axios'
6
+
7
+ export type AvatarLike =
8
+ | string
9
+ | {
10
+ url?: string | null
11
+ thumb_url?: string | null
12
+ preview_url?: string | null
13
+ urls?: Record<string, string | null | undefined>
14
+ }
15
+ | null
16
+ | undefined
17
+
18
+ export interface SpaceBreadcrumb {
19
+ id: string
20
+ slug: string
21
+ name: string
22
+ }
23
+
24
+ export interface SpaceMembership {
25
+ space_id: string
26
+ is_member: boolean
27
+ member_count: number
28
+ }
29
+
30
+ export interface SpaceModerationPolicyObject {
31
+ summary?: string
32
+ rules?: string[]
33
+ notes?: string[]
34
+ }
35
+
36
+ export interface SpaceMeta {
37
+ icon?: string
38
+ color?: string
39
+ category?: string
40
+ is_category?: boolean
41
+ member_count?: number
42
+ online_count?: number
43
+ is_featured?: boolean
44
+ rules?: string[]
45
+ moderation_policy?: string | string[] | SpaceModerationPolicyObject
46
+ }
47
+
48
+ export interface Space {
49
+ id: string
50
+ slug: string
51
+ name: string
52
+ description?: string
53
+ kind: 'forum' | 'context'
54
+ visibility?: string
55
+ meta?: SpaceMeta
56
+ parent_id?: string | null
57
+ depth?: number
58
+ children_count?: number
59
+ children?: Space[]
60
+ breadcrumb?: SpaceBreadcrumb[]
61
+ is_leaf?: boolean
62
+ thread_count?: number
63
+ post_count?: number
64
+ last_activity_at?: string
65
+ created_at: string
66
+ }
67
+
68
+ export interface DiscussionAttachment {
69
+ id: string
70
+ uuid: string
71
+ mime_type: string
72
+ size: number
73
+ name: string
74
+ type: 'image' | 'video'
75
+ is_image: boolean
76
+ url?: string
77
+ thumb_url?: string | null
78
+ preview_url?: string | null
79
+ urls?: Record<string, string>
80
+ responsive?: unknown
81
+ playback_url?: string | null
82
+ provider?: string | null
83
+ playback_id?: string | null
84
+ provider_asset_id?: string | null
85
+ processing_status?: string | null
86
+ duration?: number | null
87
+ width?: number | null
88
+ height?: number | null
89
+ aspect_ratio?: string | null
90
+ thumbnail_url?: string | null
91
+ }
92
+
93
+ export interface DiscussionTag {
94
+ id: string
95
+ slug: string
96
+ label: string
97
+ thread_count?: number
98
+ }
99
+
100
+ export type SpaceThreadSort = 'most_active' | 'newest' | 'oldest'
101
+ export type ReplyReactionKind = 'like' | 'dislike'
102
+
103
+ export interface DiscussionAuthor {
104
+ id: string
105
+ name: string
106
+ handle?: string | null
107
+ avatar?: AvatarLike
108
+ avatar_url?: string | null
109
+ }
110
+
111
+ export interface ThreadMeta {
112
+ views?: number
113
+ upvotes?: number
114
+ tags?: string[]
115
+ }
116
+
117
+ export interface Thread {
118
+ id: string
119
+ space_id: string
120
+ author_id: string
121
+ author?: DiscussionAuthor
122
+ title: string
123
+ body?: string
124
+ slug?: string
125
+ audience: 'public' | 'authenticated' | 'private'
126
+ status: 'open' | 'locked' | 'archived'
127
+ is_pinned: boolean
128
+ reply_count: number
129
+ last_activity_at: string
130
+ created_at: string
131
+ meta?: ThreadMeta
132
+ tags?: DiscussionTag[]
133
+ is_subscribed?: boolean
134
+ media?: DiscussionAttachment[]
135
+ deleted_at?: string | null
136
+ }
137
+
138
+ export interface ReplyReactionObject {
139
+ kind: string
140
+ }
141
+
142
+ export interface QuotedReplyAuthor {
143
+ id: string
144
+ name: string
145
+ handle?: string | null
146
+ }
147
+
148
+ export interface QuotedReply {
149
+ id: string
150
+ author_id: string
151
+ author?: QuotedReplyAuthor | null
152
+ body: string
153
+ }
154
+
155
+ export interface ReplyMeta {
156
+ upvotes?: number
157
+ is_solution?: boolean
158
+ }
159
+
160
+ export interface Reply {
161
+ id: string
162
+ thread_id: string
163
+ author_id: string
164
+ author?: DiscussionAuthor
165
+ body: string
166
+ parent_id?: string | null
167
+ parent_reply_id?: string | null
168
+ depth?: number
169
+ display_depth?: number
170
+ reply_count?: number
171
+ children_count?: number
172
+ created_at: string
173
+ updated_at: string
174
+ likes_count?: number
175
+ dislikes_count?: number
176
+ user_reaction?: ReplyReactionObject | string | null
177
+ quoted_reply_id?: string | null
178
+ quoted_reply?: QuotedReply | null
179
+ quote_data?: Record<string, unknown> | null
180
+ is_initial_reply?: boolean
181
+ meta?: ReplyMeta
182
+ media?: DiscussionAttachment[]
183
+ }
184
+
185
+ export interface CreateThreadInput {
186
+ title: string
187
+ body: string
188
+ audience?: 'public' | 'authenticated' | 'private'
189
+ media_ids?: string[]
190
+ tags?: string[]
191
+ }
192
+
193
+ export interface UpdateThreadInput {
194
+ title?: string
195
+ body?: string
196
+ media_ids?: string[]
197
+ }
198
+
199
+ export interface CreateReplyInput {
200
+ body: string
201
+ parent_id?: string
202
+ media_ids?: string[]
203
+ quoted_reply_id?: string
204
+ }
205
+
206
+ export interface SaveDraftOptions {
207
+ title?: string
208
+ metadata?: Record<string, unknown>
209
+ format?: 'markdown' | 'html'
210
+ }
211
+
212
+ export interface QuoteResponseMetadata {
213
+ author: {
214
+ id: string
215
+ name: string
216
+ handle: string
217
+ }
218
+ reply_id: string
219
+ thread_id: string
220
+ created_at: string
221
+ }
222
+
223
+ export interface QuoteResponse {
224
+ quote_text: string
225
+ quote_data: Record<string, unknown>
226
+ metadata?: QuoteResponseMetadata
227
+ }
228
+
229
+ export interface DiscussionCategorySummary {
230
+ name: string
231
+ count: number
232
+ icon?: string
233
+ color?: string
234
+ }
235
+
236
+ interface DiscussionReadableValue<TValue> {
237
+ readonly value: TValue
238
+ }
239
+
240
+ export interface DiscussionLoadingState {
241
+ isLoading?: DiscussionReadableValue<boolean>
242
+ error?: DiscussionReadableValue<Error | null>
243
+ isEmpty?: DiscussionReadableValue<boolean>
244
+ isRetrying?: DiscussionReadableValue<boolean>
245
+ retryCount?: DiscussionReadableValue<number>
246
+ canRetry?: DiscussionReadableValue<boolean>
247
+ shouldShowSkeleton?: DiscussionReadableValue<boolean>
248
+ shouldShowError?: DiscussionReadableValue<boolean>
249
+ shouldShowEmpty?: DiscussionReadableValue<boolean>
250
+ setLoading(loading: boolean): void
251
+ setError(error: Error | null): void
252
+ setEmpty(empty: boolean): void
253
+ setRetrying?(retrying: boolean): void
254
+ reset?(): void
255
+ }
256
+
257
+ export interface DiscussionRealtimeChannelLike {
258
+ listen(event: string, callback: (payload: unknown) => void): DiscussionRealtimeChannelLike
259
+ }
260
+
261
+ export interface DiscussionRealtimeClientLike {
262
+ private(channel: string): DiscussionRealtimeChannelLike
263
+ leave(channel: string): void
264
+ }
265
+
266
+ export interface DiscussionStoreConfig {
267
+ client: AxiosInstance
268
+ getCurrentUserId: () => string | null
269
+ getEcho: () => DiscussionRealtimeClientLike | null
270
+ onEchoReconnected: (callback: () => void) => (() => void) | void
271
+ createLoadingState: () => DiscussionLoadingState
272
+ logger?: Pick<Console, 'error'>
273
+ storeId?: string
274
+ }