@appgram/react 0.1.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/LICENSE +21 -0
- package/dist/chunk-3UBJGXCO.js +6368 -0
- package/dist/chunk-3UBJGXCO.js.map +1 -0
- package/dist/chunk-75P634IK.js +758 -0
- package/dist/chunk-75P634IK.js.map +1 -0
- package/dist/chunk-AIDLOCVJ.mjs +6341 -0
- package/dist/chunk-AIDLOCVJ.mjs.map +1 -0
- package/dist/chunk-KPIKYXAN.mjs +47 -0
- package/dist/chunk-KPIKYXAN.mjs.map +1 -0
- package/dist/chunk-N6PJDQCU.mjs +741 -0
- package/dist/chunk-N6PJDQCU.mjs.map +1 -0
- package/dist/chunk-ZJZ3A2S3.js +49 -0
- package/dist/chunk-ZJZ3A2S3.js.map +1 -0
- package/dist/components/index.d.mts +1283 -0
- package/dist/components/index.d.ts +1283 -0
- package/dist/components/index.js +85 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +4 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +572 -0
- package/dist/hooks/index.d.ts +572 -0
- package/dist/hooks/index.js +53 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +4 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +399 -0
- package/dist/index.d.ts +399 -0
- package/dist/index.js +783 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +645 -0
- package/dist/index.mjs.map +1 -0
- package/dist/useVote-CLhkwtLT.d.mts +420 -0
- package/dist/useVote-CLhkwtLT.d.ts +420 -0
- package/package.json +82 -0
- package/tailwind-preset.js +48 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { W as WishFilters, a as WishesResponse, b as Wish, C as CommentsResponse, c as Comment, R as RoadmapData, d as Release, e as ReleaseFeature, H as HelpCollection, f as HelpFlow, g as HelpArticle, S as SupportRequestInput, h as SupportRequest } from './useVote-CLhkwtLT.js';
|
|
3
|
+
export { A as ArticleType, i as Category, j as CommentAuthor, k as CommentCreateInput, F as FlowDisplayType, l as HelpArticlesResponse, m as HelpCenterData, n as ReleasesResponse, o as Roadmap, p as RoadmapColumnType, q as RoadmapItem, r as RoadmapVisibility, s as SupportAttachment, t as SupportMessage, u as SupportRequestCategory, v as SupportRequestPriority, w as SupportRequestStatus, x as SupportRequestsResponse, U as UseVoteOptions, y as UseVoteResult, z as WishAuthor, B as WishPriority, D as WishStatus, E as useVote } from './useVote-CLhkwtLT.js';
|
|
4
|
+
export { UseCommentsOptions, UseCommentsResult, UseHelpArticleOptions, UseHelpArticleResult, UseHelpCenterOptions, UseHelpCenterResult, UseHelpFlowOptions, UseHelpFlowResult, UseReleaseOptions, UseReleaseResult, UseReleasesOptions, UseReleasesResult, UseRoadmapOptions, UseRoadmapResult, UseSupportOptions, UseSupportResult, UseWishOptions, UseWishResult, UseWishesOptions, UseWishesResult, useComments, useHelpArticle, useHelpCenter, useHelpFlow, useRelease, useReleases, useRoadmap, useSupport, useWish, useWishes } from './hooks/index.js';
|
|
5
|
+
export { ComponentStatus, HelpArticleDetail, HelpArticleDetailProps, HelpArticles, HelpArticlesProps, HelpCenter, HelpCenterProps, HelpCollections, HelpCollectionsProps, IncidentImpact, IncidentStatus, IncidentUpdate, OverallStatus, QuickAction, ReleaseCard, ReleaseCardProps, ReleaseDetail, ReleaseDetailProps, ReleaseList, ReleaseListProps, Releases, ReleasesProps, RoadmapBoard, RoadmapBoardProps, RoadmapColumn, RoadmapColumnProps, StatusBoard, StatusBoardProps, StatusComponent, StatusData, StatusIncident, StatusIncidentDetail, StatusIncidentDetailProps, SubmitWishForm, SubmitWishFormProps, SupportForm, SupportFormProps, VoteButton, VoteButtonProps, WhatsNewPopup, WhatsNewPopupProps, WishCard, WishCardProps, WishDetail, WishDetailProps, WishList, WishListProps } from './components/index.js';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Vote Types
|
|
10
|
+
*/
|
|
11
|
+
interface Vote {
|
|
12
|
+
id: string;
|
|
13
|
+
wish_id: string;
|
|
14
|
+
user_id?: string | null;
|
|
15
|
+
voter_email?: string | null;
|
|
16
|
+
fingerprint: string;
|
|
17
|
+
created_at: string;
|
|
18
|
+
}
|
|
19
|
+
interface VoteCheckResponse {
|
|
20
|
+
has_voted: boolean;
|
|
21
|
+
vote_id?: string;
|
|
22
|
+
}
|
|
23
|
+
interface VoteCreateInput {
|
|
24
|
+
wish_id: string;
|
|
25
|
+
fingerprint: string;
|
|
26
|
+
voter_email?: string;
|
|
27
|
+
}
|
|
28
|
+
interface VoteState {
|
|
29
|
+
hasVoted: boolean;
|
|
30
|
+
voteId?: string;
|
|
31
|
+
voteCount: number;
|
|
32
|
+
isLoading: boolean;
|
|
33
|
+
error?: string | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Customization & Theme Types
|
|
38
|
+
*/
|
|
39
|
+
interface CustomColors {
|
|
40
|
+
primary: string;
|
|
41
|
+
secondary: string;
|
|
42
|
+
accent: string;
|
|
43
|
+
background: string;
|
|
44
|
+
text: string;
|
|
45
|
+
cardBackground?: string;
|
|
46
|
+
cardText?: string;
|
|
47
|
+
navbarBackground?: string;
|
|
48
|
+
navbarText?: string;
|
|
49
|
+
}
|
|
50
|
+
interface CustomTypography {
|
|
51
|
+
fontFamily?: string;
|
|
52
|
+
fontSizes?: {
|
|
53
|
+
h1: number;
|
|
54
|
+
h2: number;
|
|
55
|
+
h3: number;
|
|
56
|
+
h4: number;
|
|
57
|
+
body: number;
|
|
58
|
+
small: number;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Theme mode - 'light', 'dark', or 'system' (follows OS preference)
|
|
63
|
+
*/
|
|
64
|
+
type ThemeMode = 'light' | 'dark' | 'system';
|
|
65
|
+
interface AppgramTheme {
|
|
66
|
+
/**
|
|
67
|
+
* Theme mode - 'light', 'dark', or 'system' (default: 'system')
|
|
68
|
+
*/
|
|
69
|
+
mode?: ThemeMode;
|
|
70
|
+
/**
|
|
71
|
+
* Light mode colors (used when mode is 'light' or system is light)
|
|
72
|
+
*/
|
|
73
|
+
colors?: Partial<CustomColors>;
|
|
74
|
+
/**
|
|
75
|
+
* Dark mode colors (used when mode is 'dark' or system is dark)
|
|
76
|
+
* If not provided, will auto-generate from light colors
|
|
77
|
+
*/
|
|
78
|
+
darkColors?: Partial<CustomColors>;
|
|
79
|
+
typography?: Partial<CustomTypography>;
|
|
80
|
+
borderRadius?: number;
|
|
81
|
+
}
|
|
82
|
+
interface LayoutConfig {
|
|
83
|
+
borderRadius?: number;
|
|
84
|
+
cardStyle?: {
|
|
85
|
+
color?: string;
|
|
86
|
+
textColor?: string;
|
|
87
|
+
shadow?: 'none' | 'sm' | 'md' | 'lg';
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Type Exports
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* API Response wrapper
|
|
97
|
+
*/
|
|
98
|
+
interface ApiResponse<T> {
|
|
99
|
+
success: boolean;
|
|
100
|
+
data?: T;
|
|
101
|
+
error?: {
|
|
102
|
+
code: string;
|
|
103
|
+
message: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Paginated response wrapper
|
|
108
|
+
*/
|
|
109
|
+
interface PaginatedResponse<T> {
|
|
110
|
+
data: T[];
|
|
111
|
+
total: number;
|
|
112
|
+
page: number;
|
|
113
|
+
per_page: number;
|
|
114
|
+
total_pages: number;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* AppgramClient
|
|
119
|
+
*
|
|
120
|
+
* API client for Appgram portal/public endpoints.
|
|
121
|
+
* Adapted from the main app's api.ts for use in the SDK.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
interface AppgramClientConfig {
|
|
125
|
+
baseUrl: string;
|
|
126
|
+
projectId: string;
|
|
127
|
+
orgSlug?: string;
|
|
128
|
+
projectSlug?: string;
|
|
129
|
+
}
|
|
130
|
+
declare class AppgramClient {
|
|
131
|
+
private baseUrl;
|
|
132
|
+
private projectId;
|
|
133
|
+
private orgSlug?;
|
|
134
|
+
private projectSlug?;
|
|
135
|
+
constructor(config: AppgramClientConfig);
|
|
136
|
+
private request;
|
|
137
|
+
private get;
|
|
138
|
+
/**
|
|
139
|
+
* Raw request that returns the API response as-is without transformation
|
|
140
|
+
*/
|
|
141
|
+
private requestRaw;
|
|
142
|
+
private post;
|
|
143
|
+
private delete;
|
|
144
|
+
/**
|
|
145
|
+
* Get public wishes for the project
|
|
146
|
+
*/
|
|
147
|
+
getPublicWishes(filters?: WishFilters): Promise<ApiResponse<WishesResponse>>;
|
|
148
|
+
/**
|
|
149
|
+
* Get a single wish by ID
|
|
150
|
+
*/
|
|
151
|
+
getWish(wishId: string): Promise<ApiResponse<Wish>>;
|
|
152
|
+
/**
|
|
153
|
+
* Create a new wish (feature request)
|
|
154
|
+
*/
|
|
155
|
+
createWish(data: {
|
|
156
|
+
title: string;
|
|
157
|
+
description: string;
|
|
158
|
+
author_email?: string;
|
|
159
|
+
author_name?: string;
|
|
160
|
+
category_id?: string;
|
|
161
|
+
}): Promise<ApiResponse<Wish>>;
|
|
162
|
+
/**
|
|
163
|
+
* Check if a fingerprint has voted on a wish
|
|
164
|
+
*/
|
|
165
|
+
checkVote(wishId: string, fingerprint: string): Promise<ApiResponse<VoteCheckResponse>>;
|
|
166
|
+
/**
|
|
167
|
+
* Create a vote
|
|
168
|
+
*/
|
|
169
|
+
createVote(wishId: string, fingerprint: string, voterEmail?: string): Promise<ApiResponse<{
|
|
170
|
+
id: string;
|
|
171
|
+
wish_id: string;
|
|
172
|
+
}>>;
|
|
173
|
+
/**
|
|
174
|
+
* Delete a vote
|
|
175
|
+
*/
|
|
176
|
+
deleteVote(voteId: string): Promise<ApiResponse<{
|
|
177
|
+
success: boolean;
|
|
178
|
+
}>>;
|
|
179
|
+
/**
|
|
180
|
+
* Get comments for a wish
|
|
181
|
+
*/
|
|
182
|
+
getComments(wishId: string, options?: {
|
|
183
|
+
page?: number;
|
|
184
|
+
per_page?: number;
|
|
185
|
+
}): Promise<ApiResponse<CommentsResponse>>;
|
|
186
|
+
/**
|
|
187
|
+
* Create a comment
|
|
188
|
+
*/
|
|
189
|
+
createComment(data: {
|
|
190
|
+
wish_id: string;
|
|
191
|
+
content: string;
|
|
192
|
+
author_name?: string;
|
|
193
|
+
author_email?: string;
|
|
194
|
+
parent_id?: string;
|
|
195
|
+
}): Promise<ApiResponse<Comment>>;
|
|
196
|
+
/**
|
|
197
|
+
* Get roadmap data for the project
|
|
198
|
+
*/
|
|
199
|
+
getRoadmapData(): Promise<ApiResponse<RoadmapData>>;
|
|
200
|
+
/**
|
|
201
|
+
* Get public releases for the project
|
|
202
|
+
*/
|
|
203
|
+
getReleases(options?: {
|
|
204
|
+
limit?: number;
|
|
205
|
+
}): Promise<ApiResponse<Release[]>>;
|
|
206
|
+
/**
|
|
207
|
+
* Get a single release by slug
|
|
208
|
+
*/
|
|
209
|
+
getRelease(releaseSlug: string): Promise<ApiResponse<Release>>;
|
|
210
|
+
/**
|
|
211
|
+
* Get features for a release (public endpoint)
|
|
212
|
+
*/
|
|
213
|
+
getReleaseFeatures(releaseSlug: string): Promise<ApiResponse<ReleaseFeature[]>>;
|
|
214
|
+
/**
|
|
215
|
+
* Get help center collection for the project
|
|
216
|
+
*/
|
|
217
|
+
getHelpCollection(): Promise<ApiResponse<{
|
|
218
|
+
collection: HelpCollection | null;
|
|
219
|
+
flows: HelpFlow[];
|
|
220
|
+
}>>;
|
|
221
|
+
/**
|
|
222
|
+
* Get a help flow by slug
|
|
223
|
+
*/
|
|
224
|
+
getHelpFlow(slug: string): Promise<ApiResponse<HelpFlow>>;
|
|
225
|
+
/**
|
|
226
|
+
* Get a help article by slug
|
|
227
|
+
*/
|
|
228
|
+
getHelpArticle(slug: string, flowId: string): Promise<ApiResponse<HelpArticle>>;
|
|
229
|
+
/**
|
|
230
|
+
* Upload a file via public portal (no auth required)
|
|
231
|
+
*/
|
|
232
|
+
uploadFile(file: File): Promise<ApiResponse<{
|
|
233
|
+
url: string;
|
|
234
|
+
name: string;
|
|
235
|
+
size: number;
|
|
236
|
+
mime_type?: string;
|
|
237
|
+
}>>;
|
|
238
|
+
/**
|
|
239
|
+
* Submit a support request
|
|
240
|
+
*/
|
|
241
|
+
submitSupportRequest(data: SupportRequestInput): Promise<ApiResponse<SupportRequest>>;
|
|
242
|
+
/**
|
|
243
|
+
* Request a magic link to access support tickets
|
|
244
|
+
*/
|
|
245
|
+
sendSupportMagicLink(userEmail: string): Promise<ApiResponse<{
|
|
246
|
+
success: boolean;
|
|
247
|
+
message: string;
|
|
248
|
+
}>>;
|
|
249
|
+
/**
|
|
250
|
+
* Verify magic link token and get user's support tickets
|
|
251
|
+
*/
|
|
252
|
+
verifySupportToken(token: string): Promise<ApiResponse<{
|
|
253
|
+
tickets: SupportRequest[];
|
|
254
|
+
user_email: string;
|
|
255
|
+
}>>;
|
|
256
|
+
/**
|
|
257
|
+
* Get a specific support ticket using magic link token
|
|
258
|
+
*/
|
|
259
|
+
getSupportTicket(ticketId: string, token: string): Promise<ApiResponse<SupportRequest>>;
|
|
260
|
+
/**
|
|
261
|
+
* Add a message to a support ticket
|
|
262
|
+
*/
|
|
263
|
+
addSupportMessage(ticketId: string, token: string, content: string): Promise<ApiResponse<{
|
|
264
|
+
id: string;
|
|
265
|
+
content: string;
|
|
266
|
+
created_at: string;
|
|
267
|
+
}>>;
|
|
268
|
+
/**
|
|
269
|
+
* Get all public page data in one request
|
|
270
|
+
*/
|
|
271
|
+
getPageData(): Promise<ApiResponse<{
|
|
272
|
+
project?: unknown;
|
|
273
|
+
customization_data?: unknown;
|
|
274
|
+
wishes?: Wish[];
|
|
275
|
+
total_wishes?: number;
|
|
276
|
+
categories?: unknown[];
|
|
277
|
+
}>>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
interface AppgramConfig {
|
|
281
|
+
/**
|
|
282
|
+
* Your Appgram project ID
|
|
283
|
+
*/
|
|
284
|
+
projectId: string;
|
|
285
|
+
/**
|
|
286
|
+
* Organization slug (used for public URLs)
|
|
287
|
+
*/
|
|
288
|
+
orgSlug?: string;
|
|
289
|
+
/**
|
|
290
|
+
* Project slug (used for public URLs)
|
|
291
|
+
*/
|
|
292
|
+
projectSlug?: string;
|
|
293
|
+
/**
|
|
294
|
+
* Optional API URL override (defaults to https://api.appgram.dev)
|
|
295
|
+
*/
|
|
296
|
+
apiUrl?: string;
|
|
297
|
+
/**
|
|
298
|
+
* Enable browser fingerprinting for anonymous voting
|
|
299
|
+
* @default true
|
|
300
|
+
*/
|
|
301
|
+
enableFingerprinting?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Theme customization
|
|
304
|
+
*/
|
|
305
|
+
theme?: AppgramTheme;
|
|
306
|
+
}
|
|
307
|
+
interface AppgramContextValue {
|
|
308
|
+
/**
|
|
309
|
+
* The Appgram configuration
|
|
310
|
+
*/
|
|
311
|
+
config: Required<Pick<AppgramConfig, 'projectId'>> & AppgramConfig;
|
|
312
|
+
/**
|
|
313
|
+
* The API client instance
|
|
314
|
+
*/
|
|
315
|
+
client: AppgramClient;
|
|
316
|
+
/**
|
|
317
|
+
* Browser fingerprint for anonymous voting
|
|
318
|
+
*/
|
|
319
|
+
fingerprint: string | null;
|
|
320
|
+
/**
|
|
321
|
+
* Theme values
|
|
322
|
+
*/
|
|
323
|
+
theme: AppgramTheme;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Hook to access the Appgram context
|
|
327
|
+
* @throws Error if used outside of AppgramProvider
|
|
328
|
+
*/
|
|
329
|
+
declare function useAppgramContext(): AppgramContextValue;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* AppgramProvider
|
|
333
|
+
*
|
|
334
|
+
* Root provider component that manages configuration, API client, and theming.
|
|
335
|
+
*/
|
|
336
|
+
|
|
337
|
+
interface AppgramProviderProps {
|
|
338
|
+
/**
|
|
339
|
+
* Appgram configuration
|
|
340
|
+
*/
|
|
341
|
+
config: AppgramConfig;
|
|
342
|
+
/**
|
|
343
|
+
* Child components
|
|
344
|
+
*/
|
|
345
|
+
children: React.ReactNode;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* AppgramProvider - Root provider for Appgram React SDK
|
|
349
|
+
*
|
|
350
|
+
* Supports automatic dark/light theme based on system preference.
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```tsx
|
|
354
|
+
* <AppgramProvider
|
|
355
|
+
* config={{
|
|
356
|
+
* projectId: 'proj_xxx',
|
|
357
|
+
* orgSlug: 'acme',
|
|
358
|
+
* projectSlug: 'feedback',
|
|
359
|
+
* theme: {
|
|
360
|
+
* mode: 'system', // 'light' | 'dark' | 'system' (default: 'system')
|
|
361
|
+
* colors: { primary: '#0EA5E9' }, // Light mode colors
|
|
362
|
+
* darkColors: { primary: '#38BDF8' }, // Dark mode colors (optional)
|
|
363
|
+
* }
|
|
364
|
+
* }}
|
|
365
|
+
* >
|
|
366
|
+
* <App />
|
|
367
|
+
* </AppgramProvider>
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
declare function AppgramProvider({ config, children, }: AppgramProviderProps): React.ReactElement;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Utility for merging Tailwind CSS classes
|
|
374
|
+
*/
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Merges Tailwind CSS classes with proper precedence handling
|
|
378
|
+
* @param inputs - Class values to merge
|
|
379
|
+
* @returns Merged class string
|
|
380
|
+
*/
|
|
381
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Browser Fingerprint Utility
|
|
385
|
+
*
|
|
386
|
+
* Generates a unique fingerprint for anonymous voting.
|
|
387
|
+
* Uses a combination of browser/device characteristics.
|
|
388
|
+
*/
|
|
389
|
+
/**
|
|
390
|
+
* Get or create a fingerprint for the current browser/device
|
|
391
|
+
* @returns The fingerprint string
|
|
392
|
+
*/
|
|
393
|
+
declare function getFingerprint(): string;
|
|
394
|
+
/**
|
|
395
|
+
* Reset the stored fingerprint (for testing purposes)
|
|
396
|
+
*/
|
|
397
|
+
declare function resetFingerprint(): void;
|
|
398
|
+
|
|
399
|
+
export { type ApiResponse, AppgramClient, type AppgramClientConfig, type AppgramConfig, type AppgramContextValue, AppgramProvider, type AppgramProviderProps, type AppgramTheme, Comment, CommentsResponse, type CustomColors, type CustomTypography, HelpArticle, HelpCollection, HelpFlow, type LayoutConfig, type PaginatedResponse, Release, ReleaseFeature, RoadmapData, SupportRequest, SupportRequestInput, type ThemeMode, type Vote, type VoteCheckResponse, type VoteCreateInput, type VoteState, Wish, WishFilters, WishesResponse, cn, getFingerprint, resetFingerprint, useAppgramContext };
|