@growsober/sdk 1.0.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/README.md +276 -0
- package/dist/__tests__/e2e.test.d.ts +7 -0
- package/dist/__tests__/e2e.test.js +472 -0
- package/dist/api/client.d.ts +11 -0
- package/dist/api/client.js +61 -0
- package/dist/api/mutations/admin.d.ts +167 -0
- package/dist/api/mutations/admin.js +326 -0
- package/dist/api/mutations/ambassadors.d.ts +52 -0
- package/dist/api/mutations/ambassadors.js +148 -0
- package/dist/api/mutations/auth.d.ts +267 -0
- package/dist/api/mutations/auth.js +332 -0
- package/dist/api/mutations/bookings.d.ts +59 -0
- package/dist/api/mutations/bookings.js +143 -0
- package/dist/api/mutations/event-chat.d.ts +35 -0
- package/dist/api/mutations/event-chat.js +147 -0
- package/dist/api/mutations/events.d.ts +87 -0
- package/dist/api/mutations/events.js +205 -0
- package/dist/api/mutations/grow90.d.ts +36 -0
- package/dist/api/mutations/grow90.js +132 -0
- package/dist/api/mutations/hubs.d.ts +111 -0
- package/dist/api/mutations/hubs.js +240 -0
- package/dist/api/mutations/index.d.ts +22 -0
- package/dist/api/mutations/index.js +39 -0
- package/dist/api/mutations/jack.d.ts +61 -0
- package/dist/api/mutations/jack.js +104 -0
- package/dist/api/mutations/library.d.ts +67 -0
- package/dist/api/mutations/library.js +168 -0
- package/dist/api/mutations/map.d.ts +153 -0
- package/dist/api/mutations/map.js +181 -0
- package/dist/api/mutations/matching.d.ts +130 -0
- package/dist/api/mutations/matching.js +204 -0
- package/dist/api/mutations/notifications.d.ts +63 -0
- package/dist/api/mutations/notifications.js +106 -0
- package/dist/api/mutations/offers.d.ts +26 -0
- package/dist/api/mutations/offers.js +47 -0
- package/dist/api/mutations/subscriptions.d.ts +127 -0
- package/dist/api/mutations/subscriptions.js +140 -0
- package/dist/api/mutations/support.d.ts +165 -0
- package/dist/api/mutations/support.js +307 -0
- package/dist/api/mutations/users.d.ts +211 -0
- package/dist/api/mutations/users.js +261 -0
- package/dist/api/queries/admin.d.ts +257 -0
- package/dist/api/queries/admin.js +320 -0
- package/dist/api/queries/ambassadors.d.ts +53 -0
- package/dist/api/queries/ambassadors.js +98 -0
- package/dist/api/queries/auth.d.ts +16 -0
- package/dist/api/queries/auth.js +25 -0
- package/dist/api/queries/bookings.d.ts +91 -0
- package/dist/api/queries/bookings.js +102 -0
- package/dist/api/queries/businesses.d.ts +212 -0
- package/dist/api/queries/businesses.js +154 -0
- package/dist/api/queries/event-chat.d.ts +19 -0
- package/dist/api/queries/event-chat.js +75 -0
- package/dist/api/queries/events.d.ts +322 -0
- package/dist/api/queries/events.js +221 -0
- package/dist/api/queries/grow90.d.ts +26 -0
- package/dist/api/queries/grow90.js +85 -0
- package/dist/api/queries/hubs.d.ts +165 -0
- package/dist/api/queries/hubs.js +143 -0
- package/dist/api/queries/index.d.ts +23 -0
- package/dist/api/queries/index.js +40 -0
- package/dist/api/queries/jack.d.ts +63 -0
- package/dist/api/queries/jack.js +92 -0
- package/dist/api/queries/library.d.ts +132 -0
- package/dist/api/queries/library.js +120 -0
- package/dist/api/queries/map.d.ts +216 -0
- package/dist/api/queries/map.js +278 -0
- package/dist/api/queries/matching.d.ts +136 -0
- package/dist/api/queries/matching.js +161 -0
- package/dist/api/queries/notifications.d.ts +78 -0
- package/dist/api/queries/notifications.js +88 -0
- package/dist/api/queries/offers.d.ts +91 -0
- package/dist/api/queries/offers.js +103 -0
- package/dist/api/queries/subscriptions.d.ts +56 -0
- package/dist/api/queries/subscriptions.js +73 -0
- package/dist/api/queries/support.d.ts +106 -0
- package/dist/api/queries/support.js +202 -0
- package/dist/api/queries/users.d.ts +293 -0
- package/dist/api/queries/users.js +370 -0
- package/dist/api/types.d.ts +464 -0
- package/dist/api/types.js +9 -0
- package/dist/hooks/useAuth.d.ts +5 -0
- package/dist/hooks/useAuth.js +39 -0
- package/dist/hooks/useUser.d.ts +43 -0
- package/dist/hooks/useUser.js +44 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +67 -0
- package/package.json +62 -0
- package/src/__tests__/e2e.test.ts +502 -0
- package/src/api/client.ts +71 -0
- package/src/api/mutations/admin.ts +531 -0
- package/src/api/mutations/ambassadors.ts +185 -0
- package/src/api/mutations/auth.ts +350 -0
- package/src/api/mutations/bookings.ts +190 -0
- package/src/api/mutations/event-chat.ts +177 -0
- package/src/api/mutations/events.ts +273 -0
- package/src/api/mutations/grow90.ts +169 -0
- package/src/api/mutations/hubs.ts +385 -0
- package/src/api/mutations/index.ts +23 -0
- package/src/api/mutations/jack.ts +130 -0
- package/src/api/mutations/library.ts +212 -0
- package/src/api/mutations/map.ts +230 -0
- package/src/api/mutations/matching.ts +271 -0
- package/src/api/mutations/notifications.ts +114 -0
- package/src/api/mutations/offers.ts +73 -0
- package/src/api/mutations/subscriptions.ts +162 -0
- package/src/api/mutations/support.ts +390 -0
- package/src/api/mutations/users.ts +271 -0
- package/src/api/queries/admin.ts +480 -0
- package/src/api/queries/ambassadors.ts +139 -0
- package/src/api/queries/auth.ts +24 -0
- package/src/api/queries/bookings.ts +135 -0
- package/src/api/queries/businesses.ts +203 -0
- package/src/api/queries/event-chat.ts +78 -0
- package/src/api/queries/events.ts +272 -0
- package/src/api/queries/grow90.ts +98 -0
- package/src/api/queries/hubs.ts +211 -0
- package/src/api/queries/index.ts +24 -0
- package/src/api/queries/jack.ts +127 -0
- package/src/api/queries/library.ts +166 -0
- package/src/api/queries/map.ts +331 -0
- package/src/api/queries/matching.ts +238 -0
- package/src/api/queries/notifications.ts +103 -0
- package/src/api/queries/offers.ts +136 -0
- package/src/api/queries/subscriptions.ts +91 -0
- package/src/api/queries/support.ts +235 -0
- package/src/api/queries/users.ts +393 -0
- package/src/api/types.ts +596 -0
- package/src/index.ts +57 -0
package/src/api/types.ts
ADDED
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type extraction utilities for OpenAPI-generated types
|
|
3
|
+
*
|
|
4
|
+
* This file provides type-safe helpers to extract request/response types
|
|
5
|
+
* from the @growsober/types package.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { paths, components } from '@growsober/types';
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// TYPE EXTRACTION HELPERS
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Extract request body type for a given endpoint and method
|
|
16
|
+
*/
|
|
17
|
+
export type RequestBody<
|
|
18
|
+
Path extends keyof paths,
|
|
19
|
+
Method extends keyof paths[Path]
|
|
20
|
+
> = paths[Path][Method] extends { requestBody: { content: { 'application/json': infer T } } }
|
|
21
|
+
? T
|
|
22
|
+
: never;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Extract response type for a given endpoint, method, and status code
|
|
26
|
+
*/
|
|
27
|
+
export type ResponseBody<
|
|
28
|
+
Path extends keyof paths,
|
|
29
|
+
Method extends keyof paths[Path],
|
|
30
|
+
Status extends number = 200
|
|
31
|
+
> = paths[Path][Method] extends { responses: { [K in Status]: { content: { 'application/json': infer T } } } }
|
|
32
|
+
? T
|
|
33
|
+
: never;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Extract query parameters type for a given endpoint and method
|
|
37
|
+
*/
|
|
38
|
+
export type QueryParams<
|
|
39
|
+
Path extends keyof paths,
|
|
40
|
+
Method extends keyof paths[Path]
|
|
41
|
+
> = paths[Path][Method] extends { parameters: { query?: infer Q } }
|
|
42
|
+
? Q
|
|
43
|
+
: Record<string, never>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Extract path parameters type for a given endpoint and method
|
|
47
|
+
*/
|
|
48
|
+
export type PathParams<
|
|
49
|
+
Path extends keyof paths,
|
|
50
|
+
Method extends keyof paths[Path]
|
|
51
|
+
> = paths[Path][Method] extends { parameters: { path: infer P } }
|
|
52
|
+
? P
|
|
53
|
+
: Record<string, never>;
|
|
54
|
+
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// AUTH TYPES
|
|
57
|
+
// ============================================================================
|
|
58
|
+
|
|
59
|
+
export type RegisterRequest = components['schemas']['RegisterDto'];
|
|
60
|
+
export type AuthResponse = components['schemas']['AuthResponseDto'];
|
|
61
|
+
export type LoginRequest = components['schemas']['LoginDto'];
|
|
62
|
+
export type RefreshTokenRequest = components['schemas']['RefreshTokenDto'];
|
|
63
|
+
export type TokenResponse = components['schemas']['TokenResponseDto'];
|
|
64
|
+
export type FirebaseAuthRequest = components['schemas']['FirebaseAuthDto'];
|
|
65
|
+
|
|
66
|
+
// ============================================================================
|
|
67
|
+
// USER TYPES
|
|
68
|
+
// ============================================================================
|
|
69
|
+
|
|
70
|
+
export type UserResponse = components['schemas']['UserResponseDto'];
|
|
71
|
+
export type UserPublicResponse = components['schemas']['UserPublicResponseDto'];
|
|
72
|
+
export type CreateUserRequest = components['schemas']['CreateUserDto'];
|
|
73
|
+
export type UpdateUserRequest = components['schemas']['UpdateUserDto'];
|
|
74
|
+
|
|
75
|
+
// ============================================================================
|
|
76
|
+
// HUB TYPES
|
|
77
|
+
// ============================================================================
|
|
78
|
+
|
|
79
|
+
export type HubResponse = components['schemas']['HubResponseDto'];
|
|
80
|
+
export type CreateHubRequest = components['schemas']['CreateHubDto'];
|
|
81
|
+
export type UpdateHubRequest = components['schemas']['UpdateHubDto'];
|
|
82
|
+
|
|
83
|
+
// HubMemberResponse - will be available when hub membership endpoints are fully implemented
|
|
84
|
+
// For now, define inline type based on API response structure
|
|
85
|
+
export interface HubMemberResponse {
|
|
86
|
+
id: string;
|
|
87
|
+
hubId: string;
|
|
88
|
+
userId: string;
|
|
89
|
+
role: 'MEMBER' | 'MODERATOR' | 'ADMIN' | 'OWNER';
|
|
90
|
+
status: 'PENDING' | 'APPROVED' | 'REJECTED';
|
|
91
|
+
joinedAt: string;
|
|
92
|
+
user?: UserPublicResponse;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ============================================================================
|
|
96
|
+
// EVENT TYPES
|
|
97
|
+
// ============================================================================
|
|
98
|
+
|
|
99
|
+
export type EventResponse = components['schemas']['EventResponseDto'];
|
|
100
|
+
export type CreateEventRequest = components['schemas']['CreateEventDto'];
|
|
101
|
+
export type UpdateEventRequest = components['schemas']['UpdateEventDto'];
|
|
102
|
+
|
|
103
|
+
// ============================================================================
|
|
104
|
+
// BOOKING TYPES
|
|
105
|
+
// ============================================================================
|
|
106
|
+
|
|
107
|
+
export type BookingResponse = components['schemas']['BookingResponseDto'];
|
|
108
|
+
export type CreateBookingRequest = components['schemas']['CreateBookingDto'];
|
|
109
|
+
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// LIBRARY TYPES
|
|
112
|
+
// ============================================================================
|
|
113
|
+
|
|
114
|
+
export type LibraryContentResponse = components['schemas']['LibraryContentResponseDto'];
|
|
115
|
+
export type LibraryContentDetailResponse = components['schemas']['LibraryContentDetailResponseDto'];
|
|
116
|
+
export type LibraryProgressResponse = components['schemas']['LibraryProgressResponseDto'];
|
|
117
|
+
|
|
118
|
+
// ============================================================================
|
|
119
|
+
// BUSINESS & OFFER TYPES
|
|
120
|
+
// ============================================================================
|
|
121
|
+
|
|
122
|
+
export type BusinessResponse = components['schemas']['BusinessResponseDto'];
|
|
123
|
+
export type OfferResponse = components['schemas']['OfferResponseDto'];
|
|
124
|
+
export type RedeemOfferRequest = components['schemas']['RedeemOfferDto'];
|
|
125
|
+
|
|
126
|
+
// ============================================================================
|
|
127
|
+
// SUBSCRIPTION TYPES
|
|
128
|
+
// ============================================================================
|
|
129
|
+
|
|
130
|
+
export type SubscriptionResponse = components['schemas']['SubscriptionResponseDto'];
|
|
131
|
+
export type CreateCheckoutRequest = components['schemas']['CreateCheckoutDto'];
|
|
132
|
+
|
|
133
|
+
// ============================================================================
|
|
134
|
+
// NOTIFICATION TYPES
|
|
135
|
+
// ============================================================================
|
|
136
|
+
|
|
137
|
+
export type NotificationResponse = components['schemas']['NotificationResponseDto'];
|
|
138
|
+
|
|
139
|
+
// ============================================================================
|
|
140
|
+
// DEVICE TOKEN TYPES
|
|
141
|
+
// ============================================================================
|
|
142
|
+
|
|
143
|
+
export type RegisterDeviceTokenRequest = components['schemas']['RegisterDeviceDto'];
|
|
144
|
+
|
|
145
|
+
// ============================================================================
|
|
146
|
+
// SUPPORT TYPES (Placeholder - will be generated when support module is registered)
|
|
147
|
+
// ============================================================================
|
|
148
|
+
|
|
149
|
+
// These types will be generated from OpenAPI once the support module endpoints
|
|
150
|
+
// are registered in the API. For now, we define placeholder interfaces.
|
|
151
|
+
|
|
152
|
+
export interface DailyCheckInResponse {
|
|
153
|
+
id: string;
|
|
154
|
+
userId: string;
|
|
155
|
+
date: string;
|
|
156
|
+
mood: number | null;
|
|
157
|
+
energy: number | null;
|
|
158
|
+
stayedSober: boolean | null;
|
|
159
|
+
triggers: string[];
|
|
160
|
+
copingUsed: string[];
|
|
161
|
+
notes: string | null;
|
|
162
|
+
gratitude: string[];
|
|
163
|
+
createdAt: string;
|
|
164
|
+
updatedAt: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface CreateCheckInRequest {
|
|
168
|
+
date: string;
|
|
169
|
+
mood?: number;
|
|
170
|
+
energy?: number;
|
|
171
|
+
stayedSober?: boolean;
|
|
172
|
+
triggers?: string[];
|
|
173
|
+
copingUsed?: string[];
|
|
174
|
+
notes?: string;
|
|
175
|
+
gratitude?: string[];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface UpdateCheckInRequest {
|
|
179
|
+
mood?: number;
|
|
180
|
+
energy?: number;
|
|
181
|
+
stayedSober?: boolean;
|
|
182
|
+
triggers?: string[];
|
|
183
|
+
copingUsed?: string[];
|
|
184
|
+
notes?: string;
|
|
185
|
+
gratitude?: string[];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface CheckInStreakResponse {
|
|
189
|
+
currentStreak: number;
|
|
190
|
+
longestStreak: number;
|
|
191
|
+
totalCheckIns: number;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface MoodLogResponse {
|
|
195
|
+
id: string;
|
|
196
|
+
userId: string;
|
|
197
|
+
mood: number;
|
|
198
|
+
notes?: string;
|
|
199
|
+
triggers?: string[];
|
|
200
|
+
createdAt: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface CreateMoodLogRequest {
|
|
204
|
+
mood: number;
|
|
205
|
+
notes?: string;
|
|
206
|
+
triggers?: string[];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface WinResponse {
|
|
210
|
+
id: string;
|
|
211
|
+
userId: string;
|
|
212
|
+
title: string;
|
|
213
|
+
description?: string;
|
|
214
|
+
category: string;
|
|
215
|
+
imageUrl?: string;
|
|
216
|
+
createdAt: string;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface CreateWinRequest {
|
|
220
|
+
title: string;
|
|
221
|
+
description?: string;
|
|
222
|
+
category: string;
|
|
223
|
+
imageUrl?: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface HabitResponse {
|
|
227
|
+
id: string;
|
|
228
|
+
userId: string;
|
|
229
|
+
name: string;
|
|
230
|
+
description?: string;
|
|
231
|
+
icon?: string;
|
|
232
|
+
color?: string;
|
|
233
|
+
frequency: string;
|
|
234
|
+
targetDays: number[];
|
|
235
|
+
targetCount: number;
|
|
236
|
+
currentStreak: number;
|
|
237
|
+
longestStreak: number;
|
|
238
|
+
totalCompletions: number;
|
|
239
|
+
isActive: boolean;
|
|
240
|
+
isPaused: boolean;
|
|
241
|
+
reminderTime?: string;
|
|
242
|
+
createdAt: string;
|
|
243
|
+
updatedAt: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface CreateHabitRequest {
|
|
247
|
+
name: string;
|
|
248
|
+
description?: string;
|
|
249
|
+
icon?: string;
|
|
250
|
+
color?: string;
|
|
251
|
+
frequency: string;
|
|
252
|
+
targetDays?: number[];
|
|
253
|
+
targetCount?: number;
|
|
254
|
+
reminderTime?: string;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface UpdateHabitRequest {
|
|
258
|
+
name?: string;
|
|
259
|
+
description?: string;
|
|
260
|
+
icon?: string;
|
|
261
|
+
color?: string;
|
|
262
|
+
frequency?: string;
|
|
263
|
+
targetDays?: number[];
|
|
264
|
+
targetCount?: number;
|
|
265
|
+
isActive?: boolean;
|
|
266
|
+
isPaused?: boolean;
|
|
267
|
+
reminderTime?: string;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface ReflectionResponse {
|
|
271
|
+
id: string;
|
|
272
|
+
userId: string;
|
|
273
|
+
prompt: string;
|
|
274
|
+
content: string;
|
|
275
|
+
mood?: number;
|
|
276
|
+
createdAt: string;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface CreateReflectionRequest {
|
|
280
|
+
prompt: string;
|
|
281
|
+
content: string;
|
|
282
|
+
mood?: number;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface UserStreakResponse {
|
|
286
|
+
id: string;
|
|
287
|
+
userId: string;
|
|
288
|
+
type: string;
|
|
289
|
+
currentStreak: number;
|
|
290
|
+
longestStreak: number;
|
|
291
|
+
totalCheckIns: number;
|
|
292
|
+
lastActivityDate: string;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// ============================================================================
|
|
296
|
+
// GAMIFICATION TYPES (Placeholder - will be generated when gamification module is registered)
|
|
297
|
+
// ============================================================================
|
|
298
|
+
|
|
299
|
+
export interface BadgeResponse {
|
|
300
|
+
id: string;
|
|
301
|
+
appId: string;
|
|
302
|
+
name: string;
|
|
303
|
+
description?: string;
|
|
304
|
+
iconUrl?: string;
|
|
305
|
+
type: string;
|
|
306
|
+
threshold?: number;
|
|
307
|
+
isSecret: boolean;
|
|
308
|
+
isActive: boolean;
|
|
309
|
+
sortOrder: number;
|
|
310
|
+
createdAt: string;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export interface UserBadgeResponse {
|
|
314
|
+
id: string;
|
|
315
|
+
userId: string;
|
|
316
|
+
badgeId: string;
|
|
317
|
+
awardedAt: string;
|
|
318
|
+
badge?: BadgeResponse;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// ============================================================================
|
|
322
|
+
// MAP TYPES (Placeholder - will be generated when map module is registered)
|
|
323
|
+
// ============================================================================
|
|
324
|
+
|
|
325
|
+
export interface MapUserResponse {
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
avatar?: string;
|
|
329
|
+
locationLat: number;
|
|
330
|
+
locationLong: number;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface MapHubResponse {
|
|
334
|
+
id: string;
|
|
335
|
+
name: string;
|
|
336
|
+
slug: string;
|
|
337
|
+
locationLat: number;
|
|
338
|
+
locationLong: number;
|
|
339
|
+
memberCount: number;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export interface MapEventResponse {
|
|
343
|
+
id: string;
|
|
344
|
+
title: string;
|
|
345
|
+
slug: string;
|
|
346
|
+
locationLat: number;
|
|
347
|
+
locationLong: number;
|
|
348
|
+
startDate: string;
|
|
349
|
+
attendeeCount: number;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export interface MapBusinessResponse {
|
|
353
|
+
id: string;
|
|
354
|
+
name: string;
|
|
355
|
+
slug?: string;
|
|
356
|
+
locationLat: number;
|
|
357
|
+
locationLong: number;
|
|
358
|
+
type: string;
|
|
359
|
+
hasAfDrinks: boolean;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// ============================================================================
|
|
363
|
+
// AMBASSADOR TYPES
|
|
364
|
+
// ============================================================================
|
|
365
|
+
|
|
366
|
+
export type AmbassadorStatus = 'PENDING' | 'ACTIVE' | 'INACTIVE' | 'ALUMNI';
|
|
367
|
+
|
|
368
|
+
export interface AmbassadorResponse {
|
|
369
|
+
id: string;
|
|
370
|
+
userId: string;
|
|
371
|
+
hubId: string | null;
|
|
372
|
+
title: string | null;
|
|
373
|
+
bio: string | null;
|
|
374
|
+
status: AmbassadorStatus;
|
|
375
|
+
isVerified: boolean;
|
|
376
|
+
isFoundingAmbassador: boolean;
|
|
377
|
+
eventsHosted: number;
|
|
378
|
+
membersRecruited: number;
|
|
379
|
+
rewardPoints: number;
|
|
380
|
+
createdAt: string;
|
|
381
|
+
approvedAt: string | null;
|
|
382
|
+
user?: {
|
|
383
|
+
id: string;
|
|
384
|
+
name: string | null;
|
|
385
|
+
profileImage: string | null;
|
|
386
|
+
};
|
|
387
|
+
hub?: {
|
|
388
|
+
id: string;
|
|
389
|
+
name: string;
|
|
390
|
+
slug: string;
|
|
391
|
+
city?: string;
|
|
392
|
+
whatsappGroupUrl?: string;
|
|
393
|
+
} | null;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface AmbassadorLeaderboardResponse {
|
|
397
|
+
id: string;
|
|
398
|
+
userId: string;
|
|
399
|
+
userName: string | null;
|
|
400
|
+
profileImage: string | null;
|
|
401
|
+
hubName: string | null;
|
|
402
|
+
eventsHosted: number;
|
|
403
|
+
membersRecruited: number;
|
|
404
|
+
rewardPoints: number;
|
|
405
|
+
isFoundingAmbassador: boolean;
|
|
406
|
+
rank: number;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export interface ApplyAmbassadorRequest {
|
|
410
|
+
hubId?: string;
|
|
411
|
+
motivation: string;
|
|
412
|
+
bio?: string;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export interface UpdateAmbassadorRequest {
|
|
416
|
+
hubId?: string;
|
|
417
|
+
title?: string;
|
|
418
|
+
bio?: string;
|
|
419
|
+
status?: AmbassadorStatus;
|
|
420
|
+
isVerified?: boolean;
|
|
421
|
+
isFoundingAmbassador?: boolean;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// ============================================================================
|
|
425
|
+
// GROW90 TYPES
|
|
426
|
+
// ============================================================================
|
|
427
|
+
|
|
428
|
+
export type Grow90Status = 'ACTIVE' | 'COMPLETED' | 'PAUSED' | 'ABANDONED';
|
|
429
|
+
|
|
430
|
+
export interface Grow90EnrollmentResponse {
|
|
431
|
+
id: string;
|
|
432
|
+
userId: string;
|
|
433
|
+
startDate: string;
|
|
434
|
+
targetEndDate: string;
|
|
435
|
+
actualEndDate: string | null;
|
|
436
|
+
currentDay: number;
|
|
437
|
+
completedDays: number;
|
|
438
|
+
missedDays: number;
|
|
439
|
+
status: Grow90Status;
|
|
440
|
+
completedAt: string | null;
|
|
441
|
+
dailyReminderTime: string;
|
|
442
|
+
weeklyCallDay: string | null;
|
|
443
|
+
createdAt: string;
|
|
444
|
+
progressPercentage: number;
|
|
445
|
+
daysRemaining: number;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface Grow90ProgressResponse {
|
|
449
|
+
id: string;
|
|
450
|
+
dayNumber: number;
|
|
451
|
+
date: string;
|
|
452
|
+
isCompleted: boolean;
|
|
453
|
+
completedAt: string | null;
|
|
454
|
+
morningCheckIn: boolean;
|
|
455
|
+
eveningCheckIn: boolean;
|
|
456
|
+
contentViewed: boolean;
|
|
457
|
+
journalEntry: string | null;
|
|
458
|
+
gratitudeList: string[];
|
|
459
|
+
morningMood: number | null;
|
|
460
|
+
eveningMood: number | null;
|
|
461
|
+
createdAt: string;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export interface Grow90TodayResponse {
|
|
465
|
+
progress: Grow90ProgressResponse | null;
|
|
466
|
+
dayNumber: number;
|
|
467
|
+
dailyContent: {
|
|
468
|
+
title: string;
|
|
469
|
+
message: string;
|
|
470
|
+
tip: string;
|
|
471
|
+
affirmation: string;
|
|
472
|
+
morningMessage?: string;
|
|
473
|
+
eveningReflection?: string;
|
|
474
|
+
journalPrompt?: string;
|
|
475
|
+
theme?: string;
|
|
476
|
+
};
|
|
477
|
+
tasks: {
|
|
478
|
+
morningCheckIn: boolean;
|
|
479
|
+
eveningCheckIn: boolean;
|
|
480
|
+
contentViewed: boolean;
|
|
481
|
+
journalEntry: boolean;
|
|
482
|
+
gratitude: boolean;
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export interface Grow90StatsResponse {
|
|
487
|
+
completedDays: number;
|
|
488
|
+
currentStreak: number;
|
|
489
|
+
longestStreak: number;
|
|
490
|
+
averageMood: number | null;
|
|
491
|
+
completionRate: number;
|
|
492
|
+
journalEntriesCount: number;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export interface EnrollGrow90Request {
|
|
496
|
+
dailyReminderTime?: string;
|
|
497
|
+
weeklyCallDay?: string;
|
|
498
|
+
stripePaymentId?: string;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export interface UpdateGrow90ProgressRequest {
|
|
502
|
+
morningCheckIn?: boolean;
|
|
503
|
+
eveningCheckIn?: boolean;
|
|
504
|
+
contentViewed?: boolean;
|
|
505
|
+
journalEntry?: string;
|
|
506
|
+
gratitudeList?: string[];
|
|
507
|
+
morningMood?: number;
|
|
508
|
+
eveningMood?: number;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
export interface UpdateGrow90SettingsRequest {
|
|
512
|
+
dailyReminderTime?: string;
|
|
513
|
+
weeklyCallDay?: string;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// ============================================================================
|
|
517
|
+
// EVENT CHAT TYPES
|
|
518
|
+
// ============================================================================
|
|
519
|
+
|
|
520
|
+
export type EventMessageType = 'TEXT' | 'IMAGE' | 'SYSTEM' | 'ANNOUNCEMENT';
|
|
521
|
+
export type ChatMemberRole = 'MEMBER' | 'MODERATOR' | 'HOST';
|
|
522
|
+
|
|
523
|
+
export interface EventChatResponse {
|
|
524
|
+
id: string;
|
|
525
|
+
eventId: string;
|
|
526
|
+
messageCount: number;
|
|
527
|
+
memberCount: number;
|
|
528
|
+
isActive: boolean;
|
|
529
|
+
isLocked: boolean;
|
|
530
|
+
lastMessageAt?: string;
|
|
531
|
+
createdAt: string;
|
|
532
|
+
eventTitle?: string;
|
|
533
|
+
eventStartDate?: string;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export interface ChatMemberResponse {
|
|
537
|
+
id: string;
|
|
538
|
+
chatId: string;
|
|
539
|
+
userId: string;
|
|
540
|
+
role: ChatMemberRole;
|
|
541
|
+
nickname?: string;
|
|
542
|
+
isMuted: boolean;
|
|
543
|
+
lastReadAt?: string;
|
|
544
|
+
joinedAt: string;
|
|
545
|
+
userName?: string;
|
|
546
|
+
userImage?: string;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export interface MessageResponse {
|
|
550
|
+
id: string;
|
|
551
|
+
chatId: string;
|
|
552
|
+
userId: string;
|
|
553
|
+
content: string;
|
|
554
|
+
messageType: EventMessageType;
|
|
555
|
+
imageUrl?: string;
|
|
556
|
+
replyToId?: string;
|
|
557
|
+
isEdited: boolean;
|
|
558
|
+
isDeleted: boolean;
|
|
559
|
+
createdAt: string;
|
|
560
|
+
updatedAt?: string;
|
|
561
|
+
userName?: string;
|
|
562
|
+
userImage?: string;
|
|
563
|
+
replyToContent?: string;
|
|
564
|
+
replyToUserName?: string;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export interface PaginatedMessagesResponse {
|
|
568
|
+
messages: MessageResponse[];
|
|
569
|
+
total: number;
|
|
570
|
+
hasMore: boolean;
|
|
571
|
+
nextCursor?: string;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export interface SendMessageRequest {
|
|
575
|
+
content: string;
|
|
576
|
+
messageType?: EventMessageType;
|
|
577
|
+
imageUrl?: string;
|
|
578
|
+
replyToId?: string;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export interface UpdateMessageRequest {
|
|
582
|
+
content: string;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export interface UpdateChatSettingsRequest {
|
|
586
|
+
isLocked?: boolean;
|
|
587
|
+
isActive?: boolean;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export interface UpdateMemberSettingsRequest {
|
|
591
|
+
isMuted?: boolean;
|
|
592
|
+
nickname?: string;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// Re-export paths and components for advanced usage
|
|
596
|
+
export type { paths, components };
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GrowSober SDK
|
|
3
|
+
*
|
|
4
|
+
* TypeScript SDK for the GrowSober API with TanStack Query hooks.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { configureSDK, useCurrentUser, useLogin } from '@growsober/sdk';
|
|
9
|
+
*
|
|
10
|
+
* // Configure SDK with your API base URL and token management
|
|
11
|
+
* configureSDK({
|
|
12
|
+
* baseURL: 'https://api.growsober.app',
|
|
13
|
+
* getAccessToken: () => localStorage.getItem('accessToken'),
|
|
14
|
+
* refreshAccessToken: async () => {
|
|
15
|
+
* // Your token refresh logic
|
|
16
|
+
* return newAccessToken;
|
|
17
|
+
* },
|
|
18
|
+
* onUnauthorized: () => {
|
|
19
|
+
* // Handle unauthorized access
|
|
20
|
+
* window.location.href = '/login';
|
|
21
|
+
* },
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Use hooks in your components
|
|
25
|
+
* function App() {
|
|
26
|
+
* const { data: user } = useCurrentUser();
|
|
27
|
+
* const { mutate: login } = useLogin();
|
|
28
|
+
* // ...
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// API CLIENT
|
|
35
|
+
// ============================================================================
|
|
36
|
+
|
|
37
|
+
export { configureSDK, getApiClient } from './api/client';
|
|
38
|
+
export type { SDKConfig } from './api/client';
|
|
39
|
+
|
|
40
|
+
// ============================================================================
|
|
41
|
+
// TYPES
|
|
42
|
+
// ============================================================================
|
|
43
|
+
|
|
44
|
+
export * from './api/types';
|
|
45
|
+
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// QUERY HOOKS
|
|
48
|
+
// ============================================================================
|
|
49
|
+
|
|
50
|
+
export * from './api/queries';
|
|
51
|
+
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// MUTATION HOOKS
|
|
54
|
+
// ============================================================================
|
|
55
|
+
|
|
56
|
+
export * from './api/mutations';
|
|
57
|
+
|