vibefast-cli 1.1.3 → 1.2.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 (300) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +63 -169
  3. package/dist/__tests__/recipes.test.js +25 -3
  4. package/dist/__tests__/recipes.test.js.map +1 -1
  5. package/dist/commands/add.d.ts +1 -1
  6. package/dist/commands/add.d.ts.map +1 -1
  7. package/dist/commands/add.js +547 -543
  8. package/dist/commands/add.js.map +1 -1
  9. package/dist/commands/checklist.d.ts +1 -1
  10. package/dist/commands/checklist.d.ts.map +1 -1
  11. package/dist/commands/checklist.js +40 -39
  12. package/dist/commands/checklist.js.map +1 -1
  13. package/dist/commands/doctor.d.ts +1 -1
  14. package/dist/commands/doctor.js +22 -22
  15. package/dist/commands/doctor.js.map +1 -1
  16. package/dist/commands/env.d.ts +1 -1
  17. package/dist/commands/env.d.ts.map +1 -1
  18. package/dist/commands/env.js +58 -53
  19. package/dist/commands/env.js.map +1 -1
  20. package/dist/commands/health.d.ts +1 -1
  21. package/dist/commands/health.d.ts.map +1 -1
  22. package/dist/commands/health.js +101 -93
  23. package/dist/commands/health.js.map +1 -1
  24. package/dist/commands/init.d.ts +1 -1
  25. package/dist/commands/init.d.ts.map +1 -1
  26. package/dist/commands/init.js +416 -296
  27. package/dist/commands/init.js.map +1 -1
  28. package/dist/commands/remove.d.ts +1 -1
  29. package/dist/commands/remove.d.ts.map +1 -1
  30. package/dist/commands/remove.js +77 -64
  31. package/dist/commands/remove.js.map +1 -1
  32. package/dist/commands/status.d.ts +1 -1
  33. package/dist/commands/status.d.ts.map +1 -1
  34. package/dist/commands/status.js +15 -14
  35. package/dist/commands/status.js.map +1 -1
  36. package/dist/core/__tests__/detect.test.js +68 -34
  37. package/dist/core/__tests__/detect.test.js.map +1 -1
  38. package/dist/core/ast.d.ts +14 -0
  39. package/dist/core/ast.d.ts.map +1 -0
  40. package/dist/core/ast.js +239 -0
  41. package/dist/core/ast.js.map +1 -0
  42. package/dist/core/codemod.d.ts.map +1 -1
  43. package/dist/core/codemod.js +62 -44
  44. package/dist/core/codemod.js.map +1 -1
  45. package/dist/core/config.d.ts +10 -0
  46. package/dist/core/config.d.ts.map +1 -0
  47. package/dist/core/config.js +51 -0
  48. package/dist/core/config.js.map +1 -0
  49. package/dist/core/detect.d.ts +8 -2
  50. package/dist/core/detect.d.ts.map +1 -1
  51. package/dist/core/detect.js +52 -21
  52. package/dist/core/detect.js.map +1 -1
  53. package/dist/core/errors.d.ts.map +1 -1
  54. package/dist/core/errors.js +9 -8
  55. package/dist/core/errors.js.map +1 -1
  56. package/dist/core/exec.d.ts +16 -0
  57. package/dist/core/exec.d.ts.map +1 -0
  58. package/dist/core/exec.js +48 -0
  59. package/dist/core/exec.js.map +1 -0
  60. package/dist/core/manualSteps.d.ts +7 -0
  61. package/dist/core/manualSteps.d.ts.map +1 -0
  62. package/dist/core/manualSteps.js +59 -0
  63. package/dist/core/manualSteps.js.map +1 -0
  64. package/dist/core/paths.d.ts +3 -1
  65. package/dist/core/paths.d.ts.map +1 -1
  66. package/dist/core/paths.js +14 -10
  67. package/dist/core/paths.js.map +1 -1
  68. package/dist/core/spinner.d.ts +1 -1
  69. package/dist/core/spinner.d.ts.map +1 -1
  70. package/dist/core/spinner.js +38 -8
  71. package/dist/core/spinner.js.map +1 -1
  72. package/dist/core/vosk.d.ts.map +1 -1
  73. package/dist/core/vosk.js +50 -39
  74. package/dist/core/vosk.js.map +1 -1
  75. package/docs/manual-testing.md +91 -0
  76. package/package.json +6 -3
  77. package/recipes/audio-recorder/apps/native/src/app/audio-recorder/index.tsx +5 -0
  78. package/recipes/audio-recorder/recipe.json +3 -3
  79. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/audio-player.tsx +301 -0
  80. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/audio-recorder.tsx +373 -0
  81. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/audio-waveform.tsx +270 -0
  82. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/index.ts +4 -0
  83. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/recording-list.tsx +89 -0
  84. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/audio-player-demo.tsx +66 -0
  85. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/audio-recorder-cloud.tsx +68 -0
  86. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/audio-recorder-interview.tsx +102 -0
  87. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/basic.tsx +27 -0
  88. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/index.ts +5 -0
  89. package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/with-recording-list-demo.tsx +82 -0
  90. package/recipes/audio-recorder-supabase/packages/backend/src/services/recordings.ts +369 -0
  91. package/recipes/audio-recorder-supabase/packages/backend/supabase/migrations/recordings.sql +70 -0
  92. package/recipes/audio-recorder-supabase/recipe.json +35 -0
  93. package/recipes/audio-recorder-supabase@latest.zip +0 -0
  94. package/recipes/audio-recorder@latest.zip +0 -0
  95. package/recipes/charts/apps/native/src/features/charts/components/bar-chart.tsx +3 -3
  96. package/recipes/charts/apps/native/src/features/charts/components/candlestick-chart.tsx +2 -2
  97. package/recipes/charts/apps/native/src/features/charts/components/chart-card.tsx +5 -5
  98. package/recipes/charts/apps/native/src/features/charts/components/column-chart.tsx +3 -3
  99. package/recipes/charts/apps/native/src/features/charts/components/doughnut-chart.tsx +20 -4
  100. package/recipes/charts/apps/native/src/features/charts/components/line-chart.tsx +7 -6
  101. package/recipes/charts/apps/native/src/features/charts/components/radar-chart.tsx +6 -4
  102. package/recipes/charts/apps/native/src/features/charts/components/radial-bar-chart.tsx +1 -1
  103. package/recipes/charts/apps/native/src/features/charts/components/stacked-bar-chart.tsx +5 -4
  104. package/recipes/charts/recipe.json +4 -13
  105. package/recipes/charts@latest.zip +0 -0
  106. package/recipes/chatbot/apps/native/src/app/chatbot/index.tsx +1 -0
  107. package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-markdown.tsx +86 -86
  108. package/recipes/chatbot/apps/native/src/features/chatbot/components/markdown/code-block.tsx +86 -53
  109. package/recipes/chatbot/recipe.json +26 -92
  110. package/recipes/chatbot-supabase/apps/native/src/api-client/supabase/chatbot.ts +515 -0
  111. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/app/index.tsx +257 -0
  112. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-header-buttons.tsx +59 -0
  113. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-input-bar.tsx +485 -0
  114. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-markdown.tsx +575 -0
  115. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-message-bubble.tsx +223 -0
  116. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-settings-modal.tsx +161 -0
  117. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/image-preview-list.tsx +116 -0
  118. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/markdown/code-block.tsx +165 -0
  119. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/markdown/index.ts +10 -0
  120. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/markdown/table-renderer.tsx +129 -0
  121. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/message-error-boundary.tsx +78 -0
  122. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/message-list.tsx +170 -0
  123. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/model-selector.tsx +283 -0
  124. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/report-content-modal.tsx +188 -0
  125. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/suggested-messages.tsx +67 -0
  126. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/constants/models.ts +20 -0
  127. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/constants/report-reasons.ts +9 -0
  128. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-attachment-cache.ts +142 -0
  129. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-chat-config.ts +458 -0
  130. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-chat-handlers.ts +429 -0
  131. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-chatbot-settings.ts +89 -0
  132. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-conversation.ts +90 -0
  133. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-image-picker.ts +122 -0
  134. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-keyboard-coordinator.ts +161 -0
  135. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-smart-scroll-manager.ts +213 -0
  136. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/index.ts +86 -0
  137. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/models.ts +162 -0
  138. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/providers.ts +62 -0
  139. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/types.ts +40 -0
  140. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/services/file-uploader.ts +287 -0
  141. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/services/message-handler-service.ts +189 -0
  142. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/types/index.ts +70 -0
  143. package/recipes/chatbot-supabase/apps/native/src/features/chatbot/utils/chat-telemetry.ts +91 -0
  144. package/recipes/chatbot-supabase/packages/backend/src/services/conversations.ts +243 -0
  145. package/recipes/chatbot-supabase/packages/backend/src/services/messages.ts +327 -0
  146. package/recipes/chatbot-supabase/packages/backend/supabase/functions/chat-stream/index.ts +347 -0
  147. package/recipes/chatbot-supabase/packages/backend/supabase/migrations/chatbot.sql +104 -0
  148. package/recipes/chatbot-supabase/recipe.json +79 -0
  149. package/recipes/chatbot-supabase@latest.zip +0 -0
  150. package/recipes/chatbot.zip +0 -0
  151. package/recipes/chatbot@latest.zip +0 -0
  152. package/recipes/image-analysis/packages/backend/convex/imageAnalysis/index.ts +2 -2
  153. package/recipes/image-analysis/packages/backend/convex/{imageAnalysisFunctions.ts → imageAnalysis.ts} +5 -5
  154. package/recipes/image-analysis/recipe.json +15 -55
  155. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/analysis-options-screen.tsx +304 -0
  156. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/camera.tsx +221 -0
  157. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/image-capture-screen.tsx +333 -0
  158. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/loading-screen.tsx +214 -0
  159. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/loading.tsx +191 -0
  160. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/results.tsx +137 -0
  161. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/trait-details.tsx +172 -0
  162. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/use-analysis-data.ts +160 -0
  163. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/use-results-screen.ts +151 -0
  164. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievement-badge.tsx +77 -0
  165. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievement-card.tsx +75 -0
  166. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievement-unlocked-modal.tsx +162 -0
  167. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievements-section.tsx +44 -0
  168. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/advice-list.tsx +42 -0
  169. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/circular-progress.tsx +233 -0
  170. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/content-card.tsx +38 -0
  171. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/error-state.tsx +42 -0
  172. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/index.ts +9 -0
  173. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/loading-state.tsx +26 -0
  174. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/profile-image.tsx +60 -0
  175. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/results-header.tsx +62 -0
  176. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/score-display.tsx +54 -0
  177. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/share-options-modal.tsx +110 -0
  178. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/traits-grid.tsx +74 -0
  179. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/config/analysis-config.ts +80 -0
  180. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/config/master-analysis-config.ts +157 -0
  181. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/hooks/index.ts +1 -0
  182. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/hooks/use-analysis.ts +38 -0
  183. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/hooks/use-image-analysis.ts +208 -0
  184. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/services/analysis-service.ts +262 -0
  185. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/services/share-service.ts +176 -0
  186. package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/services/trait-details-service.ts +289 -0
  187. package/recipes/image-analysis-supabase/packages/backend/src/services/image-analyses.ts +132 -0
  188. package/recipes/image-analysis-supabase/packages/backend/supabase/functions/analyze-image/index.ts +312 -0
  189. package/recipes/image-analysis-supabase/packages/backend/supabase/migrations/image_analysis.sql +42 -0
  190. package/recipes/image-analysis-supabase/recipe.json +57 -0
  191. package/recipes/image-analysis-supabase@latest.zip +0 -0
  192. package/recipes/image-analysis@latest.zip +0 -0
  193. package/recipes/image-generator/apps/native/src/features/image-generator/app/index.tsx +16 -2
  194. package/recipes/image-generator/apps/native/src/features/image-generator/components/image-model-selector.tsx +11 -5
  195. package/recipes/image-generator/apps/native/src/features/image-generator/hooks/use-image-generator.ts +11 -5
  196. package/recipes/image-generator/packages/backend/convex/imageGeneration/index.ts +2 -2
  197. package/recipes/image-generator/recipe.json +16 -39
  198. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/app/_layout.tsx +26 -0
  199. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/app/gallery.tsx +217 -0
  200. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/app/index.tsx +251 -0
  201. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/gallery-image.tsx +25 -0
  202. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/image-detail-modal.tsx +215 -0
  203. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/image-model-selector.tsx +216 -0
  204. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/image-placeholder.tsx +26 -0
  205. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/hooks/use-image-gallery.ts +71 -0
  206. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/hooks/use-image-generator-settings.ts +152 -0
  207. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/hooks/use-image-generator.ts +103 -0
  208. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/models/models.ts +66 -0
  209. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/services/image-gallery-service.ts +96 -0
  210. package/recipes/image-generator-supabase/apps/native/src/features/image-generator/services/image-save-service.ts +120 -0
  211. package/recipes/image-generator-supabase/packages/backend/supabase/functions/generate-image/index.ts +291 -0
  212. package/recipes/image-generator-supabase/packages/backend/supabase/migrations/image_generator.sql +71 -0
  213. package/recipes/image-generator-supabase/recipe.json +59 -0
  214. package/recipes/image-generator-supabase@latest.zip +0 -0
  215. package/recipes/image-generator@latest.zip +0 -0
  216. package/recipes/ios-widget/recipe.json +15 -24
  217. package/recipes/ios-widget@latest.zip +0 -0
  218. package/recipes/onboarding/apps/native/src/features/onboarding/analytics/index.ts +9 -0
  219. package/recipes/onboarding/apps/native/src/features/onboarding/components/onboarding-with-analytics.tsx +141 -0
  220. package/recipes/onboarding/apps/native/src/features/onboarding/components/onboarding.tsx +173 -0
  221. package/recipes/onboarding/apps/native/src/features/onboarding/config/onboarding-flow-config.ts +189 -0
  222. package/recipes/onboarding/apps/native/src/features/onboarding/demo-one/app/index.tsx +42 -0
  223. package/recipes/onboarding/apps/native/src/features/onboarding/demo-one/data.ts +32 -0
  224. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/app/index.tsx +43 -0
  225. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/interactive-onboarding.tsx +222 -0
  226. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/ai-tone-step.tsx +133 -0
  227. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/currency-step.tsx +165 -0
  228. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-ai-step.tsx +199 -0
  229. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-chatbot-step.tsx +154 -0
  230. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-manual-step.tsx +156 -0
  231. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-scan-step.tsx +158 -0
  232. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/main-reason-step.tsx +139 -0
  233. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/notification-step.tsx +129 -0
  234. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/overspend-step.tsx +138 -0
  235. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/personalizing-step.tsx +190 -0
  236. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/rating-step.tsx +98 -0
  237. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/reminder-step.tsx +181 -0
  238. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/safety-step.tsx +110 -0
  239. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/struggle-step.tsx +139 -0
  240. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/welcome-step.tsx +217 -0
  241. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/ui/onboarding-header.tsx +58 -0
  242. package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/constants.ts +179 -0
  243. package/recipes/onboarding/apps/native/src/features/onboarding/hooks/use-onboarding-analytics.ts +323 -0
  244. package/recipes/onboarding/apps/native/src/features/onboarding/services/onboarding-analytics.ts +432 -0
  245. package/recipes/onboarding/recipe.json +15 -0
  246. package/recipes/onboarding@latest.zip +0 -0
  247. package/recipes/payments/recipe.json +28 -61
  248. package/recipes/payments-supabase/apps/native/src/features/payments/README.md +200 -0
  249. package/recipes/payments-supabase/apps/native/src/features/payments/app/local-paywall.tsx +194 -0
  250. package/recipes/payments-supabase/apps/native/src/features/payments/app/remote-paywall.tsx +79 -0
  251. package/recipes/payments-supabase/apps/native/src/features/payments/components/payment-initializer.tsx +95 -0
  252. package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-error-state.tsx +60 -0
  253. package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-local-mode.tsx +116 -0
  254. package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-product-card.tsx +133 -0
  255. package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-remote-mode.tsx +146 -0
  256. package/recipes/payments-supabase/apps/native/src/features/payments/hooks/use-entitlement.ts +63 -0
  257. package/recipes/payments-supabase/apps/native/src/features/payments/index.ts +8 -0
  258. package/recipes/payments-supabase/apps/native/src/features/payments/services/revenuecat-adapter.ts +407 -0
  259. package/recipes/payments-supabase/packages/backend/src/services/payments.ts +201 -0
  260. package/recipes/payments-supabase/packages/backend/supabase/migrations/payments.sql +35 -0
  261. package/recipes/payments-supabase/recipe.json +51 -0
  262. package/recipes/payments-supabase@latest.zip +0 -0
  263. package/recipes/payments@latest.zip +0 -0
  264. package/recipes/quiz/apps/native/src/features/quiz/index.tsx +1 -2
  265. package/recipes/quiz/recipe.json +6 -9
  266. package/recipes/quiz@latest.zip +0 -0
  267. package/recipes/tracker-app/apps/native/src/features/tracker-app/app/index.tsx +1 -2
  268. package/recipes/tracker-app/recipe.json +7 -10
  269. package/recipes/tracker-app@latest.zip +0 -0
  270. package/recipes/voice-bot/recipe.json +8 -68
  271. package/recipes/voice-bot.zip +0 -0
  272. package/recipes/voice-bot@latest.zip +0 -0
  273. package/recipes/wake-word/recipe.json +10 -9
  274. package/recipes/wake-word.zip +0 -0
  275. package/recipes/wake-word@latest.zip +0 -0
  276. package/recipes/charts/apps/native/src/app/(root)/(protected)/charts/index.tsx +0 -3
  277. package/recipes/chatbot/packages/backend/convex/lib/rateLimit.ts +0 -100
  278. package/recipes/chatbot/packages/backend/convex/lib/telemetry.ts +0 -29
  279. package/recipes/chatbot/packages/backend/convex/ragKnowledge.ts +0 -0
  280. package/recipes/image-analysis/apps/native/assets/features/image-analyzer/front.jpg +0 -0
  281. package/recipes/image-analysis/apps/native/assets/features/image-analyzer/side.jpg +0 -0
  282. package/recipes/image-analysis/apps/native/assets/features/image-analyzer/threeQuarter.jpg +0 -0
  283. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/_layout.tsx +0 -5
  284. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/analysis-options.tsx +0 -50
  285. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/camera.tsx +0 -2
  286. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/index.tsx +0 -50
  287. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/loading.tsx +0 -50
  288. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/results.tsx +0 -2
  289. package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/trait-details.tsx +0 -3
  290. package/recipes/image-analysis/packages/backend/convex/lib/ai/imageAnalysisAdapter.ts +0 -200
  291. package/recipes/payments/apps/native/src/app/(root)/(protected)/paywall/index.tsx +0 -74
  292. package/recipes/payments/apps/native/src/app/(root)/(protected)/paywall/local.tsx +0 -25
  293. package/recipes/payments/apps/native/src/app/(root)/(protected)/paywall/remote.tsx +0 -23
  294. package/recipes/quiz/apps/native/src/app/(root)/(protected)/quiz/index.tsx +0 -47
  295. package/recipes/tracker-app/apps/native/src/app/(root)/(protected)/tracker-app/index.tsx +0 -1
  296. package/recipes/voice-bot/apps/native/src/app/(root)/(protected)/voice-bot/index.tsx +0 -27
  297. package/recipes/voice-bot/packages/backend/convex/router.ts +0 -81
  298. /package/recipes/{chatbot/apps/native/src/app/(root)/(protected) → chatbot-supabase/apps/native/src/app}/chatbot/index.tsx +0 -0
  299. /package/recipes/{image-generator/apps/native/src/app/(root)/(protected) → image-generator-supabase/apps/native/src/app}/image-generator/gallery.tsx +0 -0
  300. /package/recipes/{image-generator/apps/native/src/app/(root)/(protected) → image-generator-supabase/apps/native/src/app}/image-generator/index.tsx +0 -0
@@ -0,0 +1,223 @@
1
+ import { Feather, Ionicons } from '@expo/vector-icons';
2
+ import * as Clipboard from 'expo-clipboard';
3
+ import React from 'react';
4
+ import { View } from 'react-native';
5
+
6
+ import { Image, Pressable, Text } from '@/components/ui';
7
+ import { useToast } from '@/components/ui/utils';
8
+ import { ChatMarkdown } from '@/features/chatbot/components/chat-markdown';
9
+ import type { AppMessage } from '@/features/chatbot/types';
10
+ import { translate } from '@/lib';
11
+ import { useThemeConfig } from '@/lib/use-theme-config';
12
+
13
+ type ChatMessageBubbleProps = {
14
+ message: AppMessage;
15
+ onReportMessage?: (message: AppMessage) => void;
16
+ };
17
+
18
+ const StorageImage: React.FC<{
19
+ storageId: string;
20
+ isUser: boolean;
21
+ fileName?: string;
22
+ preloadedUrl?: string | null;
23
+ }> = React.memo(({ storageId, isUser, fileName, preloadedUrl }) => {
24
+ const imageUrl = preloadedUrl;
25
+ const theme = useThemeConfig();
26
+
27
+ return (
28
+ <View
29
+ className="my-1 w-48 overflow-hidden rounded-lg"
30
+ style={{ aspectRatio: 1.5, minHeight: 128 }}
31
+ testID={`supabase-image-container-${storageId}`}
32
+ >
33
+ {!imageUrl ? (
34
+ <View
35
+ className="flex-1 items-center justify-center"
36
+ style={{ backgroundColor: theme.colors.muted }}
37
+ >
38
+ <Text
39
+ className={`text-sm ${isUser ? 'text-white' : 'text-neutral-500 dark:text-neutral-400'}`}
40
+ >
41
+ Loading{fileName ? ` ${fileName}` : ''}...
42
+ </Text>
43
+ </View>
44
+ ) : (
45
+ <Image
46
+ source={{ uri: imageUrl }}
47
+ className="flex-1"
48
+ accessibilityRole="image"
49
+ accessibilityLabel={
50
+ fileName || 'Message image attachment from storage'
51
+ }
52
+ testID={`supabase-image-loaded-${storageId}`}
53
+ contentFit="cover"
54
+ transition={0}
55
+ />
56
+ )}
57
+ </View>
58
+ );
59
+ });
60
+
61
+ export const ChatMessageBubble: React.FC<ChatMessageBubbleProps> = ({
62
+ message,
63
+ onReportMessage,
64
+ }) => {
65
+ const theme = useThemeConfig();
66
+ const isUser = message.role === 'user';
67
+ const isBotMessage = message.role === 'assistant';
68
+ const toast = useToast();
69
+
70
+ const handleCopyMessage = async () => {
71
+ try {
72
+ let textToCopy = '';
73
+ if (typeof message.content === 'string') {
74
+ textToCopy = message.content;
75
+ } else if (Array.isArray(message.content)) {
76
+ textToCopy = message.content
77
+ .filter((part) => part.type === 'text')
78
+ .map((part) => part.text)
79
+ .join('\n');
80
+ }
81
+
82
+ if (textToCopy) {
83
+ await Clipboard.setStringAsync(textToCopy);
84
+ } else {
85
+ toast.warning(translate('chatbot.empty_message'), { duration: 2000 });
86
+ }
87
+ } catch (error) {
88
+ console.error('[CHATBOT_FRONTEND] Copy failed:', {
89
+ error: error instanceof Error ? error.message : 'Unknown error',
90
+ });
91
+ toast.error(translate('chatbot.copy_failed'), { duration: 3000 });
92
+ }
93
+ };
94
+
95
+ // Separate text content from images
96
+ const textContent: string[] = [];
97
+ const imageContent: React.ReactNode[] = [];
98
+
99
+ // Handle message.content (string or LocalMessageContentPart[])
100
+ if (typeof message.content === 'string') {
101
+ if (message.content.trim()) {
102
+ textContent.push(message.content);
103
+ }
104
+ } else if (Array.isArray(message.content)) {
105
+ message.content.forEach((part, index) => {
106
+ if (part.type === 'text' && part.text) {
107
+ textContent.push(part.text);
108
+ } else if (part.type === 'image' && part.image) {
109
+ const uri =
110
+ typeof part.image === 'string' ? part.image : part.image.toString();
111
+
112
+ imageContent.push(
113
+ <Image
114
+ key={`content-image-${index}`}
115
+ source={{ uri }}
116
+ className="mb-2 h-32 w-48 rounded-2xl"
117
+ accessibilityRole="image"
118
+ accessibilityLabel="Image from message content"
119
+ testID={`content-image-${index}`}
120
+ contentFit="cover"
121
+ />,
122
+ );
123
+ }
124
+ });
125
+ }
126
+
127
+ // Handle message.attachments (from backend storage) - now with pre-fetched URLs
128
+ if (message.attachments && message.attachments.length > 0) {
129
+ message.attachments.forEach((attachment, index) => {
130
+ if (attachment.type === 'image' && attachment.storageId) {
131
+ imageContent.push(
132
+ <StorageImage
133
+ key={`attachment-image-${attachment.storageId}-${index}`}
134
+ storageId={attachment.storageId}
135
+ isUser={isUser}
136
+ fileName={attachment.fileName}
137
+ preloadedUrl={attachment.url}
138
+ />,
139
+ );
140
+ }
141
+ });
142
+ }
143
+
144
+ return (
145
+ <View
146
+ className={`mb-1 ${isUser ? 'items-end' : 'items-start'}`}
147
+ accessibilityLabel={`${isUser ? 'Your' : 'Assistant'} message`}
148
+ >
149
+ {/* Images displayed outside bubble */}
150
+ {imageContent.length > 0 && (
151
+ <View className={`mb-2 ${isUser ? 'items-end' : 'items-start'}`}>
152
+ {imageContent}
153
+ </View>
154
+ )}
155
+
156
+ {/* Text bubble */}
157
+ {textContent.length > 0 && (
158
+ <View className={`w-full ${isUser ? 'items-end' : 'items-start'}`}>
159
+ <View
160
+ className={`${isUser ? 'max-w-[80%] rounded-3xl bg-neutral-200 px-5 py-4 dark:bg-neutral-800' : 'w-full py-2'}`}
161
+ >
162
+ {isBotMessage ? (
163
+ <ChatMarkdown content={textContent.join('\n\n')} />
164
+ ) : (
165
+ textContent.map((text, index) => (
166
+ <Text
167
+ key={`text-${index}`}
168
+ className={`text-[15.8px] ${isUser ? 'text-neutral-900 dark:text-white' : 'text-black dark:text-white'}`}
169
+ selectable
170
+ selectionColor={theme.colors.primary}
171
+ >
172
+ {text}
173
+ </Text>
174
+ ))
175
+ )}
176
+ </View>
177
+
178
+ {isBotMessage && (textContent.length > 0 || onReportMessage) && (
179
+ <View className="flex-row gap-x-2">
180
+ {textContent.length > 0 && (
181
+ <Pressable
182
+ onPress={handleCopyMessage}
183
+ className="rounded p-1 opacity-60 hover:opacity-100 active:opacity-40"
184
+ accessibilityRole="button"
185
+ accessibilityLabel={translate('chatbot.copy_message')}
186
+ accessibilityHint={translate('chatbot.copy_hint')}
187
+ testID="copy-message-button"
188
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
189
+ >
190
+ <Feather
191
+ name="copy"
192
+ size={20}
193
+ color={theme.colors.mutedForeground}
194
+ />
195
+ </Pressable>
196
+ )}
197
+
198
+ {onReportMessage && (
199
+ <Pressable
200
+ onPress={() => onReportMessage(message)}
201
+ className="rounded p-1 opacity-60 hover:opacity-100 active:opacity-40"
202
+ accessibilityRole="button"
203
+ accessibilityLabel={translate('chatbot.report_message')}
204
+ accessibilityHint={translate('chatbot.report_hint')}
205
+ testID="report-message-button"
206
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
207
+ >
208
+ <Ionicons
209
+ name="flag-outline"
210
+ size={20}
211
+ color={theme.colors.mutedForeground}
212
+ />
213
+ </Pressable>
214
+ )}
215
+ </View>
216
+ )}
217
+ </View>
218
+ )}
219
+
220
+ {/* If both text and images are empty (e.g. streaming just started), omit the placeholder bubble */}
221
+ </View>
222
+ );
223
+ };
@@ -0,0 +1,161 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+
4
+ import { Modal, Select, Text, useModal } from '@/components/ui';
5
+ import type { OptionType } from '@/components/ui/core/select';
6
+ import { useEntitlement } from '@/features/payments/hooks/use-entitlement';
7
+
8
+ import {
9
+ getModelsByProvider,
10
+ PREMIUM_MODELS,
11
+ type Provider,
12
+ } from '../constants/models';
13
+ import type { SearchMode } from '../hooks/use-chatbot-settings';
14
+
15
+ const PROVIDER_OPTIONS: OptionType[] = [
16
+ { label: 'OpenAI', value: 'openai' },
17
+ { label: 'Gemini', value: 'gemini' },
18
+ ];
19
+
20
+ const SEARCH_MODE_OPTIONS: OptionType[] = [
21
+ { label: 'Provider-Optimized', value: 'provider' },
22
+ { label: 'Tavily Search', value: 'tavily' },
23
+ { label: 'None', value: 'none' },
24
+ ];
25
+
26
+ type ChatSettingsModalProps = {
27
+ selectedProvider: Provider;
28
+ selectedModel: string;
29
+ selectedSearchMode: SearchMode;
30
+ onProviderChange: (provider: Provider) => void;
31
+ onModelChange: (model: string) => void;
32
+ onSearchModeChange: (searchMode: SearchMode) => void;
33
+ };
34
+
35
+ export type ChatSettingsModalRef = {
36
+ present: () => void;
37
+ dismiss: () => void;
38
+ };
39
+
40
+ export const ChatSettingsModal = React.forwardRef<
41
+ ChatSettingsModalRef,
42
+ ChatSettingsModalProps
43
+ >(
44
+ (
45
+ {
46
+ selectedProvider,
47
+ selectedModel,
48
+ selectedSearchMode,
49
+ onProviderChange,
50
+ onModelChange,
51
+ onSearchModeChange,
52
+ },
53
+ ref,
54
+ ) => {
55
+ const modal = useModal();
56
+ const { isEntitled, isLoading: isEntitlementLoading } =
57
+ useEntitlement('premium_access');
58
+
59
+ const premiumModelIds = React.useMemo(() => new Set(PREMIUM_MODELS()), []);
60
+
61
+ const baseModelOptions = React.useMemo<OptionType[]>(
62
+ () =>
63
+ getModelsByProvider(selectedProvider).map((model) => ({
64
+ label: model.name,
65
+ value: model.id,
66
+ })),
67
+ [selectedProvider],
68
+ );
69
+
70
+ // Filter model options based on entitlement
71
+ const modelOptions = React.useMemo(
72
+ () =>
73
+ baseModelOptions
74
+ .filter((option) => {
75
+ const isPremium = premiumModelIds.has(option.value as string);
76
+ return isPremium ? isEntitled : true;
77
+ })
78
+ .map((option) => {
79
+ const isPremium = premiumModelIds.has(option.value as string);
80
+ if (isPremium && isEntitled) {
81
+ return {
82
+ ...option,
83
+ label: `${option.label} ⭐`,
84
+ };
85
+ }
86
+ return option;
87
+ }),
88
+ [baseModelOptions, isEntitled, premiumModelIds],
89
+ );
90
+
91
+ const handleProviderChange = (value: string | number) => {
92
+ const provider = value as Provider;
93
+ onProviderChange(provider);
94
+
95
+ // Reset to first model of new provider if current model doesn't exist
96
+ const newModelOptions = getModelsByProvider(provider);
97
+ const modelExists = newModelOptions.some(
98
+ (model) => model.id === selectedModel,
99
+ );
100
+ if (!modelExists && newModelOptions.length > 0) {
101
+ onModelChange(newModelOptions[0].id);
102
+ }
103
+ };
104
+
105
+ const handleModelChange = (value: string | number) => {
106
+ onModelChange(value as string);
107
+ };
108
+
109
+ const handleSearchModeChange = (value: string | number) => {
110
+ onSearchModeChange(value as SearchMode);
111
+ };
112
+
113
+ // Expose modal controls via imperative handle
114
+ React.useImperativeHandle(ref, () => ({
115
+ present: modal.present,
116
+ dismiss: modal.dismiss,
117
+ }));
118
+
119
+ return (
120
+ <Modal ref={modal.ref} title="Chat Settings">
121
+ <View className="gap-6 p-4">
122
+ <View className="gap-2">
123
+ <Text className="text-base font-medium">AI Provider</Text>
124
+ <Select
125
+ options={PROVIDER_OPTIONS}
126
+ value={selectedProvider}
127
+ onSelect={handleProviderChange}
128
+ placeholder="Select AI Provider"
129
+ testID="provider-select"
130
+ />
131
+ </View>
132
+
133
+ <View className="gap-2">
134
+ <Text className="text-base font-medium">Model</Text>
135
+ <Select
136
+ options={modelOptions}
137
+ value={selectedModel}
138
+ onSelect={handleModelChange}
139
+ placeholder="Select Model"
140
+ testID="model-select"
141
+ disabled={isEntitlementLoading}
142
+ />
143
+ </View>
144
+
145
+ <View className="gap-2">
146
+ <Text className="text-base font-medium">Search Mode</Text>
147
+ <Select
148
+ options={SEARCH_MODE_OPTIONS}
149
+ value={selectedSearchMode}
150
+ onSelect={handleSearchModeChange}
151
+ placeholder="Select Search Mode"
152
+ testID="search-mode-select"
153
+ />
154
+ </View>
155
+ </View>
156
+ </Modal>
157
+ );
158
+ },
159
+ );
160
+
161
+ ChatSettingsModal.displayName = 'ChatSettingsModal';
@@ -0,0 +1,116 @@
1
+ import { Feather } from '@expo/vector-icons';
2
+ import type React from 'react';
3
+ import { ActivityIndicator, ScrollView, View } from 'react-native';
4
+
5
+ import { Image, Pressable, Text } from '@/components/ui';
6
+ import { useThemeConfig } from '@/lib/use-theme-config';
7
+
8
+ export type ImageUploadState =
9
+ | { status: 'pending'; progress: 0 }
10
+ | { status: 'uploading'; progress: number }
11
+ | { status: 'completed'; storageId: string; progress: 100 }
12
+ | { status: 'error'; error: string; progress: 0 };
13
+
14
+ export type SelectedImage = {
15
+ uri: string;
16
+ type: string;
17
+ fileName?: string;
18
+ id: string;
19
+ uploadState: ImageUploadState;
20
+ storageId?: string;
21
+ mimeType?: string;
22
+ signedUrl?: string;
23
+ };
24
+
25
+ type ImagePreviewListProps = {
26
+ images: SelectedImage[];
27
+ onRemoveImage: (id: string) => void;
28
+ onRetryUpload?: (id: string) => void;
29
+ };
30
+
31
+ /**
32
+ * Component for displaying and managing selected image previews with upload progress
33
+ */
34
+ export const ImagePreviewList: React.FC<ImagePreviewListProps> = ({
35
+ images,
36
+ onRemoveImage,
37
+ onRetryUpload,
38
+ }) => {
39
+ const theme = useThemeConfig();
40
+
41
+ if (images.length === 0) return null;
42
+
43
+ return (
44
+ <ScrollView
45
+ horizontal
46
+ showsHorizontalScrollIndicator={false}
47
+ className="mb-1"
48
+ contentContainerStyle={{ gap: 8 }}
49
+ >
50
+ {images.map((image, index) => {
51
+ const isUploading =
52
+ image.uploadState.status === 'uploading' ||
53
+ image.uploadState.status === 'pending';
54
+ const isError = image.uploadState.status === 'error';
55
+
56
+ return (
57
+ <View key={image.id} className="relative p-2">
58
+ <Image
59
+ source={{ uri: image.uri }}
60
+ className="size-20 rounded-xl border border-neutral-200 dark:border-neutral-800"
61
+ contentFit="cover"
62
+ accessibilityRole="image"
63
+ accessibilityLabel={`Selected image ${index + 1}`}
64
+ style={{ opacity: isUploading ? 0.5 : 1 }}
65
+ />
66
+
67
+ {/* Upload Progress Loader */}
68
+ {isUploading && (
69
+ <View className="absolute inset-2 items-center justify-center rounded-xl">
70
+ <ActivityIndicator
71
+ size="small"
72
+ color={theme.dark ? '#fff' : '#000'}
73
+ />
74
+ </View>
75
+ )}
76
+
77
+ {/* Error State Overlay */}
78
+ {isError && (
79
+ <View className="absolute inset-2 items-center justify-center rounded-xl bg-danger-500/90">
80
+ <Feather name="alert-circle" size={20} color="#fff" />
81
+ <Text className="mt-1 text-xs font-medium text-white">
82
+ Failed
83
+ </Text>
84
+ {onRetryUpload && (
85
+ <Pressable
86
+ onPress={() => onRetryUpload(image.id)}
87
+ className="mt-1 rounded bg-white/20 px-2 py-1"
88
+ accessibilityLabel="Retry upload"
89
+ accessibilityRole="button"
90
+ >
91
+ <Text className="text-xs font-medium text-white">
92
+ Retry
93
+ </Text>
94
+ </Pressable>
95
+ )}
96
+ </View>
97
+ )}
98
+
99
+ {/* Remove Button */}
100
+ <Pressable
101
+ onPress={() => onRemoveImage(image.id)}
102
+ className="absolute right-0 top-0 z-50 size-[26px] rounded-full bg-danger-500/70 dark:bg-danger-600/70"
103
+ accessibilityLabel={`Remove image ${index + 1}`}
104
+ accessibilityRole="button"
105
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
106
+ >
107
+ <Text className="mt-1 items-center justify-center text-center text-sm text-white">
108
+
109
+ </Text>
110
+ </Pressable>
111
+ </View>
112
+ );
113
+ })}
114
+ </ScrollView>
115
+ );
116
+ };
@@ -0,0 +1,165 @@
1
+ import { Feather } from '@expo/vector-icons';
2
+ import React, { useCallback, useState } from 'react';
3
+ import {
4
+ type ImageStyle,
5
+ Pressable,
6
+ type TextStyle,
7
+ View,
8
+ type ViewStyle,
9
+ } from 'react-native';
10
+ import SyntaxHighlighter from 'react-native-syntax-highlighter';
11
+
12
+ import { translate } from '@/lib';
13
+
14
+ type CodeBlockProps = {
15
+ containerStyle: ViewStyle | TextStyle | ImageStyle;
16
+ content: string;
17
+ language: string;
18
+ codeSyntaxTheme: any;
19
+ monospaceFontFamily: string;
20
+ subtleText: string;
21
+ codeContentStyle: ViewStyle;
22
+ codeActionsContainerStyle: ViewStyle;
23
+ codeActionButtonBaseStyle: ViewStyle;
24
+ codeToggleButtonSpacingStyle: ViewStyle;
25
+ codeContentContainerStyle: ViewStyle;
26
+ onCopyCode: (code: string) => Promise<void>;
27
+ };
28
+
29
+ /**
30
+ * CodeBlock component for rendering syntax-highlighted code with collapse/expand functionality.
31
+ *
32
+ * Features:
33
+ * - Syntax highlighting using react-native-syntax-highlighter
34
+ * - Copy to clipboard functionality
35
+ * - Collapse/expand animation with FlashList preparation
36
+ * - Smooth 220ms easeInEaseOut animation
37
+ * - Independent animation for multiple code blocks
38
+ *
39
+ * Requirements addressed:
40
+ * - 9.1: Prepare FlashList for layout animation before collapse
41
+ * - 9.2: Animate height change over 220ms with easeInEaseOut
42
+ * - 9.3: Animate each code block independently
43
+ * - 9.4: Restore full content with same animation timing
44
+ * - 9.5: Complete animation without interruption during scroll
45
+ *
46
+ * @param props - CodeBlock component props
47
+ * @returns Rendered code block with syntax highlighting and controls
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * <CodeBlock
52
+ * containerStyle={styles.code_block}
53
+ * content="const hello = 'world';"
54
+ * language="javascript"
55
+ * codeSyntaxTheme={atomOneDark}
56
+ * monospaceFontFamily="Menlo"
57
+ * subtleText="#888"
58
+ * codeContentStyle={styles.codeContent}
59
+ * codeActionsContainerStyle={styles.actions}
60
+ * codeActionButtonBaseStyle={styles.button}
61
+ * codeToggleButtonSpacingStyle={styles.spacing}
62
+ * codeContentContainerStyle={styles.container}
63
+ * onCopyCode={copyToClipboard}
64
+ * onPrepareLayoutAnimation={prepareFlashList}
65
+ * />
66
+ * ```
67
+ */
68
+ export const CodeBlock = React.memo(function CodeBlock({
69
+ containerStyle,
70
+ content,
71
+ language,
72
+ codeSyntaxTheme,
73
+ monospaceFontFamily,
74
+ subtleText,
75
+ codeContentStyle,
76
+ codeActionsContainerStyle,
77
+ codeActionButtonBaseStyle,
78
+ codeToggleButtonSpacingStyle,
79
+ codeContentContainerStyle,
80
+ onCopyCode,
81
+ }: CodeBlockProps) {
82
+ const [isCollapsed, setIsCollapsed] = useState(false);
83
+
84
+ /**
85
+ * Toggle collapsed state without animation.
86
+ * LayoutAnimation causes scroll jitter, so we disable it.
87
+ */
88
+ const toggleCollapsed = useCallback(() => {
89
+ setIsCollapsed((prev) => !prev);
90
+ }, []);
91
+
92
+ return (
93
+ <View
94
+ style={[
95
+ containerStyle as ViewStyle,
96
+ { position: 'relative' as ViewStyle['position'] },
97
+ ]}
98
+ >
99
+ <View style={codeActionsContainerStyle} pointerEvents="box-none">
100
+ <Pressable
101
+ onPress={() => onCopyCode(content)}
102
+ style={({ pressed }) => [
103
+ codeActionButtonBaseStyle,
104
+ pressed ? { opacity: 0.6 } : null,
105
+ ]}
106
+ accessibilityRole="button"
107
+ accessibilityLabel={translate('chatbot.copy_code')}
108
+ accessibilityHint={translate('chatbot.copy_code_hint')}
109
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
110
+ >
111
+ <Feather name="copy" size={16} color={subtleText} />
112
+ </Pressable>
113
+
114
+ <Pressable
115
+ onPress={toggleCollapsed}
116
+ style={({ pressed }) => [
117
+ codeActionButtonBaseStyle,
118
+ codeToggleButtonSpacingStyle,
119
+ pressed ? { opacity: 0.6 } : null,
120
+ ]}
121
+ accessibilityRole="button"
122
+ accessibilityLabel={
123
+ translate(
124
+ isCollapsed
125
+ ? 'chatbot.expand_code_block'
126
+ : 'chatbot.collapse_code_block',
127
+ ) ?? undefined
128
+ }
129
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
130
+ >
131
+ <View
132
+ style={{
133
+ transform: [{ rotate: isCollapsed ? '180deg' : '0deg' }],
134
+ }}
135
+ >
136
+ <Feather name="chevron-down" size={18} color={subtleText} />
137
+ </View>
138
+ </Pressable>
139
+ </View>
140
+
141
+ <View
142
+ style={[
143
+ codeContentContainerStyle,
144
+ isCollapsed ? { marginTop: 0 } : null,
145
+ ]}
146
+ pointerEvents={isCollapsed ? 'none' : 'auto'}
147
+ >
148
+ {isCollapsed ? null : (
149
+ <SyntaxHighlighter
150
+ language={language.length > 0 ? language : 'plaintext'}
151
+ style={codeSyntaxTheme}
152
+ highlighter="hljs"
153
+ fontFamily={monospaceFontFamily}
154
+ fontSize={15}
155
+ PreTag={View}
156
+ CodeTag={View}
157
+ customStyle={codeContentStyle}
158
+ >
159
+ {content}
160
+ </SyntaxHighlighter>
161
+ )}
162
+ </View>
163
+ </View>
164
+ );
165
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Markdown rendering components for chatbot messages.
3
+ *
4
+ * This module exports specialized components for rendering markdown content
5
+ * in chat messages, including code blocks with syntax highlighting and
6
+ * tables with intelligent column sizing.
7
+ */
8
+
9
+ export { CodeBlock } from './code-block';
10
+ export { TableRenderer } from './table-renderer';