@digilogiclabs/create-saas-app 2.11.0 → 2.12.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.
Files changed (413) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/cli/index.js +1 -1
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/generators/template-generator.d.ts +0 -2
  6. package/dist/generators/template-generator.d.ts.map +1 -1
  7. package/dist/generators/template-generator.js +18 -17
  8. package/dist/generators/template-generator.js.map +1 -1
  9. package/dist/templates/mobile/base/template/App.tsx +7 -4
  10. package/dist/templates/mobile/base/template/app/checkout.tsx +5 -2
  11. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +6 -2
  12. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +7 -3
  13. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +5 -2
  14. package/dist/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +7 -2
  15. package/dist/templates/mobile/ui-auth-payments/template/app/_layout.tsx +2 -4
  16. package/dist/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +6 -3
  17. package/dist/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +6 -3
  18. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +6 -2
  19. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +7 -3
  20. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +5 -2
  21. package/dist/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +7 -2
  22. package/dist/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +2 -4
  23. package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +6 -3
  24. package/dist/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +6 -3
  25. package/dist/templates/shared/admin/web/src/components/admin-nav.tsx +3 -3
  26. package/dist/templates/shared/auth/supabase/web/src/lib/auth-session.ts +36 -16
  27. package/dist/templates/shared/auth/supabase/web/src/middleware.ts +6 -0
  28. package/dist/templates/shared/config/web/next.config.mjs +0 -1
  29. package/dist/templates/shared/cookie-consent/web/components/cookie-consent.tsx +5 -5
  30. package/dist/templates/shared/design/web/src/components/ui/button.tsx +56 -0
  31. package/dist/templates/shared/email/web/src/lib/email/client.ts +1 -1
  32. package/dist/templates/shared/error-pages/web/src/app/error.tsx +13 -11
  33. package/dist/templates/shared/error-pages/web/src/app/global-error.tsx +2 -0
  34. package/dist/templates/shared/error-pages/web/src/app/not-found.tsx +6 -6
  35. package/dist/templates/shared/legal/web/src/app/(legal)/privacy/page.tsx +4 -4
  36. package/dist/templates/shared/legal/web/src/app/(legal)/terms/page.tsx +4 -4
  37. package/dist/templates/shared/loading/web/components/skeleton.tsx +4 -4
  38. package/dist/templates/shared/mock/web/.env.local +55 -0
  39. package/dist/templates/shared/mock/web/src/components/mock-auth-provider.tsx +72 -0
  40. package/dist/templates/shared/mock/web/src/components/mock-banner.tsx +29 -0
  41. package/dist/templates/shared/mock/web/src/lib/mock.ts +147 -0
  42. package/dist/templates/shared/payments/web/src/app/api/webhooks/stripe/route.ts +10 -4
  43. package/dist/templates/shared/redis/web/src/lib/redis.ts +1 -1
  44. package/dist/templates/web/ai-platform/template/package.json +0 -1
  45. package/dist/templates/web/ai-platform/template/src/app/chat/page.tsx +5 -2
  46. package/dist/templates/web/ai-platform/template/src/app/playground/page.tsx +5 -2
  47. package/dist/templates/web/ai-platform/template/src/components/providers/app-providers.tsx +2 -5
  48. package/dist/templates/web/base/template/eslint.config.mjs +14 -0
  49. package/dist/templates/web/base/template/src/app/auth/callback/route.ts +1 -1
  50. package/dist/templates/web/base/template/src/app/checkout/page.tsx +76 -103
  51. package/dist/templates/web/base/template/src/app/dashboard/page.tsx +145 -329
  52. package/dist/templates/web/base/template/src/app/layout.tsx +40 -38
  53. package/dist/templates/web/base/template/src/app/login/page.tsx +116 -66
  54. package/dist/templates/web/base/template/src/app/page.tsx +97 -193
  55. package/dist/templates/web/base/template/src/app/settings/page.tsx +154 -0
  56. package/dist/templates/web/base/template/src/app/signup/page.tsx +117 -66
  57. package/dist/templates/web/base/template/src/components/providers/app-providers.tsx +8 -3
  58. package/dist/templates/web/base/template/src/components/shared/header.tsx +229 -63
  59. package/dist/templates/web/iot-dashboard/template/package.json +0 -1
  60. package/dist/templates/web/iot-dashboard/template/src/components/providers/app-providers.tsx +2 -5
  61. package/dist/templates/web/marketplace/template/package.json +0 -1
  62. package/dist/templates/web/marketplace/template/src/components/providers/app-providers.tsx +2 -5
  63. package/dist/templates/web/micro-saas/template/package.json +0 -1
  64. package/dist/templates/web/micro-saas/template/src/components/providers/app-providers.tsx +2 -5
  65. package/dist/templates/web/ui-auth/template/eslint.config.mjs +14 -0
  66. package/dist/templates/web/ui-auth/template/src/app/checkout/page.tsx +3 -3
  67. package/dist/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +81 -91
  68. package/dist/templates/web/ui-auth/template/src/app/layout.tsx +38 -36
  69. package/dist/templates/web/ui-auth/template/src/app/login/page.tsx +22 -45
  70. package/dist/templates/web/ui-auth/template/src/app/page.tsx +106 -306
  71. package/dist/templates/web/ui-auth/template/src/app/setup/page.tsx +387 -402
  72. package/dist/templates/web/ui-auth/template/src/app/signup/page.tsx +24 -47
  73. package/dist/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +8 -3
  74. package/dist/templates/web/ui-auth/template/src/components/shared/header.tsx +229 -94
  75. package/dist/templates/web/ui-auth-ai/template/src/app/layout.tsx +38 -45
  76. package/dist/templates/web/ui-auth-ai/template/src/app/login/page.tsx +86 -0
  77. package/dist/templates/web/ui-auth-ai/template/src/app/page.tsx +107 -193
  78. package/dist/templates/web/ui-auth-ai/template/src/app/signup/page.tsx +105 -0
  79. package/dist/templates/web/ui-auth-ai/template/src/components/ai/audio-generator.tsx +144 -140
  80. package/dist/templates/web/ui-auth-ai/template/src/components/ai/video-generator.tsx +156 -157
  81. package/dist/templates/web/ui-auth-ai/template/src/components/auth/login-form.tsx +7 -3
  82. package/dist/templates/web/ui-auth-ai/template/src/components/providers/app-providers.tsx +25 -0
  83. package/dist/templates/web/ui-auth-ai/template/src/components/shared/footer.tsx +36 -0
  84. package/dist/templates/web/ui-auth-ai/template/src/components/shared/header.tsx +228 -0
  85. package/dist/templates/web/ui-auth-ai/template/src/components/ui/button.tsx +5 -5
  86. package/dist/templates/web/ui-auth-ai/template/src/components/ui/input.tsx +1 -1
  87. package/dist/templates/web/ui-auth-ai/template/src/components/ui/select.tsx +1 -1
  88. package/dist/templates/web/ui-auth-ai/template/src/components/ui/textarea.tsx +1 -1
  89. package/dist/templates/web/ui-auth-ai/template/src/components/ui/theme-toggle.tsx +34 -0
  90. package/dist/templates/web/ui-auth-ai/template/src/lib/supabase.ts +6 -4
  91. package/dist/templates/web/ui-auth-ai/template/src/providers/auth-provider.tsx +7 -5
  92. package/dist/templates/web/ui-auth-payments/template/src/app/billing/page.tsx +63 -192
  93. package/dist/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +104 -296
  94. package/dist/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +27 -27
  95. package/dist/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +70 -81
  96. package/dist/templates/web/ui-auth-payments/template/src/app/layout.tsx +38 -36
  97. package/dist/templates/web/ui-auth-payments/template/src/app/login/loading.tsx +9 -9
  98. package/dist/templates/web/ui-auth-payments/template/src/app/login/page.tsx +4 -104
  99. package/dist/templates/web/ui-auth-payments/template/src/app/page.tsx +69 -337
  100. package/dist/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +55 -68
  101. package/dist/templates/web/ui-auth-payments/template/src/app/signup/loading.tsx +13 -13
  102. package/dist/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +4 -123
  103. package/dist/templates/web/ui-auth-payments/template/src/components/client/auth-status.tsx +37 -52
  104. package/dist/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +49 -103
  105. package/dist/templates/web/ui-auth-payments/template/src/components/client/newsletter-signup.tsx +4 -4
  106. package/dist/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +60 -140
  107. package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +25 -28
  108. package/dist/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +229 -230
  109. package/dist/templates/web/ui-auth-payments/template/src/lib/actions/auth.ts +245 -245
  110. package/dist/templates/web/ui-auth-payments/template/src/lib/actions/index.ts +339 -339
  111. package/dist/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +305 -309
  112. package/dist/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +62 -312
  113. package/dist/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +109 -125
  114. package/dist/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +27 -27
  115. package/dist/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +68 -83
  116. package/dist/templates/web/ui-auth-payments-ai/template/src/app/layout.tsx +40 -38
  117. package/dist/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +20 -20
  118. package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +140 -394
  119. package/dist/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +28 -27
  120. package/dist/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +51 -66
  121. package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +37 -52
  122. package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +50 -79
  123. package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +58 -111
  124. package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +8 -3
  125. package/dist/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +229 -252
  126. package/dist/templates/web/ui-auth-payments-ai/template/src/lib/actions/auth.ts +245 -245
  127. package/dist/templates/web/ui-auth-payments-audio/template/src/app/billing/page.tsx +63 -192
  128. package/dist/templates/web/ui-auth-payments-audio/template/src/app/checkout/page.tsx +109 -125
  129. package/dist/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +27 -27
  130. package/dist/templates/web/ui-auth-payments-audio/template/src/app/layout.tsx +40 -38
  131. package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +122 -385
  132. package/dist/templates/web/ui-auth-payments-audio/template/src/app/setup/page.tsx +340 -344
  133. package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/auth-status.tsx +37 -52
  134. package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +49 -103
  135. package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +60 -140
  136. package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +8 -3
  137. package/dist/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +229 -252
  138. package/dist/templates/web/ui-auth-payments-audio/template/src/lib/actions/auth.ts +3 -3
  139. package/dist/templates/web/ui-auth-payments-video/template/src/app/billing/page.tsx +63 -192
  140. package/dist/templates/web/ui-auth-payments-video/template/src/app/checkout/page.tsx +109 -125
  141. package/dist/templates/web/ui-auth-payments-video/template/src/app/layout.tsx +38 -36
  142. package/dist/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +9 -109
  143. package/dist/templates/web/ui-auth-payments-video/template/src/app/page.tsx +132 -392
  144. package/dist/templates/web/ui-auth-payments-video/template/src/app/setup/page.tsx +346 -350
  145. package/dist/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +9 -128
  146. package/dist/templates/web/ui-auth-payments-video/template/src/components/client/login-form.tsx +90 -0
  147. package/dist/templates/web/ui-auth-payments-video/template/src/components/client/signup-form.tsx +105 -0
  148. package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +8 -3
  149. package/dist/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +229 -246
  150. package/dist/templates/web/ui-only/template/eslint.config.mjs +14 -0
  151. package/dist/templates/web/ui-only/template/src/app/checkout/page.tsx +2 -2
  152. package/dist/templates/web/ui-only/template/src/app/login/page.tsx +69 -63
  153. package/dist/templates/web/ui-only/template/src/app/page.tsx +69 -91
  154. package/dist/templates/web/ui-only/template/src/app/signup/page.tsx +94 -79
  155. package/dist/templates/web/ui-only/template/src/components/providers/app-providers.tsx +1 -6
  156. package/dist/templates/web/ui-only/template/src/components/shared/header.tsx +90 -53
  157. package/dist/templates/web/ui-package-test/template/package.json +19 -23
  158. package/dist/templates/web/ui-package-test/template/postcss.config.mjs +8 -0
  159. package/dist/templates/web/ui-package-test/template/src/app/globals.css +88 -0
  160. package/dist/templates/web/ui-package-test/template/src/app/layout.tsx +27 -0
  161. package/dist/templates/web/ui-package-test/template/src/app/page.tsx +46 -106
  162. package/package.json +1 -1
  163. package/src/templates/mobile/base/template/App.tsx +7 -4
  164. package/src/templates/mobile/base/template/app/checkout.tsx +5 -2
  165. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/_layout.tsx +6 -2
  166. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/billing.tsx +7 -3
  167. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/index.tsx +5 -2
  168. package/src/templates/mobile/ui-auth-payments/template/app/(tabs)/profile.tsx +7 -2
  169. package/src/templates/mobile/ui-auth-payments/template/app/_layout.tsx +2 -4
  170. package/src/templates/mobile/ui-auth-payments/template/app/auth/login.tsx +6 -3
  171. package/src/templates/mobile/ui-auth-payments/template/app/auth/signup.tsx +6 -3
  172. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/_layout.tsx +6 -2
  173. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/billing.tsx +7 -3
  174. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/index.tsx +5 -2
  175. package/src/templates/mobile/ui-auth-payments-ai/template/app/(tabs)/profile.tsx +7 -2
  176. package/src/templates/mobile/ui-auth-payments-ai/template/app/_layout.tsx +2 -4
  177. package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/login.tsx +6 -3
  178. package/src/templates/mobile/ui-auth-payments-ai/template/app/auth/signup.tsx +6 -3
  179. package/src/templates/shared/admin/web/src/components/admin-nav.tsx +3 -3
  180. package/src/templates/shared/auth/supabase/web/src/lib/auth-session.ts +36 -16
  181. package/src/templates/shared/auth/supabase/web/src/middleware.ts +6 -0
  182. package/src/templates/shared/config/web/next.config.mjs +0 -1
  183. package/src/templates/shared/cookie-consent/web/components/cookie-consent.tsx +5 -5
  184. package/src/templates/shared/design/web/src/components/ui/button.tsx +56 -0
  185. package/src/templates/shared/email/web/src/lib/email/client.ts +1 -1
  186. package/src/templates/shared/error-pages/web/src/app/error.tsx +13 -11
  187. package/src/templates/shared/error-pages/web/src/app/global-error.tsx +2 -0
  188. package/src/templates/shared/error-pages/web/src/app/not-found.tsx +6 -6
  189. package/src/templates/shared/legal/web/src/app/(legal)/privacy/page.tsx +4 -4
  190. package/src/templates/shared/legal/web/src/app/(legal)/terms/page.tsx +4 -4
  191. package/src/templates/shared/loading/web/components/skeleton.tsx +4 -4
  192. package/src/templates/shared/mock/web/.env.local +55 -0
  193. package/src/templates/shared/mock/web/src/components/mock-auth-provider.tsx +72 -0
  194. package/src/templates/shared/mock/web/src/components/mock-banner.tsx +29 -0
  195. package/src/templates/shared/mock/web/src/lib/mock.ts +147 -0
  196. package/src/templates/shared/payments/web/src/app/api/webhooks/stripe/route.ts +10 -4
  197. package/src/templates/shared/redis/web/src/lib/redis.ts +1 -1
  198. package/src/templates/web/ai-platform/template/package.json +0 -1
  199. package/src/templates/web/ai-platform/template/src/app/chat/page.tsx +5 -2
  200. package/src/templates/web/ai-platform/template/src/app/playground/page.tsx +5 -2
  201. package/src/templates/web/ai-platform/template/src/components/providers/app-providers.tsx +2 -5
  202. package/src/templates/web/base/template/eslint.config.mjs +14 -0
  203. package/src/templates/web/base/template/src/app/auth/callback/route.ts +1 -1
  204. package/src/templates/web/base/template/src/app/checkout/page.tsx +76 -103
  205. package/src/templates/web/base/template/src/app/dashboard/page.tsx +145 -329
  206. package/src/templates/web/base/template/src/app/layout.tsx +40 -38
  207. package/src/templates/web/base/template/src/app/login/page.tsx +116 -66
  208. package/src/templates/web/base/template/src/app/page.tsx +97 -193
  209. package/src/templates/web/base/template/src/app/settings/page.tsx +154 -0
  210. package/src/templates/web/base/template/src/app/signup/page.tsx +117 -66
  211. package/src/templates/web/base/template/src/components/providers/app-providers.tsx +8 -3
  212. package/src/templates/web/base/template/src/components/shared/header.tsx +229 -63
  213. package/src/templates/web/iot-dashboard/template/package.json +0 -1
  214. package/src/templates/web/iot-dashboard/template/src/components/providers/app-providers.tsx +2 -5
  215. package/src/templates/web/marketplace/template/package.json +0 -1
  216. package/src/templates/web/marketplace/template/src/components/providers/app-providers.tsx +2 -5
  217. package/src/templates/web/micro-saas/template/package.json +0 -1
  218. package/src/templates/web/micro-saas/template/src/components/providers/app-providers.tsx +2 -5
  219. package/src/templates/web/ui-auth/template/eslint.config.mjs +14 -0
  220. package/src/templates/web/ui-auth/template/src/app/checkout/page.tsx +3 -3
  221. package/src/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +81 -91
  222. package/src/templates/web/ui-auth/template/src/app/layout.tsx +38 -36
  223. package/src/templates/web/ui-auth/template/src/app/login/page.tsx +22 -45
  224. package/src/templates/web/ui-auth/template/src/app/page.tsx +106 -306
  225. package/src/templates/web/ui-auth/template/src/app/setup/page.tsx +387 -402
  226. package/src/templates/web/ui-auth/template/src/app/signup/page.tsx +24 -47
  227. package/src/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +8 -3
  228. package/src/templates/web/ui-auth/template/src/components/shared/header.tsx +229 -94
  229. package/src/templates/web/ui-auth-ai/template/src/app/layout.tsx +38 -45
  230. package/src/templates/web/ui-auth-ai/template/src/app/login/page.tsx +86 -0
  231. package/src/templates/web/ui-auth-ai/template/src/app/page.tsx +107 -193
  232. package/src/templates/web/ui-auth-ai/template/src/app/signup/page.tsx +105 -0
  233. package/src/templates/web/ui-auth-ai/template/src/components/ai/audio-generator.tsx +144 -140
  234. package/src/templates/web/ui-auth-ai/template/src/components/ai/video-generator.tsx +156 -157
  235. package/src/templates/web/ui-auth-ai/template/src/components/auth/login-form.tsx +7 -3
  236. package/src/templates/web/ui-auth-ai/template/src/components/providers/app-providers.tsx +25 -0
  237. package/src/templates/web/ui-auth-ai/template/src/components/shared/footer.tsx +36 -0
  238. package/src/templates/web/ui-auth-ai/template/src/components/shared/header.tsx +228 -0
  239. package/src/templates/web/ui-auth-ai/template/src/components/ui/button.tsx +5 -5
  240. package/src/templates/web/ui-auth-ai/template/src/components/ui/input.tsx +1 -1
  241. package/src/templates/web/ui-auth-ai/template/src/components/ui/select.tsx +1 -1
  242. package/src/templates/web/ui-auth-ai/template/src/components/ui/textarea.tsx +1 -1
  243. package/src/templates/web/ui-auth-ai/template/src/components/ui/theme-toggle.tsx +34 -0
  244. package/src/templates/web/ui-auth-ai/template/src/lib/supabase.ts +6 -4
  245. package/src/templates/web/ui-auth-ai/template/src/providers/auth-provider.tsx +7 -5
  246. package/src/templates/web/ui-auth-payments/template/src/app/billing/page.tsx +63 -192
  247. package/src/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +104 -296
  248. package/src/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +27 -27
  249. package/src/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +70 -81
  250. package/src/templates/web/ui-auth-payments/template/src/app/layout.tsx +38 -36
  251. package/src/templates/web/ui-auth-payments/template/src/app/login/loading.tsx +9 -9
  252. package/src/templates/web/ui-auth-payments/template/src/app/login/page.tsx +4 -104
  253. package/src/templates/web/ui-auth-payments/template/src/app/page.tsx +69 -337
  254. package/src/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +55 -68
  255. package/src/templates/web/ui-auth-payments/template/src/app/signup/loading.tsx +13 -13
  256. package/src/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +4 -123
  257. package/src/templates/web/ui-auth-payments/template/src/components/client/auth-status.tsx +37 -52
  258. package/src/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +49 -103
  259. package/src/templates/web/ui-auth-payments/template/src/components/client/newsletter-signup.tsx +4 -4
  260. package/src/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +60 -140
  261. package/src/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +25 -28
  262. package/src/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +229 -230
  263. package/src/templates/web/ui-auth-payments/template/src/lib/actions/auth.ts +245 -245
  264. package/src/templates/web/ui-auth-payments/template/src/lib/actions/index.ts +339 -339
  265. package/src/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +305 -309
  266. package/src/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +62 -312
  267. package/src/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +109 -125
  268. package/src/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +27 -27
  269. package/src/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +68 -83
  270. package/src/templates/web/ui-auth-payments-ai/template/src/app/layout.tsx +40 -38
  271. package/src/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +20 -20
  272. package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +140 -394
  273. package/src/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +28 -27
  274. package/src/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +51 -66
  275. package/src/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +37 -52
  276. package/src/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +50 -79
  277. package/src/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +58 -111
  278. package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +8 -3
  279. package/src/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +229 -252
  280. package/src/templates/web/ui-auth-payments-ai/template/src/lib/actions/auth.ts +245 -245
  281. package/src/templates/web/ui-auth-payments-audio/template/src/app/billing/page.tsx +63 -192
  282. package/src/templates/web/ui-auth-payments-audio/template/src/app/checkout/page.tsx +109 -125
  283. package/src/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +27 -27
  284. package/src/templates/web/ui-auth-payments-audio/template/src/app/layout.tsx +40 -38
  285. package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +122 -385
  286. package/src/templates/web/ui-auth-payments-audio/template/src/app/setup/page.tsx +340 -344
  287. package/src/templates/web/ui-auth-payments-audio/template/src/components/client/auth-status.tsx +37 -52
  288. package/src/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +49 -103
  289. package/src/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +60 -140
  290. package/src/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +8 -3
  291. package/src/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +229 -252
  292. package/src/templates/web/ui-auth-payments-audio/template/src/lib/actions/auth.ts +3 -3
  293. package/src/templates/web/ui-auth-payments-video/template/src/app/billing/page.tsx +63 -192
  294. package/src/templates/web/ui-auth-payments-video/template/src/app/checkout/page.tsx +109 -125
  295. package/src/templates/web/ui-auth-payments-video/template/src/app/layout.tsx +38 -36
  296. package/src/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +9 -109
  297. package/src/templates/web/ui-auth-payments-video/template/src/app/page.tsx +132 -392
  298. package/src/templates/web/ui-auth-payments-video/template/src/app/setup/page.tsx +346 -350
  299. package/src/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +9 -128
  300. package/src/templates/web/ui-auth-payments-video/template/src/components/client/login-form.tsx +90 -0
  301. package/src/templates/web/ui-auth-payments-video/template/src/components/client/signup-form.tsx +105 -0
  302. package/src/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +8 -3
  303. package/src/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +229 -246
  304. package/src/templates/web/ui-only/template/eslint.config.mjs +14 -0
  305. package/src/templates/web/ui-only/template/src/app/checkout/page.tsx +2 -2
  306. package/src/templates/web/ui-only/template/src/app/login/page.tsx +69 -63
  307. package/src/templates/web/ui-only/template/src/app/page.tsx +69 -91
  308. package/src/templates/web/ui-only/template/src/app/signup/page.tsx +94 -79
  309. package/src/templates/web/ui-only/template/src/components/providers/app-providers.tsx +1 -6
  310. package/src/templates/web/ui-only/template/src/components/shared/header.tsx +90 -53
  311. package/src/templates/web/ui-package-test/template/package.json +19 -23
  312. package/src/templates/web/ui-package-test/template/postcss.config.mjs +8 -0
  313. package/src/templates/web/ui-package-test/template/src/app/globals.css +88 -0
  314. package/src/templates/web/ui-package-test/template/src/app/layout.tsx +27 -0
  315. package/src/templates/web/ui-package-test/template/src/app/page.tsx +46 -106
  316. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/README.md +0 -655
  317. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +0 -683
  318. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/_layout.tsx +0 -124
  319. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app.json +0 -74
  320. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/babel.config.js +0 -25
  321. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +0 -787
  322. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/eas.json +0 -25
  323. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/expo-env.d.ts +0 -3
  324. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +0 -346
  325. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/jest-setup.ts +0 -37
  326. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +0 -180
  327. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/metro.config.js +0 -11
  328. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/package.json +0 -122
  329. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +0 -599
  330. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/tsconfig.json +0 -32
  331. package/dist/templates/web/base/template/.eslintrc.js +0 -8
  332. package/dist/templates/web/base/template/src/components/__tests__/example.test.tsx +0 -49
  333. package/dist/templates/web/base/template/src/test/setup.ts +0 -74
  334. package/dist/templates/web/base/template/vitest.config.ts +0 -17
  335. package/dist/templates/web/ui-auth/template/.eslintrc.js +0 -8
  336. package/dist/templates/web/ui-auth/template/src/components/__tests__/example.test.tsx +0 -49
  337. package/dist/templates/web/ui-auth/template/src/test/setup.ts +0 -74
  338. package/dist/templates/web/ui-auth/template/vitest.config.ts +0 -17
  339. package/dist/templates/web/ui-auth-payments/template/src/components/__tests__/example.test.tsx +0 -49
  340. package/dist/templates/web/ui-auth-payments/template/src/test/setup.ts +0 -74
  341. package/dist/templates/web/ui-auth-payments/template/vitest.config.ts +0 -17
  342. package/dist/templates/web/ui-auth-payments-ai/template/src/components/__tests__/example.test.tsx +0 -49
  343. package/dist/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +0 -74
  344. package/dist/templates/web/ui-auth-payments-ai/template/vitest.config.ts +0 -17
  345. package/dist/templates/web/ui-auth-payments-ai-rag/template/README.md +0 -434
  346. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +0 -642
  347. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +0 -466
  348. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +0 -393
  349. package/dist/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +0 -457
  350. package/dist/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +0 -478
  351. package/dist/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +0 -250
  352. package/dist/templates/web/ui-auth-payments-ai-rag/template/package.json +0 -73
  353. package/dist/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +0 -622
  354. package/dist/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +0 -396
  355. package/dist/templates/web/ui-auth-payments-audio/template/src/components/__tests__/example.test.tsx +0 -49
  356. package/dist/templates/web/ui-auth-payments-audio/template/src/test/setup.ts +0 -74
  357. package/dist/templates/web/ui-auth-payments-audio/template/vitest.config.ts +0 -17
  358. package/dist/templates/web/ui-auth-payments-video/template/src/components/__tests__/example.test.tsx +0 -49
  359. package/dist/templates/web/ui-auth-payments-video/template/src/test/setup.ts +0 -74
  360. package/dist/templates/web/ui-auth-payments-video/template/vitest.config.ts +0 -17
  361. package/dist/templates/web/ui-only/template/.eslintrc.js +0 -8
  362. package/dist/templates/web/ui-only/template/src/components/__tests__/example.test.tsx +0 -49
  363. package/dist/templates/web/ui-only/template/src/test/setup.ts +0 -74
  364. package/dist/templates/web/ui-only/template/vitest.config.ts +0 -17
  365. package/src/templates/mobile/ui-auth-payments-ai-rag/template/README.md +0 -655
  366. package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +0 -683
  367. package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/_layout.tsx +0 -124
  368. package/src/templates/mobile/ui-auth-payments-ai-rag/template/app.json +0 -74
  369. package/src/templates/mobile/ui-auth-payments-ai-rag/template/babel.config.js +0 -25
  370. package/src/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +0 -787
  371. package/src/templates/mobile/ui-auth-payments-ai-rag/template/eas.json +0 -25
  372. package/src/templates/mobile/ui-auth-payments-ai-rag/template/expo-env.d.ts +0 -3
  373. package/src/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +0 -346
  374. package/src/templates/mobile/ui-auth-payments-ai-rag/template/jest-setup.ts +0 -37
  375. package/src/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +0 -180
  376. package/src/templates/mobile/ui-auth-payments-ai-rag/template/metro.config.js +0 -11
  377. package/src/templates/mobile/ui-auth-payments-ai-rag/template/package.json +0 -122
  378. package/src/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +0 -599
  379. package/src/templates/mobile/ui-auth-payments-ai-rag/template/tsconfig.json +0 -32
  380. package/src/templates/web/base/template/.eslintrc.js +0 -8
  381. package/src/templates/web/base/template/src/components/__tests__/example.test.tsx +0 -49
  382. package/src/templates/web/base/template/src/test/setup.ts +0 -74
  383. package/src/templates/web/base/template/vitest.config.ts +0 -17
  384. package/src/templates/web/ui-auth/template/.eslintrc.js +0 -8
  385. package/src/templates/web/ui-auth/template/src/components/__tests__/example.test.tsx +0 -49
  386. package/src/templates/web/ui-auth/template/src/test/setup.ts +0 -74
  387. package/src/templates/web/ui-auth/template/vitest.config.ts +0 -17
  388. package/src/templates/web/ui-auth-payments/template/src/components/__tests__/example.test.tsx +0 -49
  389. package/src/templates/web/ui-auth-payments/template/src/test/setup.ts +0 -74
  390. package/src/templates/web/ui-auth-payments/template/vitest.config.ts +0 -17
  391. package/src/templates/web/ui-auth-payments-ai/template/src/components/__tests__/example.test.tsx +0 -49
  392. package/src/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +0 -74
  393. package/src/templates/web/ui-auth-payments-ai/template/vitest.config.ts +0 -17
  394. package/src/templates/web/ui-auth-payments-ai-rag/template/README.md +0 -434
  395. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +0 -642
  396. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +0 -466
  397. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +0 -393
  398. package/src/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +0 -457
  399. package/src/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +0 -478
  400. package/src/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +0 -250
  401. package/src/templates/web/ui-auth-payments-ai-rag/template/package.json +0 -73
  402. package/src/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +0 -622
  403. package/src/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +0 -396
  404. package/src/templates/web/ui-auth-payments-audio/template/src/components/__tests__/example.test.tsx +0 -49
  405. package/src/templates/web/ui-auth-payments-audio/template/src/test/setup.ts +0 -74
  406. package/src/templates/web/ui-auth-payments-audio/template/vitest.config.ts +0 -17
  407. package/src/templates/web/ui-auth-payments-video/template/src/components/__tests__/example.test.tsx +0 -49
  408. package/src/templates/web/ui-auth-payments-video/template/src/test/setup.ts +0 -74
  409. package/src/templates/web/ui-auth-payments-video/template/vitest.config.ts +0 -17
  410. package/src/templates/web/ui-only/template/.eslintrc.js +0 -8
  411. package/src/templates/web/ui-only/template/src/components/__tests__/example.test.tsx +0 -49
  412. package/src/templates/web/ui-only/template/src/test/setup.ts +0 -74
  413. package/src/templates/web/ui-only/template/vitest.config.ts +0 -17
@@ -1,144 +1,90 @@
1
1
  'use client'
2
2
 
3
- import React, { useState, useActionState } from 'react'
4
- import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui'
5
- import { useAuth } from '@digilogiclabs/app-sdk'
6
- import { useRouter } from 'next/navigation'
7
- import { signInAction } from '@/lib/actions/auth'
3
+ import React, { useState } from 'react'
4
+ import { Button, Card, CardContent, CardHeader, CardTitle, Input, Label } from '@digilogiclabs/saas-factory-ui'
5
+ import Link from 'next/link'
8
6
 
9
7
  export function LoginForm() {
10
8
  const [email, setEmail] = useState('')
11
9
  const [password, setPassword] = useState('')
12
- const { signIn, signInWithOAuth, loading, error, user } = useAuth()
13
- const [actionState, formAction] = useActionState(signInAction, { success: false })
14
- const router = useRouter()
10
+ const [error, setError] = useState('')
11
+ const [loading, setLoading] = useState(false)
15
12
 
16
- // Redirect if already logged in
17
- React.useEffect(() => {
18
- if (user) {
19
- router.push('/')
20
- }
21
- }, [user, router])
22
-
23
- const handleLogin = async (e: React.FormEvent) => {
13
+ const handleSubmit = async (e: React.FormEvent) => {
24
14
  e.preventDefault()
25
- try {
26
- await signIn(email, password)
27
- router.push('/')
28
- } catch (err) {
29
- console.error('Login error:', err)
30
- }
31
- }
15
+ setLoading(true)
16
+ setError('')
32
17
 
33
- const handleGoogleLogin = async () => {
34
18
  try {
35
- await signInWithOAuth('google')
36
- } catch (err) {
37
- console.error('Google login error:', err)
38
- }
39
- }
19
+ const res = await fetch('/api/auth/login', {
20
+ method: 'POST',
21
+ headers: { 'Content-Type': 'application/json' },
22
+ body: JSON.stringify({ email, password }),
23
+ })
40
24
 
41
- // Enhanced form action that uses both server action validation and client auth
42
- const handleServerAction = async (formData: FormData) => {
43
- const result = await formAction(formData)
44
-
45
- if (result?.success) {
46
- // If server validation passes, proceed with client auth
47
- const emailValue = formData.get('email') as string
48
- const passwordValue = formData.get('password') as string
49
-
50
- try {
51
- await signIn(emailValue, passwordValue)
52
- router.push('/')
53
- } catch (err) {
54
- console.error('Login error:', err)
25
+ if (!res.ok) {
26
+ const data = await res.json()
27
+ setError(data.error || 'Sign in failed')
28
+ return
55
29
  }
56
- }
57
- }
58
30
 
59
- if (loading) {
60
- return (
61
- <div className="flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-900">
62
- <div>Loading...</div>
63
- </div>
64
- )
31
+ window.location.href = '/dashboard'
32
+ } catch {
33
+ setError('An unexpected error occurred')
34
+ } finally {
35
+ setLoading(false)
36
+ }
65
37
  }
66
38
 
67
39
  return (
68
- <div className="flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-900">
69
- <Card className="w-full max-w-md p-8">
70
- <h1 className="text-2xl font-bold text-center mb-6">Sign In</h1>
71
-
72
- {/* Server action errors */}
73
- {actionState?.error && (
74
- <div className="mb-4 p-3 bg-red-100 border border-red-400 text-red-700 rounded">
75
- {actionState.error}
76
- </div>
77
- )}
78
-
79
- {/* Client auth errors */}
40
+ <Card className="w-full max-w-sm mx-auto">
41
+ <CardHeader>
42
+ <CardTitle className="text-2xl text-center">Sign In</CardTitle>
43
+ </CardHeader>
44
+ <CardContent>
80
45
  {error && (
81
- <div className="mb-4 p-3 bg-red-100 border border-red-400 text-red-700 rounded">
82
- {error.message}
46
+ <div className="mb-4 rounded-lg bg-destructive/10 p-3 text-sm text-destructive">
47
+ {error}
83
48
  </div>
84
49
  )}
85
50
 
86
- <form action={handleServerAction} className="space-y-4">
87
- <div>
51
+ <form onSubmit={handleSubmit} className="space-y-4">
52
+ <div className="space-y-2">
88
53
  <Label htmlFor="email">Email</Label>
89
54
  <Input
90
55
  id="email"
91
- name="email"
92
56
  type="email"
93
57
  value={email}
94
- onChange={(e) => setEmail(e.target.value)}
95
- placeholder="Enter your email"
58
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => setEmail(e.target.value)}
59
+ placeholder="you@example.com"
96
60
  required
97
- disabled={loading}
98
61
  />
99
- {actionState?.fieldErrors?.email && (
100
- <p className="text-sm text-red-600 mt-1">{actionState.fieldErrors.email[0]}</p>
101
- )}
102
62
  </div>
103
- <div>
63
+
64
+ <div className="space-y-2">
104
65
  <Label htmlFor="password">Password</Label>
105
66
  <Input
106
67
  id="password"
107
- name="password"
108
68
  type="password"
109
69
  value={password}
110
- onChange={(e) => setPassword(e.target.value)}
111
- placeholder="Enter your password"
70
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => setPassword(e.target.value)}
71
+ placeholder="••••••••"
112
72
  required
113
- disabled={loading}
114
73
  />
115
- {actionState?.fieldErrors?.password && (
116
- <p className="text-sm text-red-600 mt-1">{actionState.fieldErrors.password[0]}</p>
117
- )}
118
74
  </div>
75
+
119
76
  <Button type="submit" className="w-full" disabled={loading}>
120
- {loading ? 'Signing In...' : 'Sign In'}
121
- </Button>
122
- <Button
123
- type="button"
124
- variant="outline"
125
- className="w-full"
126
- onClick={handleGoogleLogin}
127
- disabled={loading}
128
- >
129
- Sign in with Google
77
+ {loading ? 'Signing in...' : 'Sign In'}
130
78
  </Button>
131
79
  </form>
132
80
 
133
- <div className="mt-4 text-center">
134
- <p className="text-sm text-gray-600 dark:text-gray-300">
135
- Don&apos;t have an account?{' '}
136
- <a href="/signup" className="text-blue-600 hover:underline dark:text-blue-400">
137
- Sign up
138
- </a>
139
- </p>
140
- </div>
141
- </Card>
142
- </div>
81
+ <p className="mt-4 text-center text-sm text-muted-foreground">
82
+ Don&apos;t have an account?{' '}
83
+ <Link href="/signup" className="text-primary hover:underline">
84
+ Sign up
85
+ </Link>
86
+ </p>
87
+ </CardContent>
88
+ </Card>
143
89
  )
144
- }
90
+ }
@@ -16,9 +16,9 @@ export function NewsletterSignup() {
16
16
  }
17
17
 
18
18
  return (
19
- <div className="bg-blue-600 dark:bg-blue-800 rounded-lg p-6 text-white">
19
+ <div className="bg-primary rounded-lg p-6 text-primary-foreground">
20
20
  <h3 className="text-lg font-semibold mb-2">Stay Updated</h3>
21
- <p className="text-blue-100 dark:text-blue-200 mb-4 text-sm">
21
+ <p className="text-primary-foreground/80 mb-4 text-sm">
22
22
  Get the latest updates and features delivered to your inbox
23
23
  </p>
24
24
 
@@ -48,7 +48,7 @@ export function NewsletterSignup() {
48
48
  placeholder="Enter your email"
49
49
  required
50
50
  disabled={isPending}
51
- className="bg-white dark:bg-gray-800 text-gray-900 dark:text-white"
51
+ className="bg-background text-foreground"
52
52
  />
53
53
  </div>
54
54
  <Button
@@ -60,7 +60,7 @@ export function NewsletterSignup() {
60
60
  </Button>
61
61
  </form>
62
62
 
63
- <p className="text-xs text-blue-200 dark:text-blue-300 mt-2">
63
+ <p className="text-xs text-primary-foreground/70 mt-2">
64
64
  We respect your privacy. Unsubscribe at any time.
65
65
  </p>
66
66
  </div>
@@ -1,185 +1,105 @@
1
1
  'use client'
2
2
 
3
- import React, { useState, useActionState } from 'react'
4
- import { Button, Card, Input, Label } from '@digilogiclabs/saas-factory-ui'
5
- import { useAuth } from '@digilogiclabs/app-sdk'
6
- import { useRouter } from 'next/navigation'
7
- import { signUpAction } from '@/lib/actions/auth'
3
+ import React, { useState } from 'react'
4
+ import { Button, Card, CardContent, CardHeader, CardTitle, Input, Label } from '@digilogiclabs/saas-factory-ui'
5
+ import Link from 'next/link'
8
6
 
9
7
  export function SignupForm() {
10
- const [name, setName] = useState('')
11
8
  const [email, setEmail] = useState('')
12
9
  const [password, setPassword] = useState('')
13
- const [confirmPassword, setConfirmPassword] = useState('')
14
- const { signUp, signInWithOAuth, loading, error, user } = useAuth()
15
- const [actionState, formAction] = useActionState(signUpAction, { success: false })
16
- const router = useRouter()
10
+ const [error, setError] = useState('')
11
+ const [loading, setLoading] = useState(false)
12
+ const [success, setSuccess] = useState(false)
17
13
 
18
- // Redirect if already logged in
19
- React.useEffect(() => {
20
- if (user) {
21
- router.push('/')
22
- }
23
- }, [user, router])
24
-
25
- const handleSignUp = async (e: React.FormEvent) => {
14
+ const handleSubmit = async (e: React.FormEvent) => {
26
15
  e.preventDefault()
27
-
28
- if (password !== confirmPassword) {
29
- console.error('Passwords do not match')
30
- return
31
- }
32
-
33
- try {
34
- await signUp(email, password)
35
- router.push('/')
36
- } catch (err) {
37
- console.error('Sign up error:', err)
38
- }
39
- }
16
+ setLoading(true)
17
+ setError('')
40
18
 
41
- const handleGoogleSignUp = async () => {
42
19
  try {
43
- await signInWithOAuth('google')
44
- } catch (err) {
45
- console.error('Google sign up error:', err)
46
- }
47
- }
20
+ const res = await fetch('/api/auth/signup', {
21
+ method: 'POST',
22
+ headers: { 'Content-Type': 'application/json' },
23
+ body: JSON.stringify({ email, password }),
24
+ })
48
25
 
49
- // Enhanced form action that uses both server action validation and client auth
50
- const handleServerAction = async (formData: FormData) => {
51
- const result = await formAction(formData)
52
-
53
- if (result?.success) {
54
- // If server validation passes, proceed with client auth
55
- const emailValue = formData.get('email') as string
56
- const passwordValue = formData.get('password') as string
57
- const nameValue = formData.get('name') as string
58
-
59
- try {
60
- await signUp(emailValue, passwordValue)
61
- router.push('/')
62
- } catch (err) {
63
- console.error('Sign up error:', err)
26
+ if (!res.ok) {
27
+ const data = await res.json()
28
+ setError(data.error || 'Sign up failed')
29
+ return
64
30
  }
31
+
32
+ setSuccess(true)
33
+ } catch {
34
+ setError('An unexpected error occurred')
35
+ } finally {
36
+ setLoading(false)
65
37
  }
66
38
  }
67
39
 
68
- if (loading) {
40
+ if (success) {
69
41
  return (
70
- <div className="flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-900">
71
- <div>Loading...</div>
72
- </div>
42
+ <Card className="w-full max-w-sm mx-auto">
43
+ <CardContent className="pt-6 text-center">
44
+ <h2 className="text-2xl font-bold text-card-foreground mb-2">Check your email</h2>
45
+ <p className="text-muted-foreground">
46
+ We sent a confirmation link to <strong className="text-foreground">{email}</strong>.
47
+ </p>
48
+ </CardContent>
49
+ </Card>
73
50
  )
74
51
  }
75
52
 
76
53
  return (
77
- <div className="flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-900">
78
- <Card className="w-full max-w-md p-8">
79
- <h1 className="text-2xl font-bold text-center mb-6">Sign Up</h1>
80
-
81
- {/* Server action errors */}
82
- {actionState?.error && (
83
- <div className="mb-4 p-3 bg-red-100 border border-red-400 text-red-700 rounded">
84
- {actionState.error}
85
- </div>
86
- )}
87
-
88
- {/* Client auth errors */}
54
+ <Card className="w-full max-w-sm mx-auto">
55
+ <CardHeader>
56
+ <CardTitle className="text-2xl text-center">Create Account</CardTitle>
57
+ </CardHeader>
58
+ <CardContent>
89
59
  {error && (
90
- <div className="mb-4 p-3 bg-red-100 border border-red-400 text-red-700 rounded">
91
- {error.message}
60
+ <div className="mb-4 rounded-lg bg-destructive/10 p-3 text-sm text-destructive">
61
+ {error}
92
62
  </div>
93
63
  )}
94
64
 
95
- <form action={handleServerAction} className="space-y-4">
96
- <div>
97
- <Label htmlFor="name">Name</Label>
98
- <Input
99
- id="name"
100
- name="name"
101
- type="text"
102
- value={name}
103
- onChange={(e) => setName(e.target.value)}
104
- placeholder="Enter your name"
105
- required
106
- disabled={loading}
107
- />
108
- {actionState?.fieldErrors?.name && (
109
- <p className="text-sm text-red-600 mt-1">{actionState.fieldErrors.name[0]}</p>
110
- )}
111
- </div>
112
- <div>
65
+ <form onSubmit={handleSubmit} className="space-y-4">
66
+ <div className="space-y-2">
113
67
  <Label htmlFor="email">Email</Label>
114
68
  <Input
115
69
  id="email"
116
- name="email"
117
70
  type="email"
118
71
  value={email}
119
- onChange={(e) => setEmail(e.target.value)}
120
- placeholder="Enter your email"
72
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => setEmail(e.target.value)}
73
+ placeholder="you@example.com"
121
74
  required
122
- disabled={loading}
123
75
  />
124
- {actionState?.fieldErrors?.email && (
125
- <p className="text-sm text-red-600 mt-1">{actionState.fieldErrors.email[0]}</p>
126
- )}
127
76
  </div>
128
- <div>
77
+
78
+ <div className="space-y-2">
129
79
  <Label htmlFor="password">Password</Label>
130
80
  <Input
131
81
  id="password"
132
- name="password"
133
82
  type="password"
134
83
  value={password}
135
- onChange={(e) => setPassword(e.target.value)}
136
- placeholder="Enter your password"
137
- required
138
- disabled={loading}
139
- />
140
- {actionState?.fieldErrors?.password && (
141
- <p className="text-sm text-red-600 mt-1">{actionState.fieldErrors.password[0]}</p>
142
- )}
143
- </div>
144
- <div>
145
- <Label htmlFor="confirmPassword">Confirm Password</Label>
146
- <Input
147
- id="confirmPassword"
148
- name="confirmPassword"
149
- type="password"
150
- value={confirmPassword}
151
- onChange={(e) => setConfirmPassword(e.target.value)}
152
- placeholder="Confirm your password"
84
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => setPassword(e.target.value)}
85
+ placeholder="••••••••"
153
86
  required
154
- disabled={loading}
87
+ minLength={8}
155
88
  />
156
- {actionState?.fieldErrors?.confirmPassword && (
157
- <p className="text-sm text-red-600 mt-1">{actionState.fieldErrors.confirmPassword[0]}</p>
158
- )}
159
89
  </div>
90
+
160
91
  <Button type="submit" className="w-full" disabled={loading}>
161
- {loading ? 'Signing Up...' : 'Sign Up'}
162
- </Button>
163
- <Button
164
- type="button"
165
- variant="outline"
166
- className="w-full"
167
- onClick={handleGoogleSignUp}
168
- disabled={loading}
169
- >
170
- Sign up with Google
92
+ {loading ? 'Creating account...' : 'Sign Up'}
171
93
  </Button>
172
94
  </form>
173
95
 
174
- <div className="mt-4 text-center">
175
- <p className="text-sm text-gray-600 dark:text-gray-300">
176
- Already have an account?{' '}
177
- <a href="/login" className="text-blue-600 hover:underline dark:text-blue-400">
178
- Sign in
179
- </a>
180
- </p>
181
- </div>
182
- </Card>
183
- </div>
96
+ <p className="mt-4 text-center text-sm text-muted-foreground">
97
+ Already have an account?{' '}
98
+ <Link href="/login" className="text-primary hover:underline">
99
+ Sign in
100
+ </Link>
101
+ </p>
102
+ </CardContent>
103
+ </Card>
184
104
  )
185
- }
105
+ }
@@ -1,28 +1,25 @@
1
- 'use client'
2
-
3
- import React from 'react'
4
- import { ThemeProvider } from 'next-themes'
5
- import { Toaster } from '@digilogiclabs/saas-factory-ui'
6
- import { AppThemeProvider } from './theme-provider'
7
-
8
- interface AppProvidersProps {
9
- children: React.ReactNode
10
- }
11
-
12
- export function AppProviders({ children }: AppProvidersProps) {
13
- return (
14
- <ThemeProvider
15
- attribute="class"
16
- defaultTheme="{{defaultTheme}}"
17
- enableSystem
18
- disableTransitionOnChange
19
- storageKey="{{packageName}}-theme"
20
- >
21
- <AppThemeProvider themeColor="{{themeColor}}">
22
- {children}
23
- <Toaster />
24
- </AppThemeProvider>
25
- </ThemeProvider>
26
- )
27
- }
28
-
1
+ 'use client'
2
+
3
+ import { ThemeProvider } from 'next-themes'
4
+ import { Toaster } from '@digilogiclabs/saas-factory-ui'
5
+ import { MockAuthProvider } from '@/components/mock-auth-provider'
6
+
7
+ // TODO: [REAL_DATA] Replace MockAuthProvider with your auth provider:
8
+ // Supabase: import { AuthProvider } from '@/providers/auth-provider'
9
+ // NextAuth: import { SessionProvider } from 'next-auth/react'
10
+ // Keycloak: import { KeycloakProvider } from '@/providers/keycloak'
11
+
12
+ interface AppProvidersProps {
13
+ children: React.ReactNode
14
+ }
15
+
16
+ export function AppProviders({ children }: AppProvidersProps) {
17
+ return (
18
+ <ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
19
+ <MockAuthProvider>
20
+ {children}
21
+ <Toaster />
22
+ </MockAuthProvider>
23
+ </ThemeProvider>
24
+ )
25
+ }