@cachly-dev/mcp-server 0.10.56 → 0.10.58
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.
- package/.github/workflows/eas-build-android.yml +58 -0
- package/.github/workflows/eas-update.yml +55 -0
- package/.github/workflows/publish.yml +2 -2
- package/BENCH.md +91 -0
- package/CHANGELOG.md +44 -0
- package/README.md +6 -34
- package/STRATEGY.md +228 -0
- package/apps/travel-chaos-organizer/.env.example +49 -0
- package/apps/travel-chaos-organizer/DEPLOY.md +328 -0
- package/apps/travel-chaos-organizer/Makefile +57 -0
- package/apps/travel-chaos-organizer/README.md +159 -0
- package/apps/travel-chaos-organizer/backend/.env.example +10 -0
- package/apps/travel-chaos-organizer/backend/Dockerfile +25 -0
- package/apps/travel-chaos-organizer/backend/alembic/env.py +56 -0
- package/apps/travel-chaos-organizer/backend/alembic/script.py.mako +24 -0
- package/apps/travel-chaos-organizer/backend/alembic/versions/.gitkeep +0 -0
- package/apps/travel-chaos-organizer/backend/alembic/versions/0001_stripe_customer_id.py +24 -0
- package/apps/travel-chaos-organizer/backend/alembic/versions/0002_telegram_chat_id.py +24 -0
- package/apps/travel-chaos-organizer/backend/alembic.ini +39 -0
- package/apps/travel-chaos-organizer/backend/app/__init__.py +0 -0
- package/apps/travel-chaos-organizer/backend/app/auth/__init__.py +0 -0
- package/apps/travel-chaos-organizer/backend/app/auth/keycloak.py +81 -0
- package/apps/travel-chaos-organizer/backend/app/config.py +66 -0
- package/apps/travel-chaos-organizer/backend/app/db/__init__.py +0 -0
- package/apps/travel-chaos-organizer/backend/app/db/database.py +20 -0
- package/apps/travel-chaos-organizer/backend/app/db/migrations/001_init.sql +71 -0
- package/apps/travel-chaos-organizer/backend/app/db/migrations/002_telemetry_freemium.sql +31 -0
- package/apps/travel-chaos-organizer/backend/app/db/migrations/003_telegram_chat_id.sql +4 -0
- package/apps/travel-chaos-organizer/backend/app/db/migrations/004_stripe_and_email.sql +5 -0
- package/apps/travel-chaos-organizer/backend/app/limiter.py +4 -0
- package/apps/travel-chaos-organizer/backend/app/logging_config.py +25 -0
- package/apps/travel-chaos-organizer/backend/app/main.py +77 -0
- package/apps/travel-chaos-organizer/backend/app/models/__init__.py +0 -0
- package/apps/travel-chaos-organizer/backend/app/models/schemas.py +142 -0
- package/apps/travel-chaos-organizer/backend/app/routers/__init__.py +0 -0
- package/apps/travel-chaos-organizer/backend/app/routers/admin.py +237 -0
- package/apps/travel-chaos-organizer/backend/app/routers/cache.py +13 -0
- package/apps/travel-chaos-organizer/backend/app/routers/events.py +29 -0
- package/apps/travel-chaos-organizer/backend/app/routers/export.py +122 -0
- package/apps/travel-chaos-organizer/backend/app/routers/inbox.py +122 -0
- package/apps/travel-chaos-organizer/backend/app/routers/items.py +130 -0
- package/apps/travel-chaos-organizer/backend/app/routers/mail.py +108 -0
- package/apps/travel-chaos-organizer/backend/app/routers/parse.py +303 -0
- package/apps/travel-chaos-organizer/backend/app/routers/payments.py +179 -0
- package/apps/travel-chaos-organizer/backend/app/routers/trips.py +134 -0
- package/apps/travel-chaos-organizer/backend/app/routers/users.py +169 -0
- package/apps/travel-chaos-organizer/backend/app/routers/waitlist.py +37 -0
- package/apps/travel-chaos-organizer/backend/app/services/__init__.py +0 -0
- package/apps/travel-chaos-organizer/backend/app/services/cache.py +131 -0
- package/apps/travel-chaos-organizer/backend/app/services/drip.py +128 -0
- package/apps/travel-chaos-organizer/backend/app/services/email.py +61 -0
- package/apps/travel-chaos-organizer/backend/app/services/errors.py +44 -0
- package/apps/travel-chaos-organizer/backend/app/services/notifier.py +10 -0
- package/apps/travel-chaos-organizer/backend/app/services/ollama.py +101 -0
- package/apps/travel-chaos-organizer/backend/app/services/parser.py +22 -0
- package/apps/travel-chaos-organizer/backend/app/services/quota.py +85 -0
- package/apps/travel-chaos-organizer/backend/app/services/sentry.py +11 -0
- package/apps/travel-chaos-organizer/backend/app/services/telemetry.py +35 -0
- package/apps/travel-chaos-organizer/backend/pytest.ini +4 -0
- package/apps/travel-chaos-organizer/backend/requirements-dev.txt +6 -0
- package/apps/travel-chaos-organizer/backend/requirements.txt +25 -0
- package/apps/travel-chaos-organizer/backend/tests/__init__.py +0 -0
- package/apps/travel-chaos-organizer/backend/tests/conftest.py +223 -0
- package/apps/travel-chaos-organizer/backend/tests/test_admin.py +99 -0
- package/apps/travel-chaos-organizer/backend/tests/test_cache.py +142 -0
- package/apps/travel-chaos-organizer/backend/tests/test_drip.py +32 -0
- package/apps/travel-chaos-organizer/backend/tests/test_e2e_chain.py +121 -0
- package/apps/travel-chaos-organizer/backend/tests/test_export.py +48 -0
- package/apps/travel-chaos-organizer/backend/tests/test_inbox.py +107 -0
- package/apps/travel-chaos-organizer/backend/tests/test_items.py +138 -0
- package/apps/travel-chaos-organizer/backend/tests/test_mail.py +113 -0
- package/apps/travel-chaos-organizer/backend/tests/test_ollama.py +145 -0
- package/apps/travel-chaos-organizer/backend/tests/test_parse_url.py +98 -0
- package/apps/travel-chaos-organizer/backend/tests/test_parser.py +72 -0
- package/apps/travel-chaos-organizer/backend/tests/test_payments.py +163 -0
- package/apps/travel-chaos-organizer/backend/tests/test_quota.py +46 -0
- package/apps/travel-chaos-organizer/backend/tests/test_search.py +67 -0
- package/apps/travel-chaos-organizer/backend/tests/test_trips.py +123 -0
- package/apps/travel-chaos-organizer/backend/tests/test_users.py +52 -0
- package/apps/travel-chaos-organizer/backups/.gitkeep +0 -0
- package/apps/travel-chaos-organizer/caddy/Caddyfile +27 -0
- package/apps/travel-chaos-organizer/docker-compose.node1.yml +31 -0
- package/apps/travel-chaos-organizer/docker-compose.override.yml +14 -0
- package/apps/travel-chaos-organizer/docker-compose.yml +128 -0
- package/apps/travel-chaos-organizer/frontend/.env.example +13 -0
- package/apps/travel-chaos-organizer/frontend/app/(app)/_layout.tsx +80 -0
- package/apps/travel-chaos-organizer/frontend/app/(app)/inbox.tsx +166 -0
- package/apps/travel-chaos-organizer/frontend/app/(app)/search.tsx +130 -0
- package/apps/travel-chaos-organizer/frontend/app/(app)/settings.tsx +381 -0
- package/apps/travel-chaos-organizer/frontend/app/(app)/trips/[id].tsx +346 -0
- package/apps/travel-chaos-organizer/frontend/app/(app)/trips.tsx +363 -0
- package/apps/travel-chaos-organizer/frontend/app/(app)/upgrade/cancel.tsx +34 -0
- package/apps/travel-chaos-organizer/frontend/app/(app)/upgrade/success.tsx +35 -0
- package/apps/travel-chaos-organizer/frontend/app/(auth)/login.tsx +91 -0
- package/apps/travel-chaos-organizer/frontend/app/_layout.tsx +71 -0
- package/apps/travel-chaos-organizer/frontend/app/auth.tsx +29 -0
- package/apps/travel-chaos-organizer/frontend/app/index.tsx +16 -0
- package/apps/travel-chaos-organizer/frontend/app/onboarding.tsx +119 -0
- package/apps/travel-chaos-organizer/frontend/app.config.ts +54 -0
- package/apps/travel-chaos-organizer/frontend/assets/adaptive-icon.svg +66 -0
- package/apps/travel-chaos-organizer/frontend/assets/icon.svg +79 -0
- package/apps/travel-chaos-organizer/frontend/assets/splash.svg +15 -0
- package/apps/travel-chaos-organizer/frontend/components/BottomSheet.tsx +102 -0
- package/apps/travel-chaos-organizer/frontend/components/ConfettiCannon.tsx +107 -0
- package/apps/travel-chaos-organizer/frontend/components/ConfirmDialog.tsx +109 -0
- package/apps/travel-chaos-organizer/frontend/components/ErrorBoundary.tsx +45 -0
- package/apps/travel-chaos-organizer/frontend/components/FileUploadButton.tsx +19 -0
- package/apps/travel-chaos-organizer/frontend/components/ImportSheet.tsx +155 -0
- package/apps/travel-chaos-organizer/frontend/components/OfflineBadge.tsx +55 -0
- package/apps/travel-chaos-organizer/frontend/components/QRCodeViewer.tsx +80 -0
- package/apps/travel-chaos-organizer/frontend/components/ScoreRing.tsx +39 -0
- package/apps/travel-chaos-organizer/frontend/components/Screen.tsx +39 -0
- package/apps/travel-chaos-organizer/frontend/components/Skeleton.tsx +70 -0
- package/apps/travel-chaos-organizer/frontend/components/SwipeableInboxItem.tsx +121 -0
- package/apps/travel-chaos-organizer/frontend/components/SwipeableTimelineItem.tsx +70 -0
- package/apps/travel-chaos-organizer/frontend/components/TimelineItem.tsx +73 -0
- package/apps/travel-chaos-organizer/frontend/components/TimelineItemDetail.tsx +130 -0
- package/apps/travel-chaos-organizer/frontend/components/Toast.tsx +60 -0
- package/apps/travel-chaos-organizer/frontend/components/ToastContext.tsx +42 -0
- package/apps/travel-chaos-organizer/frontend/components/TripCard.tsx +146 -0
- package/apps/travel-chaos-organizer/frontend/components/TripQRModal.tsx +70 -0
- package/apps/travel-chaos-organizer/frontend/components/UpgradeBanner.tsx +44 -0
- package/apps/travel-chaos-organizer/frontend/eas.json +22 -0
- package/apps/travel-chaos-organizer/frontend/hooks/useInbox.ts +24 -0
- package/apps/travel-chaos-organizer/frontend/hooks/useNetworkSync.ts +60 -0
- package/apps/travel-chaos-organizer/frontend/hooks/useTrips.ts +112 -0
- package/apps/travel-chaos-organizer/frontend/lib/api.ts +223 -0
- package/apps/travel-chaos-organizer/frontend/lib/auth.ts +93 -0
- package/apps/travel-chaos-organizer/frontend/lib/db.ts +86 -0
- package/apps/travel-chaos-organizer/frontend/lib/fileCache.ts +54 -0
- package/apps/travel-chaos-organizer/frontend/lib/haptics.ts +13 -0
- package/apps/travel-chaos-organizer/frontend/lib/notifications.ts +112 -0
- package/apps/travel-chaos-organizer/frontend/lib/offlineQueue.ts +145 -0
- package/apps/travel-chaos-organizer/frontend/lib/quota.tsx +43 -0
- package/apps/travel-chaos-organizer/frontend/lib/sentry.ts +28 -0
- package/apps/travel-chaos-organizer/frontend/lib/shareIntent.ts +44 -0
- package/apps/travel-chaos-organizer/frontend/package-lock.json +13221 -0
- package/apps/travel-chaos-organizer/frontend/package.json +44 -0
- package/apps/travel-chaos-organizer/frontend/tsconfig.json +23 -0
- package/apps/travel-chaos-organizer/keycloak/realm-export.json +59 -0
- package/apps/travel-chaos-organizer/landing/index.html +773 -0
- package/apps/travel-chaos-organizer/scripts/backup.sh +14 -0
- package/apps/travel-chaos-organizer/scripts/configure-env.sh +82 -0
- package/apps/travel-chaos-organizer/scripts/deploy.sh +54 -0
- package/apps/travel-chaos-organizer/scripts/health-check.sh +36 -0
- package/apps/travel-chaos-organizer/scripts/migrate.sh +7 -0
- package/apps/travel-chaos-organizer/scripts/server-setup.sh +85 -0
- package/apps/travel-chaos-organizer/scripts/smoke-test.sh +29 -0
- package/apps/travel-chaos-organizer/scripts/verify-tracking.sh +71 -0
- package/apps/travel-chaos-organizer/telegram-bot/.env.example +3 -0
- package/apps/travel-chaos-organizer/telegram-bot/Dockerfile +6 -0
- package/apps/travel-chaos-organizer/telegram-bot/bot.py +504 -0
- package/apps/travel-chaos-organizer/telegram-bot/requirements.txt +3 -0
- package/dist/packages/telegram-notify/client.d.ts +19 -0
- package/dist/packages/telegram-notify/client.js +75 -0
- package/dist/packages/telegram-notify/client.js.map +1 -0
- package/dist/src/__tests__/auth.test.js.map +1 -0
- package/dist/{__tests__ → src/__tests__}/brain-flow.test.js +141 -0
- package/dist/src/__tests__/brain-flow.test.js.map +1 -0
- package/dist/src/__tests__/confidence.test.js.map +1 -0
- package/dist/src/__tests__/e2e/api-auth.test.js.map +1 -0
- package/dist/src/__tests__/e2e/api-health.test.js.map +1 -0
- package/dist/src/__tests__/e2e/cli.test.js.map +1 -0
- package/dist/src/__tests__/e2e/config.js.map +1 -0
- package/dist/src/__tests__/e2e/funnel.test.js.map +1 -0
- package/dist/src/__tests__/e2e/mcp-tools.test.js.map +1 -0
- package/dist/src/__tests__/e2e/provisioning.test.js.map +1 -0
- package/dist/{__tests__ → src/__tests__}/handlers-unit.test.js +0 -2
- package/dist/src/__tests__/handlers-unit.test.js.map +1 -0
- package/dist/src/__tests__/namespace.test.js.map +1 -0
- package/dist/src/__tests__/rerank.test.js +115 -0
- package/dist/src/__tests__/rerank.test.js.map +1 -0
- package/dist/src/auth.js.map +1 -0
- package/dist/src/bench/cachly-bench.d.ts +35 -0
- package/dist/src/bench/cachly-bench.js +182 -0
- package/dist/src/bench/cachly-bench.js.map +1 -0
- package/dist/src/bench/fixtures.d.ts +37 -0
- package/dist/src/bench/fixtures.js +225 -0
- package/dist/src/bench/fixtures.js.map +1 -0
- package/dist/src/ckg.js.map +1 -0
- package/dist/src/confidence.js.map +1 -0
- package/dist/src/embeddings.js.map +1 -0
- package/dist/{handlers → src/handlers}/advanced.d.ts +1 -1
- package/dist/{handlers → src/handlers}/advanced.js +1 -2
- package/dist/src/handlers/advanced.js.map +1 -0
- package/dist/{handlers → src/handlers}/brain.js +361 -191
- package/dist/src/handlers/brain.js.map +1 -0
- package/dist/src/handlers/cache.js.map +1 -0
- package/dist/{handlers → src/handlers}/context.js +9 -4
- package/dist/src/handlers/context.js.map +1 -0
- package/dist/{handlers → src/handlers}/fedbrain.d.ts +6 -0
- package/dist/{handlers → src/handlers}/fedbrain.js +19 -7
- package/dist/src/handlers/fedbrain.js.map +1 -0
- package/dist/src/handlers/instances.js.map +1 -0
- package/dist/{handlers → src/handlers}/roadmap.d.ts +1 -1
- package/dist/{handlers → src/handlers}/roadmap.js +8 -4
- package/dist/src/handlers/roadmap.js.map +1 -0
- package/dist/src/handlers/syndicate.js.map +1 -0
- package/dist/src/handlers/tco.d.ts +16 -0
- package/dist/src/handlers/tco.js +303 -0
- package/dist/src/handlers/tco.js.map +1 -0
- package/dist/{handlers → src/handlers}/team.js +58 -7
- package/dist/src/handlers/team.js.map +1 -0
- package/dist/{index.js → src/index.js} +207 -429
- package/dist/src/index.js.map +1 -0
- package/dist/src/namespace.js.map +1 -0
- package/dist/src/notifier.d.ts +5 -0
- package/dist/src/notifier.js +6 -0
- package/dist/src/notifier.js.map +1 -0
- package/dist/src/rerank.d.ts +55 -0
- package/dist/src/rerank.js +111 -0
- package/dist/src/rerank.js.map +1 -0
- package/dist/{search.js → src/search.js} +2 -2
- package/dist/src/search.js.map +1 -0
- package/dist/src/search.test.d.ts +1 -0
- package/dist/{search.test.js → src/search.test.js} +1 -1
- package/dist/src/search.test.js.map +1 -0
- package/dist/{tools.d.ts → src/tools.d.ts} +226 -0
- package/dist/{tools.js → src/tools.js} +196 -0
- package/dist/src/tools.js.map +1 -0
- package/dist/src/utils.js.map +1 -0
- package/eslint.config.js +1 -1
- package/package.json +8 -7
- package/packages/telegram-notify/SPLIT_PLAN.md +106 -0
- package/packages/telegram-notify/client.ts +88 -0
- package/packages/telegram-notify/emojis.json +22 -0
- package/packages/telegram-notify/pyproject.toml +17 -0
- package/packages/telegram-notify/telegram_notify/__init__.py +3 -0
- package/packages/telegram-notify/telegram_notify/client.py +87 -0
- package/packages/telegram-notify/telegram_notify/emojis.json +22 -0
- package/scripts/generate-icons.js +28 -0
- package/server.json +3 -3
- package/smithery.yaml +27 -16
- package/src/__tests__/auth.test.ts +1 -1
- package/src/__tests__/brain-flow.test.ts +175 -1
- package/src/__tests__/e2e/api-health.test.ts +1 -1
- package/src/__tests__/handlers-unit.test.ts +1 -2
- package/src/__tests__/rerank.test.ts +130 -0
- package/src/bench/cachly-bench.ts +217 -0
- package/src/bench/fixtures.ts +256 -0
- package/src/handlers/advanced.ts +2 -6
- package/src/handlers/brain.ts +371 -194
- package/src/handlers/cache.ts +1 -2
- package/src/handlers/context.ts +10 -6
- package/src/handlers/fedbrain.ts +21 -12
- package/src/handlers/roadmap.ts +8 -4
- package/src/handlers/syndicate.ts +7 -4
- package/src/handlers/tco.ts +345 -0
- package/src/handlers/team.ts +70 -10
- package/src/index.ts +193 -419
- package/src/notifier.ts +5 -0
- package/src/rerank.ts +148 -0
- package/src/search.test.ts +1 -1
- package/src/search.ts +2 -2
- package/src/tools.ts +210 -0
- package/tsconfig.json +2 -3
- package/vitest.config.ts +2 -0
- package/dist/__tests__/auth.test.js.map +0 -1
- package/dist/__tests__/brain-flow.test.js.map +0 -1
- package/dist/__tests__/brain-predict-failures.test.d.ts +0 -17
- package/dist/__tests__/brain-predict-failures.test.js +0 -339
- package/dist/__tests__/brain-predict-failures.test.js.map +0 -1
- package/dist/__tests__/confidence.test.js.map +0 -1
- package/dist/__tests__/e2e/api-auth.test.js.map +0 -1
- package/dist/__tests__/e2e/api-health.test.js.map +0 -1
- package/dist/__tests__/e2e/cli.test.js.map +0 -1
- package/dist/__tests__/e2e/config.js.map +0 -1
- package/dist/__tests__/e2e/funnel.test.js.map +0 -1
- package/dist/__tests__/e2e/mcp-tools.test.js.map +0 -1
- package/dist/__tests__/e2e/provisioning.test.js.map +0 -1
- package/dist/__tests__/handlers-unit.test.js.map +0 -1
- package/dist/__tests__/namespace.test.js.map +0 -1
- package/dist/auth.js.map +0 -1
- package/dist/ckg.js.map +0 -1
- package/dist/confidence.js.map +0 -1
- package/dist/embeddings.js.map +0 -1
- package/dist/handlers/advanced.js.map +0 -1
- package/dist/handlers/brain.js.map +0 -1
- package/dist/handlers/cache.js.map +0 -1
- package/dist/handlers/context.js.map +0 -1
- package/dist/handlers/fedbrain.js.map +0 -1
- package/dist/handlers/instances.js.map +0 -1
- package/dist/handlers/roadmap.js.map +0 -1
- package/dist/handlers/syndicate.js.map +0 -1
- package/dist/handlers/team.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/namespace.js.map +0 -1
- package/dist/search.js.map +0 -1
- package/dist/search.test.js.map +0 -1
- package/dist/tools.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/src/__tests__/brain-predict-failures.test.ts +0 -430
- /package/dist/{__tests__ → src/__tests__}/auth.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/auth.test.js +0 -0
- /package/dist/{__tests__ → src/__tests__}/brain-flow.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/confidence.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/confidence.test.js +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/api-auth.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/api-auth.test.js +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/api-health.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/api-health.test.js +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/cli.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/cli.test.js +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/config.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/config.js +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/funnel.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/funnel.test.js +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/mcp-tools.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/mcp-tools.test.js +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/provisioning.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/e2e/provisioning.test.js +0 -0
- /package/dist/{__tests__ → src/__tests__}/handlers-unit.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/namespace.test.d.ts +0 -0
- /package/dist/{__tests__ → src/__tests__}/namespace.test.js +0 -0
- /package/dist/{search.test.d.ts → src/__tests__/rerank.test.d.ts} +0 -0
- /package/dist/{auth.d.ts → src/auth.d.ts} +0 -0
- /package/dist/{auth.js → src/auth.js} +0 -0
- /package/dist/{ckg.d.ts → src/ckg.d.ts} +0 -0
- /package/dist/{ckg.js → src/ckg.js} +0 -0
- /package/dist/{confidence.d.ts → src/confidence.d.ts} +0 -0
- /package/dist/{confidence.js → src/confidence.js} +0 -0
- /package/dist/{embeddings.d.ts → src/embeddings.d.ts} +0 -0
- /package/dist/{embeddings.js → src/embeddings.js} +0 -0
- /package/dist/{handlers → src/handlers}/brain.d.ts +0 -0
- /package/dist/{handlers → src/handlers}/cache.d.ts +0 -0
- /package/dist/{handlers → src/handlers}/cache.js +0 -0
- /package/dist/{handlers → src/handlers}/context.d.ts +0 -0
- /package/dist/{handlers → src/handlers}/instances.d.ts +0 -0
- /package/dist/{handlers → src/handlers}/instances.js +0 -0
- /package/dist/{handlers → src/handlers}/syndicate.d.ts +0 -0
- /package/dist/{handlers → src/handlers}/syndicate.js +0 -0
- /package/dist/{handlers → src/handlers}/team.d.ts +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{namespace.d.ts → src/namespace.d.ts} +0 -0
- /package/dist/{namespace.js → src/namespace.js} +0 -0
- /package/dist/{search.d.ts → src/search.d.ts} +0 -0
- /package/dist/{utils.d.ts → src/utils.d.ts} +0 -0
- /package/dist/{utils.js → src/utils.js} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeline item with swipe-left-to-delete gesture.
|
|
3
|
+
* Mirrors SwipeableInboxItem pattern for consistent UX.
|
|
4
|
+
*/
|
|
5
|
+
import { useRef } from "react";
|
|
6
|
+
import { Animated, PanResponder, StyleSheet, Text, View } from "react-native";
|
|
7
|
+
import { TripItem } from "../lib/api";
|
|
8
|
+
import TimelineItem from "./TimelineItem";
|
|
9
|
+
import { haptics } from "../lib/haptics";
|
|
10
|
+
|
|
11
|
+
const SWIPE_THRESHOLD = 80;
|
|
12
|
+
const ACTION_WIDTH = 72;
|
|
13
|
+
|
|
14
|
+
type Props = {
|
|
15
|
+
item: TripItem;
|
|
16
|
+
onDelete: () => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default function SwipeableTimelineItem({ item, onDelete }: Props) {
|
|
20
|
+
const translateX = useRef(new Animated.Value(0)).current;
|
|
21
|
+
|
|
22
|
+
const panResponder = useRef(
|
|
23
|
+
PanResponder.create({
|
|
24
|
+
onMoveShouldSetPanResponder: (_, g) => Math.abs(g.dx) > 8 && Math.abs(g.dy) < 20,
|
|
25
|
+
onPanResponderMove: (_, g) => {
|
|
26
|
+
// Only allow swipe left (negative dx)
|
|
27
|
+
const clamped = Math.min(0, Math.max(-ACTION_WIDTH * 1.5, g.dx));
|
|
28
|
+
translateX.setValue(clamped);
|
|
29
|
+
},
|
|
30
|
+
onPanResponderRelease: async (_, g) => {
|
|
31
|
+
if (g.dx < -SWIPE_THRESHOLD) {
|
|
32
|
+
await haptics.warning();
|
|
33
|
+
snapBack();
|
|
34
|
+
onDelete();
|
|
35
|
+
} else {
|
|
36
|
+
snapBack();
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
).current;
|
|
41
|
+
|
|
42
|
+
function snapBack() {
|
|
43
|
+
Animated.spring(translateX, { toValue: 0, useNativeDriver: true, damping: 15 }).start();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<View style={s.wrapper}>
|
|
48
|
+
{/* Right action — delete (revealed by swipe left) */}
|
|
49
|
+
<View style={s.deleteAction}>
|
|
50
|
+
<Text style={s.deleteIcon}>🗑️</Text>
|
|
51
|
+
<Text style={s.deleteLabel}>Löschen</Text>
|
|
52
|
+
</View>
|
|
53
|
+
|
|
54
|
+
<Animated.View style={{ transform: [{ translateX }] }} {...panResponder.panHandlers}>
|
|
55
|
+
<TimelineItem item={item} />
|
|
56
|
+
</Animated.View>
|
|
57
|
+
</View>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const s = StyleSheet.create({
|
|
62
|
+
wrapper: { position: "relative" },
|
|
63
|
+
deleteAction: {
|
|
64
|
+
position: "absolute", top: 0, bottom: 8, right: 0,
|
|
65
|
+
width: ACTION_WIDTH, alignItems: "center", justifyContent: "center",
|
|
66
|
+
backgroundColor: "#dc262633", borderRadius: 14, gap: 4,
|
|
67
|
+
},
|
|
68
|
+
deleteIcon: { fontSize: 20 },
|
|
69
|
+
deleteLabel: { color: "#fff", fontSize: 11, fontWeight: "600" },
|
|
70
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { StyleSheet, Text, View } from "react-native";
|
|
2
|
+
import { format, parseISO } from "date-fns";
|
|
3
|
+
import { de } from "date-fns/locale";
|
|
4
|
+
import { TripItem } from "../lib/api";
|
|
5
|
+
import QRCodeViewer from "./QRCodeViewer";
|
|
6
|
+
|
|
7
|
+
const TYPE_ICONS: Record<string, string> = {
|
|
8
|
+
flight: "✈️", train: "🚂", bus: "🚌", hotel: "🏨",
|
|
9
|
+
rental_car: "🚗", activity: "🎡", transfer: "🚕", document: "📄", other: "📋",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const TYPE_COLORS: Record<string, string> = {
|
|
13
|
+
flight: "#4f46e5", train: "#0891b2", bus: "#059669", hotel: "#d97706",
|
|
14
|
+
rental_car: "#7c3aed", activity: "#db2777", transfer: "#6366f1", document: "#64748b", other: "#475569",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type Props = { item: TripItem };
|
|
18
|
+
|
|
19
|
+
export default function TimelineItem({ item }: Props) {
|
|
20
|
+
const color = TYPE_COLORS[item.type] ?? TYPE_COLORS.other;
|
|
21
|
+
const icon = TYPE_ICONS[item.type] ?? TYPE_ICONS.other;
|
|
22
|
+
const parsed = item.parsed_data as Record<string, unknown> | null;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View style={s.row}>
|
|
26
|
+
<View style={s.line}>
|
|
27
|
+
<View style={[s.dot, { backgroundColor: color }]} />
|
|
28
|
+
<View style={s.connector} />
|
|
29
|
+
</View>
|
|
30
|
+
|
|
31
|
+
<View style={s.card}>
|
|
32
|
+
<View style={s.cardTop}>
|
|
33
|
+
<Text style={s.icon}>{icon}</Text>
|
|
34
|
+
<View style={s.cardMeta}>
|
|
35
|
+
<Text style={s.title} numberOfLines={2}>{item.title}</Text>
|
|
36
|
+
{item.event_at && (
|
|
37
|
+
<Text style={s.time}>
|
|
38
|
+
{format(parseISO(item.event_at), "EEE dd. MMM, HH:mm", { locale: de })}
|
|
39
|
+
</Text>
|
|
40
|
+
)}
|
|
41
|
+
</View>
|
|
42
|
+
</View>
|
|
43
|
+
|
|
44
|
+
<View style={s.details}>
|
|
45
|
+
{!!parsed?.origin && !!parsed?.destination && (
|
|
46
|
+
<Text style={s.route}>{parsed.origin as string} → {parsed.destination as string}</Text>
|
|
47
|
+
)}
|
|
48
|
+
{item.provider && <Text style={s.chip}>{item.provider}</Text>}
|
|
49
|
+
{item.booking_ref && (
|
|
50
|
+
<QRCodeViewer bookingRef={item.booking_ref} title={item.title} />
|
|
51
|
+
)}
|
|
52
|
+
{!!parsed?.price && <Text style={s.chip}>{parsed.price as string}</Text>}
|
|
53
|
+
</View>
|
|
54
|
+
</View>
|
|
55
|
+
</View>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const s = StyleSheet.create({
|
|
60
|
+
row: { flexDirection: "row", gap: 12, paddingBottom: 2 },
|
|
61
|
+
line: { alignItems: "center", width: 24 },
|
|
62
|
+
dot: { width: 12, height: 12, borderRadius: 6, marginTop: 18 },
|
|
63
|
+
connector: { flex: 1, width: 2, backgroundColor: "#2a2a4e", marginTop: 2 },
|
|
64
|
+
card: { flex: 1, backgroundColor: "#1a1a2e", borderRadius: 14, padding: 14, marginBottom: 8, borderWidth: 1, borderColor: "#2a2a4e", gap: 8 },
|
|
65
|
+
cardTop: { flexDirection: "row", gap: 10, alignItems: "flex-start" },
|
|
66
|
+
icon: { fontSize: 22, marginTop: 2 },
|
|
67
|
+
cardMeta: { flex: 1, gap: 2 },
|
|
68
|
+
title: { color: "#fff", fontSize: 15, fontWeight: "600", lineHeight: 20 },
|
|
69
|
+
time: { color: "#6666aa", fontSize: 12 },
|
|
70
|
+
details: { flexDirection: "row", flexWrap: "wrap", gap: 6 },
|
|
71
|
+
route: { color: "#a5b4fc", fontSize: 13, width: "100%" },
|
|
72
|
+
chip: { backgroundColor: "#0f0f1a", borderRadius: 6, paddingHorizontal: 8, paddingVertical: 3, color: "#8888aa", fontSize: 12 },
|
|
73
|
+
});
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full-detail bottom sheet for a timeline item.
|
|
3
|
+
* Shows all parsed fields: route, passengers, price, raw_summary, booking_ref.
|
|
4
|
+
*/
|
|
5
|
+
import { ScrollView, StyleSheet, Text, View } from "react-native";
|
|
6
|
+
import { format, parseISO } from "date-fns";
|
|
7
|
+
import { de } from "date-fns/locale";
|
|
8
|
+
import BottomSheet from "./BottomSheet";
|
|
9
|
+
import QRCodeViewer from "./QRCodeViewer";
|
|
10
|
+
import { TripItem } from "../lib/api";
|
|
11
|
+
|
|
12
|
+
const TYPE_LABELS: Record<string, string> = {
|
|
13
|
+
flight: "Flug", train: "Zug", bus: "Bus", hotel: "Hotel",
|
|
14
|
+
rental_car: "Mietwagen", activity: "Aktivität", transfer: "Transfer",
|
|
15
|
+
document: "Dokument", other: "Sonstiges",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type Props = {
|
|
19
|
+
item: TripItem | null;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function eventLabels(type: string): { start: string; end: string } {
|
|
24
|
+
const map: Record<string, { start: string; end: string }> = {
|
|
25
|
+
flight: { start: "Abflug", end: "Ankunft" },
|
|
26
|
+
train: { start: "Abfahrt", end: "Ankunft" },
|
|
27
|
+
bus: { start: "Abfahrt", end: "Ankunft" },
|
|
28
|
+
hotel: { start: "Check-in", end: "Check-out" },
|
|
29
|
+
rental_car: { start: "Abholung", end: "Rückgabe" },
|
|
30
|
+
activity: { start: "Beginn", end: "Ende" },
|
|
31
|
+
transfer: { start: "Abholung", end: "Ankunft" },
|
|
32
|
+
};
|
|
33
|
+
return map[type] ?? { start: "Beginn", end: "Ende" };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default function TimelineItemDetail({ item, onClose }: Props) {
|
|
37
|
+
if (!item) return null;
|
|
38
|
+
const parsed = item.parsed_data as Record<string, unknown> | null;
|
|
39
|
+
|
|
40
|
+
function fmtDate(iso: string | null | undefined): string {
|
|
41
|
+
if (!iso) return "—";
|
|
42
|
+
try {
|
|
43
|
+
return format(parseISO(iso), "EEE dd. MMM yyyy, HH:mm", { locale: de });
|
|
44
|
+
} catch {
|
|
45
|
+
return iso;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<BottomSheet visible={!!item} onClose={onClose} heightFraction={0.75}>
|
|
51
|
+
<ScrollView showsVerticalScrollIndicator={false} style={{ flex: 1 }}>
|
|
52
|
+
{/* Header */}
|
|
53
|
+
<View style={s.header}>
|
|
54
|
+
<View style={s.typePill}>
|
|
55
|
+
<Text style={s.typeText}>{TYPE_LABELS[item.type] ?? item.type}</Text>
|
|
56
|
+
</View>
|
|
57
|
+
{item.provider && <Text style={s.provider}>{item.provider}</Text>}
|
|
58
|
+
</View>
|
|
59
|
+
|
|
60
|
+
<Text style={s.title}>{item.title}</Text>
|
|
61
|
+
|
|
62
|
+
{/* Core details */}
|
|
63
|
+
<View style={s.section}>
|
|
64
|
+
{item.event_at && <DetailRow label={eventLabels(item.type).start} value={fmtDate(item.event_at)} />}
|
|
65
|
+
{item.event_end_at && <DetailRow label={eventLabels(item.type).end} value={fmtDate(item.event_end_at)} />}
|
|
66
|
+
{!!parsed?.origin && !!parsed?.destination && (
|
|
67
|
+
<DetailRow label="Route" value={`${parsed.origin as string} → ${parsed.destination as string}`} />
|
|
68
|
+
)}
|
|
69
|
+
{item.booking_ref && <DetailRow label="Buchungsnr." value={item.booking_ref} mono />}
|
|
70
|
+
{!!parsed?.confirmation_number && (
|
|
71
|
+
<DetailRow label="Bestätigungsnr." value={parsed.confirmation_number as string} mono />
|
|
72
|
+
)}
|
|
73
|
+
{!!parsed?.price && <DetailRow label="Preis" value={parsed.price as string} />}
|
|
74
|
+
{!!parsed?.passengers && Array.isArray(parsed.passengers) && parsed.passengers.length > 0 && (
|
|
75
|
+
<DetailRow label="Passagiere" value={(parsed.passengers as string[]).join(", ")} />
|
|
76
|
+
)}
|
|
77
|
+
</View>
|
|
78
|
+
|
|
79
|
+
{/* Summary */}
|
|
80
|
+
{!!parsed?.raw_summary && (
|
|
81
|
+
<View style={s.summaryBox}>
|
|
82
|
+
<Text style={s.summaryLabel}>Zusammenfassung</Text>
|
|
83
|
+
<Text style={s.summaryText}>{parsed.raw_summary as string}</Text>
|
|
84
|
+
</View>
|
|
85
|
+
)}
|
|
86
|
+
|
|
87
|
+
{/* QR code */}
|
|
88
|
+
{item.booking_ref && (
|
|
89
|
+
<View style={s.qrRow}>
|
|
90
|
+
<QRCodeViewer bookingRef={item.booking_ref} title={item.title} />
|
|
91
|
+
</View>
|
|
92
|
+
)}
|
|
93
|
+
|
|
94
|
+
{/* Confidence */}
|
|
95
|
+
{typeof parsed?.confidence === "number" && (
|
|
96
|
+
<Text style={s.confidence}>
|
|
97
|
+
KI-Konfidenz: {Math.round((parsed.confidence as number) * 100)}%
|
|
98
|
+
</Text>
|
|
99
|
+
)}
|
|
100
|
+
</ScrollView>
|
|
101
|
+
</BottomSheet>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function DetailRow({ label, value, mono }: { label: string; value: string; mono?: boolean }) {
|
|
106
|
+
return (
|
|
107
|
+
<View style={s.row}>
|
|
108
|
+
<Text style={s.rowLabel}>{label}</Text>
|
|
109
|
+
<Text style={[s.rowValue, mono && s.mono]} numberOfLines={2}>{value}</Text>
|
|
110
|
+
</View>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const s = StyleSheet.create({
|
|
115
|
+
header: { flexDirection: "row", alignItems: "center", gap: 8, marginBottom: 8 },
|
|
116
|
+
typePill: { backgroundColor: "#4f46e522", borderRadius: 6, paddingHorizontal: 8, paddingVertical: 3, borderWidth: 1, borderColor: "#4f46e544" },
|
|
117
|
+
typeText: { color: "#a5b4fc", fontSize: 12, fontWeight: "600" },
|
|
118
|
+
provider: { color: "#6666aa", fontSize: 13 },
|
|
119
|
+
title: { fontSize: 18, fontWeight: "700", color: "#fff", marginBottom: 16, lineHeight: 24 },
|
|
120
|
+
section: { backgroundColor: "#0f0f1a", borderRadius: 12, padding: 4, marginBottom: 14, borderWidth: 1, borderColor: "#2a2a4e" },
|
|
121
|
+
row: { flexDirection: "row", justifyContent: "space-between", alignItems: "flex-start", paddingVertical: 10, paddingHorizontal: 12, gap: 12 },
|
|
122
|
+
rowLabel: { color: "#6666aa", fontSize: 13, flex: 1 },
|
|
123
|
+
rowValue: { color: "#e2e8f0", fontSize: 13, flex: 2, textAlign: "right" },
|
|
124
|
+
mono: { fontFamily: "monospace", color: "#a5b4fc" },
|
|
125
|
+
summaryBox: { backgroundColor: "#1a1a2e", borderRadius: 12, padding: 14, marginBottom: 14, borderWidth: 1, borderColor: "#2a2a4e" },
|
|
126
|
+
summaryLabel: { color: "#6666aa", fontSize: 11, fontWeight: "600", letterSpacing: 0.5, textTransform: "uppercase", marginBottom: 6 },
|
|
127
|
+
summaryText: { color: "#c4b5fd", fontSize: 13, lineHeight: 20 },
|
|
128
|
+
qrRow: { alignItems: "flex-start", marginBottom: 14 },
|
|
129
|
+
confidence: { color: "#3a3a5e", fontSize: 11, textAlign: "right", marginBottom: 8 },
|
|
130
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { Animated, StyleSheet, Text, View } from "react-native";
|
|
3
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
|
+
import { ToastItem } from "./ToastContext";
|
|
5
|
+
|
|
6
|
+
// exported so ToastContext can import the type
|
|
7
|
+
export type { ToastItem };
|
|
8
|
+
|
|
9
|
+
const ICONS = { success: "✓", error: "✗", warning: "⚠", info: "ℹ" };
|
|
10
|
+
const COLORS = {
|
|
11
|
+
success: { border: "#34d399", bg: "#34d39915", text: "#34d399" },
|
|
12
|
+
error: { border: "#f87171", bg: "#f8717115", text: "#f87171" },
|
|
13
|
+
warning: { border: "#fbbf24", bg: "#fbbf2415", text: "#fbbf24" },
|
|
14
|
+
info: { border: "#60a5fa", bg: "#60a5fa15", text: "#60a5fa" },
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function SingleToast({ toast, onDone }: { toast: ToastItem; onDone: (id: string) => void }) {
|
|
18
|
+
const translateY = useRef(new Animated.Value(-72)).current;
|
|
19
|
+
const opacity = useRef(new Animated.Value(0)).current;
|
|
20
|
+
const c = COLORS[toast.type];
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
Animated.parallel([
|
|
24
|
+
Animated.spring(translateY, { toValue: 0, useNativeDriver: true, damping: 20, stiffness: 220 }),
|
|
25
|
+
Animated.timing(opacity, { toValue: 1, duration: 180, useNativeDriver: true }),
|
|
26
|
+
]).start();
|
|
27
|
+
|
|
28
|
+
const timer = setTimeout(() => {
|
|
29
|
+
Animated.parallel([
|
|
30
|
+
Animated.timing(translateY, { toValue: -72, duration: 220, useNativeDriver: true }),
|
|
31
|
+
Animated.timing(opacity, { toValue: 0, duration: 200, useNativeDriver: true }),
|
|
32
|
+
]).start(() => onDone(toast.id));
|
|
33
|
+
}, toast.duration ?? 3500);
|
|
34
|
+
|
|
35
|
+
return () => clearTimeout(timer);
|
|
36
|
+
}, []);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Animated.View style={[s.toast, { borderColor: c.border, backgroundColor: c.bg, opacity, transform: [{ translateY }] }]}>
|
|
40
|
+
<Text style={[s.icon, { color: c.text }]}>{ICONS[toast.type]}</Text>
|
|
41
|
+
<Text style={[s.msg, { color: c.text }]} numberOfLines={3}>{toast.message}</Text>
|
|
42
|
+
</Animated.View>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default function ToastRenderer({ toasts, remove }: { toasts: ToastItem[]; remove: (id: string) => void }) {
|
|
47
|
+
const insets = useSafeAreaInsets();
|
|
48
|
+
return (
|
|
49
|
+
<View style={[s.container, { top: insets.top + 12 }]} pointerEvents="none">
|
|
50
|
+
{toasts.slice(0, 3).map(t => <SingleToast key={t.id} toast={t} onDone={remove} />)}
|
|
51
|
+
</View>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const s = StyleSheet.create({
|
|
56
|
+
container: { position: "absolute", left: 16, right: 16, zIndex: 9999, gap: 8 },
|
|
57
|
+
toast: { flexDirection: "row", alignItems: "center", gap: 10, padding: 14, borderRadius: 12, borderWidth: 1 },
|
|
58
|
+
icon: { fontSize: 16, fontWeight: "700", flexShrink: 0 },
|
|
59
|
+
msg: { fontSize: 14, flex: 1, fontWeight: "500", lineHeight: 19 },
|
|
60
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createContext, ReactNode, useCallback, useContext, useRef, useState } from "react";
|
|
2
|
+
import ToastRenderer from "./Toast";
|
|
3
|
+
|
|
4
|
+
export type ToastType = "success" | "error" | "warning" | "info";
|
|
5
|
+
export interface ToastItem {
|
|
6
|
+
id: string;
|
|
7
|
+
message: string;
|
|
8
|
+
type: ToastType;
|
|
9
|
+
duration?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface ToastCtx {
|
|
13
|
+
showToast: (message: string, type?: ToastType, duration?: number) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const Ctx = createContext<ToastCtx>({ showToast: () => {} });
|
|
17
|
+
|
|
18
|
+
let _counter = 0;
|
|
19
|
+
|
|
20
|
+
export function ToastProvider({ children }: { children: ReactNode }) {
|
|
21
|
+
const [toasts, setToasts] = useState<ToastItem[]>([]);
|
|
22
|
+
|
|
23
|
+
const showToast = useCallback((message: string, type: ToastType = "info", duration?: number) => {
|
|
24
|
+
const id = String(++_counter);
|
|
25
|
+
setToasts(prev => [...prev, { id, message, type, duration }]);
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
const remove = useCallback((id: string) => {
|
|
29
|
+
setToasts(prev => prev.filter(t => t.id !== id));
|
|
30
|
+
}, []);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Ctx.Provider value={{ showToast }}>
|
|
34
|
+
{children}
|
|
35
|
+
<ToastRenderer toasts={toasts} remove={remove} />
|
|
36
|
+
</Ctx.Provider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function useToast() {
|
|
41
|
+
return useContext(Ctx);
|
|
42
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { Animated, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
3
|
+
import { format, parseISO, differenceInDays } from "date-fns";
|
|
4
|
+
import { de } from "date-fns/locale";
|
|
5
|
+
import { Trip } from "../lib/api";
|
|
6
|
+
import { haptics } from "../lib/haptics";
|
|
7
|
+
import ScoreRing from "./ScoreRing";
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
trip: Trip;
|
|
11
|
+
onPress: () => void;
|
|
12
|
+
onLongPress?: () => void;
|
|
13
|
+
score?: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default function TripCard({ trip, onPress, onLongPress, score }: Props) {
|
|
17
|
+
const start = trip.start_date ? parseISO(trip.start_date) : null;
|
|
18
|
+
const end = trip.end_date ? parseISO(trip.end_date) : null;
|
|
19
|
+
const duration = start && end ? differenceInDays(end, start) : null;
|
|
20
|
+
const today = new Date();
|
|
21
|
+
const isActive = start && end && start <= today && today <= end;
|
|
22
|
+
const daysUntil = start && start > today ? differenceInDays(start, today) : null;
|
|
23
|
+
const isUpcoming = start && start > today;
|
|
24
|
+
const isPast = end && end < today;
|
|
25
|
+
|
|
26
|
+
const pulseAnim = useRef(new Animated.Value(1)).current;
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (isActive) {
|
|
30
|
+
const loop = Animated.loop(
|
|
31
|
+
Animated.sequence([
|
|
32
|
+
Animated.timing(pulseAnim, { toValue: 0.4, duration: 800, useNativeDriver: true }),
|
|
33
|
+
Animated.timing(pulseAnim, { toValue: 1, duration: 800, useNativeDriver: true }),
|
|
34
|
+
])
|
|
35
|
+
);
|
|
36
|
+
loop.start();
|
|
37
|
+
return () => loop.stop();
|
|
38
|
+
}
|
|
39
|
+
}, [isActive]);
|
|
40
|
+
|
|
41
|
+
async function handleLongPress() {
|
|
42
|
+
if (onLongPress) {
|
|
43
|
+
await haptics.confirm();
|
|
44
|
+
onLongPress();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getBadgeText(): string {
|
|
49
|
+
if (isActive) return "✈️ Jetzt auf Reise";
|
|
50
|
+
if (daysUntil !== null) {
|
|
51
|
+
if (daysUntil === 0) return "🚀 Heute!";
|
|
52
|
+
if (daysUntil === 1) return "✈️ Morgen!";
|
|
53
|
+
if (daysUntil <= 7) return `✈️ in ${daysUntil} Tagen`;
|
|
54
|
+
if (daysUntil <= 30) return `🗓️ in ${daysUntil} Tagen`;
|
|
55
|
+
}
|
|
56
|
+
if (isUpcoming) return "Geplant";
|
|
57
|
+
if (isPast) return "Vorbei";
|
|
58
|
+
return "Aktuell";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const badgeText = getBadgeText();
|
|
62
|
+
const isCloseCountdown = daysUntil !== null && daysUntil <= 7;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<TouchableOpacity
|
|
66
|
+
style={[s.card, isActive && s.cardActive]}
|
|
67
|
+
onPress={onPress}
|
|
68
|
+
onLongPress={handleLongPress}
|
|
69
|
+
activeOpacity={0.8}
|
|
70
|
+
accessibilityLabel={`Trip: ${trip.name}`}
|
|
71
|
+
accessibilityRole="button"
|
|
72
|
+
accessibilityHint={onLongPress ? "Gedrückt halten zum Bearbeiten" : undefined}
|
|
73
|
+
>
|
|
74
|
+
<View style={s.row}>
|
|
75
|
+
<View style={s.info}>
|
|
76
|
+
<Text style={s.name} numberOfLines={1}>{trip.name}</Text>
|
|
77
|
+
{start && (
|
|
78
|
+
<Text style={s.dates}>
|
|
79
|
+
{format(start, "dd. MMM", { locale: de })}
|
|
80
|
+
{end ? ` → ${format(end, "dd. MMM yyyy", { locale: de })}` : ""}
|
|
81
|
+
{duration !== null ? ` · ${duration} Tage` : ""}
|
|
82
|
+
</Text>
|
|
83
|
+
)}
|
|
84
|
+
{!start && <Text style={s.dates}>Kein Datum gesetzt</Text>}
|
|
85
|
+
</View>
|
|
86
|
+
<View style={s.badgeRow}>
|
|
87
|
+
{isActive && (
|
|
88
|
+
<Animated.View style={[s.pulseDot, { opacity: pulseAnim }]} />
|
|
89
|
+
)}
|
|
90
|
+
<View style={[
|
|
91
|
+
s.badge,
|
|
92
|
+
isActive && s.badgeActive,
|
|
93
|
+
isUpcoming && !isActive && s.badgeUpcoming,
|
|
94
|
+
isPast && s.badgePast,
|
|
95
|
+
]}>
|
|
96
|
+
<Text style={[
|
|
97
|
+
s.badgeText,
|
|
98
|
+
isActive && s.badgeTextActive,
|
|
99
|
+
isCloseCountdown && s.badgeTextCountdown,
|
|
100
|
+
]}>
|
|
101
|
+
{badgeText}
|
|
102
|
+
</Text>
|
|
103
|
+
</View>
|
|
104
|
+
</View>
|
|
105
|
+
</View>
|
|
106
|
+
<View style={s.footer}>
|
|
107
|
+
<View style={s.footerLeft}>
|
|
108
|
+
{trip.description
|
|
109
|
+
? <Text style={s.desc} numberOfLines={1}>{trip.description}</Text>
|
|
110
|
+
: null}
|
|
111
|
+
{onLongPress && <Text style={s.editHint}>Gedrückt halten zum Bearbeiten</Text>}
|
|
112
|
+
</View>
|
|
113
|
+
{score !== undefined && (
|
|
114
|
+
<View style={s.scoreWrap}>
|
|
115
|
+
<ScoreRing score={score} size={38} />
|
|
116
|
+
{score === 100 && <Text style={s.scoreComplete}>✓</Text>}
|
|
117
|
+
</View>
|
|
118
|
+
)}
|
|
119
|
+
</View>
|
|
120
|
+
</TouchableOpacity>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const s = StyleSheet.create({
|
|
125
|
+
card: { backgroundColor: "#1a1a2e", borderRadius: 16, padding: 18, borderWidth: 1, borderColor: "#2a2a4e", gap: 6 },
|
|
126
|
+
cardActive: { borderLeftWidth: 4, borderLeftColor: "#4f46e5" },
|
|
127
|
+
row: { flexDirection: "row", alignItems: "flex-start", gap: 12 },
|
|
128
|
+
info: { flex: 1, gap: 4 },
|
|
129
|
+
name: { color: "#fff", fontSize: 17, fontWeight: "700" },
|
|
130
|
+
dates: { color: "#6666aa", fontSize: 13 },
|
|
131
|
+
desc: { color: "#8888aa", fontSize: 13 },
|
|
132
|
+
badgeRow: { flexDirection: "row", alignItems: "center", gap: 6 },
|
|
133
|
+
pulseDot: { width: 8, height: 8, borderRadius: 4, backgroundColor: "#a5b4fc" },
|
|
134
|
+
badge: { backgroundColor: "#2a2a4e", borderRadius: 6, paddingHorizontal: 8, paddingVertical: 3 },
|
|
135
|
+
badgeActive: { backgroundColor: "#4f46e5" },
|
|
136
|
+
badgeUpcoming: { backgroundColor: "#4f46e522", borderWidth: 1, borderColor: "#4f46e5" },
|
|
137
|
+
badgePast: { backgroundColor: "#1a1a1a" },
|
|
138
|
+
badgeText: { color: "#a5b4fc", fontSize: 12, fontWeight: "500" },
|
|
139
|
+
badgeTextActive: { color: "#fff" },
|
|
140
|
+
badgeTextCountdown: { color: "#a5b4fc", fontWeight: "700" },
|
|
141
|
+
editHint: { color: "#3a3a5e", fontSize: 11 },
|
|
142
|
+
footer: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: 8 },
|
|
143
|
+
footerLeft: { flex: 1, gap: 2 },
|
|
144
|
+
scoreWrap: { alignItems: "center", justifyContent: "center" },
|
|
145
|
+
scoreComplete: { position: "absolute", color: "#10b981", fontSize: 14, fontWeight: "800" },
|
|
146
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Modal, StyleSheet, Text, TouchableOpacity, View, Share, ActivityIndicator,
|
|
4
|
+
} from "react-native";
|
|
5
|
+
// @ts-ignore — added in Phase 3 deps
|
|
6
|
+
import QRCode from "react-native-qrcode-svg";
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
tripId: string;
|
|
10
|
+
tripName: string;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function TripQRModal({ tripId, tripName, visible, onClose }: Props) {
|
|
16
|
+
const deepLink = `tco://trips/${tripId}`;
|
|
17
|
+
const [qrReady, setQrReady] = useState(false);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (visible) {
|
|
21
|
+
// Defer QR generation until after the modal animation frame
|
|
22
|
+
const id = requestAnimationFrame(() => setQrReady(true));
|
|
23
|
+
return () => { cancelAnimationFrame(id); setQrReady(false); };
|
|
24
|
+
} else {
|
|
25
|
+
setQrReady(false);
|
|
26
|
+
}
|
|
27
|
+
}, [visible]);
|
|
28
|
+
|
|
29
|
+
async function handleShare() {
|
|
30
|
+
await Share.share({
|
|
31
|
+
message: `Mein Trip "${tripName}" in Travel Chaos Organizer: ${deepLink}`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Modal visible={visible} transparent animationType="fade" onRequestClose={onClose}>
|
|
37
|
+
<View style={s.overlay}>
|
|
38
|
+
<View style={s.card}>
|
|
39
|
+
<Text style={s.title}>{tripName}</Text>
|
|
40
|
+
<Text style={s.sub}>QR-Code zum Teilen</Text>
|
|
41
|
+
<View style={s.qrBox}>
|
|
42
|
+
{qrReady
|
|
43
|
+
? <QRCode value={deepLink} size={180} color="#fff" backgroundColor="#1a1a2e" />
|
|
44
|
+
: <ActivityIndicator color="#4f46e5" size="large" style={{ width: 180, height: 180 }} />}
|
|
45
|
+
</View>
|
|
46
|
+
<Text style={s.link}>{deepLink}</Text>
|
|
47
|
+
<TouchableOpacity style={s.shareBtn} onPress={handleShare} activeOpacity={0.8} accessibilityLabel="Teilen" accessibilityRole="button">
|
|
48
|
+
<Text style={s.shareBtnText}>Teilen</Text>
|
|
49
|
+
</TouchableOpacity>
|
|
50
|
+
<TouchableOpacity style={s.closeBtn} onPress={onClose} accessibilityLabel="Schließen" accessibilityRole="button">
|
|
51
|
+
<Text style={s.closeBtnText}>Schließen</Text>
|
|
52
|
+
</TouchableOpacity>
|
|
53
|
+
</View>
|
|
54
|
+
</View>
|
|
55
|
+
</Modal>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const s = StyleSheet.create({
|
|
60
|
+
overlay: { flex: 1, backgroundColor: "#000000aa", justifyContent: "center", alignItems: "center" },
|
|
61
|
+
card: { backgroundColor: "#1a1a2e", borderRadius: 24, padding: 28, alignItems: "center", width: 300, gap: 12 },
|
|
62
|
+
title: { fontSize: 18, fontWeight: "800", color: "#fff", textAlign: "center" },
|
|
63
|
+
sub: { fontSize: 12, color: "#6666aa" },
|
|
64
|
+
qrBox: { backgroundColor: "#1a1a2e", padding: 16, borderRadius: 16, borderWidth: 1, borderColor: "#2a2a4a" },
|
|
65
|
+
link: { fontSize: 11, color: "#6666aa", fontFamily: "monospace" },
|
|
66
|
+
shareBtn: { backgroundColor: "#4f46e5", paddingVertical: 12, paddingHorizontal: 32, borderRadius: 12, width: "100%", alignItems: "center" },
|
|
67
|
+
shareBtnText: { color: "#fff", fontWeight: "700", fontSize: 15 },
|
|
68
|
+
closeBtn: { paddingVertical: 8 },
|
|
69
|
+
closeBtnText: { color: "#6666aa", fontSize: 14 },
|
|
70
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet, Text, TouchableOpacity, View, Linking } from "react-native";
|
|
3
|
+
import { useQuota } from "../lib/quota";
|
|
4
|
+
|
|
5
|
+
export function UpgradeBanner() {
|
|
6
|
+
const { plan, isPro } = useQuota();
|
|
7
|
+
if (isPro || !plan) return null;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<View style={s.banner}>
|
|
11
|
+
<Text style={s.text}>
|
|
12
|
+
Free Plan · {plan.free_daily_parses} Parses/Tag · {plan.free_max_trips} Trips
|
|
13
|
+
</Text>
|
|
14
|
+
<TouchableOpacity
|
|
15
|
+
style={s.btn}
|
|
16
|
+
onPress={() => Linking.openURL(process.env.EXPO_PUBLIC_UPGRADE_URL ?? "https://tco.app/upgrade")}
|
|
17
|
+
activeOpacity={0.8}
|
|
18
|
+
>
|
|
19
|
+
<Text style={s.btnText}>Pro ✦</Text>
|
|
20
|
+
</TouchableOpacity>
|
|
21
|
+
</View>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const s = StyleSheet.create({
|
|
26
|
+
banner: {
|
|
27
|
+
flexDirection: "row",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
justifyContent: "space-between",
|
|
30
|
+
backgroundColor: "#1a1a2e",
|
|
31
|
+
borderBottomWidth: 1,
|
|
32
|
+
borderBottomColor: "#2a2a4a",
|
|
33
|
+
paddingHorizontal: 16,
|
|
34
|
+
paddingVertical: 8,
|
|
35
|
+
},
|
|
36
|
+
text: { color: "#6666aa", fontSize: 12 },
|
|
37
|
+
btn: {
|
|
38
|
+
backgroundColor: "#4f46e5",
|
|
39
|
+
paddingHorizontal: 12,
|
|
40
|
+
paddingVertical: 4,
|
|
41
|
+
borderRadius: 8,
|
|
42
|
+
},
|
|
43
|
+
btnText: { color: "#fff", fontSize: 12, fontWeight: "700" },
|
|
44
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cli": {
|
|
3
|
+
"version": ">= 7.0.0"
|
|
4
|
+
},
|
|
5
|
+
"build": {
|
|
6
|
+
"development": {
|
|
7
|
+
"developmentClient": true,
|
|
8
|
+
"distribution": "internal"
|
|
9
|
+
},
|
|
10
|
+
"preview": {
|
|
11
|
+
"distribution": "internal",
|
|
12
|
+
"channel": "preview"
|
|
13
|
+
},
|
|
14
|
+
"production": {
|
|
15
|
+
"channel": "production",
|
|
16
|
+
"autoIncrement": true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"submit": {
|
|
20
|
+
"production": {}
|
|
21
|
+
}
|
|
22
|
+
}
|