@digilogiclabs/create-saas-app 1.14.1 → 1.17.1
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/CHANGELOG.md +31 -0
- package/README.md +285 -39
- package/bin/index.js +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli/prompts/project-setup.d.ts.map +1 -1
- package/dist/cli/prompts/project-setup.js +49 -12
- package/dist/cli/prompts/project-setup.js.map +1 -1
- package/dist/generators/template-generator.d.ts.map +1 -1
- package/dist/generators/template-generator.js +27 -4
- package/dist/generators/template-generator.js.map +1 -1
- package/dist/templates/mobile/base/template/App.tsx +2 -0
- package/dist/templates/mobile/ui-auth-payments/template/.env.example +20 -0
- package/dist/templates/mobile/ui-auth-payments/template/README.md +218 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +153 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/analytics.tsx +668 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +743 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +757 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/orders.tsx +402 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +580 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/_layout.tsx +127 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +246 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +362 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/onboarding/index.tsx +193 -0
- package/dist/templates/mobile/ui-auth-payments/template/app/tour/index.tsx +272 -0
- package/dist/templates/mobile/ui-auth-payments/template/app.json +93 -0
- package/dist/templates/mobile/ui-auth-payments/template/babel.config.js +23 -0
- package/dist/templates/mobile/ui-auth-payments/template/eas.json +45 -0
- package/dist/templates/mobile/ui-auth-payments/template/expo-env.d.ts +3 -0
- package/dist/templates/mobile/ui-auth-payments/template/jest-setup.ts +74 -0
- package/dist/templates/mobile/ui-auth-payments/template/metro.config.js +11 -0
- package/dist/templates/mobile/ui-auth-payments/template/package.json +106 -0
- package/dist/templates/mobile/ui-auth-payments/template/tsconfig.json +31 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/.env.example +23 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/README.md +254 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +169 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/ai.tsx +522 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/analytics.tsx +668 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +743 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +676 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/orders.tsx +402 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +580 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +127 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +246 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +362 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/onboarding/index.tsx +193 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app/tour/index.tsx +272 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/app.json +93 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/babel.config.js +23 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/eas.json +45 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/expo-env.d.ts +3 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/jest-setup.ts +74 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/metro.config.js +11 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/package.json +108 -0
- package/dist/templates/mobile/ui-auth-payments-ai/template/tsconfig.json +31 -0
- package/dist/templates/web/base/template/src/app/dashboard/page.tsx +62 -20
- package/dist/templates/web/base/template/src/app/loading.tsx +45 -27
- package/dist/templates/web/base/template/src/components/providers/app-providers.tsx +2 -0
- package/dist/templates/web/ui-auth/template/package.json +1 -1
- package/dist/templates/web/ui-auth/template/src/app/loading.tsx +30 -12
- package/dist/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +2 -0
- package/dist/templates/web/ui-auth/template/src/components/shared/header.tsx +43 -2
- package/dist/templates/web/ui-auth-ai/template/package.json +1 -1
- package/dist/templates/web/ui-auth-payments/template/package.json +1 -1
- package/dist/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +69 -17
- package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +2 -0
- package/dist/templates/web/ui-auth-payments-ai/template/package.json +1 -1
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +218 -7
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +62 -9
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +364 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +532 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +70 -51
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +76 -60
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +2 -0
- package/dist/templates/web/ui-auth-payments-audio/template/package.json +1 -1
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +71 -17
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +2 -0
- package/dist/templates/web/ui-auth-payments-video/template/package.json +1 -1
- package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +2 -0
- package/package.json +1 -1
- package/src/templates/mobile/base/template/App.tsx +2 -0
- package/src/templates/mobile/ui-auth-payments/template/.env.example +20 -0
- package/src/templates/mobile/ui-auth-payments/template/README.md +218 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +153 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/analytics.tsx +668 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +743 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +757 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/orders.tsx +402 -0
- package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +580 -0
- package/src/templates/mobile/ui-auth-payments/template/app/_layout.tsx +127 -0
- package/src/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +246 -0
- package/src/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +362 -0
- package/src/templates/mobile/ui-auth-payments/template/app/onboarding/index.tsx +193 -0
- package/src/templates/mobile/ui-auth-payments/template/app/tour/index.tsx +272 -0
- package/src/templates/mobile/ui-auth-payments/template/app.json +93 -0
- package/src/templates/mobile/ui-auth-payments/template/babel.config.js +23 -0
- package/src/templates/mobile/ui-auth-payments/template/eas.json +45 -0
- package/src/templates/mobile/ui-auth-payments/template/expo-env.d.ts +3 -0
- package/src/templates/mobile/ui-auth-payments/template/jest-setup.ts +74 -0
- package/src/templates/mobile/ui-auth-payments/template/metro.config.js +11 -0
- package/src/templates/mobile/ui-auth-payments/template/package.json +106 -0
- package/src/templates/mobile/ui-auth-payments/template/tsconfig.json +31 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/.env.example +23 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/README.md +254 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +169 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/ai.tsx +522 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/analytics.tsx +668 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +743 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +676 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/orders.tsx +402 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +580 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +127 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +246 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +362 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/onboarding/index.tsx +193 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app/tour/index.tsx +272 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/app.json +93 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/babel.config.js +23 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/eas.json +45 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/expo-env.d.ts +3 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/jest-setup.ts +74 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/metro.config.js +11 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/package.json +108 -0
- package/src/templates/mobile/ui-auth-payments-ai/template/tsconfig.json +31 -0
- package/src/templates/web/base/template/src/app/dashboard/page.tsx +62 -20
- package/src/templates/web/base/template/src/app/loading.tsx +45 -27
- package/src/templates/web/base/template/src/components/providers/app-providers.tsx +2 -0
- package/src/templates/web/ui-auth/template/package.json +1 -1
- package/src/templates/web/ui-auth/template/src/app/loading.tsx +30 -12
- package/src/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +2 -0
- package/src/templates/web/ui-auth/template/src/components/shared/header.tsx +43 -2
- package/src/templates/web/ui-auth-ai/template/package.json +1 -1
- package/src/templates/web/ui-auth-payments/template/package.json +1 -1
- package/src/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +69 -17
- package/src/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +2 -0
- package/src/templates/web/ui-auth-payments-ai/template/package.json +1 -1
- package/src/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +218 -7
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +62 -9
- package/src/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +364 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +532 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +70 -51
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +76 -60
- package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +2 -0
- package/src/templates/web/ui-auth-payments-audio/template/package.json +1 -1
- package/src/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +71 -17
- package/src/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +2 -0
- package/src/templates/web/ui-auth-payments-video/template/package.json +1 -1
- package/src/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +2 -0
package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import React from 'react'
|
|
|
4
4
|
import { ThemeProvider } from 'next-themes'
|
|
5
5
|
import { AuthProvider } from '@digilogiclabs/saas-factory-auth'
|
|
6
6
|
import { PaymentsProvider } from '@digilogiclabs/saas-factory-payments'
|
|
7
|
+
import { Toaster } from '@digilogiclabs/saas-factory-ui'
|
|
7
8
|
import { AppThemeProvider } from './theme-provider'
|
|
8
9
|
|
|
9
10
|
interface AppProvidersProps {
|
|
@@ -23,6 +24,7 @@ export function AppProviders({ children }: AppProvidersProps) {
|
|
|
23
24
|
<PaymentsProvider>
|
|
24
25
|
<AppThemeProvider themeColor="{{themeColor}}">
|
|
25
26
|
{children}
|
|
27
|
+
<Toaster />
|
|
26
28
|
</AppThemeProvider>
|
|
27
29
|
</PaymentsProvider>
|
|
28
30
|
</AuthProvider>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"next": "^15.0.0",
|
|
18
18
|
"react": "^19.0.0",
|
|
19
19
|
"react-dom": "^19.0.0",
|
|
20
|
-
"@digilogiclabs/saas-factory-ui": "^0.
|
|
20
|
+
"@digilogiclabs/saas-factory-ui": "^0.21.0",
|
|
21
21
|
"@digilogiclabs/saas-factory-auth": "^1.0.1",
|
|
22
22
|
"@digilogiclabs/saas-factory-payments": "^1.1.0",
|
|
23
23
|
"@digilogiclabs/saas-factory-ai": "^3.1.1",
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
4
|
import { usePayments, formatCurrency, formatDate } from '@digilogiclabs/saas-factory-payments';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Button,
|
|
7
|
+
Card,
|
|
8
|
+
SingleStepForm,
|
|
9
|
+
FormField,
|
|
10
|
+
FormSection,
|
|
11
|
+
FormProvider,
|
|
12
|
+
Modal
|
|
13
|
+
} from '@digilogiclabs/saas-factory-ui';
|
|
6
14
|
|
|
7
15
|
export default function BillingPage() {
|
|
8
16
|
const { loading } = usePayments();
|
|
17
|
+
const [showPaymentMethodModal, setShowPaymentMethodModal] = useState(false);
|
|
18
|
+
const [showPlanChangeModal, setShowPlanChangeModal] = useState(false);
|
|
19
|
+
const [editingPaymentMethod, setEditingPaymentMethod] = useState<string | null>(null);
|
|
9
20
|
|
|
10
21
|
const handleSubscriptionChange = () => {
|
|
11
|
-
|
|
12
|
-
// Handle subscription changes (upgrade, downgrade, cancel, resume)
|
|
22
|
+
setShowPlanChangeModal(true);
|
|
13
23
|
};
|
|
14
24
|
|
|
15
|
-
const handlePaymentMethodUpdate = () => {
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
const handlePaymentMethodUpdate = (methodId?: string) => {
|
|
26
|
+
setEditingPaymentMethod(methodId || null);
|
|
27
|
+
setShowPaymentMethodModal(true);
|
|
18
28
|
};
|
|
19
29
|
|
|
20
30
|
const handleInvoiceDownload = (invoiceId: string) => {
|
|
@@ -22,6 +32,19 @@ export default function BillingPage() {
|
|
|
22
32
|
// Handle invoice download
|
|
23
33
|
};
|
|
24
34
|
|
|
35
|
+
const handlePaymentMethodSubmit = async (formData: FormData) => {
|
|
36
|
+
console.log('Payment method data:', Object.fromEntries(formData));
|
|
37
|
+
// Handle payment method creation/update
|
|
38
|
+
setShowPaymentMethodModal(false);
|
|
39
|
+
setEditingPaymentMethod(null);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const handlePlanChangeSubmit = async (formData: FormData) => {
|
|
43
|
+
console.log('Plan change data:', Object.fromEntries(formData));
|
|
44
|
+
// Handle plan change
|
|
45
|
+
setShowPlanChangeModal(false);
|
|
46
|
+
};
|
|
47
|
+
|
|
25
48
|
// Mock current subscription data - in real app this would come from your backend
|
|
26
49
|
const currentSubscription = {
|
|
27
50
|
plan: 'Pro Plan',
|
|
@@ -204,6 +227,194 @@ export default function BillingPage() {
|
|
|
204
227
|
</table>
|
|
205
228
|
</div>
|
|
206
229
|
</Card>
|
|
230
|
+
|
|
231
|
+
{/* Payment Method Modal */}
|
|
232
|
+
<Modal
|
|
233
|
+
isOpen={showPaymentMethodModal}
|
|
234
|
+
onClose={() => {
|
|
235
|
+
setShowPaymentMethodModal(false);
|
|
236
|
+
setEditingPaymentMethod(null);
|
|
237
|
+
}}
|
|
238
|
+
title={editingPaymentMethod ? "Edit Payment Method" : "Add Payment Method"}
|
|
239
|
+
size="lg"
|
|
240
|
+
>
|
|
241
|
+
<FormProvider>
|
|
242
|
+
<SingleStepForm
|
|
243
|
+
onSubmit={handlePaymentMethodSubmit}
|
|
244
|
+
submitButton={{
|
|
245
|
+
text: editingPaymentMethod ? "Update Payment Method" : "Add Payment Method",
|
|
246
|
+
disabled: loading
|
|
247
|
+
}}
|
|
248
|
+
realTimeValidation={true}
|
|
249
|
+
className="space-y-4"
|
|
250
|
+
>
|
|
251
|
+
<FormSection title="Card Information">
|
|
252
|
+
<FormField
|
|
253
|
+
name="cardNumber"
|
|
254
|
+
type="creditCard"
|
|
255
|
+
label="Card Number"
|
|
256
|
+
placeholder="1234 5678 9012 3456"
|
|
257
|
+
validation={['required', 'creditCard']}
|
|
258
|
+
disabled={loading}
|
|
259
|
+
/>
|
|
260
|
+
|
|
261
|
+
<div className="grid grid-cols-2 gap-4">
|
|
262
|
+
<FormField
|
|
263
|
+
name="expiryDate"
|
|
264
|
+
type="text"
|
|
265
|
+
label="Expiry Date"
|
|
266
|
+
placeholder="MM/YY"
|
|
267
|
+
validation={['required', 'expiryDate']}
|
|
268
|
+
disabled={loading}
|
|
269
|
+
/>
|
|
270
|
+
<FormField
|
|
271
|
+
name="cvc"
|
|
272
|
+
type="text"
|
|
273
|
+
label="CVC"
|
|
274
|
+
placeholder="123"
|
|
275
|
+
validation={['required', 'cvc']}
|
|
276
|
+
disabled={loading}
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
</FormSection>
|
|
280
|
+
|
|
281
|
+
<FormSection title="Billing Information">
|
|
282
|
+
<FormField
|
|
283
|
+
name="cardholderName"
|
|
284
|
+
type="text"
|
|
285
|
+
label="Cardholder Name"
|
|
286
|
+
placeholder="Full name as it appears on card"
|
|
287
|
+
validation={['required']}
|
|
288
|
+
disabled={loading}
|
|
289
|
+
/>
|
|
290
|
+
|
|
291
|
+
<FormField
|
|
292
|
+
name="billingAddress"
|
|
293
|
+
type="address"
|
|
294
|
+
label="Billing Address"
|
|
295
|
+
validation={['required']}
|
|
296
|
+
disabled={loading}
|
|
297
|
+
fields={{
|
|
298
|
+
line1: { placeholder: "Street address" },
|
|
299
|
+
city: { placeholder: "City" },
|
|
300
|
+
state: { placeholder: "State/Province" },
|
|
301
|
+
postalCode: { placeholder: "ZIP/Postal code" },
|
|
302
|
+
country: { placeholder: "Country" }
|
|
303
|
+
}}
|
|
304
|
+
/>
|
|
305
|
+
|
|
306
|
+
<FormField
|
|
307
|
+
name="makeDefault"
|
|
308
|
+
type="checkbox"
|
|
309
|
+
label="Make this my default payment method"
|
|
310
|
+
disabled={loading}
|
|
311
|
+
/>
|
|
312
|
+
</FormSection>
|
|
313
|
+
</SingleStepForm>
|
|
314
|
+
</FormProvider>
|
|
315
|
+
</Modal>
|
|
316
|
+
|
|
317
|
+
{/* Plan Change Modal */}
|
|
318
|
+
<Modal
|
|
319
|
+
isOpen={showPlanChangeModal}
|
|
320
|
+
onClose={() => setShowPlanChangeModal(false)}
|
|
321
|
+
title="Change Subscription Plan"
|
|
322
|
+
size="xl"
|
|
323
|
+
>
|
|
324
|
+
<FormProvider>
|
|
325
|
+
<SingleStepForm
|
|
326
|
+
onSubmit={handlePlanChangeSubmit}
|
|
327
|
+
submitButton={{
|
|
328
|
+
text: "Change Plan",
|
|
329
|
+
disabled: loading
|
|
330
|
+
}}
|
|
331
|
+
realTimeValidation={true}
|
|
332
|
+
className="space-y-6"
|
|
333
|
+
>
|
|
334
|
+
<FormSection title="Select New Plan">
|
|
335
|
+
<FormField
|
|
336
|
+
name="newPlan"
|
|
337
|
+
type="radio"
|
|
338
|
+
label="Choose Your Plan"
|
|
339
|
+
options={[
|
|
340
|
+
{
|
|
341
|
+
value: 'basic',
|
|
342
|
+
label: 'Basic Plan',
|
|
343
|
+
description: 'Perfect for individuals getting started',
|
|
344
|
+
price: '$9/month',
|
|
345
|
+
features: [
|
|
346
|
+
'1,000 AI requests/month',
|
|
347
|
+
'Basic AI models',
|
|
348
|
+
'Email support',
|
|
349
|
+
'5GB storage'
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
value: 'pro',
|
|
354
|
+
label: 'Pro Plan',
|
|
355
|
+
description: 'Best for growing teams and businesses',
|
|
356
|
+
price: '$29/month',
|
|
357
|
+
features: [
|
|
358
|
+
'10,000 AI requests/month',
|
|
359
|
+
'Advanced AI models',
|
|
360
|
+
'Priority support',
|
|
361
|
+
'50GB storage',
|
|
362
|
+
'Team collaboration'
|
|
363
|
+
],
|
|
364
|
+
recommended: true
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
value: 'enterprise',
|
|
368
|
+
label: 'Enterprise Plan',
|
|
369
|
+
description: 'For large organizations',
|
|
370
|
+
price: 'Custom pricing',
|
|
371
|
+
features: [
|
|
372
|
+
'Unlimited AI requests',
|
|
373
|
+
'All AI models',
|
|
374
|
+
'Dedicated support',
|
|
375
|
+
'Unlimited storage',
|
|
376
|
+
'Advanced security'
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
]}
|
|
380
|
+
validation={['required']}
|
|
381
|
+
defaultValue="pro"
|
|
382
|
+
/>
|
|
383
|
+
</FormSection>
|
|
384
|
+
|
|
385
|
+
<FormSection title="Billing Options">
|
|
386
|
+
<FormField
|
|
387
|
+
name="billingInterval"
|
|
388
|
+
type="radio"
|
|
389
|
+
label="Billing Frequency"
|
|
390
|
+
options={[
|
|
391
|
+
{ value: 'monthly', label: 'Monthly billing' },
|
|
392
|
+
{ value: 'yearly', label: 'Yearly billing (save 20%)' }
|
|
393
|
+
]}
|
|
394
|
+
defaultValue="monthly"
|
|
395
|
+
validation={['required']}
|
|
396
|
+
/>
|
|
397
|
+
|
|
398
|
+
<FormField
|
|
399
|
+
name="prorationPolicy"
|
|
400
|
+
type="checkbox"
|
|
401
|
+
label="I understand that charges will be prorated for the current billing period"
|
|
402
|
+
validation={['required']}
|
|
403
|
+
/>
|
|
404
|
+
</FormSection>
|
|
405
|
+
|
|
406
|
+
<div className="bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg">
|
|
407
|
+
<h4 className="font-medium text-blue-900 dark:text-blue-100 mb-2">Plan Change Summary</h4>
|
|
408
|
+
<div className="text-sm text-blue-800 dark:text-blue-200 space-y-1">
|
|
409
|
+
<div>Current plan: Pro Plan ($29/month)</div>
|
|
410
|
+
<div>New plan: Will be calculated based on selection</div>
|
|
411
|
+
<div>Effective date: Immediate</div>
|
|
412
|
+
<div>Next billing date: {formatDate(new Date(Date.now() + 15 * 24 * 60 * 60 * 1000))}</div>
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
</SingleStepForm>
|
|
416
|
+
</FormProvider>
|
|
417
|
+
</Modal>
|
|
207
418
|
</div>
|
|
208
419
|
</div>
|
|
209
420
|
);
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import { Suspense } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Card,
|
|
5
|
+
DashboardLayout,
|
|
6
|
+
CommandPalette,
|
|
7
|
+
Tour
|
|
8
|
+
} from '@digilogiclabs/saas-factory-ui'
|
|
9
|
+
import {
|
|
10
|
+
User,
|
|
11
|
+
Settings,
|
|
12
|
+
CreditCard,
|
|
13
|
+
Activity,
|
|
14
|
+
Home,
|
|
15
|
+
Brain,
|
|
16
|
+
Users,
|
|
17
|
+
BarChart,
|
|
18
|
+
Plus,
|
|
19
|
+
Search
|
|
20
|
+
} from 'lucide-react'
|
|
4
21
|
import { requireAuth } from '@/lib/auth-server'
|
|
5
22
|
import Link from 'next/link'
|
|
6
23
|
|
|
@@ -90,11 +107,44 @@ export default async function DashboardPage() {
|
|
|
90
107
|
// Server-side authentication requirement
|
|
91
108
|
const user = await requireAuth()
|
|
92
109
|
|
|
110
|
+
const sidebarNavigation = [
|
|
111
|
+
{ name: 'Overview', href: '/dashboard', icon: Home, current: true },
|
|
112
|
+
{ name: 'Profile', href: '/profile', icon: User },
|
|
113
|
+
{ name: 'Settings', href: '/settings', icon: Settings },
|
|
114
|
+
{ name: 'Billing', href: '/billing', icon: CreditCard },
|
|
115
|
+
{ name: 'Analytics', href: '/analytics', icon: BarChart }
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
const tourSteps = [
|
|
119
|
+
{
|
|
120
|
+
target: '[data-tour="overview"]',
|
|
121
|
+
title: 'Dashboard Overview',
|
|
122
|
+
content: 'Get a quick overview of your account stats and recent activity.'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
target: '[data-tour="stats"]',
|
|
126
|
+
title: 'Account Statistics',
|
|
127
|
+
content: 'View your key metrics and performance indicators here.'
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
target: '[data-tour="actions"]',
|
|
131
|
+
title: 'Quick Actions',
|
|
132
|
+
content: 'Access your most commonly used features from these cards.'
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
|
|
93
136
|
return (
|
|
94
|
-
<
|
|
95
|
-
|
|
137
|
+
<DashboardLayout
|
|
138
|
+
navigation={sidebarNavigation}
|
|
139
|
+
headerActions={[
|
|
140
|
+
<CommandPalette key="command-palette" />,
|
|
141
|
+
<Tour key="tour" steps={tourSteps} />
|
|
142
|
+
]}
|
|
143
|
+
>
|
|
144
|
+
<div className="min-h-screen bg-gray-50 dark:bg-gray-900">
|
|
145
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
|
96
146
|
{/* Header */}
|
|
97
|
-
<div className="mb-8">
|
|
147
|
+
<div className="mb-8" data-tour="overview">
|
|
98
148
|
<h1 className="text-3xl font-bold text-gray-900 dark:text-white">
|
|
99
149
|
Welcome back, {user.name || user.email}!
|
|
100
150
|
</h1>
|
|
@@ -104,12 +154,14 @@ export default async function DashboardPage() {
|
|
|
104
154
|
</div>
|
|
105
155
|
|
|
106
156
|
{/* Stats - Streaming with Suspense */}
|
|
107
|
-
<
|
|
108
|
-
<
|
|
109
|
-
|
|
157
|
+
<div data-tour="stats">
|
|
158
|
+
<Suspense fallback={<UserStatsSkeleton />}>
|
|
159
|
+
<UserStats userId={user.id} />
|
|
160
|
+
</Suspense>
|
|
161
|
+
</div>
|
|
110
162
|
|
|
111
163
|
{/* Quick Actions */}
|
|
112
|
-
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8">
|
|
164
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8" data-tour="actions">
|
|
113
165
|
<Card className="p-6">
|
|
114
166
|
<div className="flex items-center mb-4">
|
|
115
167
|
<User className="h-6 w-6 text-blue-600 dark:text-blue-400 mr-3" />
|
|
@@ -179,5 +231,6 @@ export default async function DashboardPage() {
|
|
|
179
231
|
</Card>
|
|
180
232
|
</div>
|
|
181
233
|
</div>
|
|
234
|
+
</DashboardLayout>
|
|
182
235
|
)
|
|
183
236
|
}
|