diff --git a/client/fastlane/metadata/android/en-US/full_description.txt b/client/fastlane/metadata/android/en-US/full_description.txt index bd7c62d99..441edb89a 100644 --- a/client/fastlane/metadata/android/en-US/full_description.txt +++ b/client/fastlane/metadata/android/en-US/full_description.txt @@ -1,6 +1,6 @@ TREK is a travel planner for the trips you take with other people. Plan the days together, see every place on the map, keep bookings, costs and packing lists in one place, and still have all of it with you when the connection drops. -TREK is open source and works with a TREK server: one you run yourself, at home or on a rented server, one your organisation provides, or the public demo to try it out. Your trips stay on that server. The makers of TREK receive none of your data. +TREK is open source and connects to a TREK server. Use a server you run, connect to one your organisation provides, or try the public demo. Where available, you can subscribe to a managed instance through TREK Cloud. Google Play shows the price and billing period for your storefront before purchase. PLAN TOGETHER • Days with places, notes, transports and stays, in order and on the map @@ -17,8 +17,8 @@ ON THE ROAD • A travel journal with photos, and an atlas of the countries you have visited YOUR DATA -• No account with us, no tracking, no ads +• Your trips are stored on the TREK server you choose • Sign in with a password, a passkey or your organisation's single sign-on • Available in 27 languages -To use the app you need the address of a TREK server. Without one yet, tap "Try the demo" on the first screen, or read how to run your own at github.com/liketrek/TREK. +On the first screen you can enter your server address, choose TREK Cloud, or tap "Try the demo". To run your own server, see github.com/liketrek/TREK. diff --git a/client/fastlane/metadata/en-US/description.txt b/client/fastlane/metadata/en-US/description.txt index bd7c62d99..bf519b120 100644 --- a/client/fastlane/metadata/en-US/description.txt +++ b/client/fastlane/metadata/en-US/description.txt @@ -1,6 +1,6 @@ TREK is a travel planner for the trips you take with other people. Plan the days together, see every place on the map, keep bookings, costs and packing lists in one place, and still have all of it with you when the connection drops. -TREK is open source and works with a TREK server: one you run yourself, at home or on a rented server, one your organisation provides, or the public demo to try it out. Your trips stay on that server. The makers of TREK receive none of your data. +TREK is open source and connects to a TREK server. Use a server you run, connect to one your organisation provides, or try the public demo. Where available, you can subscribe to a managed instance through TREK Cloud. The App Store shows the price and billing period for your storefront before purchase. PLAN TOGETHER • Days with places, notes, transports and stays, in order and on the map @@ -17,8 +17,8 @@ ON THE ROAD • A travel journal with photos, and an atlas of the countries you have visited YOUR DATA -• No account with us, no tracking, no ads +• Your trips are stored on the TREK server you choose • Sign in with a password, a passkey or your organisation's single sign-on • Available in 27 languages -To use the app you need the address of a TREK server. Without one yet, tap "Try the demo" on the first screen, or read how to run your own at github.com/liketrek/TREK. +On the first screen you can enter your server address, choose TREK Cloud, or tap "Try the demo". To run your own server, see github.com/liketrek/TREK. diff --git a/client/native-shell/main.ts b/client/native-shell/main.ts index 1bd1e6c9f..1436be314 100644 --- a/client/native-shell/main.ts +++ b/client/native-shell/main.ts @@ -7,7 +7,7 @@ import { PASSWORD_MIN_LENGTH, passwordProblem, passwordRuleStates } from '../../ import logoWhite from '../public/logo-light.svg'; // #fff wordmark, for the landscape import { pageUnderStatusBar } from '../src/native/appBoot'; import { AUTH_GATE_NAMES, canSignInInApp, type AuthGate } from '../src/native/authGate'; -import { opensSoon, refundedBeforeOpening } from '../src/native/cloudOrders'; +import { isNewCloudPlan, opensSoon, planForUnclaimedPurchase, refundedBeforeOpening } from '../src/native/cloudOrders'; import { fakeIapClient, getIapClient, productIdFor, type Purchase } from '../src/native/iap'; import { APP_STORE_SUBSCRIPTIONS_URL, @@ -152,6 +152,7 @@ const I = { image: 'M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM8.5 10a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM21 15l-5-5L5 21', spark: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z', + mail: 'M4 5h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM3 7l9 6 9-6', people: 'M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75', shield: 'M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10', @@ -661,13 +662,14 @@ interface CloudPlan { /** Absent while orders are closed: the cloud names its plans but no price leaves it then. */ monthlyCents?: number; yearlyCents?: number; + currency?: 'EUR' | 'USD'; aiDocuments: number; + aiDocumentLimit?: 0 | null; + aiAssistant?: 'planned' | 'included' | 'unavailable'; + bookingMailImport?: boolean; storageGb: number; } -function money(cents: number): string { - return new Intl.NumberFormat(locale, { style: 'currency', currency: 'EUR' }).format(cents / 100); -} function count(n: number): string { return new Intl.NumberFormat(locale).format(n); } @@ -676,10 +678,28 @@ function count(n: number): string { // during development, so its /api/plans is unreachable from a local build. Never // used in a real build (see the import.meta.env.DEV guard below). const SAMPLE_PLANS: CloudPlan[] = [ - { id: 'start', name: 'Start', monthlyCents: 490, yearlyCents: 4900, aiDocuments: 0, storageGb: 10 }, - { id: 'basis', name: 'Basis', monthlyCents: 790, yearlyCents: 7900, aiDocuments: 25, storageGb: 10 }, - { id: 'plus', name: 'Plus', monthlyCents: 1290, yearlyCents: 12900, aiDocuments: 100, storageGb: 25 }, - { id: 'pro', name: 'Pro', monthlyCents: 1990, yearlyCents: 19900, aiDocuments: 150, storageGb: 50 }, + { + id: 'start', + name: 'Start', + monthlyCents: 499, + yearlyCents: 4899, + currency: 'USD', + aiDocuments: 0, + aiDocumentLimit: 0, + storageGb: 200, + }, + { + id: 'plus', + name: 'Plus', + monthlyCents: 999, + yearlyCents: 9900, + currency: 'USD', + aiDocuments: 100, + aiDocumentLimit: null, + aiAssistant: 'planned', + bookingMailImport: true, + storageGb: 200, + }, ]; interface CloudPlans { @@ -693,8 +713,8 @@ async function fetchPlans(): Promise { const res = await get(`${CLOUD_URL}/api/plans`); const data = typeof res.data === 'string' ? JSON.parse(res.data) : res.data; const body = (data ?? {}) as { plans?: CloudPlan[]; ordering?: string }; - if (Array.isArray(body.plans) && body.plans.length) - return { plans: body.plans, closed: body.ordering === 'closed' }; + const plans = Array.isArray(body.plans) ? body.plans.filter((plan) => isNewCloudPlan(plan.id)) : []; + if (plans.length) return { plans, closed: body.ordering === 'closed' }; } catch { // Fall through to the preview fallback. } @@ -716,11 +736,16 @@ interface Offer { } function offerFor(offer: Offer, plan: CloudPlan, interval: 'month' | 'year'): { label: string; buyable: boolean } { + if (!offer.canBuy) return { label: '', buyable: false }; + if (iap !== fakeIapClient) { + const label = offer.storePrices?.get(productIdFor(plan.id, interval)) ?? ''; + return { label, buyable: label !== '' }; + } const cents = interval === 'year' ? plan.yearlyCents : plan.monthlyCents; - const ours = typeof cents === 'number' ? money(cents) : ''; - const storePrice = offer.storePrices?.get(productIdFor(plan.id, interval)); - if (offer.storePrices) return { label: storePrice ?? ours, buyable: offer.canBuy && !!storePrice }; - return { label: ours, buyable: offer.canBuy && ours !== '' }; + const currency = plan.currency ?? 'EUR'; + const label = + typeof cents === 'number' ? new Intl.NumberFormat(locale, { style: 'currency', currency }).format(cents / 100) : ''; + return { label, buyable: label !== '' }; } async function loadOffer(list: CloudPlans): Promise { @@ -771,7 +796,7 @@ let chosenInterval: 'month' | 'year' = 'month'; * phone). Found and redeemed: the instance it belongs to opens. Paid but never * set up: the claim screen takes the purchase as it is, so nothing is bought twice. */ -function restoreButton(offer: Offer, plans: CloudPlan[]): HTMLButtonElement { +function restoreButton(plans: CloudPlan[]): HTMLButtonElement { const restore = el('button', { type: 'button', className: 'link' }, t('native.plans.restore')); const say = (text: string) => { restore.classList.add('msg'); @@ -795,13 +820,10 @@ function restoreButton(offer: Offer, plans: CloudPlan[]): HTMLButtonElement { return; } // Paid but never set up (Ask to Buy approved later, the app closed mid-purchase). - const unclaimed = redeemed.code === 'email-invalid' || (redeemed.code ?? '').startsWith('slug-'); - const match = /^cloud\.([a-z0-9-]+)\.(monthly|yearly)$/.exec(purchase.productId); - const plan = match ? plans.find((p) => p.id === match[1]) : undefined; - if (unclaimed && match && plan) { - const interval = match[2] === 'yearly' ? 'year' : 'month'; - const { label } = offerFor(offer, plan, interval); - showClaim(plan, interval, label, { bought: purchase }); + const unclaimed = planForUnclaimedPurchase(purchase.productId, redeemed.code); + if (unclaimed) { + const plan = plans.find((candidate) => candidate.id === unclaimed.plan.id) ?? unclaimed.plan; + showClaim(plan, unclaimed.interval, '', { bought: purchase }); return; } void notify(NotificationType.Error); @@ -901,6 +923,10 @@ function showPlans(opts: { back?: boolean } = {}): void { const plan = selected(); if (!plan) return; const index = plans.indexOf(plan); + const month = offerFor(offer, plan, 'month'); + const year = offerFor(offer, plan, 'year'); + if (interval === 'month' && !month.buyable && year.buyable) interval = 'year'; + if (interval === 'year' && !year.buyable && month.buyable) interval = 'month'; tiers .querySelectorAll('button') .forEach((b) => b.setAttribute('aria-checked', String(b.dataset.plan === plan.id))); @@ -917,25 +943,30 @@ function showPlans(opts: { back?: boolean } = {}): void { text.textContent = tripText; text.hidden = !tripText; - const { label, buyable } = offerFor(offer, plan, interval); + const { label, buyable } = interval === 'month' ? month : year; // No price yet (orders not open): the plan shows without one rather than with an empty one. price.hidden = !label; pricePer.textContent = per(interval); if (label) paintPrice(label, animate); - const year = offerFor(offer, plan, 'year').label; + // Without a price in either period (orders not open yet) the switch would choose between nothing. - pricebox.hidden = !label && !year; - const yearAmount = amountIn(year); + pricebox.hidden = !month.label && !year.label; + monthBtn.disabled = !month.label; + yearBtn.disabled = !year.label; + const yearAmount = amountIn(year.label); equals.textContent = - !label || !year + !label || !year.label ? '' : interval === 'month' - ? t('native.plans.yearlyIs', { price: year }) + ? t('native.plans.yearlyIs', { price: year.label }) : yearAmount ? t('native.plans.monthlyIs', { price: yearAmount.render(yearAmount.value / 12) }) : ''; const gb = plan.storageGb >= 1000 ? `${count(plan.storageGb / 1000)} TB` : `${count(plan.storageGb)} GB`; + const notIncluded = t('native.plans.aiNone'); + const included = t('native.plans.included'); + const assistant = plan.aiAssistant === 'included'; const tile = (glyph: string, big: string, small: string, off = false) => el( 'span', @@ -944,11 +975,28 @@ function showPlans(opts: { back?: boolean } = {}): void { el('span', {}, el('b', {}, big), el('small', {}, small)) ); specs.replaceChildren( - // About 3 MB a photo, as a phone takes them: a size people can picture. - tile(I.image, gb, t('native.plans.photos', { n: count(plan.storageGb * 300) })), + tile(I.image, gb, t('native.plans.storageFairUse')), plan.aiDocuments > 0 - ? tile(I.spark, t('native.plans.aiPerMonth', { n: count(plan.aiDocuments) }), t('native.plans.aiLabel')) - : tile(I.spark, t('native.plans.aiNone'), t('native.plans.aiLabel'), true), + ? tile( + I.spark, + plan.aiDocumentLimit === null + ? t('native.plans.unlimited') + : t('native.plans.aiPerMonth', { n: count(plan.aiDocuments) }), + t('native.plans.aiLabel') + ) + : tile(I.spark, notIncluded, t('native.plans.aiLabel'), true), + tile( + I.spark, + assistant ? included : plan.aiAssistant === 'planned' ? t('native.plans.planned') : notIncluded, + t('native.plans.assistant'), + !assistant + ), + tile( + I.mail, + plan.bookingMailImport ? included : notIncluded, + t('native.plans.mailImport'), + !plan.bookingMailImport + ), el( 'span', { className: 'spec wide' }, @@ -982,6 +1030,9 @@ function showPlans(opts: { back?: boolean } = {}): void { choose.addEventListener('click', async () => { const plan = selected(); if (!plan) return; + const selectedInterval = interval; + const price = offerFor(offer, plan, selectedInterval); + if (!price.buyable) return; void tap(ImpactStyle.Medium); // A store account with a running subscription buys nothing more: say so before the form. choose.disabled = true; @@ -991,7 +1042,7 @@ function showPlans(opts: { back?: boolean } = {}): void { showSubscribed(); return; } - showClaim(plan, interval, offerFor(offer, plan, interval).label); + showClaim(plan, selectedInterval, price.label); }); const load = async () => { @@ -1041,8 +1092,8 @@ function showPlans(opts: { back?: boolean } = {}): void { externalLink(t('native.plans.privacyShort'), PRIVACY_URL) ) ); - dock.append(restoreButton(offer, plans)); } + if (offer.canBuy || offer.opensSoon) dock.append(restoreButton(plans)); foot.hidden = false; paint(true); }; @@ -1077,6 +1128,7 @@ async function fetchConsent(): Promise { try { const res = await CapacitorHttp.get({ url: `${CLOUD_URL}/api/iap/consent`, + params: { lang: locale === 'de' ? 'de' : 'en' }, connectTimeout: PROBE_TIMEOUT_MS, readTimeout: PROBE_TIMEOUT_MS, }); @@ -1140,7 +1192,7 @@ async function redeemPurchase( } function showClaim( - plan: CloudPlan, + plan: Pick, interval: 'month' | 'year', priceLabel: string, opts: { back?: boolean; bought?: Purchase } = {} @@ -1247,7 +1299,8 @@ function showClaim( }; void loadConsent(); - const subscribeLabel = () => t('native.claim.subscribe', { price: priceLabel }); + const subscribeLabel = () => + bought ? t('native.claim.completeSetup') : t('native.claim.subscribe', { price: priceLabel }); const submit = el('button', { type: 'button', className: 'cta' }, subscribeLabel()); // What is about to be bought, so nobody pays for a plan they did not mean. const change = el('button', { type: 'button' }, t('native.claim.change')); @@ -1258,7 +1311,12 @@ function showClaim( const planRow = el( 'div', { className: 'plan-row' }, - el('span', {}, el('b', {}, plan.name), el('small', { dir: 'ltr' }, `${priceLabel} ${per(interval)}`)), + el( + 'span', + {}, + el('b', {}, plan.name), + ...(priceLabel ? [el('small', { dir: 'ltr' }, `${priceLabel} ${per(interval)}`)] : []) + ), // A purchase already made is not a choice any more. ...(bought ? [] : [change]) ); diff --git a/client/src/components/Assistant/useAssistantStatus.ts b/client/src/components/Assistant/useAssistantStatus.ts index b905919c3..3b25372bc 100644 --- a/client/src/components/Assistant/useAssistantStatus.ts +++ b/client/src/components/Assistant/useAssistantStatus.ts @@ -2,6 +2,7 @@ import { useEffect } from 'react'; import { useAddonStore } from '../../store/addonStore'; import { aiRoutesOpen, useAssistantStore } from '../../store/assistantStore'; +import { useAuthStore } from '../../store/authStore'; /** * Asks for the assistant's status when a view of it mounts, and again when @@ -13,7 +14,8 @@ import { aiRoutesOpen, useAssistantStore } from '../../store/assistantStore'; */ export function useAssistantStatus(): void { const loadStatus = useAssistantStore((s) => s.loadStatus); - const routesOpen = useAddonStore(aiRoutesOpen); + const managed = useAuthStore((s) => s.managed); + const routesOpen = useAddonStore((s) => aiRoutesOpen(s, managed)); const assistantOn = useAddonStore((s) => s.isEnabled('ai_assistant')); useEffect(() => { diff --git a/client/src/native/cloudOrders.test.ts b/client/src/native/cloudOrders.test.ts index 0fbd1bafc..28815e51e 100644 --- a/client/src/native/cloudOrders.test.ts +++ b/client/src/native/cloudOrders.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { opensSoon, refundedBeforeOpening } from './cloudOrders'; +import { isNewCloudPlan, opensSoon, planForUnclaimedPurchase, refundedBeforeOpening } from './cloudOrders'; describe('opensSoon', () => { const base = { available: true, closed: true, sandbox: false, onPlay: false }; @@ -33,3 +33,22 @@ describe('refundedBeforeOpening', () => { expect(refundedBeforeOpening(undefined, true)).toBe(false); }); }); + +describe('Cloud catalog and purchase recovery', () => { + it('only offers Start and Plus even when the server still lists retired plans', () => { + expect(['start', 'basis', 'plus', 'pro'].filter(isNewCloudPlan)).toEqual(['start', 'plus']); + }); + + it('can finish setup for a verified purchase from a retired tier', () => { + expect(planForUnclaimedPurchase('cloud.pro.yearly', 'consent-deviations')).toEqual({ + plan: { id: 'pro', name: 'Pro' }, + interval: 'year', + }); + expect(planForUnclaimedPurchase('cloud.basis.monthly', 'email-invalid')).toEqual({ + plan: { id: 'basis', name: 'Basis' }, + interval: 'month', + }); + expect(planForUnclaimedPurchase('cloud.pro.yearly', 'ordering-closed')).toBeNull(); + expect(planForUnclaimedPurchase('cloud.unknown.monthly', 'email-invalid')).toBeNull(); + }); +}); diff --git a/client/src/native/cloudOrders.ts b/client/src/native/cloudOrders.ts index 9c5ffdf5c..ca72e34bb 100644 --- a/client/src/native/cloudOrders.ts +++ b/client/src/native/cloudOrders.ts @@ -24,3 +24,27 @@ export function opensSoon(opts: { available: boolean; closed: boolean; sandbox: export function refundedBeforeOpening(code: string | undefined, onPlay: boolean): boolean { return onPlay && code === 'ordering-closed'; } + +export function isNewCloudPlan(id: string): boolean { + return id === 'start' || id === 'plus'; +} + +const PLAN_NAMES: Record = { start: 'Start', basis: 'Basis', plus: 'Plus', pro: 'Pro' }; + +/** A verified purchase can predate the current offer and still need its instance set up. */ +export function planForUnclaimedPurchase(productId: string, code: string | undefined) { + if ( + code !== 'email-invalid' && + code !== 'consent-deviations' && + code !== 'consent-outdated' && + !code?.startsWith('slug-') + ) { + return null; + } + const match = /^cloud\.(start|basis|plus|pro)\.(monthly|yearly)$/.exec(productId); + const id = match?.[1]; + if (!id) return null; + const name = PLAN_NAMES[id] ?? id; + const interval = match?.[2] === 'yearly' ? 'year' : 'month'; + return { plan: { id, name }, interval } as const; +} diff --git a/client/src/store/assistantStore.test.ts b/client/src/store/assistantStore.test.ts index e8f46fe6e..294c3d51a 100644 --- a/client/src/store/assistantStore.test.ts +++ b/client/src/store/assistantStore.test.ts @@ -363,13 +363,18 @@ describe('assistantStore: threads, window and status', () => { expect(store().status).toBeNull(); }); - it('FE-AI-STORE-014: a managed install, which refuses /api/ai, is not asked whatever its addons say', async () => { + it('FE-AI-STORE-014: a managed install only asks for status when its assistant addon is on', async () => { const status = vi.spyOn(aiConnectionsRepo, 'status').mockResolvedValue(STATUS); useAssistantStore.setState({ status: STATUS }); useAuthStore.setState({ managed: true }); - addonsOn('ai_assistant', 'llm_parsing'); + addonsOn('llm_parsing'); await store().loadStatus(); expect(status).not.toHaveBeenCalled(); expect(store().status).toBeNull(); + + addonsOn('ai_assistant', 'llm_parsing'); + await store().loadStatus(); + expect(status).toHaveBeenCalledOnce(); + expect(store().status).toEqual(STATUS); }); }); diff --git a/client/src/store/assistantStore.ts b/client/src/store/assistantStore.ts index 3c0156f92..f9eb70fc2 100644 --- a/client/src/store/assistantStore.ts +++ b/client/src/store/assistantStore.ts @@ -124,7 +124,7 @@ interface UndoBlockResult { interface AssistantState { /** * What the assistant runs on for this user; null until loaded, while no addon - * opens /api/ai (aiRoutesOpen) and on a managed install, and the assistant stays hidden then. + * opens /api/ai (aiRoutesOpen). Otherwise the assistant stays hidden. */ status: AiStatusResponse | null; window: { open: boolean; minimized: boolean }; @@ -325,13 +325,13 @@ export function chatOf(state: Pick, key: AssistantChat * Whether the addons open /api/ai: the server opens it while the assistant or * AI parsing is on, the two sharing one connection, and answers 404 while * both are off. Closed until the addon list is in. A selector on the addon - * store; a managed install refuses /api/ai whatever it says (loadStatus). + * store. On managed installs only the assistant addon opens the status route. */ -export function aiRoutesOpen({ - loaded, - isEnabled, -}: Pick, 'loaded' | 'isEnabled'>): boolean { - return loaded && (isEnabled('ai_assistant') || isEnabled('llm_parsing')); +export function aiRoutesOpen( + { loaded, isEnabled }: Pick, 'loaded' | 'isEnabled'>, + managed: boolean +): boolean { + return loaded && (isEnabled('ai_assistant') || (!managed && isEnabled('llm_parsing'))); } function httpStatus(err: unknown): number | undefined { @@ -586,9 +586,7 @@ function backToAfter(byTrip: Record): Record { - // While /api/ai is closed the request could only get a 404, or the 403 of a managed install: nothing is asked, - // and the assistant stays hidden. The managed flag comes with the app config, which can land after the addons. - if (useAuthStore.getState().managed || !aiRoutesOpen(useAddonStore.getState())) { + if (!aiRoutesOpen(useAddonStore.getState(), useAuthStore.getState().managed)) { ctx.set({ status: null }); return; } diff --git a/server/src/app-config/README.md b/server/src/app-config/README.md index 5995d20d8..1dc354d3b 100644 --- a/server/src/app-config/README.md +++ b/server/src/app-config/README.md @@ -165,7 +165,7 @@ below.) **Runtime-toggled** (read live on every access via `readEnv()` / `RuntimeEnvService`; tests mutate these mid-lifetime): -TREK_MANAGED, PLACES_API_BASE, PLACES_API_KEY, AMAP_API_BASE, AMAP_API_KEY, AMAP_API_SECRET, MAPBOX_ACCESS_TOKEN, CARTO_API_KEY, DEMO_MODE, NODE_ENV, APP_VERSION, APP_URL, TREK_API_DOCS_ENABLED, +TREK_MANAGED, TREK_MANAGED_ASSISTANT_URL, TREK_MANAGED_ASSISTANT_TOKEN, TREK_MANAGED_ASSISTANT_MODEL, PLACES_API_BASE, PLACES_API_KEY, AMAP_API_BASE, AMAP_API_KEY, AMAP_API_SECRET, MAPBOX_ACCESS_TOKEN, CARTO_API_KEY, DEMO_MODE, NODE_ENV, APP_VERSION, APP_URL, TREK_API_DOCS_ENABLED, TREK_PLUGINS_ENABLED / _DEV_LINK / _IGNORE_TREK_RANGE / _DIR / _DATA_DIR / TREK_PLUGIN_PERMISSIONS, OIDC_*, SMTP_*, FORCE_HTTPS, COOKIE_SECURE, ALLOWED_ORIGINS, UNSPLASH_ACCESS_KEY, WEBAUTHN_*, TZ, ADMIN_EMAIL, diff --git a/server/src/app-config/derive.ts b/server/src/app-config/derive.ts index c54188806..12831ba3d 100644 --- a/server/src/app-config/derive.ts +++ b/server/src/app-config/derive.ts @@ -122,17 +122,18 @@ function flagText(raw: string | undefined): 'true' | 'false' | undefined { * Whether this instance is centrally administered: somebody other than its * admin user owns the configuration, the credentials and the upgrade schedule. * - * Only a boolean, on purpose. It answers "who configures this install", and the - * surfaces that care read it themselves rather than being listed here, so adding - * one never touches this file. - * * `=== true` so an unset, empty or unparseable value means off. A managed * install sets it deliberately; nothing should be able to switch it on by * accident, and a typo must not silently take settings away from an admin. */ export function deriveManaged(raw: RawEnv) { + const enabled = parseBool(raw.TREK_MANAGED) === true; + const baseUrl = raw.TREK_MANAGED_ASSISTANT_URL?.trim(); + const token = raw.TREK_MANAGED_ASSISTANT_TOKEN?.trim(); + const model = raw.TREK_MANAGED_ASSISTANT_MODEL?.trim(); return { - enabled: parseBool(raw.TREK_MANAGED) === true, + enabled, + assistant: enabled && baseUrl && token && model ? { baseUrl, token, model } : null, }; } diff --git a/server/src/app-config/env.schema.ts b/server/src/app-config/env.schema.ts index 9acaf78b4..91762cb45 100644 --- a/server/src/app-config/env.schema.ts +++ b/server/src/app-config/env.schema.ts @@ -213,6 +213,9 @@ export const envSchema = z.object({ ADMIN_EMAIL: anyString, ADMIN_PASSWORD: anyString, TREK_MANAGED: boolStr, + TREK_MANAGED_ASSISTANT_URL: url, + TREK_MANAGED_ASSISTANT_TOKEN: anyString, + TREK_MANAGED_ASSISTANT_MODEL: anyString, PLACES_API_BASE: url, GOOGLE_LIST_DATA_BASE: url, TREK_PLACES_URL: url, diff --git a/server/src/app-config/env.ts b/server/src/app-config/env.ts index 4d213194d..94e5b60ee 100644 --- a/server/src/app-config/env.ts +++ b/server/src/app-config/env.ts @@ -28,6 +28,8 @@ export const SECRET_ENV_KEYS: ReadonlySet = new Set([ 'ADMIN_PASSWORD', 'PLACES_API_KEY', 'TREK_SERVICES_KEY', + 'TREK_MANAGED_ASSISTANT_URL', + 'TREK_MANAGED_ASSISTANT_TOKEN', 'AMAP_API_KEY', 'AMAP_API_SECRET', 'MAPBOX_ACCESS_TOKEN', @@ -153,5 +155,30 @@ function managedPreconditions(raw: RawEnv): string[] { ); } + const { + TREK_MANAGED_ASSISTANT_URL: baseUrl, + TREK_MANAGED_ASSISTANT_MODEL: model, + TREK_MANAGED_ASSISTANT_TOKEN: token, + } = raw; + if (baseUrl || model || token) { + if (!baseUrl || !model?.trim() || !token?.trim()) { + problems.push(' - The managed assistant URL, model and token must be configured together.'); + } else { + const endpoint = URL.canParse(baseUrl) ? new URL(baseUrl) : null; + if ( + !endpoint || + endpoint.protocol !== 'https:' || + endpoint.username || + endpoint.password || + endpoint.search || + endpoint.hash + ) { + problems.push( + ' - TREK_MANAGED_ASSISTANT_URL must be an HTTPS URL without credentials, a query or a fragment.', + ); + } + } + } + return problems; } diff --git a/server/src/nest/ai-connections/ai-chat-client.service.ts b/server/src/nest/ai-connections/ai-chat-client.service.ts index d5f325895..787e242d2 100644 --- a/server/src/nest/ai-connections/ai-chat-client.service.ts +++ b/server/src/nest/ai-connections/ai-chat-client.service.ts @@ -16,6 +16,7 @@ import { Injectable } from '@nestjs/common'; * is the adapter's. */ const cloudFetch: AiFetch = (url, init) => safeFetch(url, { ...init, signal: init.signal }, { maxBytes: null }); +const hostedFetch: AiFetch = (url, init) => cloudFetch(url, { ...init, redirect: 'error' }); /** * An admin's own server, which may sit on loopback or in the LAN: the guard @@ -46,6 +47,15 @@ export class AiChatClientService { create(connection: ResolvedAiConnection): AiChatClient { const { credential, kind, model } = connection; if (credential.type === 'chatgpt') return this.chatgptPlan(connection.id, model, credential.accessToken); + if (connection.managed) { + return new OpenAiChatClient( + 'openrouter', + model, + ownServerChatBase(connection.baseUrl), + credential.apiKey, + hostedFetch, + ); + } if (kind === 'openai' && openAiWantsResponses(model)) { const apiKey = credential.apiKey ?? ''; return new OpenAiResponsesClient(model, () => Promise.resolve(apiKey), cloudFetch, 'openai'); diff --git a/server/src/nest/ai-connections/ai-connections.controller.ts b/server/src/nest/ai-connections/ai-connections.controller.ts index b411671ee..224e0f21e 100644 --- a/server/src/nest/ai-connections/ai-connections.controller.ts +++ b/server/src/nest/ai-connections/ai-connections.controller.ts @@ -46,6 +46,7 @@ export class AiConnectionsController { ) {} @Get('status') + @ManagedForbidden('managed status describes the operator gateway', { allowHostedAssistant: true }) @ResponseContract(aiStatusResponseSchema) status(@CurrentUser() user: User) { return this.connections.status(user.id); @@ -78,6 +79,9 @@ export class AiConnectionsController { } @Post('privacy-ack') + @ManagedForbidden('the hosted assistant requires each user to acknowledge the provider', { + allowHostedAssistant: true, + }) @HttpCode(200) @ResponseContract(successResponseSchema) async ackPrivacy(@CurrentUser() user: User, @Body() body: AiPrivacyAckDto) { diff --git a/server/src/nest/ai-connections/ai-connections.service.ts b/server/src/nest/ai-connections/ai-connections.service.ts index 74f9e31cb..620a2658a 100644 --- a/server/src/nest/ai-connections/ai-connections.service.ts +++ b/server/src/nest/ai-connections/ai-connections.service.ts @@ -48,6 +48,27 @@ import { /** A key test asks the provider for its models: a few a minute per user, so the server is no oracle for keys. */ const MODEL_CALLS_PER_MINUTE = 5; +function hostedConnection(): ResolvedAiConnection | null { + const config = readEnv().managed.assistant; + if (!config) return null; + return { + id: 0, + managed: true, + scope: 'instance', + kind: 'openrouter', + model: config.model, + baseUrl: config.baseUrl, + host: aiHostOf('openrouter', null), + paidBy: 'instance', + status: 'ok', + credential: { type: 'api_key', apiKey: config.token }, + }; +} + +function privacyTarget(connection: Pick): string { + return `${connection.kind}@${connection.host}${connection.managed ? ':managed' : ''}`; +} + function kindOf(row: AiConnectionRow): AiConnectionKind { return row.kind as AiConnectionKind; } @@ -94,13 +115,35 @@ export class AiConnectionsService implements SharedAiConnectionPort { /** `kind:model` of the models a provider refused an image for, while this process runs. */ private readonly textOnly = new Set(); - /** Whether the assistant exists here at all: the addon is on and the install is not centrally administered. */ + /** The addon must be on. Managed installs additionally require the operator gateway. */ async enabled(): Promise { - return !readEnv().managed.enabled && (await this.addons.isAddonEnabled(ADDON_IDS.AI_ASSISTANT)); + const managed = readEnv().managed; + return (!managed.enabled || !!managed.assistant) && (await this.addons.isAddonEnabled(ADDON_IDS.AI_ASSISTANT)); } async status(userId: number): Promise { const settings = await this.aiSettings.read(); + const hosted = hostedConnection(); + if (hosted) { + const available = await this.enabled(); + const target = privacyTarget(hosted); + const instance = { kind: hosted.kind, model: hosted.model, host: hosted.host }; + return { + available, + policy: 'instance', + canConnectOwn: false, + effective: available ? { ...instance, source: 'instance', paidBy: 'instance' } : null, + own: null, + instance: available ? instance : null, + quota: null, + privacyAcked: + available && (await this.settings.getDecryptedUserSetting(userId, AI_PRIVACY_ACK_SETTING)) === target, + studioImages: available && this.readsImages(hosted), + studioImagesAcked: available && (await this.studioImagesAckedFor(userId, target)), + retention: settings.retention, + openrouterOAuth: false, + }; + } const own = await this.connections.findForUser(userId); const instance = await this.connections.findInstance(); const picked = (await this.enabled()) ? pickConnection(settings.policy, own, instance) : null; @@ -148,6 +191,14 @@ export class AiConnectionsService implements SharedAiConnectionPort { */ async resolveForUser(userId: number): Promise { if (!(await this.enabled())) throw aiRefusal('not_connected', 'The AI assistant is not available'); + const hosted = hostedConnection(); + if (hosted) { + const target = privacyTarget(hosted); + if ((await this.settings.getDecryptedUserSetting(userId, AI_PRIVACY_ACK_SETTING)) !== target) { + throw aiRefusal('forbidden', 'Acknowledge the AI Assistant privacy notice first'); + } + return hosted; + } const { policy } = await this.aiSettings.read(); const picked = pickConnection( policy, @@ -177,6 +228,7 @@ export class AiConnectionsService implements SharedAiConnectionPort { * clears an earlier mark. */ async noteOutcome(connection: ResolvedAiConnection, code: AssistantErrorCode | null): Promise { + if (connection.managed) return; if (code === 'invalid_key' && connection.status !== 'error') { await this.connections.setStatus(connection.id, 'error'); } else if (code === 'needs_reauth' && connection.kind === 'chatgpt') { @@ -241,12 +293,19 @@ export class AiConnectionsService implements SharedAiConnectionPort { */ async ackPrivacy(userId: number, req: AiPrivacyAckRequest): Promise { const key = req.scope === 'studio_images' ? AI_STUDIO_IMAGES_ACK_SETTING : AI_PRIVACY_ACK_SETTING; - await this.settings.upsertSetting(userId, key, `${req.kind}@${req.host}`); + const hosted = hostedConnection(); + if (hosted && (req.kind !== hosted.kind || req.host !== hosted.host)) { + throw aiRefusal('forbidden', 'This is not the configured AI Assistant provider'); + } + await this.settings.upsertSetting(userId, key, privacyTarget(hosted ?? req)); } /** Whether the user let this connection receive images of their Studio pages; without it a turn stays text. */ - async studioImagesAcked(userId: number, connection: Pick): Promise { - return this.studioImagesAckedFor(userId, `${connection.kind}@${connection.host}`); + async studioImagesAcked( + userId: number, + connection: Pick, + ): Promise { + return this.studioImagesAckedFor(userId, privacyTarget(connection)); } private async studioImagesAckedFor(userId: number, target: string): Promise { @@ -259,8 +318,9 @@ export class AiConnectionsService implements SharedAiConnectionPort { * runs. Status asks this too, so the Studio offers images only where a turn * would send them. */ - readsImages({ kind, model }: Pick): boolean { - return modelReadsImages(kind, model) && !this.textOnly.has(`${kind}:${model}`); + readsImages({ kind, model, managed }: Pick): boolean { + const supported = modelReadsImages(kind, model) || (managed === true && model === 'qwen/qwen3.7-flash'); + return supported && !this.textOnly.has(`${kind}:${model}`); } /** A provider refused an image for this model: it reads pages in words until the process restarts. */ diff --git a/server/src/nest/ai-connections/ai-connections.types.ts b/server/src/nest/ai-connections/ai-connections.types.ts index d56aa586c..eeaab6948 100644 --- a/server/src/nest/ai-connections/ai-connections.types.ts +++ b/server/src/nest/ai-connections/ai-connections.types.ts @@ -10,6 +10,8 @@ export type AiCredential = { type: 'api_key'; apiKey: string | null } | { type: */ export interface ResolvedAiConnection { id: number; + /** Operator gateway configuration has no database connection row or tenant daily quota. */ + managed?: true; scope: AiConnectionScope; kind: AiConnectionKind; model: string; diff --git a/server/src/nest/assistant/assistant-attachments.controller.ts b/server/src/nest/assistant/assistant-attachments.controller.ts index fe7c99a0c..ce19ce6e7 100644 --- a/server/src/nest/assistant/assistant-attachments.controller.ts +++ b/server/src/nest/assistant/assistant-attachments.controller.ts @@ -5,7 +5,7 @@ import { aiRefusal } from '../ai-connections/ai-connections.constants'; import { RuntimeEnvService } from '../app-config/runtime-env.service'; import { CurrentUser } from '../auth-core/current-user.decorator'; import { JwtAuthGuard } from '../auth-core/jwt-auth.guard'; -import { isManagedBlocked, MANAGED_FORBIDDEN_ERROR, ManagedForbidden } from '../common/managed'; +import { isManagedAssistantBlocked, MANAGED_FORBIDDEN_ERROR, ManagedForbidden } from '../common/managed'; import { TripAccessService } from '../trip-membership/trip-access.service'; import { MAX_ATTACHMENT_BYTES } from './assistant-tools.constants'; import { channelOf } from './assistant.controller'; @@ -90,7 +90,7 @@ export class AssistantAttachmentsController { if (!(await this.addons.isAddonEnabled(ADDON_IDS.AI_ASSISTANT))) { throw new HttpException({ error: 'AI assistant addon is not enabled' }, 404); } - if (isManagedBlocked(this.env)) throw new HttpException(MANAGED_FORBIDDEN_ERROR, 403); + if (isManagedAssistantBlocked(this.env)) throw new HttpException(MANAGED_FORBIDDEN_ERROR, 403); if (!(await this.trips.findAccessible(tripId, user.id))) { throw new HttpException({ error: 'Trip not found' }, 404); } diff --git a/server/src/nest/assistant/assistant-renders.controller.ts b/server/src/nest/assistant/assistant-renders.controller.ts index 37cf2926f..0bffd18dc 100644 --- a/server/src/nest/assistant/assistant-renders.controller.ts +++ b/server/src/nest/assistant/assistant-renders.controller.ts @@ -5,7 +5,7 @@ import { RuntimeEnvService } from '../app-config/runtime-env.service'; import { CurrentUser } from '../auth-core/current-user.decorator'; import { JwtAuthGuard } from '../auth-core/jwt-auth.guard'; import { readImageHeader } from '../common/image-header'; -import { isManagedBlocked, MANAGED_FORBIDDEN_ERROR, ManagedForbidden } from '../common/managed'; +import { isManagedAssistantBlocked, MANAGED_FORBIDDEN_ERROR, ManagedForbidden } from '../common/managed'; import { ResponseContract } from '../common/response-contract'; import { toRowId } from '../common/row-id'; import { JourneyAiPhotosService } from '../journey/journey-ai-photos.service'; @@ -90,7 +90,7 @@ export class AssistantRendersController { if (!(await this.addons.isAddonEnabled(ADDON_IDS.AI_ASSISTANT))) { throw new HttpException({ error: 'AI assistant addon is not enabled' }, 404); } - if (isManagedBlocked(this.env)) throw new HttpException(MANAGED_FORBIDDEN_ERROR, 403); + if (isManagedAssistantBlocked(this.env)) throw new HttpException(MANAGED_FORBIDDEN_ERROR, 403); if (!(await this.addons.isAddonEnabled(ADDON_IDS.JOURNEY))) { throw new HttpException({ error: 'Journey addon is not enabled' }, 404); } diff --git a/server/src/nest/assistant/assistant.controller.ts b/server/src/nest/assistant/assistant.controller.ts index 0b02cab35..c8ef36aa1 100644 --- a/server/src/nest/assistant/assistant.controller.ts +++ b/server/src/nest/assistant/assistant.controller.ts @@ -66,7 +66,7 @@ export function channelOf(res: Response): TurnChannel { @Controller('api/trips/:tripId/assistant') @UseGuards(AddonGuard, JwtAuthGuard, TripAccessGuard) @RequireAddon(ADDON_IDS.AI_ASSISTANT, 'AI assistant') -@ManagedForbidden('the operator decides which model a managed install talks to, and pays for it') +@ManagedForbidden('managed assistant requests use the operator gateway', { allowHostedAssistant: true }) export class AssistantController { constructor( private readonly assistant: AssistantService, diff --git a/server/src/nest/assistant/assistant.service.ts b/server/src/nest/assistant/assistant.service.ts index 93057a04d..96a9f70ed 100644 --- a/server/src/nest/assistant/assistant.service.ts +++ b/server/src/nest/assistant/assistant.service.ts @@ -249,7 +249,7 @@ export class AssistantService { if (begun.created) w.thread(begun.threadId, begun.title); await this.usage.record(userId, connection.paidBy, { turns: 1 }); const quota = - connection.paidBy === 'instance' + connection.paidBy === 'instance' && dailyTurns !== null ? { used: await this.usage.instanceTurnsToday(userId), limit: dailyTurns } : null; const spec: TurnSpec = { @@ -372,7 +372,7 @@ export class AssistantService { const w = new UiStreamWriter(stream); w.start(messageIdOf(await this.answerStart(threadId, decided[0].call.message_id))); const quota = - connection.paidBy === 'instance' + connection.paidBy === 'instance' && dailyTurns !== null ? { used: await this.usage.instanceTurnsToday(userId), limit: dailyTurns } : null; const spec: TurnSpec = { @@ -530,7 +530,8 @@ export class AssistantService { * day reached the admin's limit; answers that limit. A decision counts no * turn of its own, but runs the model again, so it is held to the limit too. */ - private async withinDailyLimit(userId: number, connection: ResolvedAiConnection): Promise { + private async withinDailyLimit(userId: number, connection: ResolvedAiConnection): Promise { + if (connection.managed) return null; const { dailyTurns } = await this.connections.readSettings(); if (connection.paidBy === 'instance' && (await this.usage.instanceTurnsToday(userId)) >= dailyTurns) { throw aiRefusal('daily_limit', 'The daily limit of the assistant is reached'); diff --git a/server/src/nest/assistant/home-assistant.controller.ts b/server/src/nest/assistant/home-assistant.controller.ts index 46a4d0311..e7fef9389 100644 --- a/server/src/nest/assistant/home-assistant.controller.ts +++ b/server/src/nest/assistant/home-assistant.controller.ts @@ -36,7 +36,7 @@ import type { Response } from 'express'; @Controller('api/assistant') @UseGuards(AddonGuard, JwtAuthGuard) @RequireAddon(ADDON_IDS.AI_ASSISTANT, 'AI assistant') -@ManagedForbidden('the operator decides which model a managed install talks to, and pays for it') +@ManagedForbidden('managed assistant requests use the operator gateway', { allowHostedAssistant: true }) export class HomeAssistantController { constructor(private readonly assistant: AssistantService) {} diff --git a/server/src/nest/assistant/journey-assistant.controller.ts b/server/src/nest/assistant/journey-assistant.controller.ts index 7f34632eb..c54e7bbf5 100644 --- a/server/src/nest/assistant/journey-assistant.controller.ts +++ b/server/src/nest/assistant/journey-assistant.controller.ts @@ -49,7 +49,7 @@ function journeyScope(journeyId: string, surface?: AssistantJourneySurface): Ass @Controller('api/journeys/:journeyId/assistant') @UseGuards(AddonGuard, JwtAuthGuard, JourneyAssistantGuard) @RequireAddon(ADDON_IDS.AI_ASSISTANT, 'AI assistant') -@ManagedForbidden('the operator decides which model a managed install talks to, and pays for it') +@ManagedForbidden('managed assistant requests use the operator gateway', { allowHostedAssistant: true }) export class JourneyAssistantController { constructor(private readonly assistant: AssistantService) {} diff --git a/server/src/nest/common/managed.guard.ts b/server/src/nest/common/managed.guard.ts index fed305f34..30c351670 100644 --- a/server/src/nest/common/managed.guard.ts +++ b/server/src/nest/common/managed.guard.ts @@ -1,5 +1,5 @@ import { RuntimeEnvService } from '../app-config/runtime-env.service'; -import { MANAGED_FORBIDDEN, MANAGED_FORBIDDEN_ERROR } from './managed'; +import { isManagedAssistantBlocked, MANAGED_FORBIDDEN, MANAGED_FORBIDDEN_ERROR } from './managed'; import { CanActivate, ExecutionContext, HttpException, Injectable } from '@nestjs/common'; import { Reflector } from '@nestjs/core'; @@ -31,10 +31,9 @@ export class ManagedGuard implements CanActivate { canActivate(context: ExecutionContext): boolean { if (!this.env.isManaged()) return true; - const marked = this.reflector.getAllAndOverride<{ enforcedInHandler?: boolean } | undefined>(MANAGED_FORBIDDEN, [ - context.getHandler(), - context.getClass(), - ]); + const marked = this.reflector.getAllAndOverride< + { enforcedInHandler?: boolean; allowHostedAssistant?: boolean } | undefined + >(MANAGED_FORBIDDEN, [context.getHandler(), context.getClass()]); if (!marked) return true; // A multipart handler checks for itself, after the interceptor has drained @@ -42,6 +41,7 @@ export class ManagedGuard implements CanActivate { // see an ECONNRESET rather than the 403 (PROFILE-015). The marker still sits // on the route so the boot gate can inventory it. if (marked.enforcedInHandler) return true; + if (marked.allowHostedAssistant && !isManagedAssistantBlocked(this.env)) return true; throw new HttpException(MANAGED_FORBIDDEN_ERROR, 403); } diff --git a/server/src/nest/common/managed.ts b/server/src/nest/common/managed.ts index 8fbb091a3..c73d9971f 100644 --- a/server/src/nest/common/managed.ts +++ b/server/src/nest/common/managed.ts @@ -38,8 +38,12 @@ export const MANAGED_FORBIDDEN_ERROR = { * still carry the marker, because the boot gate inventories markers and a route * missing from that inventory is exactly what nobody notices. */ -export const ManagedForbidden = (reason: string, opts?: { enforcedInHandler?: true }) => - SetMetadata(MANAGED_FORBIDDEN, { reason, enforcedInHandler: opts?.enforcedInHandler === true }); +export const ManagedForbidden = (reason: string, opts?: { enforcedInHandler?: true; allowHostedAssistant?: true }) => + SetMetadata(MANAGED_FORBIDDEN, { + reason, + enforcedInHandler: opts?.enforcedInHandler === true, + ...(opts?.allowHostedAssistant ? { allowHostedAssistant: true } : {}), + }); /** * The handler-side flavour of the guard below. @@ -53,6 +57,10 @@ export function isManagedBlocked(env: RuntimeEnvService): boolean { return env.isManaged(); } +export function isManagedAssistantBlocked(env: RuntimeEnvService): boolean { + return env.isManaged() && !env.env().managed.assistant; +} + /** * The settings a centrally administered install does not hand to its admin, * because the value belongs to whoever operates it. diff --git a/server/tests/e2e/ai-connections.e2e.test.ts b/server/tests/e2e/ai-connections.e2e.test.ts index f4b25e5f8..a94daff38 100644 --- a/server/tests/e2e/ai-connections.e2e.test.ts +++ b/server/tests/e2e/ai-connections.e2e.test.ts @@ -10,6 +10,7 @@ */ import { AiConnections } from '../../src/db/entities/AiConnections.entity'; import { AiConnectionsModule } from '../../src/nest/ai-connections/ai-connections.module'; +import { AiConnectionsService } from '../../src/nest/ai-connections/ai-connections.service'; import { AppConfigModule } from '../../src/nest/app-config/app-config.module'; import { DemoModule } from '../../src/nest/common/demo.module'; import { TrekExceptionFilter } from '../../src/nest/common/trek-exception.filter'; @@ -24,6 +25,7 @@ import { FakeRealtimeService } from '../helpers/fake-realtime'; import { createTestMikroOrmModule, createTestOrm, type TestOrm } from '../helpers/test-orm'; import { TestUnitOfWorkModule } from '../helpers/test-uow'; import { sessionCookie } from './harness'; +import { RequestContext } from '@mikro-orm/core'; import { Test } from '@nestjs/testing'; import cookieParser from 'cookie-parser'; @@ -111,6 +113,42 @@ afterAll(async () => { }); describe('AI connections e2e', () => { + it('uses the operator gateway and requires a separate acknowledgement on a managed instance', async () => { + vi.stubEnv('TREK_MANAGED', '1'); + vi.stubEnv('TREK_MANAGED_ASSISTANT_URL', 'https://gate.example.test/ai/v1'); + vi.stubEnv('TREK_MANAGED_ASSISTANT_MODEL', 'qwen/qwen3.7-flash'); + vi.stubEnv('TREK_MANAGED_ASSISTANT_TOKEN', 'synthetic-instance-bearer'); + try { + const connections = app.get(AiConnectionsService); + const resolve = () => RequestContext.create(orm.em, () => connections.resolveForUser(OTHER)); + const first = await request(server).get('/api/ai/status').set(as(OTHER)); + expect(first.status).toBe(200); + expect(first.body).toMatchObject({ + available: true, + canConnectOwn: false, + effective: { kind: 'openrouter', host: 'openrouter.ai', source: 'instance' }, + privacyAcked: false, + quota: null, + studioImages: true, + }); + expect(first.text).not.toContain('synthetic-instance-bearer'); + await expect(resolve()).rejects.toThrow('Acknowledge the AI Assistant privacy notice'); + const ack = await request(server) + .post('/api/ai/privacy-ack') + .set(as(OTHER)) + .send({ kind: 'openrouter', host: 'openrouter.ai' }); + expect(ack.status).toBe(200); + await expect(resolve()).resolves.toMatchObject({ + managed: true, + baseUrl: 'https://gate.example.test/ai/v1', + }); + expect((await request(server).get('/api/ai/status').set(as(OTHER))).body.privacyAcked).toBe(true); + expect(safeFetch).not.toHaveBeenCalled(); + } finally { + vi.unstubAllEnvs(); + } + }); + it('AIE2E-001: the addon gate answers 404 before auth, then auth answers 401', async () => { await setAddonEnabled(orm, 'ai_assistant', false); expect((await request(server).get('/api/ai/status')).status).toBe(404); diff --git a/server/tests/unit/app-config/env-reference.test.ts b/server/tests/unit/app-config/env-reference.test.ts index 70a97caac..4b1d3fcc3 100644 --- a/server/tests/unit/app-config/env-reference.test.ts +++ b/server/tests/unit/app-config/env-reference.test.ts @@ -24,6 +24,9 @@ const NOT_OPERATOR_SETTINGS: Record = { APP_VERSION: 'set by the image build; the VERSION file wins over it', TREK_DB_FILE: 'points the Playwright harness at a throwaway database', TREK_MANAGED: 'managed hosting only, deliberately undocumented for self-hosters', + TREK_MANAGED_ASSISTANT_URL: 'managed hosting only, the operator gateway URL', + TREK_MANAGED_ASSISTANT_TOKEN: 'managed hosting only, the instance credential for the operator gateway', + TREK_MANAGED_ASSISTANT_MODEL: 'managed hosting only, the operator-selected assistant model', MAPBOX_ACCESS_TOKEN: 'managed hosting only (read with TREK_MANAGED), deliberately undocumented for self-hosters', CARTO_API_KEY: 'managed hosting only (read with TREK_MANAGED), deliberately undocumented for self-hosters', PLACES_API_BASE: "managed hosting's egress gateway for the Places calls, deliberately undocumented for self-hosters", diff --git a/server/tests/unit/app-config/validate.test.ts b/server/tests/unit/app-config/validate.test.ts index 250bf79c0..9553526a7 100644 --- a/server/tests/unit/app-config/validate.test.ts +++ b/server/tests/unit/app-config/validate.test.ts @@ -59,6 +59,41 @@ describe('validateEnvAtBoot', () => { ).not.toThrow(); }); + const managedAssistant = { + TREK_MANAGED: '1', + ENCRYPTION_KEY: 'a'.repeat(64), + TREK_MANAGED_ASSISTANT_URL: 'https://gate.example.com/ai/v1', + TREK_MANAGED_ASSISTANT_MODEL: 'provider/model', + TREK_MANAGED_ASSISTANT_TOKEN: 'synthetic-assistant-credential', + }; + + it('accepts a managed assistant with a complete gateway configuration', () => { + expect(() => validateEnvAtBoot(managedAssistant)).not.toThrow(); + }); + + it.each([ + ['TREK_MANAGED_ASSISTANT_URL', ''], + ['TREK_MANAGED_ASSISTANT_MODEL', ' '], + ['TREK_MANAGED_ASSISTANT_TOKEN', ' '], + ])('refuses partial managed assistant configuration with %s missing', (key, value) => { + const report = bootReport({ ...managedAssistant, [key]: value }); + expect(report.printed).toContain('URL, model and token must be configured together'); + }); + + it.each([ + 'https://name:synthetic-url-password@invalid host/', + 'http://gate.example.com/ai/v1', + 'https://user@gate.example.com/ai/v1', + 'https://:synthetic-url-password@gate.example.com/ai/v1', + 'https://gate.example.com/ai/v1?query=1', + 'https://gate.example.com/ai/v1#section', + ])('refuses an unsafe managed assistant URL', (url) => { + const report = bootReport({ ...managedAssistant, TREK_MANAGED_ASSISTANT_URL: url }); + expect(report.printed).toContain('must be an HTTPS URL without credentials, a query or a fragment'); + expect(report.printed).not.toContain('synthetic-url-password'); + expect(report.printed).not.toContain(managedAssistant.TREK_MANAGED_ASSISTANT_TOKEN); + }); + it('refuses an LLM ceiling that would silently become a zero timeout', () => { // Both shapes pass a plain "positive number" check and then degrade into an // immediate abort: a fractional value floors to 0, and anything past the diff --git a/server/tests/unit/nest/assistant/assistant-attachments.controller.test.ts b/server/tests/unit/nest/assistant/assistant-attachments.controller.test.ts index 657dbd220..bfc64385f 100644 --- a/server/tests/unit/nest/assistant/assistant-attachments.controller.test.ts +++ b/server/tests/unit/nest/assistant/assistant-attachments.controller.test.ts @@ -48,13 +48,16 @@ class FakeResponse extends EventEmitter { } } -function make(opts: { addon?: boolean; managed?: boolean; trip?: boolean } = {}) { +function make(opts: { addon?: boolean; managed?: boolean; managedAssistant?: boolean; trip?: boolean } = {}) { const service = { attach: vi.fn(async (_u: number, _t: number, _b: unknown, _f: unknown, _c: TurnChannel) => undefined), }; const trips = { findAccessible: vi.fn(async () => (opts.trip === false ? undefined : { id: 5, user_id: 7 })) }; const addons = { isAddonEnabled: vi.fn(async () => opts.addon !== false) }; - const env = { isManaged: () => opts.managed === true }; + const env = { + isManaged: () => opts.managed === true, + env: () => ({ managed: { assistant: opts.managedAssistant ? { model: 'test-model' } : undefined } }), + }; const controller = new AssistantAttachmentsController( service as unknown as AssistantService, trips as unknown as TripAccessService, @@ -105,6 +108,10 @@ describe('AssistantAttachmentsController', () => { }); expect(stranger.trips.findAccessible).toHaveBeenCalledWith('5', 7); for (const t of [off, managed, stranger]) expect(t.service.attach).not.toHaveBeenCalled(); + + const managedWithAssistant = make({ managed: true, managedAssistant: true }); + await managedWithAssistant.controller.attach(user, '5', file('a.pdf'), BODY, res); + expect(managedWithAssistant.service.attach).toHaveBeenCalledOnce(); }); it('ASTATT-003: a missing, too large or unknown file is refused before the turn', async () => { diff --git a/server/tests/unit/nest/managed.guard.test.ts b/server/tests/unit/nest/managed.guard.test.ts index aac355857..4ecfa865c 100644 --- a/server/tests/unit/nest/managed.guard.test.ts +++ b/server/tests/unit/nest/managed.guard.test.ts @@ -17,12 +17,23 @@ import { Reflector } from '@nestjs/core'; import { describe, it, expect, vi } from 'vitest'; -function makeGuard(managed: boolean, marked: boolean, enforcedInHandler = false) { +function makeGuard( + managed: boolean, + marked: boolean, + enforcedInHandler = false, + hosted = false, + allowHostedAssistant = false, +) { const getAllAndOverride = vi.fn((key: string) => - key === MANAGED_FORBIDDEN && marked ? { reason: 'the operator holds this', enforcedInHandler } : undefined, + key === MANAGED_FORBIDDEN && marked + ? { reason: 'the operator holds this', enforcedInHandler, allowHostedAssistant } + : undefined, ); const guard = new ManagedGuard( - { isManaged: () => managed } as unknown as RuntimeEnvService, + { + isManaged: () => managed, + env: () => ({ managed: { assistant: hosted ? {} : null } }), + } as unknown as RuntimeEnvService, { getAllAndOverride } as unknown as Reflector, ); return { guard, getAllAndOverride }; @@ -80,6 +91,12 @@ describe('ManagedGuard', () => { expect(guard.canActivate(ctx)).toBe(true); }); + it('only lets the hosted assistant through when the operator configured it and the handler permits it', () => { + expect(makeGuard(true, true, false, true, true).guard.canActivate(ctx)).toBe(true); + expect(thrown(() => makeGuard(true, true, false, true).guard.canActivate(ctx))?.getStatus()).toBe(403); + expect(thrown(() => makeGuard(true, true, false, false, true).guard.canActivate(ctx))?.getStatus()).toBe(403); + }); + it('MANAGED-GUARD-005: asks for the decorator on handler and controller, not for a path', () => { const { guard, getAllAndOverride } = makeGuard(true, false); guard.canActivate(ctx); diff --git a/shared/scripts/i18n-parity.mjs b/shared/scripts/i18n-parity.mjs index 37591d9a0..c4acce352 100644 --- a/shared/scripts/i18n-parity.mjs +++ b/shared/scripts/i18n-parity.mjs @@ -114,10 +114,6 @@ export const NOT_PLURAL = [ { key: 'dawarich.duration.hours', because: 'a duration in a unit symbol (h), the same for any number' }, { key: 'dawarich.duration.hoursMinutes', because: 'a duration in unit symbols (h, min), the same for any number' }, { key: 'files.uploadErrorSize', because: 'a size limit in a unit symbol (MB), the same for any number' }, - { - key: 'native.plans.photos', - because: 'an estimate of photos a plan holds, always in the thousands, so no singular ever shows', - }, { key: 'native.plans.aiPerMonth', because: 'a monthly document allowance before a unit ("25 / month"), always in the tens', diff --git a/shared/src/i18n/ar/native.ts b/shared/src/i18n/ar/native.ts index 7eb79485b..ff3e3329d 100644 --- a/shared/src/i18n/ar/native.ts +++ b/shared/src/i18n/ar/native.ts @@ -49,6 +49,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': 'كلمة المرور', 'native.claim.passwordHint': '8 أحرف على الأقل. يجب أن تحتوي كلمة المرور على حرف كبير وحرف صغير ورقم ورمز خاص.', 'native.claim.subscribe': 'اشترك مقابل {price}', + 'native.claim.completeSetup': 'إكمال الإعداد', 'native.claim.cancelled': 'تم إلغاء الشراء.', 'native.claim.failed': 'لم تتم عملية الشراء. حاول مرة أخرى.', 'native.claim.redeemFailed': 'تعذّر علينا إعداد TREK الخاص بك. حاول مرة أخرى.', @@ -200,9 +201,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'في كل خطة', 'native.plans.yearlyIs': '{price} سنويًا، ألغِ في أي وقت', 'native.plans.monthlyIs': 'أي {price} شهريًا', - 'native.plans.photos': '≈ {n} صورة', + 'native.plans.storageFairUse': 'تخزين وفق الاستخدام العادل', 'native.plans.aiPerMonth': '{n} / شهر', - 'native.plans.aiNone': 'لا شيء', + 'native.plans.aiNone': 'غير مشمول', + 'native.plans.included': 'مشمول', + 'native.plans.planned': 'مخطط له', + 'native.plans.assistant': 'مساعد الذكاء الاصطناعي', + 'native.plans.mailImport': 'استيراد البريد تلقائيًا', 'native.plans.aiLabel': 'مستندات الذكاء الاصطناعي', 'native.plans.choose': 'اختر {trip}', 'native.plans.termsShort': 'شروط الاستخدام (EULA)', diff --git a/shared/src/i18n/az/native.ts b/shared/src/i18n/az/native.ts index f2ce6842c..0f390828a 100644 --- a/shared/src/i18n/az/native.ts +++ b/shared/src/i18n/az/native.ts @@ -49,6 +49,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': 'Parol', 'native.claim.passwordHint': 'Ən azı 8 simvol. Parolda böyük hərf, kiçik hərf, rəqəm və xüsusi simvol olmalıdır.', 'native.claim.subscribe': '{price} qarşılığında abunə ol', + 'native.claim.completeSetup': 'Quraşdırmanı tamamla', 'native.claim.cancelled': 'Alış ləğv edildi.', 'native.claim.failed': 'Alış baş tutmadı. Zəhmət olmasa yenidən cəhd edin.', 'native.claim.redeemFailed': 'TREK-inizi hazırlaya bilmədik. Zəhmət olmasa yenidən cəhd edin.', @@ -205,9 +206,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'hər planda', 'native.plans.yearlyIs': 'İllik {price}, istənilən vaxt ləğv edin', 'native.plans.monthlyIs': 'Bu, ayda {price} edir', - 'native.plans.photos': '≈ {n} foto', + 'native.plans.storageFairUse': 'Ədalətli istifadə yaddaşı', 'native.plans.aiPerMonth': '{n} / ay', - 'native.plans.aiNone': 'Yoxdur', + 'native.plans.aiNone': 'Daxil deyil', + 'native.plans.included': 'Daxildir', + 'native.plans.planned': 'Planlaşdırılır', + 'native.plans.assistant': 'Sİ köməkçisi', + 'native.plans.mailImport': 'Avtomatik e-poçt idxalı', 'native.plans.aiLabel': 'Sİ sənədləri', 'native.plans.choose': '{trip} seçin', 'native.plans.termsShort': 'İstifadə şərtləri (EULA)', diff --git a/shared/src/i18n/br/native.ts b/shared/src/i18n/br/native.ts index 22b46bce3..8be4e6742 100644 --- a/shared/src/i18n/br/native.ts +++ b/shared/src/i18n/br/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Pelo menos 8 caracteres. A senha deve ter maiúscula, minúscula, número e um caractere especial.', 'native.claim.subscribe': 'Assinar por {price}', + 'native.claim.completeSetup': 'Concluir configuração', 'native.claim.cancelled': 'Compra cancelada.', 'native.claim.failed': 'A compra não foi concluída. Tente novamente.', 'native.claim.redeemFailed': 'Não conseguimos preparar seu TREK. Tente novamente.', @@ -207,9 +208,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'em todos os planos', 'native.plans.yearlyIs': '{price} por ano, cancele quando quiser', 'native.plans.monthlyIs': 'São {price} por mês', - 'native.plans.photos': '≈ {n} fotos', + 'native.plans.storageFairUse': 'Armazenamento de uso justo', 'native.plans.aiPerMonth': '{n} / mês', - 'native.plans.aiNone': 'Nenhum', + 'native.plans.aiNone': 'Não incluído', + 'native.plans.included': 'Incluído', + 'native.plans.planned': 'Planejado', + 'native.plans.assistant': 'Assistente de IA', + 'native.plans.mailImport': 'Importação automática de e-mails', 'native.plans.aiLabel': 'Documentos de IA', 'native.plans.choose': 'Escolher {trip}', 'native.plans.termsShort': 'Termos de uso (EULA)', diff --git a/shared/src/i18n/ca/native.ts b/shared/src/i18n/ca/native.ts index cf7f07e7c..ad857e1b6 100644 --- a/shared/src/i18n/ca/native.ts +++ b/shared/src/i18n/ca/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Almenys 8 caràcters. La contrasenya ha de contenir majúscules, minúscules, números i un caràcter especial.', 'native.claim.subscribe': 'Subscriu-te per {price}', + 'native.claim.completeSetup': 'Completa la configuració', 'native.claim.cancelled': 'Compra cancel·lada.', 'native.claim.failed': 'La compra no s’ha completat. Torna-ho a provar.', 'native.claim.redeemFailed': 'No hem pogut preparar el teu TREK. Torna-ho a provar.', @@ -208,9 +209,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'en tots els plans', 'native.plans.yearlyIs': '{price} l’any, cancel·la quan vulguis', 'native.plans.monthlyIs': 'Són {price} al mes', - 'native.plans.photos': '≈ {n} fotos', + 'native.plans.storageFairUse': 'Emmagatzematge d’ús raonable', 'native.plans.aiPerMonth': '{n} / mes', - 'native.plans.aiNone': 'Cap', + 'native.plans.aiNone': 'No inclòs', + 'native.plans.included': 'Inclòs', + 'native.plans.planned': 'Previst', + 'native.plans.assistant': 'Assistent d’IA', + 'native.plans.mailImport': 'Importació automàtica de correus', 'native.plans.aiLabel': 'Documents IA', 'native.plans.choose': 'Tria {trip}', 'native.plans.termsShort': 'Condicions d’ús (EULA)', diff --git a/shared/src/i18n/cs/native.ts b/shared/src/i18n/cs/native.ts index 3725911bf..55091aea9 100644 --- a/shared/src/i18n/cs/native.ts +++ b/shared/src/i18n/cs/native.ts @@ -49,6 +49,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': 'Heslo', 'native.claim.passwordHint': 'Alespoň 8 znaků. Heslo musí obsahovat velké a malé písmeno, číslici a speciální znak.', 'native.claim.subscribe': 'Předplatit za {price}', + 'native.claim.completeSetup': 'Dokončit nastavení', 'native.claim.cancelled': 'Nákup zrušen.', 'native.claim.failed': 'Nákup se nezdařil. Zkuste to znovu.', 'native.claim.redeemFailed': 'Nepodařilo se připravit váš TREK. Zkuste to znovu.', @@ -201,9 +202,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'v každém tarifu', 'native.plans.yearlyIs': '{price} ročně, zrušení kdykoli', 'native.plans.monthlyIs': 'To je {price} měsíčně', - 'native.plans.photos': '≈ {n} fotek', + 'native.plans.storageFairUse': 'Úložiště v režimu férového využití', 'native.plans.aiPerMonth': '{n} / měsíc', - 'native.plans.aiNone': 'Žádné', + 'native.plans.aiNone': 'Není součástí', + 'native.plans.included': 'Součástí', + 'native.plans.planned': 'Plánováno', + 'native.plans.assistant': 'Asistent AI', + 'native.plans.mailImport': 'Automatický import e-mailů', 'native.plans.aiLabel': 'Dokumenty AI', 'native.plans.choose': 'Vybrat: {trip}', 'native.plans.termsShort': 'Podmínky použití (EULA)', diff --git a/shared/src/i18n/de/native.ts b/shared/src/i18n/de/native.ts index a4d18264d..d31636c31 100644 --- a/shared/src/i18n/de/native.ts +++ b/shared/src/i18n/de/native.ts @@ -51,6 +51,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Mindestens 8 Zeichen. Passwort muss Groß-, Kleinbuchstaben, eine Zahl und ein Sonderzeichen enthalten.', 'native.claim.subscribe': 'Abonnieren für {price}', + 'native.claim.completeSetup': 'Einrichtung abschließen', 'native.claim.cancelled': 'Kauf abgebrochen.', 'native.claim.failed': 'Der Kauf hat nicht geklappt. Bitte versuch es erneut.', 'native.claim.redeemFailed': 'Wir konnten dein TREK nicht einrichten. Bitte versuch es erneut.', @@ -211,9 +212,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'in jedem Tarif', 'native.plans.yearlyIs': 'Jährlich {price}, jederzeit kündbar', 'native.plans.monthlyIs': 'Das sind {price} im Monat', - 'native.plans.photos': '≈ {n} Fotos', + 'native.plans.storageFairUse': 'Speicher unter Fair Use', 'native.plans.aiPerMonth': '{n} / Monat', - 'native.plans.aiNone': 'Keine', + 'native.plans.aiNone': 'Nicht enthalten', + 'native.plans.included': 'Enthalten', + 'native.plans.planned': 'Geplant', + 'native.plans.assistant': 'KI-Assistent', + 'native.plans.mailImport': 'Automatischer E-Mail-Import', 'native.plans.aiLabel': 'KI-Dokumente', 'native.plans.choose': '{trip} wählen', 'native.plans.termsShort': 'Nutzungsbedingungen (EULA)', diff --git a/shared/src/i18n/en/native.ts b/shared/src/i18n/en/native.ts index f13de27ff..1b6465fdc 100644 --- a/shared/src/i18n/en/native.ts +++ b/shared/src/i18n/en/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'At least 8 characters. Password must contain uppercase, lowercase, a number, and a special character.', 'native.claim.subscribe': 'Subscribe for {price}', + 'native.claim.completeSetup': 'Complete setup', 'native.claim.cancelled': 'Purchase cancelled.', 'native.claim.failed': 'The purchase did not go through. Please try again.', 'native.claim.redeemFailed': 'We could not set up your TREK. Please try again.', @@ -206,9 +207,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'in every plan', 'native.plans.yearlyIs': 'Yearly {price}, cancel anytime', 'native.plans.monthlyIs': 'That is {price} a month', - 'native.plans.photos': '≈ {n} photos', + 'native.plans.storageFairUse': 'Storage fair use', 'native.plans.aiPerMonth': '{n} / month', - 'native.plans.aiNone': 'None', + 'native.plans.aiNone': 'Not included', + 'native.plans.included': 'Included', + 'native.plans.planned': 'Planned', + 'native.plans.assistant': 'AI Assistant', + 'native.plans.mailImport': 'Automated Mail Import', 'native.plans.aiLabel': 'AI documents', 'native.plans.choose': 'Choose {trip}', 'native.plans.termsShort': 'Terms of Use (EULA)', diff --git a/shared/src/i18n/es/native.ts b/shared/src/i18n/es/native.ts index 3175c9603..d8866c617 100644 --- a/shared/src/i18n/es/native.ts +++ b/shared/src/i18n/es/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Al menos 8 caracteres. La contraseña debe contener mayúsculas, minúsculas, números y un carácter especial.', 'native.claim.subscribe': 'Suscribirse por {price}', + 'native.claim.completeSetup': 'Completar configuración', 'native.claim.cancelled': 'Compra cancelada.', 'native.claim.failed': 'La compra no se completó. Inténtalo de nuevo.', 'native.claim.redeemFailed': 'No pudimos preparar tu TREK. Inténtalo de nuevo.', @@ -206,9 +207,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'en todos los planes', 'native.plans.yearlyIs': '{price} al año, cancela cuando quieras', 'native.plans.monthlyIs': 'Son {price} al mes', - 'native.plans.photos': '≈ {n} fotos', + 'native.plans.storageFairUse': 'Almacenamiento de uso razonable', 'native.plans.aiPerMonth': '{n} / mes', - 'native.plans.aiNone': 'Ninguno', + 'native.plans.aiNone': 'No incluido', + 'native.plans.included': 'Incluido', + 'native.plans.planned': 'Previsto', + 'native.plans.assistant': 'Asistente de IA', + 'native.plans.mailImport': 'Importación automática de correo', 'native.plans.aiLabel': 'Documentos IA', 'native.plans.choose': 'Elegir {trip}', 'native.plans.termsShort': 'Condiciones de uso (EULA)', diff --git a/shared/src/i18n/et/native.ts b/shared/src/i18n/et/native.ts index 7d2999361..febcfa912 100644 --- a/shared/src/i18n/et/native.ts +++ b/shared/src/i18n/et/native.ts @@ -49,6 +49,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': 'Parool', 'native.claim.passwordHint': 'Vähemalt 8 märki. Parool peab sisaldama suur- ja väiketähte, numbrit ning erimärki.', 'native.claim.subscribe': 'Telli hinnaga {price}', + 'native.claim.completeSetup': 'Lõpeta seadistamine', 'native.claim.cancelled': 'Ost tühistatud.', 'native.claim.failed': 'Ost ei õnnestunud. Proovi uuesti.', 'native.claim.redeemFailed': 'Me ei saanud sinu TREK-i seadistada. Proovi uuesti.', @@ -203,9 +204,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'igas paketis', 'native.plans.yearlyIs': '{price} aastas, tühista igal ajal', 'native.plans.monthlyIs': 'See on {price} kuus', - 'native.plans.photos': '≈ {n} fotot', + 'native.plans.storageFairUse': 'Õiglase kasutuse salvestusruum', 'native.plans.aiPerMonth': '{n} / kuus', - 'native.plans.aiNone': 'Puudub', + 'native.plans.aiNone': 'Ei sisaldu', + 'native.plans.included': 'Sisaldub', + 'native.plans.planned': 'Plaanis', + 'native.plans.assistant': 'AI-assistent', + 'native.plans.mailImport': 'Automaatne e-kirjade import', 'native.plans.aiLabel': 'TI-dokumendid', 'native.plans.choose': 'Vali {trip}', 'native.plans.termsShort': 'Kasutustingimused (EULA)', diff --git a/shared/src/i18n/fr/native.ts b/shared/src/i18n/fr/native.ts index 7ae377c04..5e4e6a3f1 100644 --- a/shared/src/i18n/fr/native.ts +++ b/shared/src/i18n/fr/native.ts @@ -51,6 +51,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Au moins 8 caractères. Le mot de passe doit contenir des majuscules, des minuscules, un chiffre et un caractère spécial.', 'native.claim.subscribe': 'S’abonner pour {price}', + 'native.claim.completeSetup': 'Terminer la configuration', 'native.claim.cancelled': 'Achat annulé.', 'native.claim.failed': 'L’achat n’a pas abouti. Réessayez.', 'native.claim.redeemFailed': 'Nous n’avons pas pu préparer votre TREK. Réessayez.', @@ -210,9 +211,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'dans chaque offre', 'native.plans.yearlyIs': '{price} par an, résiliable à tout moment', 'native.plans.monthlyIs': 'Soit {price} par mois', - 'native.plans.photos': '≈ {n} photos', // same-as-en + 'native.plans.storageFairUse': 'Stockage en usage raisonnable', 'native.plans.aiPerMonth': '{n} / mois', - 'native.plans.aiNone': 'Aucun', + 'native.plans.aiNone': 'Non inclus', + 'native.plans.included': 'Inclus', + 'native.plans.planned': 'Prévu', + 'native.plans.assistant': 'Assistant IA', + 'native.plans.mailImport': 'Import automatique des e-mails', 'native.plans.aiLabel': 'Documents IA', 'native.plans.choose': 'Choisir {trip}', 'native.plans.termsShort': 'Conditions d’utilisation (EULA)', diff --git a/shared/src/i18n/gr/native.ts b/shared/src/i18n/gr/native.ts index 7078f99b7..d8074bf59 100644 --- a/shared/src/i18n/gr/native.ts +++ b/shared/src/i18n/gr/native.ts @@ -51,6 +51,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Τουλάχιστον 8 χαρακτήρες. Ο κωδικός πρέπει να περιέχει κεφαλαία, πεζά, έναν αριθμό και έναν ειδικό χαρακτήρα.', 'native.claim.subscribe': 'Εγγραφή για {price}', + 'native.claim.completeSetup': 'Ολοκλήρωση ρύθμισης', 'native.claim.cancelled': 'Η αγορά ακυρώθηκε.', 'native.claim.failed': 'Η αγορά δεν ολοκληρώθηκε. Δοκιμάστε ξανά.', 'native.claim.redeemFailed': 'Δεν μπορέσαμε να ετοιμάσουμε το TREK σας. Δοκιμάστε ξανά.', @@ -213,9 +214,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'σε κάθε πακέτο', 'native.plans.yearlyIs': '{price} τον χρόνο, ακύρωση οποτεδήποτε', 'native.plans.monthlyIs': 'Δηλαδή {price} τον μήνα', - 'native.plans.photos': '≈ {n} φωτογραφίες', + 'native.plans.storageFairUse': 'Αποθήκευση με εύλογη χρήση', 'native.plans.aiPerMonth': '{n} / μήνα', - 'native.plans.aiNone': 'Κανένα', + 'native.plans.aiNone': 'Δεν περιλαμβάνεται', + 'native.plans.included': 'Περιλαμβάνεται', + 'native.plans.planned': 'Προγραμματίζεται', + 'native.plans.assistant': 'Βοηθός AI', + 'native.plans.mailImport': 'Αυτόματη εισαγωγή email', 'native.plans.aiLabel': 'Έγγραφα AI', 'native.plans.choose': 'Επιλογή: {trip}', 'native.plans.termsShort': 'Όροι χρήσης (EULA)', diff --git a/shared/src/i18n/he/native.ts b/shared/src/i18n/he/native.ts index 902e2abf3..adc451413 100644 --- a/shared/src/i18n/he/native.ts +++ b/shared/src/i18n/he/native.ts @@ -49,6 +49,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': 'סיסמה', 'native.claim.passwordHint': 'לפחות 8 תווים. הסיסמה חייבת להכיל אות גדולה, אות קטנה, ספרה ותו מיוחד.', 'native.claim.subscribe': 'הרשמה תמורת {price}', + 'native.claim.completeSetup': 'השלמת ההגדרה', 'native.claim.cancelled': 'הרכישה בוטלה.', 'native.claim.failed': 'הרכישה לא הושלמה. אנא נסו שוב.', 'native.claim.redeemFailed': 'לא הצלחנו להכין את ה-TREK שלכם. אנא נסו שוב.', @@ -199,9 +200,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'בכל חבילה', 'native.plans.yearlyIs': '{price} לשנה, ביטול בכל עת', 'native.plans.monthlyIs': 'כלומר {price} לחודש', - 'native.plans.photos': '≈ {n} תמונות', + 'native.plans.storageFairUse': 'אחסון בשימוש הוגן', 'native.plans.aiPerMonth': '{n} / חודש', - 'native.plans.aiNone': 'אין', + 'native.plans.aiNone': 'לא כלול', + 'native.plans.included': 'כלול', + 'native.plans.planned': 'מתוכנן', + 'native.plans.assistant': 'עוזר AI', + 'native.plans.mailImport': 'ייבוא דוא״ל אוטומטי', 'native.plans.aiLabel': 'מסמכי AI', 'native.plans.choose': 'בחירת {trip}', 'native.plans.termsShort': 'תנאי שימוש (EULA)', diff --git a/shared/src/i18n/hu/native.ts b/shared/src/i18n/hu/native.ts index 9b9f93f9c..27ae978c8 100644 --- a/shared/src/i18n/hu/native.ts +++ b/shared/src/i18n/hu/native.ts @@ -51,6 +51,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Legalább 8 karakter. A jelszónak tartalmaznia kell nagybetűt, kisbetűt, számot és speciális karaktert.', 'native.claim.subscribe': 'Előfizetés ennyiért: {price}', + 'native.claim.completeSetup': 'Beállítás befejezése', 'native.claim.cancelled': 'Vásárlás megszakítva.', 'native.claim.failed': 'A vásárlás nem sikerült. Próbáld újra.', 'native.claim.redeemFailed': 'Nem sikerült beállítani a TREK-edet. Próbáld újra.', @@ -209,9 +210,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'minden csomagban', 'native.plans.yearlyIs': 'Évente {price}, bármikor lemondható', 'native.plans.monthlyIs': 'Ez havonta {price}', - 'native.plans.photos': '≈ {n} fotó', + 'native.plans.storageFairUse': 'Tárhely méltányos használatra', 'native.plans.aiPerMonth': '{n} / hó', - 'native.plans.aiNone': 'Nincs', + 'native.plans.aiNone': 'Nem tartalmazza', + 'native.plans.included': 'Tartalmazza', + 'native.plans.planned': 'Tervezett', + 'native.plans.assistant': 'MI-asszisztens', + 'native.plans.mailImport': 'Automatikus e-mail-importálás', 'native.plans.aiLabel': 'MI-dokumentumok', 'native.plans.choose': '{trip} választása', 'native.plans.termsShort': 'Felhasználási feltételek (EULA)', diff --git a/shared/src/i18n/id/native.ts b/shared/src/i18n/id/native.ts index b69430e3c..4241abe40 100644 --- a/shared/src/i18n/id/native.ts +++ b/shared/src/i18n/id/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Minimal 8 karakter. Kata sandi harus mengandung huruf besar, huruf kecil, angka, dan karakter khusus.', 'native.claim.subscribe': 'Berlangganan seharga {price}', + 'native.claim.completeSetup': 'Selesaikan penyiapan', 'native.claim.cancelled': 'Pembelian dibatalkan.', 'native.claim.failed': 'Pembelian tidak berhasil. Silakan coba lagi.', 'native.claim.redeemFailed': 'Kami tidak dapat menyiapkan TREK Anda. Silakan coba lagi.', @@ -208,9 +209,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'di setiap paket', 'native.plans.yearlyIs': '{price} per tahun, batalkan kapan saja', 'native.plans.monthlyIs': 'Itu {price} per bulan', - 'native.plans.photos': '≈ {n} foto', + 'native.plans.storageFairUse': 'Penyimpanan penggunaan wajar', 'native.plans.aiPerMonth': '{n} / bulan', - 'native.plans.aiNone': 'Tidak ada', + 'native.plans.aiNone': 'Tidak disertakan', + 'native.plans.included': 'Disertakan', + 'native.plans.planned': 'Direncanakan', + 'native.plans.assistant': 'Asisten AI', + 'native.plans.mailImport': 'Impor email otomatis', 'native.plans.aiLabel': 'Dokumen AI', 'native.plans.choose': 'Pilih {trip}', 'native.plans.termsShort': 'Ketentuan Penggunaan (EULA)', diff --git a/shared/src/i18n/it/native.ts b/shared/src/i18n/it/native.ts index 6f97ed30d..1a31268d9 100644 --- a/shared/src/i18n/it/native.ts +++ b/shared/src/i18n/it/native.ts @@ -51,6 +51,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Almeno 8 caratteri. La password deve contenere lettere maiuscole, minuscole, un numero e un carattere speciale.', 'native.claim.subscribe': 'Abbonati per {price}', + 'native.claim.completeSetup': 'Completa la configurazione', 'native.claim.cancelled': 'Acquisto annullato.', 'native.claim.failed': 'L’acquisto non è andato a buon fine. Riprova.', 'native.claim.redeemFailed': 'Non siamo riusciti a preparare il tuo TREK. Riprova.', @@ -210,9 +211,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'in ogni piano', 'native.plans.yearlyIs': '{price} all’anno, disdici quando vuoi', 'native.plans.monthlyIs': 'Sono {price} al mese', - 'native.plans.photos': '≈ {n} foto', + 'native.plans.storageFairUse': 'Spazio con uso ragionevole', 'native.plans.aiPerMonth': '{n} / mese', - 'native.plans.aiNone': 'Nessuno', + 'native.plans.aiNone': 'Non incluso', + 'native.plans.included': 'Incluso', + 'native.plans.planned': 'Previsto', + 'native.plans.assistant': 'Assistente IA', + 'native.plans.mailImport': 'Importazione automatica delle e-mail', 'native.plans.aiLabel': 'Documenti IA', 'native.plans.choose': 'Scegli {trip}', 'native.plans.termsShort': 'Condizioni d’uso (EULA)', diff --git a/shared/src/i18n/ja/native.ts b/shared/src/i18n/ja/native.ts index fe0b47c46..c1d1c3c73 100644 --- a/shared/src/i18n/ja/native.ts +++ b/shared/src/i18n/ja/native.ts @@ -49,6 +49,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': 'パスワード', 'native.claim.passwordHint': '8文字以上。大文字・小文字・数字・記号を含めてください。', 'native.claim.subscribe': '{price} で登録', + 'native.claim.completeSetup': '設定を完了', 'native.claim.cancelled': '購入をキャンセルしました。', 'native.claim.failed': '購入できませんでした。もう一度お試しください。', 'native.claim.redeemFailed': 'TREKを用意できませんでした。もう一度お試しください。', @@ -205,9 +206,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'すべてのプランで', 'native.plans.yearlyIs': '年額 {price}、いつでも解約可能', 'native.plans.monthlyIs': '月あたり {price}', - 'native.plans.photos': '約 {n} 枚の写真', + 'native.plans.storageFairUse': 'ストレージの公平利用枠', 'native.plans.aiPerMonth': '{n} / 月', - 'native.plans.aiNone': 'なし', + 'native.plans.aiNone': '対象外', + 'native.plans.included': '利用可能', + 'native.plans.planned': '提供予定', + 'native.plans.assistant': 'AI アシスタント', + 'native.plans.mailImport': 'メールの自動取り込み', 'native.plans.aiLabel': 'AI ドキュメント', 'native.plans.choose': '{trip}を選ぶ', 'native.plans.termsShort': '利用規約 (EULA)', diff --git a/shared/src/i18n/ko/native.ts b/shared/src/i18n/ko/native.ts index 9bad4a736..fe7720b50 100644 --- a/shared/src/i18n/ko/native.ts +++ b/shared/src/i18n/ko/native.ts @@ -48,6 +48,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': '비밀번호', 'native.claim.passwordHint': '8자 이상. 비밀번호는 대문자, 소문자, 숫자, 특수문자를 포함해야 합니다.', 'native.claim.subscribe': '{price}에 구독', + 'native.claim.completeSetup': '설정 완료', 'native.claim.cancelled': '구매가 취소되었습니다.', 'native.claim.failed': '구매가 완료되지 않았습니다. 다시 시도하세요.', 'native.claim.redeemFailed': 'TREK을 준비하지 못했습니다. 다시 시도하세요.', @@ -202,9 +203,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': '모든 요금제에 포함', 'native.plans.yearlyIs': '연 {price}, 언제든 해지', 'native.plans.monthlyIs': '월 {price}에 해당', - 'native.plans.photos': '약 {n}장의 사진', + 'native.plans.storageFairUse': '공정 사용 저장 공간', 'native.plans.aiPerMonth': '{n} / 월', - 'native.plans.aiNone': '없음', + 'native.plans.aiNone': '미포함', + 'native.plans.included': '포함', + 'native.plans.planned': '예정', + 'native.plans.assistant': 'AI 어시스턴트', + 'native.plans.mailImport': '자동 이메일 가져오기', 'native.plans.aiLabel': 'AI 문서', 'native.plans.choose': '{trip} 선택', 'native.plans.termsShort': '이용 약관 (EULA)', diff --git a/shared/src/i18n/nl/native.ts b/shared/src/i18n/nl/native.ts index 07ac95149..f874c06b3 100644 --- a/shared/src/i18n/nl/native.ts +++ b/shared/src/i18n/nl/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Minstens 8 tekens. Wachtwoord moet hoofdletters, kleine letters, een cijfer en een speciaal teken bevatten.', 'native.claim.subscribe': 'Abonneren voor {price}', + 'native.claim.completeSetup': 'Installatie voltooien', 'native.claim.cancelled': 'Aankoop geannuleerd.', 'native.claim.failed': 'De aankoop is niet gelukt. Probeer het opnieuw.', 'native.claim.redeemFailed': 'We konden je TREK niet klaarzetten. Probeer het opnieuw.', @@ -208,9 +209,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'in elk abonnement', 'native.plans.yearlyIs': '{price} per jaar, altijd opzegbaar', 'native.plans.monthlyIs': 'Dat is {price} per maand', - 'native.plans.photos': '≈ {n} foto’s', + 'native.plans.storageFairUse': 'Opslag bij redelijk gebruik', 'native.plans.aiPerMonth': '{n} / maand', - 'native.plans.aiNone': 'Geen', + 'native.plans.aiNone': 'Niet inbegrepen', + 'native.plans.included': 'Inbegrepen', + 'native.plans.planned': 'Gepland', + 'native.plans.assistant': 'AI-assistent', + 'native.plans.mailImport': 'Automatische e-mailimport', 'native.plans.aiLabel': 'AI-documenten', 'native.plans.choose': '{trip} kiezen', 'native.plans.termsShort': 'Gebruiksvoorwaarden (EULA)', diff --git a/shared/src/i18n/pl/native.ts b/shared/src/i18n/pl/native.ts index 96ce7093d..de5ae7dc1 100644 --- a/shared/src/i18n/pl/native.ts +++ b/shared/src/i18n/pl/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Co najmniej 8 znaków. Hasło musi zawierać wielką literę, małą literę, cyfrę i znak specjalny.', 'native.claim.subscribe': 'Subskrybuj za {price}', + 'native.claim.completeSetup': 'Dokończ konfigurację', 'native.claim.cancelled': 'Zakup anulowany.', 'native.claim.failed': 'Zakup się nie powiódł. Spróbuj ponownie.', 'native.claim.redeemFailed': 'Nie udało się przygotować Twojego TREK. Spróbuj ponownie.', @@ -205,9 +206,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'w każdym planie', 'native.plans.yearlyIs': '{price} rocznie, rezygnacja w każdej chwili', 'native.plans.monthlyIs': 'To {price} miesięcznie', - 'native.plans.photos': '≈ {n} zdjęć', + 'native.plans.storageFairUse': 'Miejsce w ramach uczciwego użytkowania', 'native.plans.aiPerMonth': '{n} / miesiąc', - 'native.plans.aiNone': 'Brak', + 'native.plans.aiNone': 'Niedostępne', + 'native.plans.included': 'W pakiecie', + 'native.plans.planned': 'Planowane', + 'native.plans.assistant': 'Asystent AI', + 'native.plans.mailImport': 'Automatyczny import poczty', 'native.plans.aiLabel': 'Dokumenty AI', 'native.plans.choose': 'Wybierz: {trip}', 'native.plans.termsShort': 'Warunki korzystania (EULA)', diff --git a/shared/src/i18n/ru/native.ts b/shared/src/i18n/ru/native.ts index 5b6abf792..af3217487 100644 --- a/shared/src/i18n/ru/native.ts +++ b/shared/src/i18n/ru/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Не менее 8 символов. Пароль должен содержать заглавные, строчные буквы, цифру и специальный символ.', 'native.claim.subscribe': 'Подписаться за {price}', + 'native.claim.completeSetup': 'Завершить настройку', 'native.claim.cancelled': 'Покупка отменена.', 'native.claim.failed': 'Покупка не прошла. Повторите попытку.', 'native.claim.redeemFailed': 'Не удалось настроить ваш TREK. Повторите попытку.', @@ -208,9 +209,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'в каждом тарифе', 'native.plans.yearlyIs': '{price} в год, отмена в любое время', 'native.plans.monthlyIs': 'Это {price} в месяц', - 'native.plans.photos': '≈ {n} фото', + 'native.plans.storageFairUse': 'Хранилище по правилам добросовестного использования', 'native.plans.aiPerMonth': '{n} / мес.', - 'native.plans.aiNone': 'Нет', + 'native.plans.aiNone': 'Не включено', + 'native.plans.included': 'Включено', + 'native.plans.planned': 'Планируется', + 'native.plans.assistant': 'ИИ-помощник', + 'native.plans.mailImport': 'Автоматический импорт писем', 'native.plans.aiLabel': 'Документы ИИ', 'native.plans.choose': 'Выбрать: {trip}', 'native.plans.termsShort': 'Условия использования (EULA)', diff --git a/shared/src/i18n/sk/native.ts b/shared/src/i18n/sk/native.ts index 98d65360e..614f220c2 100644 --- a/shared/src/i18n/sk/native.ts +++ b/shared/src/i18n/sk/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Aspoň 8 znakov. Heslo musí obsahovať veľké písmeno, malé písmeno, číslicu a špeciálny znak.', 'native.claim.subscribe': 'Predplatiť za {price}', + 'native.claim.completeSetup': 'Dokončiť nastavenie', 'native.claim.cancelled': 'Nákup zrušený.', 'native.claim.failed': 'Nákup sa nepodaril. Skúste to znova.', 'native.claim.redeemFailed': 'Nepodarilo sa pripraviť váš TREK. Skúste to znova.', @@ -203,9 +204,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'v každom tarife', 'native.plans.yearlyIs': '{price} ročne, zrušenie kedykoľvek', 'native.plans.monthlyIs': 'To je {price} mesačne', - 'native.plans.photos': '≈ {n} fotiek', + 'native.plans.storageFairUse': 'Úložisko v režime primeraného využitia', 'native.plans.aiPerMonth': '{n} / mesiac', - 'native.plans.aiNone': 'Žiadne', + 'native.plans.aiNone': 'Nie je zahrnuté', + 'native.plans.included': 'Zahrnuté', + 'native.plans.planned': 'Plánované', + 'native.plans.assistant': 'Asistent AI', + 'native.plans.mailImport': 'Automatický import e-mailov', 'native.plans.aiLabel': 'Dokumenty AI', 'native.plans.choose': 'Vybrať: {trip}', 'native.plans.termsShort': 'Podmienky používania (EULA)', diff --git a/shared/src/i18n/sv/native.ts b/shared/src/i18n/sv/native.ts index ae8b09021..d7423add9 100644 --- a/shared/src/i18n/sv/native.ts +++ b/shared/src/i18n/sv/native.ts @@ -51,6 +51,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Minst 8 tecken. Lösenordet måste innehålla versaler, gemener, en siffra och ett specialtecken.', 'native.claim.subscribe': 'Prenumerera för {price}', + 'native.claim.completeSetup': 'Slutför konfigureringen', 'native.claim.cancelled': 'Köpet avbröts.', 'native.claim.failed': 'Köpet gick inte igenom. Försök igen.', 'native.claim.redeemFailed': 'Vi kunde inte göra i ordning din TREK. Försök igen.', @@ -204,9 +205,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'i varje plan', 'native.plans.yearlyIs': '{price} per år, avsluta när du vill', 'native.plans.monthlyIs': 'Det blir {price} i månaden', - 'native.plans.photos': '≈ {n} bilder', + 'native.plans.storageFairUse': 'Lagring vid skälig användning', 'native.plans.aiPerMonth': '{n} / månad', - 'native.plans.aiNone': 'Inga', + 'native.plans.aiNone': 'Ingår inte', + 'native.plans.included': 'Ingår', + 'native.plans.planned': 'Planerat', + 'native.plans.assistant': 'AI-assistent', + 'native.plans.mailImport': 'Automatisk e-postimport', 'native.plans.aiLabel': 'AI-dokument', 'native.plans.choose': 'Välj {trip}', 'native.plans.termsShort': 'Användarvillkor (EULA)', diff --git a/shared/src/i18n/th/native.ts b/shared/src/i18n/th/native.ts index 22f71a37f..cf1b4dd8d 100644 --- a/shared/src/i18n/th/native.ts +++ b/shared/src/i18n/th/native.ts @@ -46,6 +46,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': 'รหัสผ่าน', 'native.claim.passwordHint': 'อย่างน้อย 8 ตัวอักษร รหัสผ่านจะต้องมีตัวพิมพ์ใหญ่ ตัวพิมพ์เล็ก ตัวเลข และอักขระพิเศษ', 'native.claim.subscribe': 'สมัครสมาชิกในราคา {price}', + 'native.claim.completeSetup': 'ตั้งค่าให้เสร็จ', 'native.claim.cancelled': 'ยกเลิกการซื้อแล้ว', 'native.claim.failed': 'การซื้อไม่สำเร็จ โปรดลองอีกครั้ง', 'native.claim.redeemFailed': 'เราตั้งค่า TREK ของคุณไม่สำเร็จ โปรดลองอีกครั้ง', @@ -193,9 +194,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'ในทุกแพ็กเกจ', 'native.plans.yearlyIs': 'ปีละ {price} ยกเลิกได้ทุกเมื่อ', 'native.plans.monthlyIs': 'เท่ากับเดือนละ {price}', - 'native.plans.photos': '≈ {n} รูป', + 'native.plans.storageFairUse': 'พื้นที่เก็บข้อมูลภายใต้การใช้งานอย่างเหมาะสม', 'native.plans.aiPerMonth': '{n} / เดือน', - 'native.plans.aiNone': 'ไม่มี', + 'native.plans.aiNone': 'ไม่รวม', + 'native.plans.included': 'รวมแล้ว', + 'native.plans.planned': 'อยู่ในแผน', + 'native.plans.assistant': 'ผู้ช่วย AI', + 'native.plans.mailImport': 'นำเข้าอีเมลอัตโนมัติ', 'native.plans.aiLabel': 'เอกสาร AI', 'native.plans.choose': 'เลือก{trip}', 'native.plans.termsShort': 'ข้อกำหนดการใช้งาน (EULA)', diff --git a/shared/src/i18n/tr/native.ts b/shared/src/i18n/tr/native.ts index 1849622e9..a6d32306f 100644 --- a/shared/src/i18n/tr/native.ts +++ b/shared/src/i18n/tr/native.ts @@ -49,6 +49,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': 'Şifre', 'native.claim.passwordHint': 'En az 8 karakter. Şifre büyük harf, küçük harf, sayı ve özel karakter içermelidir.', 'native.claim.subscribe': '{price} karşılığında abone ol', + 'native.claim.completeSetup': 'Kurulumu tamamla', 'native.claim.cancelled': 'Satın alma iptal edildi.', 'native.claim.failed': 'Satın alma tamamlanamadı. Lütfen tekrar deneyin.', 'native.claim.redeemFailed': 'TREK’inizi hazırlayamadık. Lütfen tekrar deneyin.', @@ -204,9 +205,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'her pakette', 'native.plans.yearlyIs': 'Yıllık {price}, istediğin zaman iptal', 'native.plans.monthlyIs': 'Ayda {price} eder', - 'native.plans.photos': '≈ {n} fotoğraf', + 'native.plans.storageFairUse': 'Adil kullanım depolama alanı', 'native.plans.aiPerMonth': '{n} / ay', - 'native.plans.aiNone': 'Yok', + 'native.plans.aiNone': 'Dahil değil', + 'native.plans.included': 'Dahil', + 'native.plans.planned': 'Planlanıyor', + 'native.plans.assistant': 'Yapay zekâ asistanı', + 'native.plans.mailImport': 'Otomatik e-posta içe aktarma', 'native.plans.aiLabel': 'Yapay zekâ belgeleri', 'native.plans.choose': '{trip} seç', 'native.plans.termsShort': 'Kullanım Koşulları (EULA)', diff --git a/shared/src/i18n/uk/native.ts b/shared/src/i18n/uk/native.ts index e89675558..97ce98614 100644 --- a/shared/src/i18n/uk/native.ts +++ b/shared/src/i18n/uk/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordHint': 'Щонайменше 8 символів. Пароль повинен містити великі й малі літери, цифру та спеціальний символ.', 'native.claim.subscribe': 'Підписатися за {price}', + 'native.claim.completeSetup': 'Завершити налаштування', 'native.claim.cancelled': 'Покупку скасовано.', 'native.claim.failed': 'Покупка не пройшла. Повторіть спробу.', 'native.claim.redeemFailed': 'Не вдалося налаштувати ваш TREK. Повторіть спробу.', @@ -205,9 +206,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'у кожному тарифі', 'native.plans.yearlyIs': '{price} на рік, скасування будь-коли', 'native.plans.monthlyIs': 'Це {price} на місяць', - 'native.plans.photos': '≈ {n} фото', + 'native.plans.storageFairUse': 'Сховище за правилами добросовісного використання', 'native.plans.aiPerMonth': '{n} / міс.', - 'native.plans.aiNone': 'Немає', + 'native.plans.aiNone': 'Не включено', + 'native.plans.included': 'Включено', + 'native.plans.planned': 'Заплановано', + 'native.plans.assistant': 'Асистент ШІ', + 'native.plans.mailImport': 'Автоматичний імпорт листів', 'native.plans.aiLabel': 'Документи ШІ', 'native.plans.choose': 'Обрати: {trip}', 'native.plans.termsShort': 'Умови використання (EULA)', diff --git a/shared/src/i18n/vi/native.ts b/shared/src/i18n/vi/native.ts index 10c8109ad..cd8ff7639 100644 --- a/shared/src/i18n/vi/native.ts +++ b/shared/src/i18n/vi/native.ts @@ -50,6 +50,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': 'Mật khẩu', 'native.claim.passwordHint': 'Ít nhất 8 ký tự. Mật khẩu phải có chữ hoa, chữ thường, số và ký tự đặc biệt.', 'native.claim.subscribe': 'Đăng ký với giá {price}', + 'native.claim.completeSetup': 'Hoàn tất thiết lập', 'native.claim.cancelled': 'Đã hủy mua.', 'native.claim.failed': 'Giao dịch mua không thành công. Vui lòng thử lại.', 'native.claim.redeemFailed': 'Chúng tôi không thể thiết lập TREK của bạn. Vui lòng thử lại.', @@ -205,9 +206,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': 'trong mọi gói', 'native.plans.yearlyIs': '{price} mỗi năm, hủy bất cứ lúc nào', 'native.plans.monthlyIs': 'Tức là {price} mỗi tháng', - 'native.plans.photos': '≈ {n} ảnh', + 'native.plans.storageFairUse': 'Dung lượng theo chính sách sử dụng hợp lý', 'native.plans.aiPerMonth': '{n} / tháng', - 'native.plans.aiNone': 'Không có', + 'native.plans.aiNone': 'Không bao gồm', + 'native.plans.included': 'Đã bao gồm', + 'native.plans.planned': 'Dự kiến', + 'native.plans.assistant': 'Trợ lý AI', + 'native.plans.mailImport': 'Tự động nhập email', 'native.plans.aiLabel': 'Tài liệu AI', 'native.plans.choose': 'Chọn {trip}', 'native.plans.termsShort': 'Điều khoản sử dụng (EULA)', diff --git a/shared/src/i18n/zh-TW/native.ts b/shared/src/i18n/zh-TW/native.ts index cc6fffa57..5ff1a0dda 100644 --- a/shared/src/i18n/zh-TW/native.ts +++ b/shared/src/i18n/zh-TW/native.ts @@ -46,6 +46,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': '密碼', 'native.claim.passwordHint': '至少 8 個字元。密碼必須包含大寫字母、小寫字母、數字和特殊字元。', 'native.claim.subscribe': '以 {price} 訂閱', + 'native.claim.completeSetup': '完成設定', 'native.claim.cancelled': '已取消購買。', 'native.claim.failed': '購買未成功。請重試。', 'native.claim.redeemFailed': '我們無法為你設定 TREK。請重試。', @@ -193,9 +194,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': '每個方案都有', 'native.plans.yearlyIs': '每年 {price},隨時可取消', 'native.plans.monthlyIs': '相當於每月 {price}', - 'native.plans.photos': '約 {n} 張照片', + 'native.plans.storageFairUse': '公平使用儲存空間', 'native.plans.aiPerMonth': '{n} / 月', - 'native.plans.aiNone': '無', + 'native.plans.aiNone': '不包含', + 'native.plans.included': '已包含', + 'native.plans.planned': '計畫推出', + 'native.plans.assistant': 'AI 助理', + 'native.plans.mailImport': '自動郵件匯入', 'native.plans.aiLabel': 'AI 文件', 'native.plans.choose': '選擇{trip}', 'native.plans.termsShort': '使用條款 (EULA)', diff --git a/shared/src/i18n/zh/native.ts b/shared/src/i18n/zh/native.ts index 0fad516f2..e0b797d9e 100644 --- a/shared/src/i18n/zh/native.ts +++ b/shared/src/i18n/zh/native.ts @@ -45,6 +45,7 @@ const native: TranslationStrings = { 'native.claim.passwordLabel': '密码', 'native.claim.passwordHint': '至少 8 个字符。密码必须包含大写字母、小写字母、数字和特殊字符。', 'native.claim.subscribe': '以 {price} 订阅', + 'native.claim.completeSetup': '完成设置', 'native.claim.cancelled': '购买已取消。', 'native.claim.failed': '购买未成功。请重试。', 'native.claim.redeemFailed': '我们无法为你设置 TREK。请重试。', @@ -192,9 +193,13 @@ const native: TranslationStrings = { 'native.plans.inEveryPlan': '每个方案都有', 'native.plans.yearlyIs': '每年 {price},随时可取消', 'native.plans.monthlyIs': '相当于每月 {price}', - 'native.plans.photos': '约 {n} 张照片', + 'native.plans.storageFairUse': '公平使用存储空间', 'native.plans.aiPerMonth': '{n} / 月', - 'native.plans.aiNone': '无', + 'native.plans.aiNone': '不包含', + 'native.plans.included': '已包含', + 'native.plans.planned': '计划推出', + 'native.plans.assistant': 'AI 助手', + 'native.plans.mailImport': '自动邮件导入', 'native.plans.aiLabel': 'AI 文档', 'native.plans.choose': '选择{trip}', 'native.plans.termsShort': '使用条款 (EULA)',