@devvistatech/devvista-kit 0.0.12 → 0.0.13

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.
Files changed (84) hide show
  1. package/README.md +40 -0
  2. package/app/ClientLayout.tsx +66 -0
  3. package/app/about/page.tsx +11 -248
  4. package/app/adRequest/page.tsx +101 -25
  5. package/app/admin-profile/page.tsx +123 -0
  6. package/app/analytics/page.tsx +41 -5
  7. package/app/api/about/route.ts +2 -18
  8. package/app/api/adRequest/route.ts +7 -27
  9. package/app/api/analytics/[reportType]/route.ts +1 -64
  10. package/app/api/bio/route.ts +1 -17
  11. package/app/api/blog/route.ts +1 -19
  12. package/app/api/contacts/route.ts +1 -46
  13. package/app/api/files/route.ts +1 -15
  14. package/app/api/gallery-data/route.ts +53 -61
  15. package/app/api/schedule/route.ts +5 -21
  16. package/app/api/signup/route.ts +129 -0
  17. package/app/api/sync-user/route.ts +268 -94
  18. package/app/api/verify-admin/route.ts +46 -0
  19. package/app/blog/[id]/page.tsx +71 -52
  20. package/app/blog/page.tsx +43 -10
  21. package/app/favicon.ico +0 -0
  22. package/app/gallery/page.tsx +27 -6
  23. package/app/layout.tsx +31 -82
  24. package/app/page.tsx +20 -311
  25. package/app/products/constants/product.ts +27 -0
  26. package/app/products/page.tsx +296 -0
  27. package/app/products/productOne/page.tsx +266 -0
  28. package/app/products/productTwo/page.tsx +272 -0
  29. package/app/schedule/page.tsx +78 -40
  30. package/bin/init.js +0 -12
  31. package/components/addOns/functional/ClassList.tsx +21 -17
  32. package/components/addOns/functional/ProductList.tsx +1027 -0
  33. package/components/addOns/functional/aboutSections/AboutSection.tsx +107 -70
  34. package/components/addOns/functional/aboutSections/constants/aboutSection.ts +9 -4
  35. package/components/addOns/functional/banner/Banner.tsx +150 -0
  36. package/components/addOns/functional/banner/BannerDashboard.tsx +283 -0
  37. package/components/addOns/functional/bioSections/BioEditor.tsx +471 -0
  38. package/components/addOns/functional/bioSections/constants/bioEditor.ts +36 -0
  39. package/components/addOns/functional/blogSections/BlogDashboard.tsx +1 -1
  40. package/components/addOns/functional/blogSections/BlogFormPopUp.tsx +2 -1
  41. package/components/addOns/functional/{ImageDescCarousel.tsx → carousels/ImageDescCarousel.tsx} +166 -57
  42. package/components/addOns/functional/carousels/ProductDescCarousel.tsx +1129 -0
  43. package/components/addOns/functional/{ScheduleCarousel.tsx → carousels/ScheduleCarousel.tsx} +110 -50
  44. package/components/addOns/functional/carousels/constants.ts/productDescCarousel.ts +197 -0
  45. package/components/addOns/functional/carousels/constants.ts/scheduleCarousel.ts +20 -0
  46. package/components/addOns/functional/contactsDashboard/ContactsDashboard.tsx +1 -1
  47. package/components/addOns/functional/fileUploaders/FileUploader.tsx +437 -0
  48. package/components/addOns/functional/fileUploaders/constants/fileUploader.ts +45 -0
  49. package/components/addOns/functional/galleries/GalleryComplex.tsx +468 -267
  50. package/components/addOns/functional/galleries/GallerySimple.tsx +78 -50
  51. package/components/addOns/functional/galleries/ThreeSetGallery.tsx +260 -0
  52. package/components/addOns/functional/schedules/ScheduleGridOne.tsx +22 -8
  53. package/components/addOns/functional/schedules/ScheduleGridTwo.tsx +12 -7
  54. package/components/addOns/functional/schedules/ScheduleGridTwoBasic.tsx +12 -7
  55. package/components/addOns/non-functional/SampleCarousel.tsx +3 -3
  56. package/components/addOns/non-functional/ThreeSetGallery.tsx +3 -3
  57. package/components/addOns/non-functional/featureSections/FeaturesSection.tsx +74 -0
  58. package/components/addOns/non-functional/featureSections/constants/featuresSection.ts +30 -0
  59. package/components/addOns/non-functional/{Heros/HeroSection.tsx → heros/HomeHero.tsx} +17 -15
  60. package/components/addOns/non-functional/heros/ProductHero.tsx +111 -0
  61. package/components/addOns/non-functional/heros/constants/hero.ts +62 -0
  62. package/components/addOns/non-functional/imageCarousels/ProductSlider.tsx +6 -6
  63. package/components/addOns/non-functional/imageCarousels/ProgramCarousel.tsx +10 -10
  64. package/components/footers/footer.tsx +161 -198
  65. package/components/other/admin-menu.tsx +1 -1
  66. package/lib/auth/auth-context.tsx +225 -0
  67. package/lib/auth/auth-utils.tsx +30 -0
  68. package/lib/constants/adRequest.ts +199 -56
  69. package/lib/constants/admin-profile.ts +12 -0
  70. package/lib/constants/page.ts +15 -15
  71. package/lib/google/google-analytics-tracking.tsx +44 -0
  72. package/lib/types.ts +235 -0
  73. package/lib/utils/compressImage.tsx +32 -0
  74. package/middleware.ts +9 -5
  75. package/next.config.js +1 -1
  76. package/package.json +3 -2
  77. package/public/images/test.png +0 -0
  78. package/components/addOns/functional/BioEditor.tsx +0 -447
  79. package/components/addOns/functional/FileUploader.tsx +0 -295
  80. package/components/addOns/non-functional/FeaturesSection.tsx +0 -63
  81. package/components/types.ts +0 -50
  82. package/lib/auth-context.tsx +0 -131
  83. package/lib/verify-user.ts +0 -118
  84. /package/lib/{google-analytics.tsx → google/google-analytics.tsx} +0 -0
package/lib/types.ts ADDED
@@ -0,0 +1,235 @@
1
+ export type Category = "none" | "indoor" | "outdoor" | "commercial";
2
+
3
+ export interface ScheduleClass {
4
+ name: string;
5
+ startTime: string;
6
+ endTime: string;
7
+ id: number | undefined;
8
+ documentId?: string;
9
+ daysOfWeek?: number[];
10
+ classDescription?: string;
11
+ }
12
+
13
+ export interface WeeklySchedule {
14
+ Monday: ScheduleClass[];
15
+ Tuesday: ScheduleClass[];
16
+ Wednesday: ScheduleClass[];
17
+ Thursday: ScheduleClass[];
18
+ Friday: ScheduleClass[];
19
+ Saturday: ScheduleClass[];
20
+ Sunday: ScheduleClass[];
21
+ }
22
+
23
+ export interface UploadedFile {
24
+ id: number;
25
+ documentId: string;
26
+ name: string;
27
+ url: string;
28
+ createdAt: string;
29
+ }
30
+
31
+ export interface StrapiUser {
32
+ id: number;
33
+ username: string;
34
+ email: string;
35
+ authId?: string;
36
+ authProvider?: string;
37
+ businessAdminId?: string;
38
+ documentId?: string;
39
+ userRole?: string;
40
+ firstName?: string;
41
+ lastName?: string;
42
+ businessId?: string[] | null;
43
+ dateJoined?: string;
44
+ businessOwner?: boolean;
45
+ userStatus?: string;
46
+ timezone?: string | null;
47
+ language?: string | null;
48
+ isVerified?: boolean;
49
+ businessTitle?: string | null;
50
+ userTitle?: string | null;
51
+ number?: string | null;
52
+ address?: {
53
+ zip: string;
54
+ city: string;
55
+ state: string;
56
+ street: string;
57
+ country: string;
58
+ } | null;
59
+ websiteUrl?: string | null;
60
+ primaryBusinessColor?: string | null;
61
+ secondaryBusinessColor?: string | null;
62
+ logoImage?: string | null;
63
+ }
64
+
65
+ export interface UploadFormState {
66
+ file: File | null;
67
+ title: string;
68
+ description: string;
69
+ category: Category;
70
+ subCategory?: string;
71
+ favorite: boolean;
72
+ banner: boolean;
73
+ startDate?: string;
74
+ endDate?: string;
75
+ }
76
+
77
+ export interface GallerySectionProps {
78
+ user: StrapiUser | null;
79
+ authLoading: boolean;
80
+ uploadedImages: UploadedImage[];
81
+ setUploadedImages: (images: UploadedImage[]) => void;
82
+ error: string | null;
83
+ setError: (error: string | null) => void;
84
+ isLoading: boolean;
85
+ setIsLoading: React.Dispatch<React.SetStateAction<boolean>>;
86
+ setUser: React.Dispatch<React.SetStateAction<StrapiUser | null>>;
87
+ handleImageUpload: (
88
+ e: React.FormEvent<HTMLFormElement>,
89
+ file: File | null,
90
+ title: string,
91
+ description: string,
92
+ category: Category,
93
+ subCategory: string,
94
+ favorite: boolean
95
+ ) => Promise<void>;
96
+ handleDeleteImage: (documentId: string) => Promise<void>;
97
+ }
98
+
99
+
100
+ export interface ImageDescCarouselProps {
101
+ user: StrapiUser | null;
102
+ uploadedImages: UploadedImage[];
103
+ setUploadedImages: (images: UploadedImage[]) => void;
104
+ error: string | null;
105
+ setError: (error: string | null) => void;
106
+ isLoading: boolean;
107
+ setIsLoading: (isLoading: boolean) => void;
108
+ handleImageUpload: (
109
+ e: React.FormEvent<HTMLFormElement>,
110
+ file: File | null,
111
+ title: string,
112
+ description: string,
113
+ category: Category,
114
+ subCategory: string,
115
+ favorite: boolean
116
+ ) => Promise<void>;
117
+ handleDeleteImage: (documentId: string) => Promise<void>;
118
+ }
119
+
120
+ export interface AboutContent {
121
+ id: number;
122
+ documentId: string;
123
+ title: string;
124
+ description: string;
125
+ about: boolean;
126
+ image?: { url: string; id: number };
127
+ createdAt: string;
128
+ }
129
+
130
+ export interface BioContent {
131
+ id: number;
132
+ documentId: string;
133
+ title: string;
134
+ description: string;
135
+ bio: boolean;
136
+ image?: { url: string; id: number };
137
+ createdAt: string;
138
+ }
139
+
140
+ export interface BlogPost {
141
+ id: number;
142
+ documentId: string;
143
+ title: string;
144
+ description: string;
145
+ author: string;
146
+ publishedAt: string;
147
+ }
148
+
149
+ export interface StrapiContact {
150
+ id: number;
151
+ documentId: string;
152
+ name: string;
153
+ lastName: string;
154
+ email: string;
155
+ phone: string;
156
+ subject: string;
157
+ message: string;
158
+ submissionDate: string;
159
+ }
160
+
161
+ export interface AdRequest {
162
+ id: number;
163
+ documentId: string;
164
+ platform: string;
165
+ adType: string;
166
+ description: string;
167
+ timestamp: string;
168
+ userId: string;
169
+ credits: number;
170
+ lastResetDate: string;
171
+ nextResetDate: string;
172
+ }
173
+
174
+ export interface AnalyticsData {
175
+ date: string;
176
+ country: string;
177
+ deviceCategory: string;
178
+ activeUsers: number;
179
+ totalUsers: number;
180
+ newUsers: number;
181
+ pageViews: number;
182
+ engagedSessions: number;
183
+ averageSessionDuration: number;
184
+ averageEngagementTimePerActiveUser: number;
185
+ bounceRate: number;
186
+ }
187
+
188
+ export interface ChannelGroupData {
189
+ date: string;
190
+ channelGroup: string;
191
+ newUsers: number;
192
+ activeUsers: number;
193
+ }
194
+
195
+ export interface RealtimeData {
196
+ activeUsersInLast30Minutes: number;
197
+ }
198
+
199
+ export interface UserActivityData {
200
+ date: string;
201
+ country: string;
202
+ activeUsers: number;
203
+ }
204
+
205
+ export interface UploadedImage {
206
+ id: number;
207
+ documentId: string;
208
+ title?: string;
209
+ description?: string;
210
+ url: string;
211
+ createdAt: string;
212
+ category?: Category;
213
+ subCategory?: string;
214
+ favorite: boolean;
215
+ banner: boolean;
216
+ startDate?: string;
217
+ endDate?: string;
218
+ }
219
+
220
+ export interface FormState {
221
+ file: File | null;
222
+ title: string;
223
+ description: string;
224
+ category: Category;
225
+ subCategory: string;
226
+ favorite: boolean;
227
+ banner: boolean;
228
+ startDate?: string;
229
+ endDate?: string;
230
+ }
231
+
232
+ export interface EditFormState extends FormState {
233
+ id: number;
234
+ documentId: string;
235
+ }
@@ -0,0 +1,32 @@
1
+ // lib/utils/compressImage.ts
2
+ import imageCompression from "browser-image-compression";
3
+
4
+ interface CompressImageOptions {
5
+ maxSizeMB: number;
6
+ maxWidthOrHeight?: number;
7
+ useWebWorker?: boolean;
8
+ }
9
+
10
+ export async function compressImage(file: File): Promise<File> {
11
+ const validTypes = ["image/jpeg", "image/png", "image/gif"];
12
+ if (!validTypes.includes(file.type)) {
13
+ throw new Error("Invalid file type. Only JPEG, PNG, and GIF are allowed.");
14
+ }
15
+
16
+ const options: CompressImageOptions = {
17
+ maxSizeMB: 0.5, // 500KB
18
+ maxWidthOrHeight: 1920, // Limit resolution for smaller files
19
+ useWebWorker: true, // Use web worker for performance
20
+ };
21
+
22
+ try {
23
+ const compressedFile = await imageCompression(file, options);
24
+ return new File([compressedFile], file.name, {
25
+ type: file.type,
26
+ lastModified: file.lastModified,
27
+ });
28
+ } catch (error) {
29
+ console.error("Image compression error:", error);
30
+ throw new Error("Failed to compress image. Please try a smaller or different image.");
31
+ }
32
+ }
package/middleware.ts CHANGED
@@ -1,4 +1,6 @@
1
+ // middleware.ts for devvistakit
1
2
  import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
3
+ import { NextResponse } from "next/server";
2
4
 
3
5
  const isPublicRoute = createRouteMatcher([
4
6
  '/',
@@ -15,22 +17,24 @@ const isPublicRoute = createRouteMatcher([
15
17
  '/api/trial-request',
16
18
  '/api/contact',
17
19
  '/api/blog',
20
+ '/api/signup',
18
21
  '/blog/:path*',
19
22
  '/.well-known/(.*)',
20
23
  '/404',
21
- '/500',
24
+ '/500',
22
25
  '/_not-found',
23
26
  ]);
24
27
 
25
28
  export default clerkMiddleware((auth, req) => {
26
- if (isPublicRoute(req) && req.method === 'GET') {
27
- return;
29
+ if (isPublicRoute(req) && (req.method === 'GET' || req.method === 'POST')) {
30
+ return NextResponse.next();
28
31
  }
29
32
  try {
30
33
  auth.protect();
34
+ return NextResponse.next();
31
35
  } catch (error) {
32
- console.error('Middleware error:', error);
33
- return;
36
+ console.error('Middleware error:', { error, path: req.nextUrl.pathname, method: req.method, timestamp: new Date().toISOString() });
37
+ return NextResponse.redirect(new URL('/sign-in', req.url));
34
38
  }
35
39
  });
36
40
 
package/next.config.js CHANGED
@@ -2,7 +2,7 @@ const nextConfig = {
2
2
  images: { unoptimized: true },
3
3
  experimental: {
4
4
  serverActions: {
5
- allowedOrigins: ['localhost:3000', 'https://devvista-kit.netlify.app'],
5
+ allowedOrigins: ['localhost:3000', 'https://devvistakit.devvistatech.com' ],
6
6
  },
7
7
  },
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvistatech/devvista-kit",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": {
@@ -72,6 +72,7 @@
72
72
  "@types/react-dom": "^18.3.0",
73
73
  "ai": "^4.3.17",
74
74
  "autoprefixer": "^10.4.20",
75
+ "browser-image-compression": "^2.0.2",
75
76
  "chart.js": "^4.5.0",
76
77
  "class-variance-authority": "^0.7.0",
77
78
  "clsx": "^2.1.1",
@@ -113,4 +114,4 @@
113
114
  "@types/nodemailer": "^6.4.17",
114
115
  "cross-env": "^10.0.0"
115
116
  }
116
- }
117
+ }
Binary file