@digilogiclabs/create-saas-app 1.5.2 → 1.5.4

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 (223) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/templates/mobile/base/template/.env.example +15 -0
  3. package/dist/templates/mobile/base/template/App.tsx +88 -0
  4. package/dist/templates/mobile/base/template/app/(auth)/login.tsx +44 -0
  5. package/dist/templates/mobile/base/template/app/(auth)/signup.tsx +43 -0
  6. package/dist/templates/mobile/base/template/app/checkout.tsx +20 -0
  7. package/dist/templates/mobile/base/template/package.json +38 -0
  8. package/dist/templates/shared/auth/firebase/web/config.ts +23 -0
  9. package/dist/templates/shared/auth/supabase/web/config.ts +8 -0
  10. package/dist/templates/web/base/template/.env.example +15 -0
  11. package/dist/templates/web/base/template/.eslintrc.js +8 -0
  12. package/dist/templates/web/base/template/README.md +68 -0
  13. package/dist/templates/web/base/template/next.config.js +15 -0
  14. package/dist/templates/web/base/template/package.json +58 -0
  15. package/dist/templates/web/base/template/postcss.config.js +7 -0
  16. package/dist/templates/web/base/template/src/app/auth/callback/route.ts +18 -0
  17. package/dist/templates/web/base/template/src/app/checkout/page.tsx +28 -0
  18. package/dist/templates/web/base/template/src/app/error.tsx +97 -0
  19. package/dist/templates/web/base/template/src/app/globals.css +60 -0
  20. package/dist/templates/web/base/template/src/app/layout.tsx +35 -0
  21. package/dist/templates/web/base/template/src/app/loading.tsx +34 -0
  22. package/dist/templates/web/base/template/src/app/login/page.tsx +39 -0
  23. package/dist/templates/web/base/template/src/app/page.tsx +132 -0
  24. package/dist/templates/web/base/template/src/app/signup/page.tsx +39 -0
  25. package/dist/templates/web/base/template/src/components/__tests__/example.test.tsx +49 -0
  26. package/dist/templates/web/base/template/src/components/providers/app-providers.tsx +33 -0
  27. package/dist/templates/web/base/template/src/components/providers/theme-provider.tsx +94 -0
  28. package/dist/templates/web/base/template/src/components/shared/footer.tsx +36 -0
  29. package/dist/templates/web/base/template/src/components/shared/header.tsx +44 -0
  30. package/dist/templates/web/base/template/src/components/ui/badge.tsx +36 -0
  31. package/dist/templates/web/base/template/src/components/ui/button.tsx +56 -0
  32. package/dist/templates/web/base/template/src/components/ui/card.tsx +71 -0
  33. package/dist/templates/web/base/template/src/components/ui/theme-toggle.tsx +34 -0
  34. package/dist/templates/web/base/template/src/lib/auth-server.ts +177 -0
  35. package/dist/templates/web/base/template/src/lib/env.ts +46 -0
  36. package/dist/templates/web/base/template/src/lib/utils.ts +140 -0
  37. package/dist/templates/web/base/template/src/test/setup.ts +79 -0
  38. package/dist/templates/web/base/template/tailwind.config.js +77 -0
  39. package/dist/templates/web/base/template/tsconfig.json +33 -0
  40. package/dist/templates/web/base/template/vitest.config.ts +17 -0
  41. package/dist/templates/web/base/template.backup/.env.example +15 -0
  42. package/dist/templates/web/base/template.backup.20250817/.env.example +15 -0
  43. package/dist/templates/web/ui-auth/template/.env.example +15 -0
  44. package/dist/templates/web/ui-auth/template/.eslintrc.js +8 -0
  45. package/dist/templates/web/ui-auth/template/README.md +68 -0
  46. package/dist/templates/web/ui-auth/template/next.config.js +12 -0
  47. package/dist/templates/web/ui-auth/template/package.json +50 -0
  48. package/dist/templates/web/ui-auth/template/postcss.config.js +7 -0
  49. package/dist/templates/web/ui-auth/template/src/app/auth/callback/route.ts +12 -0
  50. package/dist/templates/web/ui-auth/template/src/app/checkout/page.tsx +25 -0
  51. package/dist/templates/web/ui-auth/template/src/app/error.tsx +67 -0
  52. package/dist/templates/web/ui-auth/template/src/app/globals.css +42 -0
  53. package/dist/templates/web/ui-auth/template/src/app/layout.tsx +33 -0
  54. package/dist/templates/web/ui-auth/template/src/app/loading.tsx +20 -0
  55. package/dist/templates/web/ui-auth/template/src/app/login/page.tsx +109 -0
  56. package/dist/templates/web/ui-auth/template/src/app/page.tsx +129 -0
  57. package/dist/templates/web/ui-auth/template/src/app/signup/page.tsx +128 -0
  58. package/dist/templates/web/ui-auth/template/src/components/__tests__/example.test.tsx +49 -0
  59. package/dist/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +29 -0
  60. package/dist/templates/web/ui-auth/template/src/components/providers/theme-provider.tsx +94 -0
  61. package/dist/templates/web/ui-auth/template/src/components/shared/footer.tsx +36 -0
  62. package/dist/templates/web/ui-auth/template/src/components/shared/header.tsx +53 -0
  63. package/dist/templates/web/ui-auth/template/src/components/ui/badge.tsx +36 -0
  64. package/dist/templates/web/ui-auth/template/src/components/ui/theme-toggle.tsx +34 -0
  65. package/dist/templates/web/ui-auth/template/src/lib/env.ts +49 -0
  66. package/dist/templates/web/ui-auth/template/src/lib/utils.ts +140 -0
  67. package/dist/templates/web/ui-auth/template/src/test/setup.ts +79 -0
  68. package/dist/templates/web/ui-auth/template/tailwind.config.js +77 -0
  69. package/dist/templates/web/ui-auth/template/tsconfig.json +33 -0
  70. package/dist/templates/web/ui-auth/template/vitest.config.ts +17 -0
  71. package/dist/templates/web/ui-auth/template.backup/.env.example +15 -0
  72. package/dist/templates/web/ui-auth/template.backup.20250817/.env.example +15 -0
  73. package/dist/templates/web/ui-auth-payments/template/.env.example +15 -0
  74. package/dist/templates/web/ui-auth-payments/template/README.md +165 -0
  75. package/dist/templates/web/ui-auth-payments/template/middleware.ts +68 -0
  76. package/dist/templates/web/ui-auth-payments/template/next.config.js +12 -0
  77. package/dist/templates/web/ui-auth-payments/template/package-lock.json +12240 -0
  78. package/dist/templates/web/ui-auth-payments/template/package.json +52 -0
  79. package/dist/templates/web/ui-auth-payments/template/postcss.config.js +7 -0
  80. package/dist/templates/web/ui-auth-payments/template/src/app/auth/callback/route.ts +12 -0
  81. package/dist/templates/web/ui-auth-payments/template/src/app/billing/page.tsx +211 -0
  82. package/dist/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +142 -0
  83. package/dist/templates/web/ui-auth-payments/template/src/app/dashboard/layout.tsx +22 -0
  84. package/dist/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +183 -0
  85. package/dist/templates/web/ui-auth-payments/template/src/app/error.tsx +67 -0
  86. package/dist/templates/web/ui-auth-payments/template/src/app/globals.css +42 -0
  87. package/dist/templates/web/ui-auth-payments/template/src/app/layout.tsx +33 -0
  88. package/dist/templates/web/ui-auth-payments/template/src/app/loading.tsx +20 -0
  89. package/dist/templates/web/ui-auth-payments/template/src/app/login/loading.tsx +38 -0
  90. package/dist/templates/web/ui-auth-payments/template/src/app/login/page.tsx +109 -0
  91. package/dist/templates/web/ui-auth-payments/template/src/app/page.tsx +143 -0
  92. package/dist/templates/web/ui-auth-payments/template/src/app/signup/loading.tsx +50 -0
  93. package/dist/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +128 -0
  94. package/dist/templates/web/ui-auth-payments/template/src/components/__tests__/example.test.tsx +49 -0
  95. package/dist/templates/web/ui-auth-payments/template/src/components/client/auth-status.tsx +52 -0
  96. package/dist/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +144 -0
  97. package/dist/templates/web/ui-auth-payments/template/src/components/client/newsletter-signup.tsx +68 -0
  98. package/dist/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +185 -0
  99. package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +32 -0
  100. package/dist/templates/web/ui-auth-payments/template/src/components/providers/theme-provider.tsx +94 -0
  101. package/dist/templates/web/ui-auth-payments/template/src/components/shared/footer.tsx +36 -0
  102. package/dist/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +62 -0
  103. package/dist/templates/web/ui-auth-payments/template/src/components/ui/badge.tsx +36 -0
  104. package/dist/templates/web/ui-auth-payments/template/src/components/ui/theme-toggle.tsx +34 -0
  105. package/dist/templates/web/ui-auth-payments/template/src/lib/actions/auth.ts +246 -0
  106. package/dist/templates/web/ui-auth-payments/template/src/lib/actions/index.ts +340 -0
  107. package/dist/templates/web/ui-auth-payments/template/src/lib/auth-server.ts +177 -0
  108. package/dist/templates/web/ui-auth-payments/template/src/lib/env.ts +49 -0
  109. package/dist/templates/web/ui-auth-payments/template/src/lib/utils.ts +140 -0
  110. package/dist/templates/web/ui-auth-payments/template/src/test/setup.ts +79 -0
  111. package/dist/templates/web/ui-auth-payments/template/tailwind.config.js +77 -0
  112. package/dist/templates/web/ui-auth-payments/template/tsconfig.json +33 -0
  113. package/dist/templates/web/ui-auth-payments/template/tsconfig.tsbuildinfo +1 -0
  114. package/dist/templates/web/ui-auth-payments/template/vitest.config.ts +17 -0
  115. package/dist/templates/web/ui-auth-payments-audio/template/.env.example +15 -0
  116. package/dist/templates/web/ui-auth-payments-audio/template/README.md +187 -0
  117. package/dist/templates/web/ui-auth-payments-audio/template/middleware.ts +68 -0
  118. package/dist/templates/web/ui-auth-payments-audio/template/next.config.js +12 -0
  119. package/dist/templates/web/ui-auth-payments-audio/template/package-lock.json +12241 -0
  120. package/dist/templates/web/ui-auth-payments-audio/template/package.json +53 -0
  121. package/dist/templates/web/ui-auth-payments-audio/template/postcss.config.js +7 -0
  122. package/dist/templates/web/ui-auth-payments-audio/template/src/app/auth/callback/route.ts +12 -0
  123. package/dist/templates/web/ui-auth-payments-audio/template/src/app/billing/page.tsx +211 -0
  124. package/dist/templates/web/ui-auth-payments-audio/template/src/app/checkout/page.tsx +142 -0
  125. package/dist/templates/web/ui-auth-payments-audio/template/src/app/dashboard/layout.tsx +22 -0
  126. package/dist/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +183 -0
  127. package/dist/templates/web/ui-auth-payments-audio/template/src/app/error.tsx +67 -0
  128. package/dist/templates/web/ui-auth-payments-audio/template/src/app/globals.css +42 -0
  129. package/dist/templates/web/ui-auth-payments-audio/template/src/app/layout.tsx +35 -0
  130. package/dist/templates/web/ui-auth-payments-audio/template/src/app/loading.tsx +20 -0
  131. package/dist/templates/web/ui-auth-payments-audio/template/src/app/login/page.tsx +6 -0
  132. package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +181 -0
  133. package/dist/templates/web/ui-auth-payments-audio/template/src/app/signup/page.tsx +6 -0
  134. package/dist/templates/web/ui-auth-payments-audio/template/src/components/__tests__/example.test.tsx +49 -0
  135. package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/auth-status.tsx +52 -0
  136. package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +144 -0
  137. package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +185 -0
  138. package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +32 -0
  139. package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/theme-provider.tsx +94 -0
  140. package/dist/templates/web/ui-auth-payments-audio/template/src/components/shared/footer.tsx +36 -0
  141. package/dist/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +62 -0
  142. package/dist/templates/web/ui-auth-payments-audio/template/src/components/ui/badge.tsx +36 -0
  143. package/dist/templates/web/ui-auth-payments-audio/template/src/components/ui/theme-toggle.tsx +34 -0
  144. package/dist/templates/web/ui-auth-payments-audio/template/src/lib/actions/auth.ts +246 -0
  145. package/dist/templates/web/ui-auth-payments-audio/template/src/lib/actions/index.ts +14 -0
  146. package/dist/templates/web/ui-auth-payments-audio/template/src/lib/auth-server.ts +177 -0
  147. package/dist/templates/web/ui-auth-payments-audio/template/src/lib/env.ts +49 -0
  148. package/dist/templates/web/ui-auth-payments-audio/template/src/lib/utils.ts +140 -0
  149. package/dist/templates/web/ui-auth-payments-audio/template/src/test/setup.ts +79 -0
  150. package/dist/templates/web/ui-auth-payments-audio/template/tailwind.config.js +77 -0
  151. package/dist/templates/web/ui-auth-payments-audio/template/tsconfig.json +33 -0
  152. package/dist/templates/web/ui-auth-payments-audio/template/tsconfig.tsbuildinfo +1 -0
  153. package/dist/templates/web/ui-auth-payments-audio/template/vitest.config.ts +17 -0
  154. package/dist/templates/web/ui-auth-payments-video/template/.env.example +15 -0
  155. package/dist/templates/web/ui-auth-payments-video/template/README.md +190 -0
  156. package/dist/templates/web/ui-auth-payments-video/template/next.config.js +12 -0
  157. package/dist/templates/web/ui-auth-payments-video/template/package.json +53 -0
  158. package/dist/templates/web/ui-auth-payments-video/template/postcss.config.js +7 -0
  159. package/dist/templates/web/ui-auth-payments-video/template/src/app/auth/callback/route.ts +12 -0
  160. package/dist/templates/web/ui-auth-payments-video/template/src/app/billing/page.tsx +211 -0
  161. package/dist/templates/web/ui-auth-payments-video/template/src/app/checkout/page.tsx +142 -0
  162. package/dist/templates/web/ui-auth-payments-video/template/src/app/error.tsx +67 -0
  163. package/dist/templates/web/ui-auth-payments-video/template/src/app/globals.css +42 -0
  164. package/dist/templates/web/ui-auth-payments-video/template/src/app/layout.tsx +33 -0
  165. package/dist/templates/web/ui-auth-payments-video/template/src/app/loading.tsx +20 -0
  166. package/dist/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +109 -0
  167. package/dist/templates/web/ui-auth-payments-video/template/src/app/page.tsx +187 -0
  168. package/dist/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +128 -0
  169. package/dist/templates/web/ui-auth-payments-video/template/src/components/__tests__/example.test.tsx +49 -0
  170. package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +32 -0
  171. package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/theme-provider.tsx +94 -0
  172. package/dist/templates/web/ui-auth-payments-video/template/src/components/shared/footer.tsx +36 -0
  173. package/dist/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +62 -0
  174. package/dist/templates/web/ui-auth-payments-video/template/src/components/ui/badge.tsx +36 -0
  175. package/dist/templates/web/ui-auth-payments-video/template/src/components/ui/theme-toggle.tsx +34 -0
  176. package/dist/templates/web/ui-auth-payments-video/template/src/lib/env.ts +49 -0
  177. package/dist/templates/web/ui-auth-payments-video/template/src/lib/utils.ts +140 -0
  178. package/dist/templates/web/ui-auth-payments-video/template/src/test/setup.ts +79 -0
  179. package/dist/templates/web/ui-auth-payments-video/template/tailwind.config.js +77 -0
  180. package/dist/templates/web/ui-auth-payments-video/template/tsconfig.json +33 -0
  181. package/dist/templates/web/ui-auth-payments-video/template/vitest.config.ts +17 -0
  182. package/dist/templates/web/ui-only/template/.env.example +15 -0
  183. package/dist/templates/web/ui-only/template/.eslintrc.js +8 -0
  184. package/dist/templates/web/ui-only/template/README.md +68 -0
  185. package/dist/templates/web/ui-only/template/next.config.js +12 -0
  186. package/dist/templates/web/ui-only/template/package.json +49 -0
  187. package/dist/templates/web/ui-only/template/postcss.config.js +7 -0
  188. package/dist/templates/web/ui-only/template/src/app/auth/callback/route.ts +12 -0
  189. package/dist/templates/web/ui-only/template/src/app/checkout/page.tsx +25 -0
  190. package/dist/templates/web/ui-only/template/src/app/error.tsx +67 -0
  191. package/dist/templates/web/ui-only/template/src/app/globals.css +42 -0
  192. package/dist/templates/web/ui-only/template/src/app/layout.tsx +33 -0
  193. package/dist/templates/web/ui-only/template/src/app/loading.tsx +20 -0
  194. package/dist/templates/web/ui-only/template/src/app/login/page.tsx +63 -0
  195. package/dist/templates/web/ui-only/template/src/app/page.tsx +91 -0
  196. package/dist/templates/web/ui-only/template/src/app/signup/page.tsx +79 -0
  197. package/dist/templates/web/ui-only/template/src/components/__tests__/example.test.tsx +49 -0
  198. package/dist/templates/web/ui-only/template/src/components/providers/app-providers.tsx +26 -0
  199. package/dist/templates/web/ui-only/template/src/components/providers/theme-provider.tsx +94 -0
  200. package/dist/templates/web/ui-only/template/src/components/shared/footer.tsx +36 -0
  201. package/dist/templates/web/ui-only/template/src/components/shared/header.tsx +53 -0
  202. package/dist/templates/web/ui-only/template/src/components/ui/badge.tsx +36 -0
  203. package/dist/templates/web/ui-only/template/src/components/ui/theme-toggle.tsx +34 -0
  204. package/dist/templates/web/ui-only/template/src/lib/env.ts +49 -0
  205. package/dist/templates/web/ui-only/template/src/lib/utils.ts +140 -0
  206. package/dist/templates/web/ui-only/template/src/test/setup.ts +79 -0
  207. package/dist/templates/web/ui-only/template/tailwind.config.js +77 -0
  208. package/dist/templates/web/ui-only/template/tsconfig.json +33 -0
  209. package/dist/templates/web/ui-only/template/vitest.config.ts +17 -0
  210. package/dist/templates/web/ui-only/template.backup/.env.example +15 -0
  211. package/dist/templates/web/ui-only/template.backup.20250817/.env.example +15 -0
  212. package/dist/templates/web/ui-package-test/template/next-env.d.ts +5 -0
  213. package/dist/templates/web/ui-package-test/template/package.json +42 -0
  214. package/dist/templates/web/ui-package-test/template/src/app/page.tsx +106 -0
  215. package/dist/templates/web/ui-package-test/template/tsconfig.json +41 -0
  216. package/package.json +3 -2
  217. package/src/templates/mobile/base/template/package.json +38 -38
  218. package/src/templates/web/base/template/package.json +1 -1
  219. package/src/templates/web/ui-auth/template/package.json +1 -1
  220. package/src/templates/web/ui-auth-payments/template/package.json +1 -1
  221. package/src/templates/web/ui-auth-payments-audio/template/package.json +1 -1
  222. package/src/templates/web/ui-auth-payments-video/template/package.json +1 -1
  223. package/src/templates/web/ui-only/template/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "{{packageName}}",
3
+ "version": "0.1.0",
4
+ "description": "{{description}} (with UI Package v0.11.1 + Auth v1.0.0 + Payments)",
5
+ "private": true,
6
+ "scripts": {
7
+ "dev": "next dev",
8
+ "build": "next build",
9
+ "start": "next start",
10
+ "lint": "next lint",
11
+ "type-check": "tsc --noEmit",
12
+ "test": "vitest",
13
+ "test:ui": "vitest --ui",
14
+ "test:run": "vitest run"
15
+ },
16
+ "dependencies": {
17
+ "next": "^15.0.0",
18
+ "react": "^19.0.0",
19
+ "react-dom": "^19.0.0",
20
+ "@digilogiclabs/saas-factory-ui": "^0.11.1",
21
+ "@digilogiclabs/saas-factory-auth": "^1.0.0",
22
+ "@digilogiclabs/saas-factory-payments": "^1.0.0",
23
+ "stripe": "^14.0.0",
24
+ "tailwindcss": "^3.3.0",
25
+ "autoprefixer": "^10.4.16",
26
+ "postcss": "^8.4.31",
27
+ "clsx": "^2.0.0",
28
+ "class-variance-authority": "^0.7.0",
29
+ "tailwind-merge": "^2.0.0",
30
+ "next-themes": "^0.2.1",
31
+ "lucide-react": "^0.542.0",
32
+ "zod": "^3.22.4"
33
+ },
34
+ "devDependencies": {
35
+ "typescript": "^5.0.0",
36
+ "@types/node": "^20.0.0",
37
+ "@types/react": "^19.0.0",
38
+ "@types/react-dom": "^19.0.0",
39
+ "eslint": "^8.0.0",
40
+ "eslint-config-next": "^15.0.0",
41
+ "prettier": "^3.0.0",
42
+ "vitest": "^1.0.0",
43
+ "@vitejs/plugin-react": "^4.0.0",
44
+ "@testing-library/react": "^16.0.0",
45
+ "@testing-library/jest-dom": "^6.0.0",
46
+ "@testing-library/user-event": "^14.0.0",
47
+ "jsdom": "^24.0.0"
48
+ },
49
+ "engines": {
50
+ "node": ">=18.0.0"
51
+ }
52
+ }
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
7
+
@@ -0,0 +1,12 @@
1
+ import { NextResponse } from 'next/server';
2
+ import type { NextRequest } from 'next/server';
3
+
4
+ export async function GET(request: NextRequest) {
5
+ const requestUrl = new URL(request.url);
6
+
7
+ // Placeholder auth callback - requires @digilogiclabs/saas-factory-auth package
8
+ console.log('Auth callback triggered - requires auth package for full functionality');
9
+
10
+ // URL to redirect to after sign in process completes
11
+ return NextResponse.redirect(requestUrl.origin);
12
+ }
@@ -0,0 +1,211 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { usePayments, formatCurrency, formatDate } from '@digilogiclabs/saas-factory-payments';
5
+ import { Button, Card } from '@digilogiclabs/saas-factory-ui';
6
+
7
+ export default function BillingPage() {
8
+ const { loading } = usePayments();
9
+
10
+ const handleSubscriptionChange = () => {
11
+ console.log('Subscription change requested');
12
+ // Handle subscription changes (upgrade, downgrade, cancel, resume)
13
+ };
14
+
15
+ const handlePaymentMethodUpdate = () => {
16
+ console.log('Payment method update requested');
17
+ // Handle payment method updates (add, edit, delete, set default)
18
+ };
19
+
20
+ const handleInvoiceDownload = (invoiceId: string) => {
21
+ console.log('Download invoice:', invoiceId);
22
+ // Handle invoice download
23
+ };
24
+
25
+ // Mock current subscription data - in real app this would come from your backend
26
+ const currentSubscription = {
27
+ plan: 'Pro Plan',
28
+ price: 1999,
29
+ interval: 'month',
30
+ status: 'active',
31
+ nextBilling: new Date(Date.now() + 15 * 24 * 60 * 60 * 1000)
32
+ };
33
+
34
+ // Mock payment methods - in real app this would come from your backend
35
+ const paymentMethods = [
36
+ {
37
+ id: 'pm_123',
38
+ type: 'card',
39
+ last4: '4242',
40
+ brand: 'visa',
41
+ expiryMonth: 12,
42
+ expiryYear: 2025,
43
+ isDefault: true
44
+ },
45
+ {
46
+ id: 'pm_456',
47
+ type: 'card',
48
+ last4: '0005',
49
+ brand: 'mastercard',
50
+ expiryMonth: 8,
51
+ expiryYear: 2026,
52
+ isDefault: false
53
+ }
54
+ ];
55
+
56
+ // Mock billing history - in real app this would come from your backend
57
+ const invoices = [
58
+ {
59
+ id: 'inv_123',
60
+ amount: 1999,
61
+ currency: 'usd',
62
+ status: 'paid',
63
+ date: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000),
64
+ description: 'Pro Plan - Monthly'
65
+ },
66
+ {
67
+ id: 'inv_456',
68
+ amount: 1999,
69
+ currency: 'usd',
70
+ status: 'paid',
71
+ date: new Date(Date.now() - 60 * 24 * 60 * 60 * 1000),
72
+ description: 'Pro Plan - Monthly'
73
+ },
74
+ {
75
+ id: 'inv_789',
76
+ amount: 999,
77
+ currency: 'usd',
78
+ status: 'paid',
79
+ date: new Date(Date.now() - 90 * 24 * 60 * 60 * 1000),
80
+ description: 'Basic Plan - Monthly'
81
+ }
82
+ ];
83
+
84
+ return (
85
+ <div className="min-h-screen bg-gray-100 py-8">
86
+ <div className="max-w-7xl mx-auto px-4">
87
+ <div className="mb-8">
88
+ <h1 className="text-4xl font-bold text-gray-900 mb-2">Billing & Subscription</h1>
89
+ <p className="text-xl text-gray-600">Manage your subscription and billing information</p>
90
+ </div>
91
+
92
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-8 mb-8">
93
+ {/* Current Subscription */}
94
+ <Card className="p-6">
95
+ <h2 className="text-2xl font-bold mb-6">Current Subscription</h2>
96
+ <div className="space-y-4">
97
+ <div>
98
+ <h3 className="font-semibold">{currentSubscription.plan}</h3>
99
+ <p className="text-2xl font-bold">
100
+ {formatCurrency(currentSubscription.price)}
101
+ <span className="text-sm font-normal">/{currentSubscription.interval}</span>
102
+ </p>
103
+ </div>
104
+ <div>
105
+ <p className="text-sm text-gray-600">Status</p>
106
+ <span className="inline-block px-2 py-1 bg-green-100 text-green-800 rounded text-sm">
107
+ {currentSubscription.status}
108
+ </span>
109
+ </div>
110
+ <div>
111
+ <p className="text-sm text-gray-600">Next billing date</p>
112
+ <p>{formatDate(currentSubscription.nextBilling)}</p>
113
+ </div>
114
+ <Button
115
+ onClick={handleSubscriptionChange}
116
+ disabled={loading}
117
+ variant="outline"
118
+ className="w-full"
119
+ >
120
+ Change Plan
121
+ </Button>
122
+ </div>
123
+ </Card>
124
+
125
+ {/* Payment Methods */}
126
+ <Card className="p-6">
127
+ <h2 className="text-2xl font-bold mb-6">Payment Methods</h2>
128
+ <div className="space-y-4">
129
+ {paymentMethods.map((method) => (
130
+ <div key={method.id} className="flex items-center justify-between p-3 border rounded-lg">
131
+ <div className="flex items-center">
132
+ <div className="w-8 h-8 bg-blue-100 rounded flex items-center justify-center mr-3">
133
+ 💳
134
+ </div>
135
+ <div>
136
+ <p className="font-medium">
137
+ {method.brand.toUpperCase()} •••• {method.last4}
138
+ </p>
139
+ <p className="text-sm text-gray-600">
140
+ Expires {method.expiryMonth}/{method.expiryYear}
141
+ {method.isDefault && <span className="ml-2 text-blue-600">(Default)</span>}
142
+ </p>
143
+ </div>
144
+ </div>
145
+ <Button
146
+ onClick={handlePaymentMethodUpdate}
147
+ disabled={loading}
148
+ variant="outline"
149
+ size="sm"
150
+ >
151
+ Edit
152
+ </Button>
153
+ </div>
154
+ ))}
155
+ <Button
156
+ onClick={handlePaymentMethodUpdate}
157
+ disabled={loading}
158
+ variant="outline"
159
+ className="w-full"
160
+ >
161
+ Add Payment Method
162
+ </Button>
163
+ </div>
164
+ </Card>
165
+ </div>
166
+
167
+ {/* Billing History */}
168
+ <Card className="p-6">
169
+ <h2 className="text-2xl font-bold mb-6">Billing History</h2>
170
+ <div className="overflow-x-auto">
171
+ <table className="w-full">
172
+ <thead>
173
+ <tr className="border-b">
174
+ <th className="text-left py-2">Date</th>
175
+ <th className="text-left py-2">Description</th>
176
+ <th className="text-left py-2">Amount</th>
177
+ <th className="text-left py-2">Status</th>
178
+ <th className="text-left py-2">Actions</th>
179
+ </tr>
180
+ </thead>
181
+ <tbody>
182
+ {invoices.map((invoice) => (
183
+ <tr key={invoice.id} className="border-b">
184
+ <td className="py-3">{formatDate(invoice.date)}</td>
185
+ <td className="py-3">{invoice.description}</td>
186
+ <td className="py-3">{formatCurrency(invoice.amount)}</td>
187
+ <td className="py-3">
188
+ <span className="inline-block px-2 py-1 bg-green-100 text-green-800 rounded text-sm">
189
+ {invoice.status}
190
+ </span>
191
+ </td>
192
+ <td className="py-3">
193
+ <Button
194
+ onClick={() => handleInvoiceDownload(invoice.id)}
195
+ variant="outline"
196
+ size="sm"
197
+ >
198
+ Download
199
+ </Button>
200
+ </td>
201
+ </tr>
202
+ ))}
203
+ </tbody>
204
+ </table>
205
+ </div>
206
+ </Card>
207
+ </div>
208
+ </div>
209
+ );
210
+ }
211
+
@@ -0,0 +1,142 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+ import { usePayments, formatCurrency } from '@digilogiclabs/saas-factory-payments';
5
+ import { Button, Card } from '@digilogiclabs/saas-factory-ui';
6
+
7
+ export default function CheckoutPage() {
8
+ const { loading } = usePayments();
9
+
10
+ const handlePlanSelect = (planId: string) => {
11
+ console.log('Plan selected:', planId);
12
+ // Handle plan selection - redirect to payment processing
13
+ };
14
+
15
+ const handlePayment = () => {
16
+ console.log('Processing payment...');
17
+ // Handle payment processing
18
+ };
19
+
20
+ // Example pricing plans - in real app these would come from your backend/Stripe
21
+ const plans = [
22
+ {
23
+ id: 'basic',
24
+ name: 'Basic Plan',
25
+ price: 999, // in cents
26
+ interval: 'month',
27
+ features: ['Feature 1', 'Feature 2', 'Feature 3'],
28
+ stripePriceId: 'price_basic_monthly'
29
+ },
30
+ {
31
+ id: 'pro',
32
+ name: 'Pro Plan',
33
+ price: 1999, // in cents
34
+ interval: 'month',
35
+ features: ['All Basic features', 'Feature 4', 'Feature 5', 'Priority support'],
36
+ popular: true,
37
+ stripePriceId: 'price_pro_monthly'
38
+ },
39
+ {
40
+ id: 'enterprise',
41
+ name: 'Enterprise Plan',
42
+ price: 4999, // in cents
43
+ interval: 'month',
44
+ features: ['All Pro features', 'Custom integrations', 'Dedicated support', 'SLA guarantee'],
45
+ stripePriceId: 'price_enterprise_monthly'
46
+ }
47
+ ];
48
+
49
+ return (
50
+ <div className="min-h-screen bg-gray-100 py-8">
51
+ <div className="max-w-6xl mx-auto px-4">
52
+ <div className="text-center mb-12">
53
+ <h1 className="text-4xl font-bold text-gray-900 mb-4">Choose Your Plan</h1>
54
+ <p className="text-xl text-gray-600">Select the perfect plan for your needs</p>
55
+ </div>
56
+
57
+ {/* Subscription Plans */}
58
+ <div className="grid md:grid-cols-3 gap-6 mb-8">
59
+ {plans.map((plan) => (
60
+ <Card key={plan.id} className={`p-6 relative ${plan.popular ? 'ring-2 ring-blue-500' : ''}`}>
61
+ {plan.popular && (
62
+ <div className="absolute -top-3 left-1/2 transform -translate-x-1/2">
63
+ <span className="bg-blue-500 text-white px-3 py-1 rounded-full text-sm font-medium">
64
+ Most Popular
65
+ </span>
66
+ </div>
67
+ )}
68
+ <h3 className="text-xl font-bold mb-2">{plan.name}</h3>
69
+ <div className="text-3xl font-bold mb-4">
70
+ {formatCurrency(plan.price)}
71
+ <span className="text-sm font-normal">/{plan.interval}</span>
72
+ </div>
73
+ <ul className="mb-6 space-y-2">
74
+ {plan.features.map((feature, index) => (
75
+ <li key={index} className="flex items-center">
76
+ <span className="text-green-500 mr-2">✓</span>
77
+ {feature}
78
+ </li>
79
+ ))}
80
+ </ul>
81
+ <Button
82
+ onClick={() => handlePlanSelect(plan.id)}
83
+ disabled={loading}
84
+ className="w-full"
85
+ variant={plan.popular ? "default" : "outline"}
86
+ >
87
+ {loading ? 'Processing...' : 'Select Plan'}
88
+ </Button>
89
+ </Card>
90
+ ))}
91
+ </div>
92
+
93
+ {/* Payment Form */}
94
+ <Card className="p-6 max-w-md mx-auto">
95
+ <h2 className="text-2xl font-bold mb-6">Payment Details</h2>
96
+ <div className="space-y-4">
97
+ <div>
98
+ <label className="block text-sm font-medium mb-2">Card Number</label>
99
+ <input
100
+ type="text"
101
+ placeholder="1234 5678 9012 3456"
102
+ className="w-full p-3 border rounded-lg"
103
+ disabled
104
+ />
105
+ </div>
106
+ <div className="grid grid-cols-2 gap-4">
107
+ <div>
108
+ <label className="block text-sm font-medium mb-2">Expiry Date</label>
109
+ <input
110
+ type="text"
111
+ placeholder="MM/YY"
112
+ className="w-full p-3 border rounded-lg"
113
+ disabled
114
+ />
115
+ </div>
116
+ <div>
117
+ <label className="block text-sm font-medium mb-2">CVC</label>
118
+ <input
119
+ type="text"
120
+ placeholder="123"
121
+ className="w-full p-3 border rounded-lg"
122
+ disabled
123
+ />
124
+ </div>
125
+ </div>
126
+ <Button
127
+ onClick={handlePayment}
128
+ disabled={loading}
129
+ className="w-full"
130
+ >
131
+ {loading ? 'Processing...' : 'Complete Payment'}
132
+ </Button>
133
+ <p className="text-sm text-gray-600 text-center">
134
+ This is a demo. Payment processing requires Stripe integration.
135
+ </p>
136
+ </div>
137
+ </Card>
138
+ </div>
139
+ </div>
140
+ );
141
+ }
142
+
@@ -0,0 +1,22 @@
1
+ import { requireAuth } from '@/lib/auth-server'
2
+ import { redirect } from 'next/navigation'
3
+
4
+ export default async function DashboardLayout({
5
+ children,
6
+ }: {
7
+ children: React.ReactNode
8
+ }) {
9
+ // Ensure user is authenticated at the layout level
10
+ try {
11
+ await requireAuth()
12
+ } catch (error) {
13
+ // This will happen if requireAuth redirects, but just in case
14
+ redirect('/login')
15
+ }
16
+
17
+ return (
18
+ <div className="dashboard-layout">
19
+ {children}
20
+ </div>
21
+ )
22
+ }
@@ -0,0 +1,183 @@
1
+ import { Suspense } from 'react'
2
+ import { Button, Card } from '@digilogiclabs/saas-factory-ui'
3
+ import { User, Settings, CreditCard, Activity } from 'lucide-react'
4
+ import { requireAuth } from '@/lib/auth-server'
5
+ import Link from 'next/link'
6
+
7
+ // Example of server component data fetching
8
+ async function getUserStats(userId: string) {
9
+ // Simulate API call
10
+ await new Promise(resolve => setTimeout(resolve, 100))
11
+
12
+ return {
13
+ totalPosts: 42,
14
+ totalViews: 1337,
15
+ totalLikes: 256,
16
+ joinedDate: '2024-01-15'
17
+ }
18
+ }
19
+
20
+ function StatsCard({ title, value, icon: Icon, href }: {
21
+ title: string
22
+ value: string | number
23
+ icon: React.ComponentType<any>
24
+ href?: string
25
+ }) {
26
+ const content = (
27
+ <Card className="p-6 hover:shadow-lg transition-shadow">
28
+ <div className="flex items-center justify-between">
29
+ <div>
30
+ <p className="text-sm font-medium text-gray-600 dark:text-gray-400">{title}</p>
31
+ <p className="text-2xl font-bold text-gray-900 dark:text-white">{value}</p>
32
+ </div>
33
+ <Icon className="h-8 w-8 text-blue-600 dark:text-blue-400" />
34
+ </div>
35
+ </Card>
36
+ )
37
+
38
+ if (href) {
39
+ return <Link href={href}>{content}</Link>
40
+ }
41
+
42
+ return content
43
+ }
44
+
45
+ async function UserStats({ userId }: { userId: string }) {
46
+ const stats = await getUserStats(userId)
47
+
48
+ return (
49
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
50
+ <StatsCard
51
+ title="Total Posts"
52
+ value={stats.totalPosts}
53
+ icon={Activity}
54
+ />
55
+ <StatsCard
56
+ title="Total Views"
57
+ value={stats.totalViews.toLocaleString()}
58
+ icon={Activity}
59
+ />
60
+ <StatsCard
61
+ title="Total Likes"
62
+ value={stats.totalLikes}
63
+ icon={Activity}
64
+ />
65
+ <StatsCard
66
+ title="Member Since"
67
+ value={new Date(stats.joinedDate).getFullYear()}
68
+ icon={User}
69
+ />
70
+ </div>
71
+ )
72
+ }
73
+
74
+ function UserStatsSkeleton() {
75
+ return (
76
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
77
+ {[...Array(4)].map((_, i) => (
78
+ <Card key={i} className="p-6">
79
+ <div className="animate-pulse">
80
+ <div className="h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/2 mb-2"></div>
81
+ <div className="h-8 bg-gray-200 dark:bg-gray-700 rounded w-1/3"></div>
82
+ </div>
83
+ </Card>
84
+ ))}
85
+ </div>
86
+ )
87
+ }
88
+
89
+ export default async function DashboardPage() {
90
+ // Server-side authentication requirement
91
+ const user = await requireAuth()
92
+
93
+ return (
94
+ <div className="min-h-screen bg-gray-50 dark:bg-gray-900">
95
+ <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
96
+ {/* Header */}
97
+ <div className="mb-8">
98
+ <h1 className="text-3xl font-bold text-gray-900 dark:text-white">
99
+ Welcome back, {user.name || user.email}!
100
+ </h1>
101
+ <p className="text-gray-600 dark:text-gray-300 mt-2">
102
+ Here's what's happening with your account today.
103
+ </p>
104
+ </div>
105
+
106
+ {/* Stats - Streaming with Suspense */}
107
+ <Suspense fallback={<UserStatsSkeleton />}>
108
+ <UserStats userId={user.id} />
109
+ </Suspense>
110
+
111
+ {/* Quick Actions */}
112
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8">
113
+ <Card className="p-6">
114
+ <div className="flex items-center mb-4">
115
+ <User className="h-6 w-6 text-blue-600 dark:text-blue-400 mr-3" />
116
+ <h3 className="text-lg font-semibold text-gray-900 dark:text-white">Profile</h3>
117
+ </div>
118
+ <p className="text-gray-600 dark:text-gray-300 mb-4">
119
+ Update your personal information and preferences
120
+ </p>
121
+ <Link href="/profile">
122
+ <Button className="w-full">Manage Profile</Button>
123
+ </Link>
124
+ </Card>
125
+
126
+ <Card className="p-6">
127
+ <div className="flex items-center mb-4">
128
+ <Settings className="h-6 w-6 text-blue-600 dark:text-blue-400 mr-3" />
129
+ <h3 className="text-lg font-semibold text-gray-900 dark:text-white">Settings</h3>
130
+ </div>
131
+ <p className="text-gray-600 dark:text-gray-300 mb-4">
132
+ Configure your account settings and security options
133
+ </p>
134
+ <Link href="/settings">
135
+ <Button variant="outline" className="w-full">Open Settings</Button>
136
+ </Link>
137
+ </Card>
138
+
139
+ <Card className="p-6">
140
+ <div className="flex items-center mb-4">
141
+ <CreditCard className="h-6 w-6 text-blue-600 dark:text-blue-400 mr-3" />
142
+ <h3 className="text-lg font-semibold text-gray-900 dark:text-white">Billing</h3>
143
+ </div>
144
+ <p className="text-gray-600 dark:text-gray-300 mb-4">
145
+ View your subscription and payment information
146
+ </p>
147
+ <Link href="/billing">
148
+ <Button variant="outline" className="w-full">View Billing</Button>
149
+ </Link>
150
+ </Card>
151
+ </div>
152
+
153
+ {/* Recent Activity */}
154
+ <Card className="p-6">
155
+ <h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-4">Recent Activity</h3>
156
+ <div className="space-y-4">
157
+ <div className="flex items-center justify-between py-3 border-b border-gray-200 dark:border-gray-700">
158
+ <div className="flex items-center">
159
+ <div className="w-2 h-2 bg-green-500 rounded-full mr-3"></div>
160
+ <span className="text-gray-900 dark:text-white">Account created</span>
161
+ </div>
162
+ <span className="text-sm text-gray-500 dark:text-gray-400">2 days ago</span>
163
+ </div>
164
+ <div className="flex items-center justify-between py-3 border-b border-gray-200 dark:border-gray-700">
165
+ <div className="flex items-center">
166
+ <div className="w-2 h-2 bg-blue-500 rounded-full mr-3"></div>
167
+ <span className="text-gray-900 dark:text-white">Profile updated</span>
168
+ </div>
169
+ <span className="text-sm text-gray-500 dark:text-gray-400">1 week ago</span>
170
+ </div>
171
+ <div className="flex items-center justify-between py-3">
172
+ <div className="flex items-center">
173
+ <div className="w-2 h-2 bg-purple-500 rounded-full mr-3"></div>
174
+ <span className="text-gray-900 dark:text-white">Subscription started</span>
175
+ </div>
176
+ <span className="text-sm text-gray-500 dark:text-gray-400">2 weeks ago</span>
177
+ </div>
178
+ </div>
179
+ </Card>
180
+ </div>
181
+ </div>
182
+ )
183
+ }