@cachly-dev/mcp-server 0.10.65 → 0.10.66

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 (269) hide show
  1. package/dist/src/handlers/brain.js +1 -1
  2. package/dist/src/index.js +1 -1
  3. package/package.json +7 -1
  4. package/server.json +2 -2
  5. package/.env.test.example +0 -23
  6. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -50
  7. package/.github/ISSUE_TEMPLATE/config.yml +0 -8
  8. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -25
  9. package/.github/workflows/eas-build-android.yml +0 -58
  10. package/.github/workflows/eas-update.yml +0 -55
  11. package/.github/workflows/publish.yml +0 -72
  12. package/BENCH.md +0 -113
  13. package/CHANGELOG.md +0 -653
  14. package/Dockerfile +0 -16
  15. package/LAUNCH_TEXTS.md +0 -182
  16. package/PROGRESS.md +0 -141
  17. package/STRATEGY.md +0 -228
  18. package/VISION_10X.md +0 -133
  19. package/apps/travel-chaos-organizer/.env.example +0 -49
  20. package/apps/travel-chaos-organizer/DEPLOY.md +0 -328
  21. package/apps/travel-chaos-organizer/Makefile +0 -57
  22. package/apps/travel-chaos-organizer/README.md +0 -159
  23. package/apps/travel-chaos-organizer/backend/.env.example +0 -10
  24. package/apps/travel-chaos-organizer/backend/Dockerfile +0 -25
  25. package/apps/travel-chaos-organizer/backend/alembic/env.py +0 -56
  26. package/apps/travel-chaos-organizer/backend/alembic/script.py.mako +0 -24
  27. package/apps/travel-chaos-organizer/backend/alembic/versions/.gitkeep +0 -0
  28. package/apps/travel-chaos-organizer/backend/alembic/versions/0001_stripe_customer_id.py +0 -24
  29. package/apps/travel-chaos-organizer/backend/alembic/versions/0002_telegram_chat_id.py +0 -24
  30. package/apps/travel-chaos-organizer/backend/alembic.ini +0 -39
  31. package/apps/travel-chaos-organizer/backend/app/__init__.py +0 -0
  32. package/apps/travel-chaos-organizer/backend/app/auth/__init__.py +0 -0
  33. package/apps/travel-chaos-organizer/backend/app/auth/keycloak.py +0 -81
  34. package/apps/travel-chaos-organizer/backend/app/config.py +0 -66
  35. package/apps/travel-chaos-organizer/backend/app/db/__init__.py +0 -0
  36. package/apps/travel-chaos-organizer/backend/app/db/database.py +0 -20
  37. package/apps/travel-chaos-organizer/backend/app/db/migrations/001_init.sql +0 -71
  38. package/apps/travel-chaos-organizer/backend/app/db/migrations/002_telemetry_freemium.sql +0 -31
  39. package/apps/travel-chaos-organizer/backend/app/db/migrations/003_telegram_chat_id.sql +0 -4
  40. package/apps/travel-chaos-organizer/backend/app/db/migrations/004_stripe_and_email.sql +0 -5
  41. package/apps/travel-chaos-organizer/backend/app/limiter.py +0 -4
  42. package/apps/travel-chaos-organizer/backend/app/logging_config.py +0 -25
  43. package/apps/travel-chaos-organizer/backend/app/main.py +0 -77
  44. package/apps/travel-chaos-organizer/backend/app/models/__init__.py +0 -0
  45. package/apps/travel-chaos-organizer/backend/app/models/schemas.py +0 -142
  46. package/apps/travel-chaos-organizer/backend/app/routers/__init__.py +0 -0
  47. package/apps/travel-chaos-organizer/backend/app/routers/admin.py +0 -237
  48. package/apps/travel-chaos-organizer/backend/app/routers/cache.py +0 -13
  49. package/apps/travel-chaos-organizer/backend/app/routers/events.py +0 -29
  50. package/apps/travel-chaos-organizer/backend/app/routers/export.py +0 -122
  51. package/apps/travel-chaos-organizer/backend/app/routers/inbox.py +0 -122
  52. package/apps/travel-chaos-organizer/backend/app/routers/items.py +0 -130
  53. package/apps/travel-chaos-organizer/backend/app/routers/mail.py +0 -108
  54. package/apps/travel-chaos-organizer/backend/app/routers/parse.py +0 -303
  55. package/apps/travel-chaos-organizer/backend/app/routers/payments.py +0 -179
  56. package/apps/travel-chaos-organizer/backend/app/routers/trips.py +0 -134
  57. package/apps/travel-chaos-organizer/backend/app/routers/users.py +0 -169
  58. package/apps/travel-chaos-organizer/backend/app/routers/waitlist.py +0 -37
  59. package/apps/travel-chaos-organizer/backend/app/services/__init__.py +0 -0
  60. package/apps/travel-chaos-organizer/backend/app/services/cache.py +0 -131
  61. package/apps/travel-chaos-organizer/backend/app/services/drip.py +0 -128
  62. package/apps/travel-chaos-organizer/backend/app/services/email.py +0 -61
  63. package/apps/travel-chaos-organizer/backend/app/services/errors.py +0 -44
  64. package/apps/travel-chaos-organizer/backend/app/services/notifier.py +0 -10
  65. package/apps/travel-chaos-organizer/backend/app/services/ollama.py +0 -101
  66. package/apps/travel-chaos-organizer/backend/app/services/parser.py +0 -22
  67. package/apps/travel-chaos-organizer/backend/app/services/quota.py +0 -85
  68. package/apps/travel-chaos-organizer/backend/app/services/sentry.py +0 -11
  69. package/apps/travel-chaos-organizer/backend/app/services/telemetry.py +0 -35
  70. package/apps/travel-chaos-organizer/backend/pytest.ini +0 -4
  71. package/apps/travel-chaos-organizer/backend/requirements-dev.txt +0 -6
  72. package/apps/travel-chaos-organizer/backend/requirements.txt +0 -25
  73. package/apps/travel-chaos-organizer/backend/tests/__init__.py +0 -0
  74. package/apps/travel-chaos-organizer/backend/tests/conftest.py +0 -223
  75. package/apps/travel-chaos-organizer/backend/tests/test_admin.py +0 -99
  76. package/apps/travel-chaos-organizer/backend/tests/test_cache.py +0 -142
  77. package/apps/travel-chaos-organizer/backend/tests/test_drip.py +0 -32
  78. package/apps/travel-chaos-organizer/backend/tests/test_e2e_chain.py +0 -121
  79. package/apps/travel-chaos-organizer/backend/tests/test_export.py +0 -48
  80. package/apps/travel-chaos-organizer/backend/tests/test_inbox.py +0 -107
  81. package/apps/travel-chaos-organizer/backend/tests/test_items.py +0 -138
  82. package/apps/travel-chaos-organizer/backend/tests/test_mail.py +0 -113
  83. package/apps/travel-chaos-organizer/backend/tests/test_ollama.py +0 -145
  84. package/apps/travel-chaos-organizer/backend/tests/test_parse_url.py +0 -98
  85. package/apps/travel-chaos-organizer/backend/tests/test_parser.py +0 -72
  86. package/apps/travel-chaos-organizer/backend/tests/test_payments.py +0 -163
  87. package/apps/travel-chaos-organizer/backend/tests/test_quota.py +0 -46
  88. package/apps/travel-chaos-organizer/backend/tests/test_search.py +0 -67
  89. package/apps/travel-chaos-organizer/backend/tests/test_trips.py +0 -123
  90. package/apps/travel-chaos-organizer/backend/tests/test_users.py +0 -52
  91. package/apps/travel-chaos-organizer/backups/.gitkeep +0 -0
  92. package/apps/travel-chaos-organizer/caddy/Caddyfile +0 -27
  93. package/apps/travel-chaos-organizer/docker-compose.node1.yml +0 -31
  94. package/apps/travel-chaos-organizer/docker-compose.override.yml +0 -14
  95. package/apps/travel-chaos-organizer/docker-compose.yml +0 -128
  96. package/apps/travel-chaos-organizer/frontend/.env.example +0 -13
  97. package/apps/travel-chaos-organizer/frontend/app/(app)/_layout.tsx +0 -80
  98. package/apps/travel-chaos-organizer/frontend/app/(app)/inbox.tsx +0 -166
  99. package/apps/travel-chaos-organizer/frontend/app/(app)/search.tsx +0 -130
  100. package/apps/travel-chaos-organizer/frontend/app/(app)/settings.tsx +0 -381
  101. package/apps/travel-chaos-organizer/frontend/app/(app)/trips/[id].tsx +0 -346
  102. package/apps/travel-chaos-organizer/frontend/app/(app)/trips.tsx +0 -363
  103. package/apps/travel-chaos-organizer/frontend/app/(app)/upgrade/cancel.tsx +0 -34
  104. package/apps/travel-chaos-organizer/frontend/app/(app)/upgrade/success.tsx +0 -35
  105. package/apps/travel-chaos-organizer/frontend/app/(auth)/login.tsx +0 -91
  106. package/apps/travel-chaos-organizer/frontend/app/_layout.tsx +0 -71
  107. package/apps/travel-chaos-organizer/frontend/app/auth.tsx +0 -29
  108. package/apps/travel-chaos-organizer/frontend/app/index.tsx +0 -16
  109. package/apps/travel-chaos-organizer/frontend/app/onboarding.tsx +0 -119
  110. package/apps/travel-chaos-organizer/frontend/app.config.ts +0 -54
  111. package/apps/travel-chaos-organizer/frontend/assets/adaptive-icon.svg +0 -66
  112. package/apps/travel-chaos-organizer/frontend/assets/icon.svg +0 -79
  113. package/apps/travel-chaos-organizer/frontend/assets/splash.svg +0 -15
  114. package/apps/travel-chaos-organizer/frontend/components/BottomSheet.tsx +0 -102
  115. package/apps/travel-chaos-organizer/frontend/components/ConfettiCannon.tsx +0 -107
  116. package/apps/travel-chaos-organizer/frontend/components/ConfirmDialog.tsx +0 -109
  117. package/apps/travel-chaos-organizer/frontend/components/ErrorBoundary.tsx +0 -45
  118. package/apps/travel-chaos-organizer/frontend/components/FileUploadButton.tsx +0 -19
  119. package/apps/travel-chaos-organizer/frontend/components/ImportSheet.tsx +0 -155
  120. package/apps/travel-chaos-organizer/frontend/components/OfflineBadge.tsx +0 -55
  121. package/apps/travel-chaos-organizer/frontend/components/QRCodeViewer.tsx +0 -80
  122. package/apps/travel-chaos-organizer/frontend/components/ScoreRing.tsx +0 -39
  123. package/apps/travel-chaos-organizer/frontend/components/Screen.tsx +0 -39
  124. package/apps/travel-chaos-organizer/frontend/components/Skeleton.tsx +0 -70
  125. package/apps/travel-chaos-organizer/frontend/components/SwipeableInboxItem.tsx +0 -121
  126. package/apps/travel-chaos-organizer/frontend/components/SwipeableTimelineItem.tsx +0 -70
  127. package/apps/travel-chaos-organizer/frontend/components/TimelineItem.tsx +0 -73
  128. package/apps/travel-chaos-organizer/frontend/components/TimelineItemDetail.tsx +0 -130
  129. package/apps/travel-chaos-organizer/frontend/components/Toast.tsx +0 -60
  130. package/apps/travel-chaos-organizer/frontend/components/ToastContext.tsx +0 -42
  131. package/apps/travel-chaos-organizer/frontend/components/TripCard.tsx +0 -146
  132. package/apps/travel-chaos-organizer/frontend/components/TripQRModal.tsx +0 -70
  133. package/apps/travel-chaos-organizer/frontend/components/UpgradeBanner.tsx +0 -44
  134. package/apps/travel-chaos-organizer/frontend/eas.json +0 -22
  135. package/apps/travel-chaos-organizer/frontend/hooks/useInbox.ts +0 -24
  136. package/apps/travel-chaos-organizer/frontend/hooks/useNetworkSync.ts +0 -60
  137. package/apps/travel-chaos-organizer/frontend/hooks/useTrips.ts +0 -112
  138. package/apps/travel-chaos-organizer/frontend/lib/api.ts +0 -223
  139. package/apps/travel-chaos-organizer/frontend/lib/auth.ts +0 -93
  140. package/apps/travel-chaos-organizer/frontend/lib/db.ts +0 -86
  141. package/apps/travel-chaos-organizer/frontend/lib/fileCache.ts +0 -54
  142. package/apps/travel-chaos-organizer/frontend/lib/haptics.ts +0 -13
  143. package/apps/travel-chaos-organizer/frontend/lib/notifications.ts +0 -112
  144. package/apps/travel-chaos-organizer/frontend/lib/offlineQueue.ts +0 -145
  145. package/apps/travel-chaos-organizer/frontend/lib/quota.tsx +0 -43
  146. package/apps/travel-chaos-organizer/frontend/lib/sentry.ts +0 -28
  147. package/apps/travel-chaos-organizer/frontend/lib/shareIntent.ts +0 -44
  148. package/apps/travel-chaos-organizer/frontend/package-lock.json +0 -13221
  149. package/apps/travel-chaos-organizer/frontend/package.json +0 -44
  150. package/apps/travel-chaos-organizer/frontend/tsconfig.json +0 -23
  151. package/apps/travel-chaos-organizer/keycloak/realm-export.json +0 -59
  152. package/apps/travel-chaos-organizer/landing/index.html +0 -773
  153. package/apps/travel-chaos-organizer/scripts/backup.sh +0 -14
  154. package/apps/travel-chaos-organizer/scripts/configure-env.sh +0 -82
  155. package/apps/travel-chaos-organizer/scripts/deploy.sh +0 -54
  156. package/apps/travel-chaos-organizer/scripts/health-check.sh +0 -36
  157. package/apps/travel-chaos-organizer/scripts/migrate.sh +0 -7
  158. package/apps/travel-chaos-organizer/scripts/server-setup.sh +0 -85
  159. package/apps/travel-chaos-organizer/scripts/smoke-test.sh +0 -29
  160. package/apps/travel-chaos-organizer/scripts/verify-tracking.sh +0 -71
  161. package/apps/travel-chaos-organizer/telegram-bot/.env.example +0 -3
  162. package/apps/travel-chaos-organizer/telegram-bot/Dockerfile +0 -6
  163. package/apps/travel-chaos-organizer/telegram-bot/bot.py +0 -504
  164. package/apps/travel-chaos-organizer/telegram-bot/requirements.txt +0 -3
  165. package/dist/src/__tests__/auth.test.d.ts +0 -1
  166. package/dist/src/__tests__/auth.test.js +0 -107
  167. package/dist/src/__tests__/auth.test.js.map +0 -1
  168. package/dist/src/__tests__/brain-flow.test.d.ts +0 -12
  169. package/dist/src/__tests__/brain-flow.test.js +0 -1241
  170. package/dist/src/__tests__/brain-flow.test.js.map +0 -1
  171. package/dist/src/__tests__/confidence.test.d.ts +0 -13
  172. package/dist/src/__tests__/confidence.test.js +0 -233
  173. package/dist/src/__tests__/confidence.test.js.map +0 -1
  174. package/dist/src/__tests__/e2e/api-auth.test.d.ts +0 -7
  175. package/dist/src/__tests__/e2e/api-auth.test.js +0 -162
  176. package/dist/src/__tests__/e2e/api-auth.test.js.map +0 -1
  177. package/dist/src/__tests__/e2e/api-health.test.d.ts +0 -7
  178. package/dist/src/__tests__/e2e/api-health.test.js +0 -95
  179. package/dist/src/__tests__/e2e/api-health.test.js.map +0 -1
  180. package/dist/src/__tests__/e2e/cli.test.d.ts +0 -10
  181. package/dist/src/__tests__/e2e/cli.test.js +0 -204
  182. package/dist/src/__tests__/e2e/cli.test.js.map +0 -1
  183. package/dist/src/__tests__/e2e/config.d.ts +0 -35
  184. package/dist/src/__tests__/e2e/config.js +0 -53
  185. package/dist/src/__tests__/e2e/config.js.map +0 -1
  186. package/dist/src/__tests__/e2e/funnel.test.d.ts +0 -13
  187. package/dist/src/__tests__/e2e/funnel.test.js +0 -90
  188. package/dist/src/__tests__/e2e/funnel.test.js.map +0 -1
  189. package/dist/src/__tests__/e2e/mcp-tools.test.d.ts +0 -7
  190. package/dist/src/__tests__/e2e/mcp-tools.test.js +0 -129
  191. package/dist/src/__tests__/e2e/mcp-tools.test.js.map +0 -1
  192. package/dist/src/__tests__/e2e/provisioning.test.d.ts +0 -15
  193. package/dist/src/__tests__/e2e/provisioning.test.js +0 -123
  194. package/dist/src/__tests__/e2e/provisioning.test.js.map +0 -1
  195. package/dist/src/__tests__/handlers-unit.test.d.ts +0 -12
  196. package/dist/src/__tests__/handlers-unit.test.js +0 -505
  197. package/dist/src/__tests__/handlers-unit.test.js.map +0 -1
  198. package/dist/src/__tests__/namespace.test.d.ts +0 -1
  199. package/dist/src/__tests__/namespace.test.js +0 -114
  200. package/dist/src/__tests__/namespace.test.js.map +0 -1
  201. package/dist/src/__tests__/rerank.test.d.ts +0 -1
  202. package/dist/src/__tests__/rerank.test.js +0 -125
  203. package/dist/src/__tests__/rerank.test.js.map +0 -1
  204. package/dist/src/__tests__/utils.test.d.ts +0 -1
  205. package/dist/src/__tests__/utils.test.js +0 -83
  206. package/dist/src/__tests__/utils.test.js.map +0 -1
  207. package/dist/src/bench/cachly-bench.d.ts +0 -39
  208. package/dist/src/bench/cachly-bench.js +0 -223
  209. package/dist/src/bench/cachly-bench.js.map +0 -1
  210. package/dist/src/bench/fixtures.d.ts +0 -37
  211. package/dist/src/bench/fixtures.js +0 -225
  212. package/dist/src/bench/fixtures.js.map +0 -1
  213. package/dist/src/search.test.d.ts +0 -1
  214. package/dist/src/search.test.js +0 -713
  215. package/dist/src/search.test.js.map +0 -1
  216. package/eslint.config.js +0 -16
  217. package/glama.json +0 -36
  218. package/llms.txt +0 -155
  219. package/packages/telegram-notify/SPLIT_PLAN.md +0 -106
  220. package/packages/telegram-notify/client.ts +0 -88
  221. package/packages/telegram-notify/emojis.json +0 -22
  222. package/packages/telegram-notify/pyproject.toml +0 -17
  223. package/packages/telegram-notify/telegram_notify/__init__.py +0 -3
  224. package/packages/telegram-notify/telegram_notify/client.py +0 -87
  225. package/packages/telegram-notify/telegram_notify/emojis.json +0 -22
  226. package/scripts/e2e-run.sh +0 -160
  227. package/scripts/generate-icons.js +0 -28
  228. package/smithery.yaml +0 -45
  229. package/src/__tests__/auth.test.ts +0 -147
  230. package/src/__tests__/brain-flow.test.ts +0 -1472
  231. package/src/__tests__/confidence.test.ts +0 -285
  232. package/src/__tests__/e2e/api-auth.test.ts +0 -182
  233. package/src/__tests__/e2e/api-health.test.ts +0 -103
  234. package/src/__tests__/e2e/cli.test.ts +0 -228
  235. package/src/__tests__/e2e/config.ts +0 -53
  236. package/src/__tests__/e2e/funnel.test.ts +0 -99
  237. package/src/__tests__/e2e/mcp-tools.test.ts +0 -191
  238. package/src/__tests__/e2e/provisioning.test.ts +0 -128
  239. package/src/__tests__/handlers-unit.test.ts +0 -677
  240. package/src/__tests__/namespace.test.ts +0 -126
  241. package/src/__tests__/rerank.test.ts +0 -141
  242. package/src/__tests__/utils.test.ts +0 -81
  243. package/src/auth.ts +0 -46
  244. package/src/bench/cachly-bench.ts +0 -263
  245. package/src/bench/fixtures.ts +0 -256
  246. package/src/ckg.ts +0 -103
  247. package/src/confidence.ts +0 -38
  248. package/src/embeddings.ts +0 -217
  249. package/src/handlers/advanced.ts +0 -647
  250. package/src/handlers/brain.ts +0 -2622
  251. package/src/handlers/cache.ts +0 -633
  252. package/src/handlers/context.ts +0 -222
  253. package/src/handlers/fedbrain.ts +0 -1232
  254. package/src/handlers/instances.ts +0 -180
  255. package/src/handlers/roadmap.ts +0 -201
  256. package/src/handlers/syndicate.ts +0 -460
  257. package/src/handlers/tco.ts +0 -345
  258. package/src/handlers/team.ts +0 -1249
  259. package/src/index.ts +0 -2815
  260. package/src/namespace.ts +0 -128
  261. package/src/notifier.ts +0 -5
  262. package/src/rerank.ts +0 -148
  263. package/src/search.test.ts +0 -848
  264. package/src/search.ts +0 -1781
  265. package/src/tools.ts +0 -2056
  266. package/src/utils.ts +0 -90
  267. package/test-features.cjs +0 -23
  268. package/tsconfig.json +0 -16
  269. package/vitest.config.ts +0 -14
@@ -1,45 +0,0 @@
1
- import React from "react";
2
- import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
3
- import { captureException } from "../lib/sentry";
4
-
5
- type State = { hasError: boolean; error: string | null };
6
-
7
- export class ErrorBoundary extends React.Component<
8
- { children: React.ReactNode },
9
- State
10
- > {
11
- state: State = { hasError: false, error: null };
12
-
13
- static getDerivedStateFromError(err: Error): State {
14
- return { hasError: true, error: err.message };
15
- }
16
-
17
- componentDidCatch(err: Error) {
18
- captureException(err);
19
- }
20
-
21
- reset = () => this.setState({ hasError: false, error: null });
22
-
23
- render() {
24
- if (!this.state.hasError) return this.props.children;
25
- return (
26
- <View style={s.container}>
27
- <Text style={s.icon}>⚠️</Text>
28
- <Text style={s.title}>Etwas ist schiefgelaufen</Text>
29
- <Text style={s.msg}>{this.state.error ?? "Unbekannter Fehler"}</Text>
30
- <TouchableOpacity style={s.btn} onPress={this.reset} activeOpacity={0.8}>
31
- <Text style={s.btnText}>Neu laden</Text>
32
- </TouchableOpacity>
33
- </View>
34
- );
35
- }
36
- }
37
-
38
- const s = StyleSheet.create({
39
- container: { flex: 1, backgroundColor: "#0f0f1a", justifyContent: "center", alignItems: "center", padding: 32 },
40
- icon: { fontSize: 48, marginBottom: 16 },
41
- title: { fontSize: 20, fontWeight: "800", color: "#fff", marginBottom: 8, textAlign: "center" },
42
- msg: { fontSize: 13, color: "#6666aa", textAlign: "center", marginBottom: 32, lineHeight: 20 },
43
- btn: { backgroundColor: "#4f46e5", paddingVertical: 14, paddingHorizontal: 32, borderRadius: 12 },
44
- btnText: { color: "#fff", fontWeight: "700", fontSize: 15 },
45
- });
@@ -1,19 +0,0 @@
1
- import { StyleSheet, Text, TouchableOpacity } from "react-native";
2
-
3
- type Props = { icon: string; label: string; onPress: () => void; disabled?: boolean };
4
-
5
- export default function FileUploadButton({ icon, label, onPress, disabled }: Props) {
6
- return (
7
- <TouchableOpacity style={[s.btn, disabled && s.btnDisabled]} onPress={onPress} disabled={disabled} activeOpacity={0.8}>
8
- <Text style={s.icon}>{icon}</Text>
9
- <Text style={s.label}>{label}</Text>
10
- </TouchableOpacity>
11
- );
12
- }
13
-
14
- const s = StyleSheet.create({
15
- btn: { flex: 1, flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 6, backgroundColor: "#0f0f1a", borderRadius: 12, paddingVertical: 12, borderWidth: 1, borderColor: "#2a2a4e" },
16
- btnDisabled: { opacity: 0.4 },
17
- icon: { fontSize: 18 },
18
- label: { color: "#a5b4fc", fontSize: 14, fontWeight: "500" },
19
- });
@@ -1,155 +0,0 @@
1
- /**
2
- * In-app text/email import — paste booking text or email body directly.
3
- * Calls /parse/text → saves to inbox or a specific trip.
4
- * Sits above the upload bar in the trip detail and as a standalone entry point.
5
- */
6
- import { useState } from "react";
7
- import {
8
- ActivityIndicator,
9
- StyleSheet, Text, TextInput, TouchableOpacity, View,
10
- } from "react-native";
11
- import BottomSheet from "./BottomSheet";
12
- import { ApiError, mailApi } from "../lib/api";
13
- import { haptics } from "../lib/haptics";
14
- import { useToast } from "./ToastContext";
15
-
16
- type Props = {
17
- visible: boolean;
18
- onClose: () => void;
19
- /** If provided, parse result goes directly to this trip. Otherwise → inbox. */
20
- tripId?: string;
21
- onSuccess: () => void;
22
- };
23
-
24
- export default function ImportSheet({ visible, onClose, tripId, onSuccess }: Props) {
25
- const { showToast } = useToast();
26
- const [text, setText] = useState("");
27
- const [loading, setLoading] = useState(false);
28
- const [error, setError] = useState<string | null>(null);
29
-
30
- async function submit() {
31
- if (!text.trim()) return;
32
- setLoading(true);
33
- setError(null);
34
- await haptics.confirm();
35
-
36
- try {
37
- await mailApi.import(text.trim(), tripId);
38
- await haptics.success();
39
- setText("");
40
- onClose();
41
- onSuccess();
42
- showToast("Dokument erfolgreich importiert", "success");
43
- } catch (err) {
44
- await haptics.error();
45
- if (err instanceof ApiError && err.status === 429) {
46
- showToast("Tageslimit erreicht (50 Parses/Tag). Upgrade auf Pro.", "warning");
47
- } else if (err instanceof ApiError && err.status === 408) {
48
- showToast("Timeout — Ollama antwortet nicht. Bitte warte und versuche es erneut.", "error");
49
- } else {
50
- setError(err instanceof Error ? err.message : "Unbekannter Fehler");
51
- }
52
- } finally {
53
- setLoading(false);
54
- }
55
- }
56
-
57
- function handleClose() {
58
- setText("");
59
- setError(null);
60
- onClose();
61
- }
62
-
63
- return (
64
- <BottomSheet visible={visible} onClose={handleClose} heightFraction={0.75} hasInputs>
65
- <View style={{ flex: 1 }}>
66
- <Text style={s.title}>Text / E-Mail importieren</Text>
67
- <Text style={s.subtitle}>
68
- {tripId
69
- ? "Buchungsbestätigung, E-Mail-Text oder Ticketinhalt einfügen."
70
- : "Inhalt wird in den Chaos Inbox importiert. E-Mail-Header werden automatisch entfernt."}
71
- </Text>
72
-
73
- <TextInput
74
- style={s.input}
75
- placeholder={"Buchungsbestätigung, weitergeleitete E-Mail oder Tickettext hier einfügen…"}
76
- placeholderTextColor="#4a4a7a"
77
- value={text}
78
- onChangeText={setText}
79
- multiline
80
- numberOfLines={8}
81
- autoFocus
82
- textAlignVertical="top"
83
- accessibilityLabel="Buchungstext eingeben"
84
- />
85
-
86
- {error && (
87
- <View style={s.errorBox}>
88
- <Text style={s.errorText}>⚠️ {error}</Text>
89
- </View>
90
- )}
91
-
92
- <View style={s.buttons}>
93
- <TouchableOpacity
94
- style={s.cancelBtn}
95
- onPress={handleClose}
96
- accessibilityRole="button"
97
- accessibilityLabel="Abbrechen"
98
- >
99
- <Text style={s.cancelText}>Abbrechen</Text>
100
- </TouchableOpacity>
101
- <TouchableOpacity
102
- style={[s.submitBtn, (!text.trim() || loading) && s.submitDisabled]}
103
- onPress={submit}
104
- disabled={loading || !text.trim()}
105
- accessibilityRole="button"
106
- accessibilityLabel="Text mit Ollama analysieren"
107
- >
108
- {loading
109
- ? <ActivityIndicator color="#fff" size="small" />
110
- : <Text style={s.submitText}>Analysieren ✨</Text>}
111
- </TouchableOpacity>
112
- </View>
113
- </View>
114
- </BottomSheet>
115
- );
116
- }
117
-
118
- const s = StyleSheet.create({
119
- title: { fontSize: 18, fontWeight: "700", color: "#fff", marginBottom: 4 },
120
- subtitle: { fontSize: 13, color: "#6666aa", marginBottom: 12, lineHeight: 18 },
121
- input: {
122
- flex: 1,
123
- backgroundColor: "#0f0f1a",
124
- borderRadius: 12,
125
- padding: 14,
126
- color: "#fff",
127
- fontSize: 14,
128
- lineHeight: 20,
129
- borderWidth: 1,
130
- borderColor: "#2a2a4e",
131
- marginBottom: 12,
132
- minHeight: 120,
133
- },
134
- errorBox: {
135
- backgroundColor: "#ff6b6b18",
136
- borderRadius: 10,
137
- padding: 10,
138
- marginBottom: 10,
139
- borderWidth: 1,
140
- borderColor: "#ff6b6b33",
141
- },
142
- errorText: { color: "#ff8888", fontSize: 13 },
143
- buttons: { flexDirection: "row", gap: 12, justifyContent: "flex-end" },
144
- cancelBtn: {
145
- paddingVertical: 12, paddingHorizontal: 20,
146
- borderRadius: 10, borderWidth: 1, borderColor: "#2a2a4e",
147
- },
148
- cancelText: { color: "#8888aa", fontSize: 15 },
149
- submitBtn: {
150
- flex: 1, paddingVertical: 14, borderRadius: 12,
151
- backgroundColor: "#4f46e5", alignItems: "center",
152
- },
153
- submitDisabled: { opacity: 0.45 },
154
- submitText: { color: "#fff", fontWeight: "700", fontSize: 15 },
155
- });
@@ -1,55 +0,0 @@
1
- import { useEffect, useRef, useState } from "react";
2
- import { Animated, AppState, AppStateStatus, StyleSheet, Text } from "react-native";
3
- import * as Network from "expo-network";
4
-
5
- export default function OfflineBadge() {
6
- const [offline, setOffline] = useState(false);
7
- const opacity = useState(new Animated.Value(0))[0];
8
- const appState = useRef<AppStateStatus>(AppState.currentState);
9
-
10
- useEffect(() => {
11
- let mounted = true;
12
-
13
- async function check() {
14
- const net = await Network.getNetworkStateAsync();
15
- if (!mounted) return;
16
- const isOffline = !net.isConnected;
17
- setOffline(isOffline);
18
- Animated.timing(opacity, {
19
- toValue: isOffline ? 1 : 0,
20
- duration: 300,
21
- useNativeDriver: true,
22
- }).start();
23
- }
24
-
25
- check();
26
- // Re-check when app returns to foreground, fall back to 30s interval
27
- const appStateSub = AppState.addEventListener("change", (next) => {
28
- if (appState.current.match(/inactive|background/) && next === "active") {
29
- check();
30
- }
31
- appState.current = next;
32
- });
33
- const interval = setInterval(check, 30_000);
34
- return () => { mounted = false; appStateSub.remove(); clearInterval(interval); };
35
- }, []);
36
-
37
- if (!offline) return null;
38
-
39
- return (
40
- <Animated.View style={[s.badge, { opacity }]}>
41
- <Text style={s.text}>⚡ Offline — gespeicherte Daten</Text>
42
- </Animated.View>
43
- );
44
- }
45
-
46
- const s = StyleSheet.create({
47
- badge: {
48
- backgroundColor: "#7c3aed33",
49
- borderBottomWidth: 1,
50
- borderBottomColor: "#7c3aed55",
51
- paddingVertical: 6,
52
- alignItems: "center",
53
- },
54
- text: { color: "#c4b5fd", fontSize: 12, fontWeight: "500" },
55
- });
@@ -1,80 +0,0 @@
1
- /**
2
- * Shows a QR code for a booking reference — works fully offline.
3
- * Uses the booking_ref string to generate the QR locally (no network call).
4
- * Install: npm install react-native-qrcode-svg react-native-svg
5
- */
6
- import { ActivityIndicator, Modal, StyleSheet, Text, TouchableOpacity, View } from "react-native";
7
- import { useEffect, useState } from "react";
8
- // @ts-ignore — added in Phase 3 deps
9
- import QRCode from "react-native-qrcode-svg";
10
-
11
- type Props = { bookingRef: string; title?: string };
12
-
13
- export default function QRCodeViewer({ bookingRef, title }: Props) {
14
- const [visible, setVisible] = useState(false);
15
- const [qrReady, setQrReady] = useState(false);
16
-
17
- useEffect(() => {
18
- if (visible) {
19
- const id = requestAnimationFrame(() => setQrReady(true));
20
- return () => { cancelAnimationFrame(id); setQrReady(false); };
21
- } else {
22
- setQrReady(false);
23
- }
24
- }, [visible]);
25
-
26
- return (
27
- <>
28
- <TouchableOpacity style={s.trigger} onPress={() => setVisible(true)}>
29
- <Text style={s.triggerText}>QR · {bookingRef}</Text>
30
- </TouchableOpacity>
31
-
32
- <Modal visible={visible} transparent animationType="fade">
33
- <TouchableOpacity style={s.backdrop} activeOpacity={1} onPress={() => setVisible(false)}>
34
- <View style={s.card}>
35
- <Text style={s.cardTitle}>{title ?? bookingRef}</Text>
36
- <View style={s.qr}>
37
- {qrReady
38
- ? <QRCode value={bookingRef} size={220} backgroundColor="#fff" color="#0f0f1a" />
39
- : <ActivityIndicator color="#4f46e5" size="large" style={{ width: 220, height: 220 }} />}
40
- </View>
41
- <Text style={s.ref}>{bookingRef}</Text>
42
- <Text style={s.hint}>Antippen zum Schließen</Text>
43
- </View>
44
- </TouchableOpacity>
45
- </Modal>
46
- </>
47
- );
48
- }
49
-
50
- const s = StyleSheet.create({
51
- trigger: {
52
- backgroundColor: "#0f0f1a",
53
- borderRadius: 6,
54
- paddingHorizontal: 10,
55
- paddingVertical: 4,
56
- borderWidth: 1,
57
- borderColor: "#4f46e555",
58
- alignSelf: "flex-start",
59
- },
60
- triggerText: { color: "#a5b4fc", fontSize: 12, fontWeight: "500" },
61
- backdrop: {
62
- flex: 1,
63
- backgroundColor: "#000000cc",
64
- alignItems: "center",
65
- justifyContent: "center",
66
- },
67
- card: {
68
- backgroundColor: "#1a1a2e",
69
- borderRadius: 24,
70
- padding: 32,
71
- alignItems: "center",
72
- gap: 16,
73
- borderWidth: 1,
74
- borderColor: "#2a2a4e",
75
- },
76
- cardTitle: { color: "#fff", fontSize: 16, fontWeight: "700" },
77
- qr: { backgroundColor: "#fff", padding: 16, borderRadius: 12 },
78
- ref: { color: "#6666aa", fontSize: 13, letterSpacing: 1 },
79
- hint: { color: "#3a3a5e", fontSize: 12 },
80
- });
@@ -1,39 +0,0 @@
1
- import { View, Text, StyleSheet } from "react-native";
2
- // @ts-ignore — react-native-svg is a peer dep of react-native-qrcode-svg
3
- import Svg, { Circle } from "react-native-svg";
4
-
5
- type Props = { score: number; size?: number };
6
-
7
- export default function ScoreRing({ score, size = 40 }: Props) {
8
- const stroke = 3;
9
- const radius = (size - stroke) / 2;
10
- const circumference = 2 * Math.PI * radius;
11
- const filled = (score / 100) * circumference;
12
- const gap = circumference - filled;
13
-
14
- const color = score === 100 ? "#10b981" : score >= 50 ? "#4f46e5" : "#3a3a5e";
15
-
16
- return (
17
- <View style={[s.wrap, { width: size, height: size }]}>
18
- <Svg width={size} height={size}>
19
- <Circle
20
- cx={size / 2} cy={size / 2} r={radius}
21
- stroke="#2a2a4e" strokeWidth={stroke} fill="none"
22
- />
23
- <Circle
24
- cx={size / 2} cy={size / 2} r={radius}
25
- stroke={color} strokeWidth={stroke} fill="none"
26
- strokeDasharray={`${filled} ${gap}`}
27
- strokeLinecap="round"
28
- transform={`rotate(-90 ${size / 2} ${size / 2})`}
29
- />
30
- </Svg>
31
- <Text style={[s.label, { color }]}>{score}</Text>
32
- </View>
33
- );
34
- }
35
-
36
- const s = StyleSheet.create({
37
- wrap: { alignItems: "center", justifyContent: "center", position: "relative" },
38
- label: { position: "absolute", fontSize: 10, fontWeight: "700" },
39
- });
@@ -1,39 +0,0 @@
1
- /**
2
- * Mobile-first layout wrapper.
3
- * - Handles safe areas (notch, Dynamic Island, home indicator)
4
- * - Sets dark status bar across all screens
5
- * - Provides consistent screen-level padding
6
- */
7
- import { ReactNode } from "react";
8
- import { Platform, StatusBar, StyleSheet, View } from "react-native";
9
- import { useSafeAreaInsets } from "react-native-safe-area-context";
10
-
11
- type Props = {
12
- children: ReactNode;
13
- noPadding?: boolean;
14
- };
15
-
16
- export default function Screen({ children, noPadding }: Props) {
17
- const insets = useSafeAreaInsets();
18
-
19
- return (
20
- <View
21
- style={[
22
- s.container,
23
- !noPadding && {
24
- paddingTop: insets.top,
25
- paddingBottom: insets.bottom,
26
- paddingLeft: insets.left,
27
- paddingRight: insets.right,
28
- },
29
- ]}
30
- >
31
- <StatusBar barStyle="light-content" backgroundColor="#0f0f1a" />
32
- {children}
33
- </View>
34
- );
35
- }
36
-
37
- const s = StyleSheet.create({
38
- container: { flex: 1, backgroundColor: "#0f0f1a" },
39
- });
@@ -1,70 +0,0 @@
1
- /**
2
- * Skeleton loader — animated shimmer placeholder while data loads.
3
- * Mirrors the shape of TripCard and TimelineItem so there's no layout jump.
4
- */
5
- import { useEffect, useRef } from "react";
6
- import { Animated, StyleSheet, View } from "react-native";
7
-
8
- function ShimmerBar({ width, height = 14, style }: { width: number | `${number}%`; height?: number; style?: object }) {
9
- const anim = useRef(new Animated.Value(0.3)).current;
10
-
11
- useEffect(() => {
12
- Animated.loop(
13
- Animated.sequence([
14
- Animated.timing(anim, { toValue: 1, duration: 900, useNativeDriver: true }),
15
- Animated.timing(anim, { toValue: 0.3, duration: 900, useNativeDriver: true }),
16
- ])
17
- ).start();
18
- }, []);
19
-
20
- return (
21
- <Animated.View
22
- style={[{ width, height, borderRadius: 6, backgroundColor: "#2a2a4e", opacity: anim }, style]}
23
- />
24
- );
25
- }
26
-
27
- export function TripCardSkeleton() {
28
- return (
29
- <View style={s.card}>
30
- <View style={s.row}>
31
- <View style={{ flex: 1, gap: 8 }}>
32
- <ShimmerBar width="70%" height={16} />
33
- <ShimmerBar width="45%" height={12} />
34
- </View>
35
- <ShimmerBar width={52} height={22} style={{ borderRadius: 6 }} />
36
- </View>
37
- </View>
38
- );
39
- }
40
-
41
- export function TimelineItemSkeleton() {
42
- return (
43
- <View style={s.timelineRow}>
44
- <View style={s.line}>
45
- <ShimmerBar width={12} height={12} style={{ borderRadius: 6 }} />
46
- </View>
47
- <View style={s.timelineCard}>
48
- <View style={s.row}>
49
- <ShimmerBar width={28} height={28} style={{ borderRadius: 6 }} />
50
- <View style={{ flex: 1, gap: 6 }}>
51
- <ShimmerBar width="65%" height={14} />
52
- <ShimmerBar width="40%" height={11} />
53
- </View>
54
- </View>
55
- <View style={{ flexDirection: "row", gap: 8, marginTop: 4 }}>
56
- <ShimmerBar width={80} height={22} />
57
- <ShimmerBar width={70} height={22} />
58
- </View>
59
- </View>
60
- </View>
61
- );
62
- }
63
-
64
- const s = StyleSheet.create({
65
- card: { backgroundColor: "#1a1a2e", borderRadius: 16, padding: 18, borderWidth: 1, borderColor: "#2a2a4e", gap: 10 },
66
- row: { flexDirection: "row", alignItems: "center", gap: 12 },
67
- timelineRow: { flexDirection: "row", gap: 12, paddingBottom: 2 },
68
- line: { alignItems: "center", width: 24, paddingTop: 18 },
69
- timelineCard: { flex: 1, backgroundColor: "#1a1a2e", borderRadius: 14, padding: 14, marginBottom: 8, borderWidth: 1, borderColor: "#2a2a4e", gap: 10 },
70
- });
@@ -1,121 +0,0 @@
1
- /**
2
- * Swipeable inbox row — swipe left to reject, swipe right to assign.
3
- * Uses Animated + PanResponder (no extra library needed).
4
- * Minimum touch target: 48pt (Apple HIG / Material spec).
5
- */
6
- import { useRef } from "react";
7
- import {
8
- Animated, PanResponder, StyleSheet, Text, TouchableOpacity, View,
9
- } from "react-native";
10
- import { InboxItem } from "../lib/api";
11
- import { haptics } from "../lib/haptics";
12
-
13
- const SWIPE_THRESHOLD = 80;
14
- const ACTION_WIDTH = 72;
15
-
16
- type Props = {
17
- item: InboxItem;
18
- onAssign: () => void;
19
- onReject: () => void;
20
- };
21
-
22
- export default function SwipeableInboxItem({ item, onAssign, onReject }: Props) {
23
- const translateX = useRef(new Animated.Value(0)).current;
24
- const parsed = item.parsed_data as Record<string, unknown> | null;
25
-
26
- const panResponder = useRef(
27
- PanResponder.create({
28
- onMoveShouldSetPanResponder: (_, g) => Math.abs(g.dx) > 8 && Math.abs(g.dy) < 20,
29
- onPanResponderMove: (_, g) => {
30
- translateX.setValue(Math.max(-ACTION_WIDTH * 1.5, Math.min(ACTION_WIDTH * 1.5, g.dx)));
31
- },
32
- onPanResponderRelease: async (_, g) => {
33
- if (g.dx > SWIPE_THRESHOLD) {
34
- await haptics.confirm();
35
- snapBack();
36
- onAssign();
37
- } else if (g.dx < -SWIPE_THRESHOLD) {
38
- await haptics.warning();
39
- snapBack();
40
- onReject();
41
- } else {
42
- snapBack();
43
- }
44
- },
45
- })
46
- ).current;
47
-
48
- function snapBack() {
49
- Animated.spring(translateX, { toValue: 0, useNativeDriver: true, damping: 15 }).start();
50
- }
51
-
52
- return (
53
- <View style={s.wrapper}>
54
- {/* Left action — assign (revealed by swipe right) */}
55
- <View style={[s.action, s.actionAssign]}>
56
- <Text style={s.actionIcon}>✅</Text>
57
- <Text style={s.actionLabel}>Zuweisen</Text>
58
- </View>
59
-
60
- {/* Right action — reject (revealed by swipe left) */}
61
- <View style={[s.action, s.actionReject]}>
62
- <Text style={s.actionIcon}>🗑️</Text>
63
- <Text style={s.actionLabel}>Ablehnen</Text>
64
- </View>
65
-
66
- {/* Card row */}
67
- <Animated.View style={[s.card, { transform: [{ translateX }] }]} {...panResponder.panHandlers}>
68
- <View style={s.typeCol}>
69
- <Text style={s.typeIcon}>{typeIcon(parsed?.type as string)}</Text>
70
- </View>
71
-
72
- <View style={s.content}>
73
- <Text style={s.title} numberOfLines={1}>
74
- {(parsed?.title as string) ?? "Unbekanntes Dokument"}
75
- </Text>
76
- <Text style={s.sub} numberOfLines={1}>
77
- {(parsed?.provider as string) ?? (item.source ?? "Unbekannte Quelle")}
78
- {parsed?.booking_ref ? ` · #${parsed.booking_ref}` : ""}
79
- </Text>
80
- {!!parsed?.raw_summary && (
81
- <Text style={s.summary} numberOfLines={2}>{parsed.raw_summary as string}</Text>
82
- )}
83
- </View>
84
-
85
- {/* Explicit buttons as fallback for non-swipe users */}
86
- <View style={s.actions}>
87
- <TouchableOpacity style={s.btn} onPress={onAssign} hitSlop={{ top: 12, bottom: 12, left: 8, right: 8 }} accessibilityLabel="Zuweisen" accessibilityRole="button">
88
- <Text style={s.btnText}>→</Text>
89
- </TouchableOpacity>
90
- <TouchableOpacity style={[s.btn, s.btnDanger]} onPress={onReject} hitSlop={{ top: 12, bottom: 12, left: 8, right: 8 }} accessibilityLabel="Ablehnen" accessibilityRole="button">
91
- <Text style={s.btnText}>✕</Text>
92
- </TouchableOpacity>
93
- </View>
94
- </Animated.View>
95
- </View>
96
- );
97
- }
98
-
99
- function typeIcon(type?: string): string {
100
- return ({ flight: "✈️", train: "🚂", bus: "🚌", hotel: "🏨", rental_car: "🚗", activity: "🎡", transfer: "🚕", document: "📄" } as Record<string, string>)[type ?? ""] ?? "📋";
101
- }
102
-
103
- const s = StyleSheet.create({
104
- wrapper: { position: "relative", marginBottom: 10 },
105
- action: { position: "absolute", top: 0, bottom: 0, width: ACTION_WIDTH, alignItems: "center", justifyContent: "center", borderRadius: 16, gap: 4 },
106
- actionAssign: { left: 0, backgroundColor: "#16a34a33" },
107
- actionReject: { right: 0, backgroundColor: "#dc262633" },
108
- actionIcon: { fontSize: 22 },
109
- actionLabel: { color: "#fff", fontSize: 11, fontWeight: "600" },
110
- card: { backgroundColor: "#1a1a2e", borderRadius: 16, padding: 14, flexDirection: "row", alignItems: "center", gap: 12, borderWidth: 1, borderColor: "#2a2a4e", minHeight: 72 },
111
- typeCol: { width: 36, alignItems: "center" },
112
- typeIcon: { fontSize: 26 },
113
- content: { flex: 1, gap: 3 },
114
- title: { color: "#fff", fontSize: 15, fontWeight: "600" },
115
- sub: { color: "#6666aa", fontSize: 12 },
116
- summary: { color: "#8888aa", fontSize: 12, lineHeight: 17, marginTop: 2 },
117
- actions: { gap: 6 },
118
- btn: { width: 36, height: 36, borderRadius: 10, backgroundColor: "#2a2a4e", alignItems: "center", justifyContent: "center" },
119
- btnDanger: { backgroundColor: "#3a1a1a" },
120
- btnText: { color: "#fff", fontSize: 16 },
121
- });