@digilogiclabs/create-saas-app 2.11.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/CHANGELOG.md +6 -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.map +1 -1
  6. package/dist/generators/template-generator.js +15 -8
  7. package/dist/generators/template-generator.js.map +1 -1
  8. package/dist/templates/shared/admin/web/src/components/admin-nav.tsx +3 -3
  9. package/dist/templates/shared/auth/supabase/web/src/lib/auth-session.ts +36 -16
  10. package/dist/templates/shared/auth/supabase/web/src/middleware.ts +6 -0
  11. package/dist/templates/shared/cookie-consent/web/components/cookie-consent.tsx +5 -5
  12. package/dist/templates/shared/design/web/src/components/ui/button.tsx +56 -0
  13. package/dist/templates/shared/email/web/src/lib/email/client.ts +1 -1
  14. package/dist/templates/shared/error-pages/web/src/app/error.tsx +13 -11
  15. package/dist/templates/shared/error-pages/web/src/app/global-error.tsx +2 -0
  16. package/dist/templates/shared/error-pages/web/src/app/not-found.tsx +6 -6
  17. package/dist/templates/shared/legal/web/src/app/(legal)/privacy/page.tsx +4 -4
  18. package/dist/templates/shared/legal/web/src/app/(legal)/terms/page.tsx +4 -4
  19. package/dist/templates/shared/loading/web/components/skeleton.tsx +4 -4
  20. package/dist/templates/shared/mock/web/.env.local +55 -0
  21. package/dist/templates/shared/mock/web/src/components/mock-auth-provider.tsx +72 -0
  22. package/dist/templates/shared/mock/web/src/components/mock-banner.tsx +29 -0
  23. package/dist/templates/shared/mock/web/src/lib/mock.ts +147 -0
  24. package/dist/templates/shared/payments/web/src/app/api/webhooks/stripe/route.ts +10 -4
  25. package/dist/templates/shared/redis/web/src/lib/redis.ts +1 -1
  26. package/dist/templates/web/base/template/eslint.config.mjs +14 -0
  27. package/dist/templates/web/base/template/src/app/auth/callback/route.ts +1 -1
  28. package/dist/templates/web/base/template/src/app/checkout/page.tsx +76 -103
  29. package/dist/templates/web/base/template/src/app/dashboard/page.tsx +145 -329
  30. package/dist/templates/web/base/template/src/app/layout.tsx +40 -38
  31. package/dist/templates/web/base/template/src/app/login/page.tsx +116 -66
  32. package/dist/templates/web/base/template/src/app/page.tsx +97 -193
  33. package/dist/templates/web/base/template/src/app/settings/page.tsx +154 -0
  34. package/dist/templates/web/base/template/src/app/signup/page.tsx +117 -66
  35. package/dist/templates/web/base/template/src/components/providers/app-providers.tsx +8 -3
  36. package/dist/templates/web/base/template/src/components/shared/header.tsx +229 -63
  37. package/dist/templates/web/ui-auth/template/eslint.config.mjs +14 -0
  38. package/dist/templates/web/ui-auth/template/src/app/checkout/page.tsx +3 -3
  39. package/dist/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +81 -91
  40. package/dist/templates/web/ui-auth/template/src/app/layout.tsx +38 -36
  41. package/dist/templates/web/ui-auth/template/src/app/login/page.tsx +22 -45
  42. package/dist/templates/web/ui-auth/template/src/app/page.tsx +106 -306
  43. package/dist/templates/web/ui-auth/template/src/app/setup/page.tsx +387 -402
  44. package/dist/templates/web/ui-auth/template/src/app/signup/page.tsx +24 -47
  45. package/dist/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +8 -3
  46. package/dist/templates/web/ui-auth/template/src/components/shared/header.tsx +229 -94
  47. package/dist/templates/web/ui-auth-ai/template/src/app/layout.tsx +38 -45
  48. package/dist/templates/web/ui-auth-ai/template/src/app/login/page.tsx +86 -0
  49. package/dist/templates/web/ui-auth-ai/template/src/app/page.tsx +107 -193
  50. package/dist/templates/web/ui-auth-ai/template/src/app/signup/page.tsx +105 -0
  51. package/dist/templates/web/ui-auth-ai/template/src/components/ai/audio-generator.tsx +144 -140
  52. package/dist/templates/web/ui-auth-ai/template/src/components/ai/video-generator.tsx +156 -157
  53. package/dist/templates/web/ui-auth-ai/template/src/components/auth/login-form.tsx +7 -3
  54. package/dist/templates/web/ui-auth-ai/template/src/components/providers/app-providers.tsx +25 -0
  55. package/dist/templates/web/ui-auth-ai/template/src/components/shared/footer.tsx +36 -0
  56. package/dist/templates/web/ui-auth-ai/template/src/components/shared/header.tsx +228 -0
  57. package/dist/templates/web/ui-auth-ai/template/src/components/ui/button.tsx +5 -5
  58. package/dist/templates/web/ui-auth-ai/template/src/components/ui/input.tsx +1 -1
  59. package/dist/templates/web/ui-auth-ai/template/src/components/ui/select.tsx +1 -1
  60. package/dist/templates/web/ui-auth-ai/template/src/components/ui/textarea.tsx +1 -1
  61. package/dist/templates/web/ui-auth-ai/template/src/components/ui/theme-toggle.tsx +34 -0
  62. package/dist/templates/web/ui-auth-ai/template/src/lib/supabase.ts +6 -4
  63. package/dist/templates/web/ui-auth-ai/template/src/providers/auth-provider.tsx +7 -5
  64. package/dist/templates/web/ui-auth-payments/template/src/app/billing/page.tsx +63 -192
  65. package/dist/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +104 -296
  66. package/dist/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +27 -27
  67. package/dist/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +70 -81
  68. package/dist/templates/web/ui-auth-payments/template/src/app/layout.tsx +38 -36
  69. package/dist/templates/web/ui-auth-payments/template/src/app/login/loading.tsx +9 -9
  70. package/dist/templates/web/ui-auth-payments/template/src/app/login/page.tsx +4 -104
  71. package/dist/templates/web/ui-auth-payments/template/src/app/page.tsx +69 -337
  72. package/dist/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +55 -68
  73. package/dist/templates/web/ui-auth-payments/template/src/app/signup/loading.tsx +13 -13
  74. package/dist/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +4 -123
  75. package/dist/templates/web/ui-auth-payments/template/src/components/client/auth-status.tsx +37 -52
  76. package/dist/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +49 -103
  77. package/dist/templates/web/ui-auth-payments/template/src/components/client/newsletter-signup.tsx +4 -4
  78. package/dist/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +60 -140
  79. package/dist/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +25 -28
  80. package/dist/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +229 -230
  81. package/dist/templates/web/ui-auth-payments/template/src/lib/actions/auth.ts +245 -245
  82. package/dist/templates/web/ui-auth-payments/template/src/lib/actions/index.ts +339 -339
  83. package/dist/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +305 -309
  84. package/dist/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +62 -312
  85. package/dist/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +109 -125
  86. package/dist/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +27 -27
  87. package/dist/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +68 -83
  88. package/dist/templates/web/ui-auth-payments-ai/template/src/app/layout.tsx +40 -38
  89. package/dist/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +20 -20
  90. package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +140 -394
  91. package/dist/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +28 -27
  92. package/dist/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +51 -66
  93. package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +37 -52
  94. package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +50 -79
  95. package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +58 -111
  96. package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +8 -3
  97. package/dist/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +229 -252
  98. package/dist/templates/web/ui-auth-payments-ai/template/src/lib/actions/auth.ts +245 -245
  99. package/dist/templates/web/ui-auth-payments-audio/template/src/app/billing/page.tsx +63 -192
  100. package/dist/templates/web/ui-auth-payments-audio/template/src/app/checkout/page.tsx +109 -125
  101. package/dist/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +27 -27
  102. package/dist/templates/web/ui-auth-payments-audio/template/src/app/layout.tsx +40 -38
  103. package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +122 -385
  104. package/dist/templates/web/ui-auth-payments-audio/template/src/app/setup/page.tsx +340 -344
  105. package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/auth-status.tsx +37 -52
  106. package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +49 -103
  107. package/dist/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +60 -140
  108. package/dist/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +8 -3
  109. package/dist/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +229 -252
  110. package/dist/templates/web/ui-auth-payments-audio/template/src/lib/actions/auth.ts +3 -3
  111. package/dist/templates/web/ui-auth-payments-video/template/src/app/billing/page.tsx +63 -192
  112. package/dist/templates/web/ui-auth-payments-video/template/src/app/checkout/page.tsx +109 -125
  113. package/dist/templates/web/ui-auth-payments-video/template/src/app/layout.tsx +38 -36
  114. package/dist/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +9 -109
  115. package/dist/templates/web/ui-auth-payments-video/template/src/app/page.tsx +132 -392
  116. package/dist/templates/web/ui-auth-payments-video/template/src/app/setup/page.tsx +346 -350
  117. package/dist/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +9 -128
  118. package/dist/templates/web/ui-auth-payments-video/template/src/components/client/login-form.tsx +90 -0
  119. package/dist/templates/web/ui-auth-payments-video/template/src/components/client/signup-form.tsx +105 -0
  120. package/dist/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +8 -3
  121. package/dist/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +229 -246
  122. package/dist/templates/web/ui-only/template/eslint.config.mjs +14 -0
  123. package/dist/templates/web/ui-only/template/src/app/checkout/page.tsx +2 -2
  124. package/dist/templates/web/ui-only/template/src/app/login/page.tsx +69 -63
  125. package/dist/templates/web/ui-only/template/src/app/page.tsx +69 -91
  126. package/dist/templates/web/ui-only/template/src/app/signup/page.tsx +94 -79
  127. package/dist/templates/web/ui-only/template/src/components/providers/app-providers.tsx +1 -6
  128. package/dist/templates/web/ui-only/template/src/components/shared/header.tsx +90 -53
  129. package/dist/templates/web/ui-package-test/template/package.json +19 -23
  130. package/dist/templates/web/ui-package-test/template/postcss.config.mjs +8 -0
  131. package/dist/templates/web/ui-package-test/template/src/app/globals.css +88 -0
  132. package/dist/templates/web/ui-package-test/template/src/app/layout.tsx +27 -0
  133. package/dist/templates/web/ui-package-test/template/src/app/page.tsx +46 -106
  134. package/package.json +1 -1
  135. package/src/templates/shared/admin/web/src/components/admin-nav.tsx +3 -3
  136. package/src/templates/shared/auth/supabase/web/src/lib/auth-session.ts +36 -16
  137. package/src/templates/shared/auth/supabase/web/src/middleware.ts +6 -0
  138. package/src/templates/shared/cookie-consent/web/components/cookie-consent.tsx +5 -5
  139. package/src/templates/shared/design/web/src/components/ui/button.tsx +56 -0
  140. package/src/templates/shared/email/web/src/lib/email/client.ts +1 -1
  141. package/src/templates/shared/error-pages/web/src/app/error.tsx +13 -11
  142. package/src/templates/shared/error-pages/web/src/app/global-error.tsx +2 -0
  143. package/src/templates/shared/error-pages/web/src/app/not-found.tsx +6 -6
  144. package/src/templates/shared/legal/web/src/app/(legal)/privacy/page.tsx +4 -4
  145. package/src/templates/shared/legal/web/src/app/(legal)/terms/page.tsx +4 -4
  146. package/src/templates/shared/loading/web/components/skeleton.tsx +4 -4
  147. package/src/templates/shared/mock/web/.env.local +55 -0
  148. package/src/templates/shared/mock/web/src/components/mock-auth-provider.tsx +72 -0
  149. package/src/templates/shared/mock/web/src/components/mock-banner.tsx +29 -0
  150. package/src/templates/shared/mock/web/src/lib/mock.ts +147 -0
  151. package/src/templates/shared/payments/web/src/app/api/webhooks/stripe/route.ts +10 -4
  152. package/src/templates/shared/redis/web/src/lib/redis.ts +1 -1
  153. package/src/templates/web/base/template/eslint.config.mjs +14 -0
  154. package/src/templates/web/base/template/src/app/auth/callback/route.ts +1 -1
  155. package/src/templates/web/base/template/src/app/checkout/page.tsx +76 -103
  156. package/src/templates/web/base/template/src/app/dashboard/page.tsx +145 -329
  157. package/src/templates/web/base/template/src/app/layout.tsx +40 -38
  158. package/src/templates/web/base/template/src/app/login/page.tsx +116 -66
  159. package/src/templates/web/base/template/src/app/page.tsx +97 -193
  160. package/src/templates/web/base/template/src/app/settings/page.tsx +154 -0
  161. package/src/templates/web/base/template/src/app/signup/page.tsx +117 -66
  162. package/src/templates/web/base/template/src/components/providers/app-providers.tsx +8 -3
  163. package/src/templates/web/base/template/src/components/shared/header.tsx +229 -63
  164. package/src/templates/web/ui-auth/template/eslint.config.mjs +14 -0
  165. package/src/templates/web/ui-auth/template/src/app/checkout/page.tsx +3 -3
  166. package/src/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +81 -91
  167. package/src/templates/web/ui-auth/template/src/app/layout.tsx +38 -36
  168. package/src/templates/web/ui-auth/template/src/app/login/page.tsx +22 -45
  169. package/src/templates/web/ui-auth/template/src/app/page.tsx +106 -306
  170. package/src/templates/web/ui-auth/template/src/app/setup/page.tsx +387 -402
  171. package/src/templates/web/ui-auth/template/src/app/signup/page.tsx +24 -47
  172. package/src/templates/web/ui-auth/template/src/components/providers/app-providers.tsx +8 -3
  173. package/src/templates/web/ui-auth/template/src/components/shared/header.tsx +229 -94
  174. package/src/templates/web/ui-auth-ai/template/src/app/layout.tsx +38 -45
  175. package/src/templates/web/ui-auth-ai/template/src/app/login/page.tsx +86 -0
  176. package/src/templates/web/ui-auth-ai/template/src/app/page.tsx +107 -193
  177. package/src/templates/web/ui-auth-ai/template/src/app/signup/page.tsx +105 -0
  178. package/src/templates/web/ui-auth-ai/template/src/components/ai/audio-generator.tsx +144 -140
  179. package/src/templates/web/ui-auth-ai/template/src/components/ai/video-generator.tsx +156 -157
  180. package/src/templates/web/ui-auth-ai/template/src/components/auth/login-form.tsx +7 -3
  181. package/src/templates/web/ui-auth-ai/template/src/components/providers/app-providers.tsx +25 -0
  182. package/src/templates/web/ui-auth-ai/template/src/components/shared/footer.tsx +36 -0
  183. package/src/templates/web/ui-auth-ai/template/src/components/shared/header.tsx +228 -0
  184. package/src/templates/web/ui-auth-ai/template/src/components/ui/button.tsx +5 -5
  185. package/src/templates/web/ui-auth-ai/template/src/components/ui/input.tsx +1 -1
  186. package/src/templates/web/ui-auth-ai/template/src/components/ui/select.tsx +1 -1
  187. package/src/templates/web/ui-auth-ai/template/src/components/ui/textarea.tsx +1 -1
  188. package/src/templates/web/ui-auth-ai/template/src/components/ui/theme-toggle.tsx +34 -0
  189. package/src/templates/web/ui-auth-ai/template/src/lib/supabase.ts +6 -4
  190. package/src/templates/web/ui-auth-ai/template/src/providers/auth-provider.tsx +7 -5
  191. package/src/templates/web/ui-auth-payments/template/src/app/billing/page.tsx +63 -192
  192. package/src/templates/web/ui-auth-payments/template/src/app/checkout/page.tsx +104 -296
  193. package/src/templates/web/ui-auth-payments/template/src/app/dashboard/page.tsx +27 -27
  194. package/src/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +70 -81
  195. package/src/templates/web/ui-auth-payments/template/src/app/layout.tsx +38 -36
  196. package/src/templates/web/ui-auth-payments/template/src/app/login/loading.tsx +9 -9
  197. package/src/templates/web/ui-auth-payments/template/src/app/login/page.tsx +4 -104
  198. package/src/templates/web/ui-auth-payments/template/src/app/page.tsx +69 -337
  199. package/src/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +55 -68
  200. package/src/templates/web/ui-auth-payments/template/src/app/signup/loading.tsx +13 -13
  201. package/src/templates/web/ui-auth-payments/template/src/app/signup/page.tsx +4 -123
  202. package/src/templates/web/ui-auth-payments/template/src/components/client/auth-status.tsx +37 -52
  203. package/src/templates/web/ui-auth-payments/template/src/components/client/login-form.tsx +49 -103
  204. package/src/templates/web/ui-auth-payments/template/src/components/client/newsletter-signup.tsx +4 -4
  205. package/src/templates/web/ui-auth-payments/template/src/components/client/signup-form.tsx +60 -140
  206. package/src/templates/web/ui-auth-payments/template/src/components/providers/app-providers.tsx +25 -28
  207. package/src/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +229 -230
  208. package/src/templates/web/ui-auth-payments/template/src/lib/actions/auth.ts +245 -245
  209. package/src/templates/web/ui-auth-payments/template/src/lib/actions/index.ts +339 -339
  210. package/src/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +305 -309
  211. package/src/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +62 -312
  212. package/src/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +109 -125
  213. package/src/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +27 -27
  214. package/src/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +68 -83
  215. package/src/templates/web/ui-auth-payments-ai/template/src/app/layout.tsx +40 -38
  216. package/src/templates/web/ui-auth-payments-ai/template/src/app/onboarding/page.tsx +20 -20
  217. package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +140 -394
  218. package/src/templates/web/ui-auth-payments-ai/template/src/app/settings/page.tsx +28 -27
  219. package/src/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +51 -66
  220. package/src/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +37 -52
  221. package/src/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +50 -79
  222. package/src/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +58 -111
  223. package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +8 -3
  224. package/src/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +229 -252
  225. package/src/templates/web/ui-auth-payments-ai/template/src/lib/actions/auth.ts +245 -245
  226. package/src/templates/web/ui-auth-payments-audio/template/src/app/billing/page.tsx +63 -192
  227. package/src/templates/web/ui-auth-payments-audio/template/src/app/checkout/page.tsx +109 -125
  228. package/src/templates/web/ui-auth-payments-audio/template/src/app/dashboard/page.tsx +27 -27
  229. package/src/templates/web/ui-auth-payments-audio/template/src/app/layout.tsx +40 -38
  230. package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +122 -385
  231. package/src/templates/web/ui-auth-payments-audio/template/src/app/setup/page.tsx +340 -344
  232. package/src/templates/web/ui-auth-payments-audio/template/src/components/client/auth-status.tsx +37 -52
  233. package/src/templates/web/ui-auth-payments-audio/template/src/components/client/login-form.tsx +49 -103
  234. package/src/templates/web/ui-auth-payments-audio/template/src/components/client/signup-form.tsx +60 -140
  235. package/src/templates/web/ui-auth-payments-audio/template/src/components/providers/app-providers.tsx +8 -3
  236. package/src/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +229 -252
  237. package/src/templates/web/ui-auth-payments-audio/template/src/lib/actions/auth.ts +3 -3
  238. package/src/templates/web/ui-auth-payments-video/template/src/app/billing/page.tsx +63 -192
  239. package/src/templates/web/ui-auth-payments-video/template/src/app/checkout/page.tsx +109 -125
  240. package/src/templates/web/ui-auth-payments-video/template/src/app/layout.tsx +38 -36
  241. package/src/templates/web/ui-auth-payments-video/template/src/app/login/page.tsx +9 -109
  242. package/src/templates/web/ui-auth-payments-video/template/src/app/page.tsx +132 -392
  243. package/src/templates/web/ui-auth-payments-video/template/src/app/setup/page.tsx +346 -350
  244. package/src/templates/web/ui-auth-payments-video/template/src/app/signup/page.tsx +9 -128
  245. package/src/templates/web/ui-auth-payments-video/template/src/components/client/login-form.tsx +90 -0
  246. package/src/templates/web/ui-auth-payments-video/template/src/components/client/signup-form.tsx +105 -0
  247. package/src/templates/web/ui-auth-payments-video/template/src/components/providers/app-providers.tsx +8 -3
  248. package/src/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +229 -246
  249. package/src/templates/web/ui-only/template/eslint.config.mjs +14 -0
  250. package/src/templates/web/ui-only/template/src/app/checkout/page.tsx +2 -2
  251. package/src/templates/web/ui-only/template/src/app/login/page.tsx +69 -63
  252. package/src/templates/web/ui-only/template/src/app/page.tsx +69 -91
  253. package/src/templates/web/ui-only/template/src/app/signup/page.tsx +94 -79
  254. package/src/templates/web/ui-only/template/src/components/providers/app-providers.tsx +1 -6
  255. package/src/templates/web/ui-only/template/src/components/shared/header.tsx +90 -53
  256. package/src/templates/web/ui-package-test/template/package.json +19 -23
  257. package/src/templates/web/ui-package-test/template/postcss.config.mjs +8 -0
  258. package/src/templates/web/ui-package-test/template/src/app/globals.css +88 -0
  259. package/src/templates/web/ui-package-test/template/src/app/layout.tsx +27 -0
  260. package/src/templates/web/ui-package-test/template/src/app/page.tsx +46 -106
  261. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/README.md +0 -655
  262. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +0 -683
  263. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/_layout.tsx +0 -124
  264. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app.json +0 -74
  265. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/babel.config.js +0 -25
  266. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +0 -787
  267. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/eas.json +0 -25
  268. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/expo-env.d.ts +0 -3
  269. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +0 -346
  270. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/jest-setup.ts +0 -37
  271. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +0 -180
  272. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/metro.config.js +0 -11
  273. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/package.json +0 -122
  274. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +0 -599
  275. package/dist/templates/mobile/ui-auth-payments-ai-rag/template/tsconfig.json +0 -32
  276. package/dist/templates/web/base/template/.eslintrc.js +0 -8
  277. package/dist/templates/web/base/template/src/components/__tests__/example.test.tsx +0 -49
  278. package/dist/templates/web/base/template/src/test/setup.ts +0 -74
  279. package/dist/templates/web/base/template/vitest.config.ts +0 -17
  280. package/dist/templates/web/ui-auth/template/.eslintrc.js +0 -8
  281. package/dist/templates/web/ui-auth/template/src/components/__tests__/example.test.tsx +0 -49
  282. package/dist/templates/web/ui-auth/template/src/test/setup.ts +0 -74
  283. package/dist/templates/web/ui-auth/template/vitest.config.ts +0 -17
  284. package/dist/templates/web/ui-auth-payments/template/src/components/__tests__/example.test.tsx +0 -49
  285. package/dist/templates/web/ui-auth-payments/template/src/test/setup.ts +0 -74
  286. package/dist/templates/web/ui-auth-payments/template/vitest.config.ts +0 -17
  287. package/dist/templates/web/ui-auth-payments-ai/template/src/components/__tests__/example.test.tsx +0 -49
  288. package/dist/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +0 -74
  289. package/dist/templates/web/ui-auth-payments-ai/template/vitest.config.ts +0 -17
  290. package/dist/templates/web/ui-auth-payments-ai-rag/template/README.md +0 -434
  291. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +0 -642
  292. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +0 -466
  293. package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +0 -393
  294. package/dist/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +0 -457
  295. package/dist/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +0 -478
  296. package/dist/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +0 -250
  297. package/dist/templates/web/ui-auth-payments-ai-rag/template/package.json +0 -73
  298. package/dist/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +0 -622
  299. package/dist/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +0 -396
  300. package/dist/templates/web/ui-auth-payments-audio/template/src/components/__tests__/example.test.tsx +0 -49
  301. package/dist/templates/web/ui-auth-payments-audio/template/src/test/setup.ts +0 -74
  302. package/dist/templates/web/ui-auth-payments-audio/template/vitest.config.ts +0 -17
  303. package/dist/templates/web/ui-auth-payments-video/template/src/components/__tests__/example.test.tsx +0 -49
  304. package/dist/templates/web/ui-auth-payments-video/template/src/test/setup.ts +0 -74
  305. package/dist/templates/web/ui-auth-payments-video/template/vitest.config.ts +0 -17
  306. package/dist/templates/web/ui-only/template/.eslintrc.js +0 -8
  307. package/dist/templates/web/ui-only/template/src/components/__tests__/example.test.tsx +0 -49
  308. package/dist/templates/web/ui-only/template/src/test/setup.ts +0 -74
  309. package/dist/templates/web/ui-only/template/vitest.config.ts +0 -17
  310. package/src/templates/mobile/ui-auth-payments-ai-rag/template/README.md +0 -655
  311. package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +0 -683
  312. package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/_layout.tsx +0 -124
  313. package/src/templates/mobile/ui-auth-payments-ai-rag/template/app.json +0 -74
  314. package/src/templates/mobile/ui-auth-payments-ai-rag/template/babel.config.js +0 -25
  315. package/src/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +0 -787
  316. package/src/templates/mobile/ui-auth-payments-ai-rag/template/eas.json +0 -25
  317. package/src/templates/mobile/ui-auth-payments-ai-rag/template/expo-env.d.ts +0 -3
  318. package/src/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +0 -346
  319. package/src/templates/mobile/ui-auth-payments-ai-rag/template/jest-setup.ts +0 -37
  320. package/src/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +0 -180
  321. package/src/templates/mobile/ui-auth-payments-ai-rag/template/metro.config.js +0 -11
  322. package/src/templates/mobile/ui-auth-payments-ai-rag/template/package.json +0 -122
  323. package/src/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +0 -599
  324. package/src/templates/mobile/ui-auth-payments-ai-rag/template/tsconfig.json +0 -32
  325. package/src/templates/web/base/template/.eslintrc.js +0 -8
  326. package/src/templates/web/base/template/src/components/__tests__/example.test.tsx +0 -49
  327. package/src/templates/web/base/template/src/test/setup.ts +0 -74
  328. package/src/templates/web/base/template/vitest.config.ts +0 -17
  329. package/src/templates/web/ui-auth/template/.eslintrc.js +0 -8
  330. package/src/templates/web/ui-auth/template/src/components/__tests__/example.test.tsx +0 -49
  331. package/src/templates/web/ui-auth/template/src/test/setup.ts +0 -74
  332. package/src/templates/web/ui-auth/template/vitest.config.ts +0 -17
  333. package/src/templates/web/ui-auth-payments/template/src/components/__tests__/example.test.tsx +0 -49
  334. package/src/templates/web/ui-auth-payments/template/src/test/setup.ts +0 -74
  335. package/src/templates/web/ui-auth-payments/template/vitest.config.ts +0 -17
  336. package/src/templates/web/ui-auth-payments-ai/template/src/components/__tests__/example.test.tsx +0 -49
  337. package/src/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +0 -74
  338. package/src/templates/web/ui-auth-payments-ai/template/vitest.config.ts +0 -17
  339. package/src/templates/web/ui-auth-payments-ai-rag/template/README.md +0 -434
  340. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +0 -642
  341. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +0 -466
  342. package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +0 -393
  343. package/src/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +0 -457
  344. package/src/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +0 -478
  345. package/src/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +0 -250
  346. package/src/templates/web/ui-auth-payments-ai-rag/template/package.json +0 -73
  347. package/src/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +0 -622
  348. package/src/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +0 -396
  349. package/src/templates/web/ui-auth-payments-audio/template/src/components/__tests__/example.test.tsx +0 -49
  350. package/src/templates/web/ui-auth-payments-audio/template/src/test/setup.ts +0 -74
  351. package/src/templates/web/ui-auth-payments-audio/template/vitest.config.ts +0 -17
  352. package/src/templates/web/ui-auth-payments-video/template/src/components/__tests__/example.test.tsx +0 -49
  353. package/src/templates/web/ui-auth-payments-video/template/src/test/setup.ts +0 -74
  354. package/src/templates/web/ui-auth-payments-video/template/vitest.config.ts +0 -17
  355. package/src/templates/web/ui-only/template/.eslintrc.js +0 -8
  356. package/src/templates/web/ui-only/template/src/components/__tests__/example.test.tsx +0 -49
  357. package/src/templates/web/ui-only/template/src/test/setup.ts +0 -74
  358. package/src/templates/web/ui-only/template/vitest.config.ts +0 -17
@@ -1,787 +0,0 @@
1
- # Mobile AI Setup Guide
2
-
3
- Complete setup guide for your React Native AI Knowledge App with RAG v4.0.0.
4
-
5
- ## 📱 Quick Mobile Setup
6
-
7
- ```bash
8
- # Create mobile AI app
9
- npm create saas-app my-mobile-ai --template=mobile-ai-rag
10
- cd my-mobile-ai
11
-
12
- # Setup for React Native/Expo
13
- npm run setup:rag
14
-
15
- # Seed mobile knowledge
16
- npm run seed:knowledge
17
-
18
- # Start development
19
- npx expo start
20
- ```
21
-
22
- **Scan QR code with Expo Go app** or press `i` for iOS simulator, `a` for Android emulator.
23
-
24
- ## 🔧 Prerequisites
25
-
26
- ### Development Environment
27
-
28
- **macOS (iOS + Android):**
29
- ```bash
30
- # Install Xcode (for iOS)
31
- # Download from Mac App Store
32
-
33
- # Install Android Studio (for Android)
34
- # Download from developer.android.com
35
-
36
- # Install Expo CLI
37
- npm install -g @expo/cli
38
-
39
- # Install iOS Simulator (optional)
40
- xcrun simctl list devices
41
- ```
42
-
43
- **Windows/Linux (Android only):**
44
- ```bash
45
- # Install Android Studio
46
- # Download from developer.android.com
47
-
48
- # Install Expo CLI
49
- npm install -g @expo/cli
50
-
51
- # Setup Android emulator
52
- # Follow Android Studio setup guide
53
- ```
54
-
55
- ### Required Accounts
56
-
57
- 1. **Expo Account**: [Sign up at expo.dev](https://expo.dev/)
58
- 2. **Supabase Account**: [Database backend](https://supabase.com/)
59
- 3. **OpenAI Account**: [AI/ML services](https://platform.openai.com/)
60
- 4. **EAS Account**: For app building (optional for development)
61
-
62
- ## 📁 Mobile Project Structure
63
-
64
- ```
65
- my-mobile-ai/
66
- ├── app/ # Expo Router pages
67
- │ ├── (tabs)/ # Tab navigation
68
- │ │ ├── ai.tsx # Main AI interface
69
- │ │ ├── knowledge.tsx # Knowledge management
70
- │ │ └── analytics.tsx # Usage analytics
71
- │ ├── auth/ # Authentication screens
72
- │ │ ├── login.tsx
73
- │ │ └── signup.tsx
74
- │ └── onboarding/ # First-time user flow
75
- ├── components/
76
- │ └── rag/ # RAG-specific components
77
- ├── hooks/
78
- │ ├── useRAGSystem.ts # Core RAG functionality
79
- │ ├── useOfflineSync.ts # Offline capabilities
80
- │ └── useVoiceInput.ts # Speech recognition
81
- ├── lib/
82
- │ ├── rag/ # RAG configuration
83
- │ ├── supabase.ts # Mobile Supabase client
84
- │ └── storage.ts # AsyncStorage utilities
85
- ├── types/ # TypeScript definitions
86
- └── scripts/ # Setup and utility scripts
87
- ```
88
-
89
- ## ⚙️ Environment Configuration
90
-
91
- ### Mobile Environment Variables
92
-
93
- Create `.env.local`:
94
-
95
- ```env
96
- # Supabase Configuration
97
- EXPO_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
98
- EXPO_PUBLIC_SUPABASE_ANON_KEY=eyJ0eXAi...your-anon-key
99
-
100
- # OpenAI Configuration (client-side)
101
- EXPO_PUBLIC_OPENAI_API_KEY=sk-...your-openai-key
102
-
103
- # App Configuration
104
- APP_VARIANT=development
105
- EAS_PROJECT_ID=your-eas-project-id
106
- ```
107
-
108
- ⚠️ **Security Note**: React Native embeds environment variables in the build. For production apps, use server-side API routes for sensitive operations.
109
-
110
- ### App Configuration
111
-
112
- Update `app.config.js`:
113
-
114
- ```javascript
115
- const IS_DEV = process.env.APP_VARIANT === 'development'
116
-
117
- export default {
118
- expo: {
119
- name: IS_DEV ? 'AI Assistant (Dev)' : 'AI Assistant',
120
- slug: 'ai-knowledge-assistant',
121
- version: '1.0.0',
122
-
123
- // App icons and splash screen
124
- icon: './assets/icon.png',
125
- splash: {
126
- image: './assets/splash.png',
127
- resizeMode: 'contain',
128
- backgroundColor: '#ffffff'
129
- },
130
-
131
- // Platform-specific config
132
- ios: {
133
- bundleIdentifier: 'com.yourcompany.ai-assistant',
134
- supportsTablet: true,
135
- infoPlist: {
136
- NSMicrophoneUsageDescription: 'This app uses microphone for voice queries',
137
- NSCameraUsageDescription: 'This app uses camera to scan documents'
138
- }
139
- },
140
-
141
- android: {
142
- package: 'com.yourcompany.aiassistant',
143
- permissions: [
144
- 'RECORD_AUDIO',
145
- 'CAMERA',
146
- 'READ_EXTERNAL_STORAGE'
147
- ]
148
- },
149
-
150
- // Configuration passed to app
151
- extra: {
152
- supabaseUrl: process.env.EXPO_PUBLIC_SUPABASE_URL,
153
- supabaseAnonKey: process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY,
154
- openaiApiKey: process.env.EXPO_PUBLIC_OPENAI_API_KEY
155
- }
156
- }
157
- }
158
- ```
159
-
160
- ## 🎯 Domain-Specific Mobile Configs
161
-
162
- ### Plant Care App
163
- ```typescript
164
- // lib/rag/config.ts
165
- export const plantCareConfig = {
166
- domain: 'plants',
167
- voice: {
168
- plantNamesRecognition: true,
169
- scientificNamesSupport: true,
170
- gardeningTerms: true
171
- },
172
- camera: {
173
- plantIdentification: true,
174
- diseaseDetection: true,
175
- leafAnalysis: true
176
- },
177
- notifications: {
178
- wateringReminders: true,
179
- seasonalTips: true,
180
- pestAlerts: true
181
- },
182
- offline: {
183
- essentialPlantInfo: true,
184
- emergencyGuides: true
185
- }
186
- }
187
- ```
188
-
189
- ### E-commerce App
190
- ```typescript
191
- export const ecommerceConfig = {
192
- domain: 'ecommerce',
193
- voice: {
194
- productSearch: true,
195
- priceQueries: true,
196
- brandRecognition: true
197
- },
198
- camera: {
199
- barcodeScanning: true,
200
- visualProductSearch: true,
201
- receiptScanning: true
202
- },
203
- notifications: {
204
- priceDropAlerts: true,
205
- stockAlerts: true,
206
- dealNotifications: true
207
- },
208
- offline: {
209
- productCatalog: true,
210
- wishlistAccess: true
211
- }
212
- }
213
- ```
214
-
215
- ### Education App
216
- ```typescript
217
- export const educationConfig = {
218
- domain: 'education',
219
- voice: {
220
- questionAnswering: true,
221
- pronunciationHelp: true,
222
- languageSupport: ['en', 'es', 'fr']
223
- },
224
- camera: {
225
- documentScanning: true,
226
- handwritingRecognition: true,
227
- diagramAnalysis: true
228
- },
229
- notifications: {
230
- studyReminders: true,
231
- assignmentDeadlines: true,
232
- progressUpdates: true
233
- },
234
- offline: {
235
- courseContent: true,
236
- practiceExercises: true,
237
- offlineQuizzes: true
238
- }
239
- }
240
- ```
241
-
242
- ## 📱 Mobile-Specific Features Setup
243
-
244
- ### Voice Input Configuration
245
-
246
- ```typescript
247
- // hooks/useVoiceInput.ts
248
- import { useState, useEffect } from 'react'
249
- import Voice from '@react-native-voice/voice'
250
-
251
- export function useVoiceInput() {
252
- const [isListening, setIsListening] = useState(false)
253
- const [transcript, setTranscript] = useState('')
254
-
255
- useEffect(() => {
256
- Voice.onSpeechStart = () => setIsListening(true)
257
- Voice.onSpeechEnd = () => setIsListening(false)
258
- Voice.onSpeechResults = (e) => setTranscript(e.value[0])
259
-
260
- return () => Voice.destroy().then(Voice.removeAllListeners)
261
- }, [])
262
-
263
- const startListening = async () => {
264
- try {
265
- await Voice.start('en-US')
266
- } catch (error) {
267
- console.error('Voice start error:', error)
268
- }
269
- }
270
-
271
- const stopListening = async () => {
272
- try {
273
- await Voice.stop()
274
- } catch (error) {
275
- console.error('Voice stop error:', error)
276
- }
277
- }
278
-
279
- return { isListening, transcript, startListening, stopListening }
280
- }
281
- ```
282
-
283
- ### Offline Sync Setup
284
-
285
- ```typescript
286
- // hooks/useOfflineSync.ts
287
- import { useState, useEffect } from 'react'
288
- import AsyncStorage from '@react-native-async-storage/async-storage'
289
- import NetInfo from '@react-native-community/netinfo'
290
-
291
- export function useOfflineSync() {
292
- const [isOnline, setIsOnline] = useState(true)
293
- const [pendingQueries, setPendingQueries] = useState<string[]>([])
294
-
295
- useEffect(() => {
296
- const unsubscribe = NetInfo.addEventListener(state => {
297
- setIsOnline(state.isConnected ?? false)
298
-
299
- if (state.isConnected) {
300
- processPendingQueries()
301
- }
302
- })
303
-
304
- loadPendingQueries()
305
- return unsubscribe
306
- }, [])
307
-
308
- const queueQuery = async (query: string) => {
309
- const updated = [...pendingQueries, query]
310
- setPendingQueries(updated)
311
- await AsyncStorage.setItem('pending_queries', JSON.stringify(updated))
312
- }
313
-
314
- const loadPendingQueries = async () => {
315
- const stored = await AsyncStorage.getItem('pending_queries')
316
- if (stored) {
317
- setPendingQueries(JSON.parse(stored))
318
- }
319
- }
320
-
321
- const processPendingQueries = async () => {
322
- // Process queued queries when back online
323
- for (const query of pendingQueries) {
324
- try {
325
- // Process with RAG system
326
- await processQuery(query)
327
- } catch (error) {
328
- console.error('Failed to process queued query:', error)
329
- }
330
- }
331
-
332
- setPendingQueries([])
333
- await AsyncStorage.removeItem('pending_queries')
334
- }
335
-
336
- return { isOnline, queueQuery, pendingCount: pendingQueries.length }
337
- }
338
- ```
339
-
340
- ### Camera Integration
341
-
342
- ```typescript
343
- // components/DocumentScanner.tsx
344
- import { Camera, CameraType } from 'expo-camera'
345
- import { useState } from 'react'
346
- import { Text, View, TouchableOpacity } from 'react-native'
347
-
348
- export function DocumentScanner({ onDocumentScanned }) {
349
- const [type, setType] = useState(CameraType.back)
350
- const [permission, requestPermission] = Camera.useCameraPermissions()
351
-
352
- if (!permission) {
353
- return <View />
354
- }
355
-
356
- if (!permission.granted) {
357
- return (
358
- <View>
359
- <Text>We need camera permission to scan documents</Text>
360
- <TouchableOpacity onPress={requestPermission}>
361
- <Text>Grant Permission</Text>
362
- </TouchableOpacity>
363
- </View>
364
- )
365
- }
366
-
367
- const takePicture = async () => {
368
- if (camera) {
369
- const photo = await camera.takePictureAsync()
370
- // Process photo with OCR or send to RAG system
371
- onDocumentScanned(photo.uri)
372
- }
373
- }
374
-
375
- return (
376
- <View style={{ flex: 1 }}>
377
- <Camera style={{ flex: 1 }} type={type} ref={ref => setCamera(ref)}>
378
- <View style={{ flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
379
- <TouchableOpacity onPress={takePicture}>
380
- <Text>Scan Document</Text>
381
- </TouchableOpacity>
382
- </View>
383
- </Camera>
384
- </View>
385
- )
386
- }
387
- ```
388
-
389
- ## 📊 Mobile Analytics Setup
390
-
391
- ### Usage Tracking
392
-
393
- ```typescript
394
- // lib/analytics.ts
395
- import { Analytics } from 'expo-analytics'
396
-
397
- export class MobileRAGAnalytics {
398
- private analytics: Analytics
399
-
400
- constructor() {
401
- this.analytics = new Analytics('UA-XXXXXXXXX-X') // Your Google Analytics ID
402
- }
403
-
404
- trackQuery(query: string, responseTime: number, confidence: number) {
405
- this.analytics.event('rag_query', {
406
- query_length: query.length,
407
- response_time: responseTime,
408
- confidence_score: confidence,
409
- platform: 'mobile'
410
- })
411
- }
412
-
413
- trackOfflineUsage(queriesQueued: number) {
414
- this.analytics.event('offline_usage', {
415
- queries_queued: queriesQueued,
416
- platform: 'mobile'
417
- })
418
- }
419
-
420
- trackVoiceUsage(duration: number, success: boolean) {
421
- this.analytics.event('voice_input', {
422
- duration,
423
- success,
424
- platform: 'mobile'
425
- })
426
- }
427
- }
428
- ```
429
-
430
- ### Performance Monitoring
431
-
432
- ```typescript
433
- // hooks/usePerformanceMonitoring.ts
434
- import { useState, useEffect } from 'react'
435
- import { AppState, Dimensions } from 'react-native'
436
-
437
- export function usePerformanceMonitoring() {
438
- const [metrics, setMetrics] = useState({
439
- memoryUsage: 0,
440
- responseTime: 0,
441
- cacheHitRate: 0,
442
- batteryLevel: 0
443
- })
444
-
445
- useEffect(() => {
446
- const subscription = AppState.addEventListener('change', (nextAppState) => {
447
- if (nextAppState === 'active') {
448
- collectMetrics()
449
- }
450
- })
451
-
452
- return () => subscription?.remove()
453
- }, [])
454
-
455
- const collectMetrics = () => {
456
- // Collect performance metrics
457
- setMetrics({
458
- memoryUsage: getMemoryUsage(),
459
- responseTime: getAverageResponseTime(),
460
- cacheHitRate: getCacheHitRate(),
461
- batteryLevel: getBatteryLevel()
462
- })
463
- }
464
-
465
- return metrics
466
- }
467
- ```
468
-
469
- ## 🚀 Building and Distribution
470
-
471
- ### Development Build
472
-
473
- ```bash
474
- # Install EAS CLI
475
- npm install -g @expo/cli
476
-
477
- # Login to Expo
478
- npx expo login
479
-
480
- # Create development build
481
- npx expo run:ios
482
- npx expo run:android
483
- ```
484
-
485
- ### Production Build with EAS
486
-
487
- Create `eas.json`:
488
-
489
- ```json
490
- {
491
- "cli": {
492
- "version": ">= 3.0.0"
493
- },
494
- "build": {
495
- "development": {
496
- "developmentClient": true,
497
- "distribution": "internal",
498
- "ios": {
499
- "resourceClass": "m1-medium"
500
- }
501
- },
502
- "preview": {
503
- "distribution": "internal",
504
- "ios": {
505
- "resourceClass": "m1-medium"
506
- }
507
- },
508
- "production": {
509
- "ios": {
510
- "resourceClass": "m1-medium"
511
- }
512
- }
513
- },
514
- "submit": {
515
- "production": {}
516
- }
517
- }
518
- ```
519
-
520
- Build commands:
521
-
522
- ```bash
523
- # Build for iOS
524
- eas build --platform ios --profile production
525
-
526
- # Build for Android
527
- eas build --platform android --profile production
528
-
529
- # Submit to app stores
530
- eas submit --platform ios
531
- eas submit --platform android
532
- ```
533
-
534
- ### App Store Configuration
535
-
536
- **iOS (App Store Connect):**
537
- 1. Create app in App Store Connect
538
- 2. Configure app metadata and screenshots
539
- 3. Upload build with EAS Submit
540
- 4. Submit for review
541
-
542
- **Android (Google Play Console):**
543
- 1. Create app in Google Play Console
544
- 2. Configure store listing and content rating
545
- 3. Upload AAB file with EAS Submit
546
- 4. Submit for review
547
-
548
- ## 🔒 Mobile Security
549
-
550
- ### Secure Storage
551
-
552
- ```typescript
553
- import * as SecureStore from 'expo-secure-store'
554
-
555
- export class SecureStorage {
556
- static async setItem(key: string, value: string) {
557
- await SecureStore.setItemAsync(key, value)
558
- }
559
-
560
- static async getItem(key: string): Promise<string | null> {
561
- return await SecureStore.getItemAsync(key)
562
- }
563
-
564
- static async removeItem(key: string) {
565
- await SecureStore.deleteItemAsync(key)
566
- }
567
- }
568
-
569
- // Usage
570
- await SecureStorage.setItem('user_token', authToken)
571
- const token = await SecureStorage.getItem('user_token')
572
- ```
573
-
574
- ### Biometric Authentication
575
-
576
- ```typescript
577
- import * as LocalAuthentication from 'expo-local-authentication'
578
-
579
- export async function authenticateWithBiometrics() {
580
- const hasHardware = await LocalAuthentication.hasHardwareAsync()
581
- const supportedTypes = await LocalAuthentication.supportedAuthenticationTypesAsync()
582
-
583
- if (hasHardware && supportedTypes.length > 0) {
584
- const result = await LocalAuthentication.authenticateAsync({
585
- promptMessage: 'Authenticate to access your AI assistant',
586
- fallbackLabel: 'Use passcode',
587
- disableDeviceFallback: false
588
- })
589
-
590
- return result.success
591
- }
592
-
593
- return false
594
- }
595
- ```
596
-
597
- ### Certificate Pinning
598
-
599
- ```typescript
600
- // app.config.js
601
- export default {
602
- expo: {
603
- plugins: [
604
- [
605
- 'expo-ssl-public-key-pinning',
606
- {
607
- 'your-api-domain.com': {
608
- 'includeSubdomains': true,
609
- 'pinset': [
610
- {
611
- 'type': 'sha256',
612
- 'value': 'YOUR_SSL_CERTIFICATE_SHA256_HASH'
613
- }
614
- ]
615
- }
616
- }
617
- ]
618
- ]
619
- }
620
- }
621
- ```
622
-
623
- ## 🧪 Testing Mobile Apps
624
-
625
- ### Unit Testing with Jest
626
-
627
- ```bash
628
- npm install --save-dev jest @testing-library/react-native @testing-library/jest-native
629
- ```
630
-
631
- ```typescript
632
- // __tests__/RAGSystem.test.ts
633
- import { useRAGSystem } from '../hooks/useRAGSystem'
634
- import { renderHook, act } from '@testing-library/react-native'
635
-
636
- describe('RAG System', () => {
637
- test('should initialize RAG system', async () => {
638
- const { result } = renderHook(() => useRAGSystem())
639
-
640
- await act(async () => {
641
- await result.current.initialize()
642
- })
643
-
644
- expect(result.current.isReady).toBe(true)
645
- })
646
-
647
- test('should handle offline queries', async () => {
648
- const { result } = renderHook(() => useRAGSystem({ enableOffline: true }))
649
-
650
- await act(async () => {
651
- await result.current.query('test question')
652
- })
653
-
654
- expect(result.current.offlineQueueSize).toBeGreaterThan(0)
655
- })
656
- })
657
- ```
658
-
659
- ### E2E Testing with Detox
660
-
661
- ```bash
662
- npm install --save-dev detox jest-circus
663
- ```
664
-
665
- ```javascript
666
- // e2e/ai-chat.e2e.js
667
- describe('AI Chat Flow', () => {
668
- beforeEach(async () => {
669
- await device.reloadReactNative()
670
- })
671
-
672
- it('should send message and receive response', async () => {
673
- // Navigate to AI tab
674
- await element(by.id('ai-tab')).tap()
675
-
676
- // Type a message
677
- await element(by.id('chat-input')).typeText('Hello AI')
678
- await element(by.id('send-button')).tap()
679
-
680
- // Wait for response
681
- await waitFor(element(by.id('ai-response')))
682
- .toBeVisible()
683
- .withTimeout(5000)
684
-
685
- // Verify response received
686
- await expect(element(by.id('ai-response'))).toHaveText(
687
- expect.stringContaining('Hello')
688
- )
689
- })
690
-
691
- it('should work in offline mode', async () => {
692
- // Simulate offline mode
693
- await device.setNetworkConnection(false, 'airplane')
694
-
695
- // Navigate to AI tab
696
- await element(by.id('ai-tab')).tap()
697
-
698
- // Send message while offline
699
- await element(by.id('chat-input')).typeText('Offline question')
700
- await element(by.id('send-button')).tap()
701
-
702
- // Verify offline message appears
703
- await expect(element(by.id('offline-indicator'))).toBeVisible()
704
-
705
- // Restore connection
706
- await device.setNetworkConnection(true, 'wifi')
707
-
708
- // Verify message was processed
709
- await waitFor(element(by.id('ai-response')))
710
- .toBeVisible()
711
- .withTimeout(10000)
712
- })
713
- })
714
- ```
715
-
716
- ## 📱 Platform-Specific Features
717
-
718
- ### iOS-Specific Features
719
-
720
- ```typescript
721
- // iOS Shortcuts integration
722
- import { Shortcuts } from 'expo-shortcuts'
723
-
724
- Shortcuts.addShortcut({
725
- id: 'ask-ai',
726
- title: 'Ask AI Assistant',
727
- shortTitle: 'Ask AI',
728
- systemImageName: 'brain.head.profile',
729
- params: {
730
- action: 'open_chat'
731
- }
732
- })
733
-
734
- // iOS Widgets
735
- import { WidgetKit } from 'expo-widget-kit'
736
-
737
- WidgetKit.reloadAllTimelines()
738
- ```
739
-
740
- ### Android-Specific Features
741
-
742
- ```typescript
743
- // Android App Shortcuts
744
- import { ShortcutManager } from 'expo-shortcuts'
745
-
746
- ShortcutManager.addDynamicShortcuts([
747
- {
748
- id: 'ask-question',
749
- shortLabel: 'Ask Question',
750
- longLabel: 'Ask AI Assistant a Question',
751
- icon: 'ic_chat',
752
- intent: {
753
- action: 'android.intent.action.VIEW',
754
- data: 'myapp://chat'
755
- }
756
- }
757
- ])
758
-
759
- // Android Widgets with React Native
760
- import { AppWidgetProvider } from 'expo-widget'
761
-
762
- export class AIWidgetProvider extends AppWidgetProvider {
763
- onUpdate(context, appWidgetManager, appWidgetIds) {
764
- // Update widget with recent AI responses
765
- }
766
- }
767
- ```
768
-
769
- ## 🎯 Next Steps
770
-
771
- Your mobile AI app is now ready! Here's what to do next:
772
-
773
- 1. **Customize for Your Domain**: Configure the RAG system for your specific use case
774
- 2. **Add Content**: Import your knowledge base via the mobile interface
775
- 3. **Test on Devices**: Use Expo Go for quick testing, development builds for advanced features
776
- 4. **Optimize Performance**: Monitor analytics and adjust caching/offline strategies
777
- 5. **Deploy**: Build production versions and submit to app stores
778
-
779
- ### Advanced Mobile Features to Explore
780
-
781
- - **AR Integration**: Visual knowledge search with camera
782
- - **Wearable Support**: Apple Watch/WearOS integration
783
- - **Background Processing**: Smart notifications and proactive assistance
784
- - **Multi-language**: Localization for global audiences
785
- - **Accessibility**: Screen reader and voice navigation support
786
-
787
- Happy mobile development! 📱🚀