@codingfactory/socialkit-vue 0.3.1 → 0.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.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/services/echo.d.ts +90 -0
- package/dist/services/echo.d.ts.map +1 -0
- package/dist/services/echo.js +712 -0
- package/dist/services/echo.js.map +1 -0
- package/dist/stores/discussion.d.ts +2017 -0
- package/dist/stores/discussion.d.ts.map +1 -0
- package/dist/stores/discussion.js +1857 -0
- package/dist/stores/discussion.js.map +1 -0
- package/dist/types/discussion.d.ts +242 -0
- package/dist/types/discussion.d.ts.map +1 -0
- package/dist/types/discussion.js +5 -0
- package/dist/types/discussion.js.map +1 -0
- package/dist/types/realtime.d.ts +85 -0
- package/dist/types/realtime.d.ts.map +1 -0
- package/dist/types/realtime.js +5 -0
- package/dist/types/realtime.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +72 -0
- package/src/services/echo.ts +1072 -0
- package/src/stores/discussion.ts +2249 -0
- package/src/types/discussion.ts +274 -0
- package/src/types/realtime.ts +95 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared realtime payload types for SocialKit-powered frontends.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type ConnectionStatus = 'connecting' | 'connected' | 'disconnected' | 'error'
|
|
6
|
+
|
|
7
|
+
export interface NotificationEvent {
|
|
8
|
+
id: string
|
|
9
|
+
type: string
|
|
10
|
+
data: Record<string, unknown>
|
|
11
|
+
created_at: string
|
|
12
|
+
read_at?: string | null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type PresenceStatus = 'online' | 'idle' | 'dnd' | 'offline'
|
|
16
|
+
|
|
17
|
+
export interface PresenceStatusChangedEvent {
|
|
18
|
+
user_id: string
|
|
19
|
+
tenant_id?: string | null
|
|
20
|
+
tenant_scope: string
|
|
21
|
+
status: PresenceStatus
|
|
22
|
+
last_seen_at?: string | null
|
|
23
|
+
ts: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface LiveCircleCountUpdatedEvent {
|
|
27
|
+
circle_id: string
|
|
28
|
+
count: number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TutorialCommentAddedEvent {
|
|
32
|
+
tutorial_id: string
|
|
33
|
+
comment: {
|
|
34
|
+
id: string
|
|
35
|
+
author_id: string
|
|
36
|
+
author_name: string
|
|
37
|
+
body: string
|
|
38
|
+
created_at: string
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface TutorialProgressUpdatedEvent {
|
|
43
|
+
tutorial_id: string
|
|
44
|
+
user_id: string
|
|
45
|
+
current_step_id: string
|
|
46
|
+
progress_percent: number
|
|
47
|
+
completed_steps: string[]
|
|
48
|
+
is_completed: boolean
|
|
49
|
+
updated_at: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ProfileStatsUpdatedEvent {
|
|
53
|
+
stats: {
|
|
54
|
+
followers_count: number
|
|
55
|
+
following_count: number
|
|
56
|
+
posts_count?: number
|
|
57
|
+
comments_count?: number
|
|
58
|
+
replies_count?: number
|
|
59
|
+
reactions_given?: number
|
|
60
|
+
reactions_received?: number
|
|
61
|
+
threads_started?: number
|
|
62
|
+
best_answers?: number
|
|
63
|
+
streak_days?: number
|
|
64
|
+
longest_streak?: number
|
|
65
|
+
total_content?: number
|
|
66
|
+
engagement_rate?: number
|
|
67
|
+
is_active?: boolean
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ProfileActivity {
|
|
72
|
+
id: string
|
|
73
|
+
user_id: string
|
|
74
|
+
activity_type: string
|
|
75
|
+
target_type?: string
|
|
76
|
+
target_id?: string
|
|
77
|
+
metadata: Record<string, unknown>
|
|
78
|
+
is_public: boolean
|
|
79
|
+
created_at: string
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface ProfileActivityCreatedEvent {
|
|
83
|
+
activity: ProfileActivity
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface StoryTrayUpdatedEvent {
|
|
87
|
+
story_id: string
|
|
88
|
+
author_id: string
|
|
89
|
+
author: {
|
|
90
|
+
id: string
|
|
91
|
+
name: string
|
|
92
|
+
handle: string | null
|
|
93
|
+
avatar_url: string | null
|
|
94
|
+
}
|
|
95
|
+
}
|