@codingfactory/socialkit-vue 0.6.0 → 0.7.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.
- 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/circles.d.ts.map +1 -1
- package/dist/services/circles.js +12 -1
- package/dist/services/circles.js.map +1 -1
- package/dist/services/gamification.d.ts +87 -0
- package/dist/services/gamification.d.ts.map +1 -0
- package/dist/services/gamification.js +263 -0
- package/dist/services/gamification.js.map +1 -0
- package/dist/stores/discussion.d.ts.map +1 -1
- package/dist/stores/discussion.js +59 -53
- package/dist/stores/discussion.js.map +1 -1
- package/dist/stores/gamification.d.ts +2875 -0
- package/dist/stores/gamification.d.ts.map +1 -0
- package/dist/stores/gamification.js +1136 -0
- package/dist/stores/gamification.js.map +1 -0
- package/dist/types/api.d.ts +1 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/gamification.d.ts +267 -0
- package/dist/types/gamification.d.ts.map +1 -0
- package/dist/types/gamification.js +5 -0
- package/dist/types/gamification.js.map +1 -0
- package/dist/types/reputation.d.ts +55 -0
- package/dist/types/reputation.d.ts.map +1 -0
- package/dist/types/reputation.js +5 -0
- package/dist/types/reputation.js.map +1 -0
- package/package.json +4 -2
- package/src/index.ts +65 -0
- package/src/services/circles.ts +13 -1
- package/src/services/gamification.ts +432 -0
- package/src/stores/discussion.ts +75 -54
- package/src/stores/gamification.ts +1565 -0
- package/src/types/api.ts +1 -0
- package/src/types/gamification.ts +286 -0
- package/src/types/reputation.ts +78 -0
package/src/types/api.ts
CHANGED
|
@@ -51,6 +51,7 @@ export interface RequestConfig {
|
|
|
51
51
|
headers?: Record<string, string>
|
|
52
52
|
params?: Record<string, string | number | boolean>
|
|
53
53
|
timeout?: number
|
|
54
|
+
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text'
|
|
54
55
|
onUploadProgress?: (progressEvent: UploadProgressEvent) => void
|
|
55
56
|
signal?: AbortSignal
|
|
56
57
|
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gamification-domain types shared across SocialKit frontends.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface UserStats {
|
|
6
|
+
id: string
|
|
7
|
+
user_id: string
|
|
8
|
+
total_points: number
|
|
9
|
+
coin_balance: number
|
|
10
|
+
lifetime_points: number
|
|
11
|
+
current_level: number
|
|
12
|
+
level: ReputationLevel
|
|
13
|
+
next_level: ReputationLevel | null
|
|
14
|
+
level_progress: number
|
|
15
|
+
points_to_next_level: number
|
|
16
|
+
points_this_week: number
|
|
17
|
+
points_this_month: number
|
|
18
|
+
points_this_year?: number
|
|
19
|
+
rank?: number
|
|
20
|
+
percentile?: number
|
|
21
|
+
badges?: Badge[]
|
|
22
|
+
streaks?: {
|
|
23
|
+
current: number
|
|
24
|
+
longest: number
|
|
25
|
+
}
|
|
26
|
+
streak?: {
|
|
27
|
+
current_count: number
|
|
28
|
+
longest_streak: number
|
|
29
|
+
last_activity_at?: string
|
|
30
|
+
frozen: boolean
|
|
31
|
+
freeze_available: number
|
|
32
|
+
}
|
|
33
|
+
daily_limits?: {
|
|
34
|
+
points_awarded: number
|
|
35
|
+
max_points: number
|
|
36
|
+
points_remaining: number
|
|
37
|
+
is_reached: boolean
|
|
38
|
+
resets_at: string
|
|
39
|
+
}
|
|
40
|
+
privileges: UserPrivilege[]
|
|
41
|
+
stats: Record<string, unknown>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type UserReputation = UserStats
|
|
45
|
+
|
|
46
|
+
export interface ReputationLevel {
|
|
47
|
+
level_number: number
|
|
48
|
+
name: string
|
|
49
|
+
badge_color: string
|
|
50
|
+
badge_icon: string
|
|
51
|
+
benefits: string[]
|
|
52
|
+
min_points?: number
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface UserPrivilege {
|
|
56
|
+
id: string
|
|
57
|
+
slug: string
|
|
58
|
+
name: string
|
|
59
|
+
description: string
|
|
60
|
+
unlocked_at: string
|
|
61
|
+
expires_at?: string
|
|
62
|
+
category?: string
|
|
63
|
+
is_active?: boolean
|
|
64
|
+
privilege_id?: string
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface Achievement {
|
|
68
|
+
id: string
|
|
69
|
+
name: string
|
|
70
|
+
description: string
|
|
71
|
+
icon: string
|
|
72
|
+
rarity?: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary'
|
|
73
|
+
condition_type?: 'count' | 'streak' | 'points' | 'social'
|
|
74
|
+
condition_data?: {
|
|
75
|
+
action?: string
|
|
76
|
+
target: number
|
|
77
|
+
current?: number
|
|
78
|
+
}
|
|
79
|
+
reward_points?: number
|
|
80
|
+
points_awarded?: number
|
|
81
|
+
reward_data?: {
|
|
82
|
+
badge_color?: string
|
|
83
|
+
badge_text?: string
|
|
84
|
+
special_privileges?: string[]
|
|
85
|
+
unlocks_feature?: string
|
|
86
|
+
}
|
|
87
|
+
is_active?: boolean
|
|
88
|
+
is_visible?: boolean
|
|
89
|
+
is_unlocked?: boolean
|
|
90
|
+
is_claimed?: boolean
|
|
91
|
+
can_claim?: boolean
|
|
92
|
+
unlocked_at?: string | null
|
|
93
|
+
claimed_at?: string | null
|
|
94
|
+
progress_percentage?: number
|
|
95
|
+
progress_current?: number
|
|
96
|
+
progress_target?: number
|
|
97
|
+
share_card?: AchievementShareCard
|
|
98
|
+
progress?: number | AchievementProgress
|
|
99
|
+
sort_order?: number
|
|
100
|
+
requirements?: AchievementRequirement[]
|
|
101
|
+
category?: string
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface AchievementShareCard {
|
|
105
|
+
title: string
|
|
106
|
+
badge_label: string
|
|
107
|
+
description: string
|
|
108
|
+
image_url: string
|
|
109
|
+
share_url: string
|
|
110
|
+
share_text: string
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface AchievementProgress {
|
|
114
|
+
current_value: number
|
|
115
|
+
target_value: number
|
|
116
|
+
percentage: number
|
|
117
|
+
unit: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface AchievementRequirement {
|
|
121
|
+
id: string
|
|
122
|
+
type: string
|
|
123
|
+
target_value: number
|
|
124
|
+
current_value: number
|
|
125
|
+
description: string
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface AchievementUnlockNotification {
|
|
129
|
+
achievementId: string
|
|
130
|
+
title: string
|
|
131
|
+
description: string
|
|
132
|
+
icon: string
|
|
133
|
+
unlockedAt: string
|
|
134
|
+
points?: number
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface Quest {
|
|
138
|
+
id: string
|
|
139
|
+
name?: string
|
|
140
|
+
title?: string
|
|
141
|
+
description: string
|
|
142
|
+
type: 'daily' | 'weekly' | 'monthly' | 'special' | 'challenge'
|
|
143
|
+
objectives: QuestObjective[]
|
|
144
|
+
rewards?: QuestReward[]
|
|
145
|
+
reward_points: number
|
|
146
|
+
status?: 'available' | 'in_progress' | 'completed' | 'expired'
|
|
147
|
+
is_active?: boolean
|
|
148
|
+
starts_at?: string
|
|
149
|
+
expires_at: string | null
|
|
150
|
+
completed_at: string | null
|
|
151
|
+
accepted_at?: string | null
|
|
152
|
+
progress?: {
|
|
153
|
+
current: number
|
|
154
|
+
total: number
|
|
155
|
+
percentage: number
|
|
156
|
+
}
|
|
157
|
+
progress_percentage?: number
|
|
158
|
+
category?: string
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface QuestObjective {
|
|
162
|
+
id: string
|
|
163
|
+
quest_id?: string
|
|
164
|
+
description: string
|
|
165
|
+
type: string
|
|
166
|
+
target: number
|
|
167
|
+
target_value?: number
|
|
168
|
+
current: number
|
|
169
|
+
current_value?: number
|
|
170
|
+
is_completed?: boolean
|
|
171
|
+
completed?: boolean
|
|
172
|
+
bonus_points?: number
|
|
173
|
+
unit?: string
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface QuestReward {
|
|
177
|
+
type: 'points' | 'badge' | 'privilege' | 'item'
|
|
178
|
+
value: number | string
|
|
179
|
+
description: string
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface LeaderboardEntry {
|
|
183
|
+
rank: number
|
|
184
|
+
user_id: string
|
|
185
|
+
handle: string
|
|
186
|
+
name: string
|
|
187
|
+
avatar_url?: string | null
|
|
188
|
+
points: number
|
|
189
|
+
period_points?: number
|
|
190
|
+
total_points: number
|
|
191
|
+
level: number
|
|
192
|
+
current_level?: number
|
|
193
|
+
level_details?: ReputationLevel
|
|
194
|
+
achievements_count?: number
|
|
195
|
+
change: number
|
|
196
|
+
trend?: number | 'up' | 'down' | 'same' | null
|
|
197
|
+
is_current_user: boolean
|
|
198
|
+
space_id?: string | null
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export type LeaderboardPeriod = 'daily' | 'weekly' | 'monthly' | 'all-time'
|
|
202
|
+
export type QuestFilter = 'active' | 'daily' | 'weekly' | 'completed'
|
|
203
|
+
|
|
204
|
+
export interface Reward {
|
|
205
|
+
id: string
|
|
206
|
+
name: string
|
|
207
|
+
description: string
|
|
208
|
+
cost_points: number
|
|
209
|
+
reward_type?: 'badge' | 'title' | 'cosmetic' | 'boost' | 'feature'
|
|
210
|
+
type?: 'cosmetic' | 'privilege' | 'boost' | 'item'
|
|
211
|
+
category?: 'badge' | 'privilege' | 'cosmetic' | 'bonus'
|
|
212
|
+
icon?: string
|
|
213
|
+
preview_image?: string
|
|
214
|
+
reward_data?: Record<string, unknown>
|
|
215
|
+
can_redeem?: boolean
|
|
216
|
+
user_points?: number
|
|
217
|
+
points_needed?: number
|
|
218
|
+
stock_quantity?: number | null
|
|
219
|
+
stock_remaining?: number | null
|
|
220
|
+
max_per_user?: number
|
|
221
|
+
user_redemptions?: number
|
|
222
|
+
availability_status?: 'available' | 'insufficient_points' | 'out_of_stock' | 'limit_reached' | 'inactive' | string
|
|
223
|
+
data?: {
|
|
224
|
+
duration?: number
|
|
225
|
+
value?: unknown
|
|
226
|
+
icon?: string
|
|
227
|
+
color?: string
|
|
228
|
+
}
|
|
229
|
+
stock?: number
|
|
230
|
+
limited_quantity?: number | null
|
|
231
|
+
remaining_quantity?: number | null
|
|
232
|
+
redemption_limit?: number
|
|
233
|
+
is_available?: boolean
|
|
234
|
+
is_claimed?: boolean
|
|
235
|
+
redeemed_count?: number
|
|
236
|
+
redeemed_at?: string
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface ClaimedReward {
|
|
240
|
+
id: string
|
|
241
|
+
reward_id: string
|
|
242
|
+
reward: Reward
|
|
243
|
+
claimed_at: string
|
|
244
|
+
status: 'active' | 'expired'
|
|
245
|
+
expires_at?: string
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface RewardTransaction {
|
|
249
|
+
id: string
|
|
250
|
+
reward_id: string
|
|
251
|
+
reward: Reward
|
|
252
|
+
points_spent: number
|
|
253
|
+
transaction_type: 'redemption' | 'refund'
|
|
254
|
+
created_at: string
|
|
255
|
+
metadata: Record<string, unknown>
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface Badge {
|
|
259
|
+
id: string
|
|
260
|
+
name: string
|
|
261
|
+
description: string
|
|
262
|
+
icon: string
|
|
263
|
+
color: string
|
|
264
|
+
rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary'
|
|
265
|
+
earned_at: string
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface GamificationNotification {
|
|
269
|
+
type: 'points_earned' | 'level_up' | 'achievement_unlocked' | 'quest_completed' | 'leaderboard_change' | 'reward_available'
|
|
270
|
+
data: unknown
|
|
271
|
+
timestamp: string
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface PointTransaction {
|
|
275
|
+
id: string
|
|
276
|
+
user_id: string
|
|
277
|
+
points: number
|
|
278
|
+
type: string
|
|
279
|
+
source_type?: string
|
|
280
|
+
source_id?: string
|
|
281
|
+
description: string
|
|
282
|
+
created_at: string
|
|
283
|
+
is_reversed?: boolean
|
|
284
|
+
reversed_at?: string
|
|
285
|
+
reversal_reason?: string
|
|
286
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic reputation-adjacent types shared across SocialKit frontends.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
LeaderboardEntry,
|
|
7
|
+
PointTransaction,
|
|
8
|
+
ReputationLevel,
|
|
9
|
+
UserReputation,
|
|
10
|
+
UserStats,
|
|
11
|
+
UserPrivilege,
|
|
12
|
+
} from './gamification.js'
|
|
13
|
+
|
|
14
|
+
export type Timestamp = string
|
|
15
|
+
|
|
16
|
+
export type {
|
|
17
|
+
LeaderboardEntry,
|
|
18
|
+
PointTransaction,
|
|
19
|
+
ReputationLevel,
|
|
20
|
+
UserPrivilege,
|
|
21
|
+
UserReputation,
|
|
22
|
+
UserStats,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ReputationPrivilege {
|
|
26
|
+
id: string
|
|
27
|
+
name: string
|
|
28
|
+
slug: string
|
|
29
|
+
category: string
|
|
30
|
+
required_points: number
|
|
31
|
+
required_level: number | null
|
|
32
|
+
description: string
|
|
33
|
+
is_active: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface DailyLimitStatus {
|
|
37
|
+
points_awarded: number
|
|
38
|
+
max_points: number
|
|
39
|
+
points_remaining: number
|
|
40
|
+
is_reached: boolean
|
|
41
|
+
resets_at: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface StreakMilestone {
|
|
45
|
+
days: number
|
|
46
|
+
days_remaining: number
|
|
47
|
+
bonus_points: number
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface UserStreakStatus {
|
|
51
|
+
days: number
|
|
52
|
+
is_active_today: boolean
|
|
53
|
+
freeze_available: number
|
|
54
|
+
next_milestone: StreakMilestone | null
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface PointsAwardedEvent {
|
|
58
|
+
transaction_id?: string
|
|
59
|
+
action_type: string
|
|
60
|
+
points: number
|
|
61
|
+
reason?: string
|
|
62
|
+
source_type?: string
|
|
63
|
+
source_id?: string
|
|
64
|
+
metadata?: Record<string, unknown>
|
|
65
|
+
level_progress?: number
|
|
66
|
+
lifetime_points?: number
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface LevelUpEvent {
|
|
70
|
+
new_level: number
|
|
71
|
+
level_details: ReputationLevel
|
|
72
|
+
next_level_details: ReputationLevel | null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ReputationSnapshot {
|
|
76
|
+
snapshot_date: Timestamp
|
|
77
|
+
total_points: number
|
|
78
|
+
}
|