From 42bc566300cdde9941d611956df382f66b4b6241 Mon Sep 17 00:00:00 2001 From: CRT Date: Sat, 10 Oct 2026 23:40:59 +0000 Subject: [PATCH] desktop: Prices, Store art, Growth and App info tabs, exports at the top right and in the command palette, studio and fastlane steps in the first-run guide, fix hints on errors; fixtures, screenshots, tests, UX audit in docs/desktop.md --- apps/desktop/scripts/screens.ts | 26 ++ apps/desktop/src/App.tsx | 15 +- apps/desktop/src/api.ts | 14 + apps/desktop/src/dev/fixtures-more.ts | 217 +++++++++++++ apps/desktop/src/dev/fixtures.ts | 23 +- apps/desktop/src/i18n/en.ts | 354 ++++++++++++++++++++- apps/desktop/src/i18n/tr.ts | 354 ++++++++++++++++++++- apps/desktop/src/lib/exports.ts | 111 +++++++ apps/desktop/src/lib/format.ts | 6 + apps/desktop/src/lib/views.ts | 128 ++++++++ apps/desktop/src/main.tsx | 3 +- apps/desktop/src/nav.ts | 17 +- apps/desktop/src/screens/Accounts.tsx | 2 +- apps/desktop/src/screens/AppFolders.tsx | 23 +- apps/desktop/src/screens/AppView.tsx | 19 +- apps/desktop/src/screens/Onboarding.tsx | 87 +++-- apps/desktop/src/screens/Portfolio.tsx | 4 + apps/desktop/src/screens/tabs/AppInfo.tsx | 184 +++++++++++ apps/desktop/src/screens/tabs/Art.tsx | 168 ++++++++++ apps/desktop/src/screens/tabs/Catalog.tsx | 17 +- apps/desktop/src/screens/tabs/Checks.tsx | 8 +- apps/desktop/src/screens/tabs/Growth.tsx | 189 +++++++++++ apps/desktop/src/screens/tabs/Health.tsx | 7 +- apps/desktop/src/screens/tabs/Listings.tsx | 10 +- apps/desktop/src/screens/tabs/Prices.tsx | 205 ++++++++++++ apps/desktop/src/screens/tabs/Reviews.tsx | 8 +- apps/desktop/src/store.tsx | 9 +- apps/desktop/src/styles.css | 111 +++++++ apps/desktop/src/ui/Exports.tsx | 106 ++++++ apps/desktop/src/ui/LineChart.tsx | 59 ++++ apps/desktop/src/ui/icons.tsx | 8 + apps/desktop/src/ui/kit.tsx | 20 ++ apps/desktop/tests/complete.test.ts | 65 ++++ docs/desktop.md | 62 +++- 34 files changed, 2572 insertions(+), 67 deletions(-) create mode 100644 apps/desktop/src/dev/fixtures-more.ts create mode 100644 apps/desktop/src/lib/exports.ts create mode 100644 apps/desktop/src/lib/views.ts create mode 100644 apps/desktop/src/screens/tabs/AppInfo.tsx create mode 100644 apps/desktop/src/screens/tabs/Art.tsx create mode 100644 apps/desktop/src/screens/tabs/Growth.tsx create mode 100644 apps/desktop/src/screens/tabs/Prices.tsx create mode 100644 apps/desktop/src/ui/Exports.tsx create mode 100644 apps/desktop/src/ui/LineChart.tsx create mode 100644 apps/desktop/tests/complete.test.ts diff --git a/apps/desktop/scripts/screens.ts b/apps/desktop/scripts/screens.ts index 2226825c..7718049f 100644 --- a/apps/desktop/scripts/screens.ts +++ b/apps/desktop/scripts/screens.ts @@ -24,6 +24,8 @@ export const SCREENS: [string, string][] = [ ['ignored', 'ignored'], ['store-app', 'app:releases:3'], ['store-app-reviews', 'app:reviews:3'], ['store-app-single', 'app:releases:7'], ['settings-pairing', 'settings:pairing'], ['settings-refresh', 'settings:refresh'], ['settings-privacy', 'settings:privacy'], ['palette', 'palette'], ['welcome-1', 'welcome:1'], ['welcome-2', 'welcome:2'], ['welcome-3', 'welcome:3'], ['welcome-4', 'welcome:4'], ['welcome-5', 'welcome:5'], + ['welcome-6', 'welcome:6'], ['prices', 'app:prices'], ['art', 'app:art'], ['growth', 'app:growth'], ['growth-2', 'app:growth:2'], ['appinfo', 'app:appinfo'], + ['appinfo-2', 'app:appinfo:2'], ['store-app-growth', 'app:growth:3'], ]; async function settle(page: Page) { @@ -120,6 +122,30 @@ for (const theme of themes) { await page.waitForTimeout(700); await shot('import'); } + if (!only.length || only.includes('prices-diff')) { + // a price sheet compared with the stores, with the owner's Apply + await page.goto(`${base}/?start=app:prices&theme=${theme}&lang=${lang}`); + await settle(page); + await page.getByRole('button', { name: /Compare store\/prices.csv|store\/prices.csv karşılaştır/ }).click(); + await page.waitForTimeout(1500); + await shot('prices-diff'); + } + if (!only.length || only.includes('export-menu')) { + // the top-right Export menu of a screen + await page.goto(`${base}/?start=app:reviews&theme=${theme}&lang=${lang}`); + await settle(page); + await page.getByRole('button', { name: /^Export$|^Dışa aktar$/ }).click(); + await page.waitForTimeout(300); + await shot('export-menu'); + } + if (!only.length || only.includes('art-lightbox')) { + // one render opened large + await page.goto(`${base}/?start=app:art&theme=${theme}&lang=${lang}`); + await settle(page); + await page.locator('.art-pic').first().click(); + await page.waitForTimeout(500); + await shot('art-lightbox'); + } if (errors.length) console.error(`${theme}: page errors:\n ${[...new Set(errors)].join('\n ')}`); await ctx.close(); } diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index f0ecfa16..1af69082 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -20,6 +20,7 @@ import { useData } from './store'; import { Icon, type IconName, Mark } from './ui/icons'; import { AppIcon, Kbd, MOD, StudioMark } from './ui/kit'; import { type Command, Palette } from './ui/Palette'; +import { ExportMenu, useExportItems, useRunExport } from './ui/Exports'; import { Toasts } from './ui/Toasts'; const WS_ICON: Record = { apps: 'folder', accounts: 'building', ignored: 'eyeOff', dependencies: 'package', settings: 'settings' }; @@ -38,6 +39,8 @@ export function App({ onTheme }: { onTheme: () => void }) { const [welcome, setWelcome] = useState(false); const [started, setStarted] = useState(false); const [collapsed, setCollapsed] = useState(loadCollapsed); + const exports = useExportItems(); + const runExport = useRunExport(); const go = useCallback((r: Route) => { setRoute(r); document.getElementById('content')?.scrollTo({ top: 0 }); }, []); const visible = useMemo(() => d.apps.filter(a => !a.ignored).sort((a, b) => a.name.localeCompare(b.name)), [d.apps]); @@ -100,7 +103,7 @@ export function App({ onTheme }: { onTheme: () => void }) { const commands = useMemo(() => { const c: Command[] = []; - const G = { apps: t('palette.gApps'), go: t('palette.gGo'), tabs: t('palette.gTabs'), act: t('palette.gActions') }; + const G = { apps: t('palette.gApps'), go: t('palette.gGo'), tabs: t('palette.gTabs'), act: t('palette.gActions'), exp: t('palette.gExport') }; const studioName = (a: UnifiedApp) => d.studios.find(s => s.id === a.studio)?.name; for (const a of visible) c.push({ id: `app-${a.key}`, group: G.apps, title: a.name, hint: studioName(a) ?? t('palette.openApp'), keywords: `${a.ios?.app.bundleId ?? ''} ${a.android?.app.id ?? ''} ${a.project?.name ?? ''}`, app: { name: a.name, icon: d.iconFor(a) }, run: () => go({ screen: 'app', appId: a.key, tab: route.screen === 'app' && tabsFor(!!a.project).includes(route.tab) ? route.tab : 'releases' }) }); @@ -108,6 +111,13 @@ export function App({ onTheme }: { onTheme: () => void }) { WORKSPACE.forEach((s, i) => c.push({ id: `go-${s}`, group: G.go, title: t(WS_KEY[s]), icon: WS_ICON[s], hint: `${MOD} ${i + 2}`, run: () => go({ screen: s }) })); for (const s of d.studios) c.push({ id: `studio-${s.id}`, group: G.go, title: s.name, icon: 'building', keywords: 'studio', hint: t('palette.studio'), run: () => go({ screen: 'accounts', section: s.id }) }); if (app) for (const tab of tabs) c.push({ id: `tab-${tab}`, group: G.tabs, title: `${app.name} · ${t(TAB_KEY[tab])}`, icon: TAB_ICON[tab], run: () => go({ screen: 'app', appId: app.key, tab }) }); + for (const x of exports) c.push({ id: `export-${x.id}`, group: G.exp, title: t('palette.export', { what: x.label }), icon: x.icon ?? 'download', keywords: `export save download ${x.kind}`, hint: x.disabled || `.${x.kind}`, run: () => { runExport(x); } }); + if (app?.project) { + const p = app.project.id; + c.push({ id: 'act-prices', group: G.act, title: t('palette.prices', { name: app.name }), icon: 'coins', keywords: 'prices csv sheet', run: () => go({ screen: 'app', appId: p, tab: 'prices' }) }); + c.push({ id: 'act-art', group: G.act, title: t('palette.art', { name: app.name }), icon: 'grid', keywords: 'screenshots gallery renders', run: () => go({ screen: 'app', appId: p, tab: 'art' }) }); + } + c.push({ id: 'act-fastlane', group: G.act, title: t('folders.fastlane'), icon: 'download', keywords: 'fastlane import deliver supply migrate', run: () => go({ screen: 'apps' }) }); c.push({ id: 'act-live', group: G.act, title: t('action.readStores'), icon: 'refresh', keywords: 'refresh sync', run: () => { d.refreshPortfolio(true); } }); c.push({ id: 'act-import', group: G.act, title: t('action.importApps'), icon: 'download', keywords: 'import sync accounts', run: () => { d.importApps(); } }); c.push({ id: 'act-check', group: G.act, title: t('action.checkConfigs'), icon: 'shield', run: () => { d.refreshPortfolio(false); } }); @@ -116,7 +126,7 @@ export function App({ onTheme }: { onTheme: () => void }) { c.push({ id: 'act-theme', group: G.act, title: t('action.toggleTheme'), icon: 'moon', keywords: 'dark light', run: onTheme }); c.push({ id: 'act-welcome', group: G.act, title: t('action.welcome'), icon: 'sparkle', keywords: 'onboarding start guide', run: () => setWelcome(true) }); return c; - }, [d, visible, app, tabs, route, go, onTheme]); + }, [d, visible, app, tabs, route, go, onTheme, exports, runExport]); const crumbs: { label: string; to?: Route }[] = route.screen === 'portfolio' ? [{ label: t('nav.portfolio') }] : route.screen === 'app' ? [{ label: t('nav.portfolio'), to: { screen: 'portfolio' } }, { label: app?.name ?? '', to: app ? { screen: 'app', appId: app.key, tab: 'releases' } : undefined }, { label: t(TAB_KEY[route.tab]) }] @@ -207,6 +217,7 @@ export function App({ onTheme }: { onTheme: () => void }) { +
{route.screen === 'portfolio' && } diff --git a/apps/desktop/src/api.ts b/apps/desktop/src/api.ts index 00c195d7..d05038e8 100644 --- a/apps/desktop/src/api.ts +++ b/apps/desktop/src/api.ts @@ -4,11 +4,13 @@ import { invoke as tauriInvoke } from '@tauri-apps/api/core'; import { listen as tauriListen, type UnlistenFn } from '@tauri-apps/api/event'; import type { AccountCheck, AppsListResult, DraftsResult, IconResult, ListingsResult, MethodDescriptor, PortfolioResult, ProgressParams, ToolResult } from '../../../cli/lib/desktop-protocol'; +import type { DeclarationsResult, ListingText, RendersResult } from '../../../cli/lib/desktop-protocol'; import type { Overrides } from './lib/identity'; export type { AccountCheck, AppIdentity, AppsListResult, AppStatus, CatalogParity, DraftsResult, StoreApp, IconResult, ListingField, ListingLocale, ListingsResult, MethodDescriptor, PortfolioResult, ProgressParams, ProjectSummary, ReleasePhase, ReleaseTrain, ReplyDraft, StoreRelease, ToolResult, + AnalyticsCompare, DeclAsk, DeclarationsResult, ListingText, PpoStatus, PpoTest, PriceDiffRow, PriceRowData, PricesCurrent, PricesDiff, RenderImage, RenderTile, RendersResult, } from '../../../cli/lib/desktop-protocol'; export interface AppInfo { version: string; identifier: string; platform: string; debug: boolean; home: string | null } @@ -116,13 +118,25 @@ export const api = { updateCheck: () => invoke('update_check'), /** Native dialog, then download, signature check, install and restart. False = not installed. */ updateInstall: (version: string) => invoke('update_install', { version }), + /** Native folder picker, the import plan in a native dialog, then `storebound import fastlane` and the folder is added. */ + importFastlane: (profile: 'app' | 'game' | 'subscription-app' | null = null) => invoke('project_import_fastlane', { profile }), + /** Native save dialog (Downloads first); `personal` shows the personal-data note first. The path written (~), or null. */ + exportSave: (name: string, kind: ExportKind, content: string, personal = false) => invoke('export_save', { name, kind, content, personal }), + /** Native open dialog for a price sheet (CSV); its path, or null. */ + pickPriceSheet: (projectId: string) => invoke('price_sheet_pick', { projectId }), + /** Shows a path of an app folder in the file manager, or opens a folder / the gallery page. */ + reveal: (projectId: string, rel = '', open = false) => invoke('project_reveal', { projectId, rel, open }), }; +export type ExportKind = 'csv' | 'md' | 'json' | 'txt'; /** Typed reads of the project files (offline) and the stores (network). */ export const reads = { icon: (projectId: string) => api.call('project.icon', projectId), listings: (projectId: string) => api.call('project.listings', projectId), drafts: (projectId: string) => api.call('reviews.drafts', projectId), + listingText: (projectId: string) => api.call('project.listing_text', projectId), + declarations: (projectId: string) => api.call('project.declarations', projectId), + renders: (projectId: string) => api.call('project.renders', projectId), }; export interface ProgressEvent extends ProgressParams { job?: string } diff --git a/apps/desktop/src/dev/fixtures-more.ts b/apps/desktop/src/dev/fixtures-more.ts new file mode 100644 index 00000000..a84952d3 --- /dev/null +++ b/apps/desktop/src/dev/fixtures-more.ts @@ -0,0 +1,217 @@ +// DEV-ONLY FIXTURE DATA for the screens that cover the rest of the CLI (prices, store art, growth, app info). Made-up +// numbers around the two demo apps; drawn SVG stand-ins for the rendered screenshots. Only src/dev/fixtures.ts imports +// this module, and only fixture mode (dev builds) loads that. +import type { AnalyticsCompare, DeclarationsResult, ListingText, PpoStatus, PriceRowData, PricesCurrent, PricesDiff, RendersResult, RenderTile } from '../api'; + +const HOME = '/home/you'; +const NOW = Date.now(); +const day = (daysAgo: number) => new Date(NOW - daysAgo * 86_400_000).toISOString().slice(0, 10); +const iso = (minutesAgo: number) => new Date(NOW - minutesAgo * 60_000).toISOString(); + +// ---- prices: products x territories on both stores ---- +const REGIONS: [string, string, number, number][] = [ + // region, currency, factor vs USD (Apple), factor (Play) + ['US', 'USD', 1, 1], ['GB', 'GBP', 0.99, 0.95], ['DE', 'EUR', 1.09, 1.05], ['FR', 'EUR', 1.09, 1.05], ['IT', 'EUR', 1.09, 1.05], ['ES', 'EUR', 1.09, 1.05], + ['NL', 'EUR', 1.09, 1.05], ['JP', 'JPY', 150, 148], ['KR', 'KRW', 1400, 1350], ['BR', 'BRL', 5, 4.1], ['IN', 'INR', 90, 79], ['TR', 'TRY', 30, 23], + ['MX', 'MXN', 18, 17], ['CA', 'CAD', 1.39, 1.35], ['AU', 'AUD', 1.59, 1.55], ['PL', 'PLN', 4.3, 4.1], ['SE', 'SEK', 11, 10.5], ['ID', 'IDR', 15000, 15000], + ['SA', 'SAR', 3.75, 3.7], ['AE', 'AED', 3.67, 3.6], ['CH', 'CHF', 1, 0.95], ['ZA', 'ZAR', 18, 17], ['TH', 'THB', 35, 33], ['VN', 'VND', 25000, 23000], +]; +const BASE: Record = { coins_small: 0.99, coins_large: 4.99, no_ads: 2.99, starter_pack: 1.99, tip_jar: 1.99 }; +const round = (v: number, cur: string) => (['JPY', 'KRW', 'IDR', 'VND'].includes(cur) ? Math.round(v / 10) * 10 : ['INR', 'TRY', 'THB', 'ZAR', 'MXN', 'SEK'].includes(cur) ? Math.round(v) - 0.01 : Math.round(v * 100) / 100); +function priceRows(products: string[], missingPlay: string[]): PriceRowData[] { + const rows: PriceRowData[] = []; + for (const p of products) { + for (const [region, cur, fa, fp] of REGIONS) { + const manual = region === 'US' || (p === 'starter_pack' && region === 'TR') || (p === 'coins_large' && region === 'IN'); + rows.push({ product: p, store: 'apple', region, currency: cur, price: round(BASE[p]! * fa * (region === 'TR' && p === 'starter_pack' ? 1.5 : 1), cur), kind: manual ? 'manual' : 'auto' }); + if (!missingPlay.includes(p)) rows.push({ product: p, store: 'play', region, currency: cur, price: round(BASE[p]! * fp, cur) }); + } + } + rows.push({ product: 'no_ads', store: 'apple', region: 'BR', currency: 'BRL', price: 19.9, startDate: day(-12), kind: 'manual' }); + return rows; +} +export const PRICES: Record = { + 'p-prism': { csv: `${HOME}/apps/prism-puddle/store/prices.csv`, products: ['coins_small', 'coins_large', 'no_ads', 'starter_pack'], stores: ['apple', 'play'], + missing: [{ product: 'starter_pack', store: 'play' }], rows: priceRows(['coins_small', 'coins_large', 'no_ads', 'starter_pack'], ['starter_pack']) }, + 'p-tidy': { csv: `${HOME}/apps/tidy-lists/store/prices.csv`, products: ['tip_jar'], stores: ['apple', 'play'], missing: [], rows: priceRows(['tip_jar'], []) }, +}; +export const PRICE_DIFF: Record = { + 'p-prism': { + csv: `${HOME}/apps/prism-puddle/store/prices.csv`, changed: ['coins_small|play', 'coins_small|apple', 'no_ads|apple', 'coins_large|play'], + diff: [ + { product: 'coins_small', store: 'play', region: 'TR', currency: 'TRY', from: 21.99, to: 24.99, change: 'change' }, + { product: 'coins_small', store: 'play', region: 'BR', currency: 'BRL', from: 3.99, to: 4.49, change: 'change' }, + { product: 'coins_small', store: 'apple', region: 'TR', currency: 'TRY', from: 29.99, to: 24.99, change: 'change' }, + { product: 'no_ads', store: 'apple', region: 'BR', startDate: day(-14), currency: 'BRL', from: 14.9, to: 12.9, change: 'change' }, + { product: 'coins_large', store: 'play', region: 'IN', currency: 'INR', from: 393, to: 449, change: 'change' }, + { product: 'coins_large', store: 'play', region: 'KR', currency: 'KRW', from: null, to: 6500, change: 'new' }, + { product: 'coins_large', store: 'apple', region: 'US', currency: 'USD', from: 4.99, to: 4.99, change: 'same' }, + ], + }, + 'p-tidy': { csv: `${HOME}/apps/tidy-lists/store/prices.csv`, changed: [], diff: [{ product: 'tip_jar', store: 'apple', region: 'US', currency: 'USD', from: 1.99, to: 1.99, change: 'same' }] }, +}; + +// ---- declarations ---- +const PRISM_CSV = 'Question ID (machine readable),Response ID (machine readable),Response value,Answer requirement,Human-friendly question label\nPSL_DATA_COLLECTION_COLLECTS_PERSONAL_DATA,,TRUE,REQUIRED,Does your app collect or share any of the required user data types?\n'; +export const DECLARATIONS: Record = { + 'p-prism': { + profile: 'game', stores: { apple: true, play: true }, + dataSafety: { + collectsData: true, encryptedInTransit: true, deletionRequest: false, accountCreation: ['PSL_ACM_NONE'], extra: 0, csv: PRISM_CSV, rows: 431, + types: [ + { id: 'PSL_DEVICE_ID', category: 'identifiers', shared: true, ephemeral: false, optional: false, collect: ['advertising', 'analytics'], share: ['advertising'] }, + { id: 'PSL_APPROX_LOCATION', category: 'location', shared: true, ephemeral: false, optional: false, collect: ['advertising'], share: ['advertising'] }, + { id: 'PSL_USER_INTERACTION', category: 'app activity', shared: false, ephemeral: false, optional: false, collect: ['analytics', 'functionality'], share: [] }, + { id: 'PSL_PURCHASE_HISTORY', category: 'financial', shared: false, ephemeral: false, optional: false, collect: ['functionality'], share: [] }, + { id: 'PSL_CRASH_LOGS', category: 'app performance', shared: false, ephemeral: false, optional: false, collect: ['analytics'], share: [] }, + ], + uploaded: { at: iso(60 * 24 * 9), changes: [ + { question: 'PSL_DATA_TYPES_LOCATION', response: 'PSL_APPROX_LOCATION', from: '', to: 'TRUE' }, + { question: 'PSL_DATA_USAGE_RESPONSES:PSL_APPROX_LOCATION:PSL_DATA_USAGE_COLLECTION_AND_SHARING', response: 'PSL_DATA_USAGE_ONLY_SHARED', from: '', to: 'TRUE' }, + { question: 'PSL_DATA_USAGE_RESPONSES:PSL_APPROX_LOCATION:DATA_USAGE_SHARING_PURPOSE', response: 'PSL_ADVERTISING', from: '', to: 'TRUE' }, + ] }, + }, + appPrivacy: { fromDataSafety: true, items: [ + { apple: 'Device ID', category: 'Identifiers', from: ['PSL_DEVICE_ID'], purposes: ['Analytics', 'Third-Party Advertising'], thirdParty: true }, + { apple: 'Coarse Location', category: 'Location', from: ['PSL_APPROX_LOCATION'], purposes: ['Third-Party Advertising'], thirdParty: true }, + { apple: 'Product Interaction', category: 'Usage Data', from: ['PSL_USER_INTERACTION'], purposes: ['Analytics', 'App Functionality'], thirdParty: false }, + { apple: 'Purchase History', category: 'Purchases', from: ['PSL_PURCHASE_HISTORY'], purposes: ['App Functionality'], thirdParty: false }, + { apple: 'Crash Data', category: 'Diagnostics', from: ['PSL_CRASH_LOGS'], purposes: ['Analytics'], thirdParty: false }, + ] }, + appInfo: { categories: { primary: 'GAMES', primarySubOne: 'GAMES_PUZZLE', primarySubTwo: 'GAMES_CASUAL' }, ageRating: [], contentRights: 'DOES_NOT_USE_THIRD_PARTY_CONTENT', free: true }, + encryption: false, + review: { signInRequired: false, accounts: false, contact: 's***@example.com', demoAccount: null, notes: 'Offline puzzle game, no sign-in. Remove Ads is restored from Settings > Restore purchases. The daily drop unlocks at midnight local time.', notesBytes: 148, notesMax: 4000 }, + ask: [ + { area: 'appInfo', id: 'ai-age', text: 'No age rating answers: storebound would answer every content question "none".', fix: 'Confirm that is true (ads, user-generated content, chat, loot boxes, web access count), or set apple.info.ageRating overrides.' }, + { area: 'appPrivacy', id: 'ap-linked', text: 'App Privacy asks per data type whether it is linked to the user\'s identity and whether it is used for tracking; the config cannot prove either.', fix: 'Answer both in App Store Connect > App Privacy for each type below (tracking also needs App Tracking Transparency in the app).' }, + ], + }, + 'p-tidy': { + profile: 'app', stores: { apple: true, play: true }, + dataSafety: { + collectsData: true, encryptedInTransit: true, deletionRequest: true, accountCreation: ['PSL_ACM_USER_ID_PASSWORD'], extra: 1, csv: PRISM_CSV, rows: 432, + types: [ + { id: 'PSL_EMAIL', category: 'personal', shared: false, ephemeral: false, optional: false, collect: ['functionality', 'account'], share: [] }, + { id: 'PSL_USER_ACCOUNT', category: 'personal', shared: false, ephemeral: false, optional: false, collect: ['functionality', 'account'], share: [] }, + { id: 'PSL_USER_GENERATED_CONTENT', category: 'app activity', shared: false, ephemeral: false, optional: false, collect: ['functionality'], share: [] }, + ], + uploaded: { at: iso(60 * 24 * 3), changes: [] }, + }, + appPrivacy: { fromDataSafety: true, items: [ + { apple: 'Email Address', category: 'Contact Info', from: ['PSL_EMAIL'], purposes: ['App Functionality'], thirdParty: false }, + { apple: 'User ID', category: 'Identifiers', from: ['PSL_USER_ACCOUNT'], purposes: ['App Functionality'], thirdParty: false }, + { apple: 'Other User Content', category: 'User Content', from: ['PSL_USER_GENERATED_CONTENT'], purposes: ['App Functionality'], thirdParty: false }, + ] }, + appInfo: { categories: { primary: 'PRODUCTIVITY' }, ageRating: [{ question: 'userGeneratedContent', value: 'true' }], contentRights: 'DOES_NOT_USE_THIRD_PARTY_CONTENT', free: true }, + encryption: null, + review: { signInRequired: true, accounts: true, contact: 's***@example.com', demoAccount: 'd***@example.com', notes: 'Sign in with the demo account. Lists are shared from the share button on a list.\n\nSign-in: use the demo account above.\n\nAccount deletion: Settings > Account > Delete account', notesBytes: 176, notesMax: 4000 }, + ask: [ + { area: 'encryption', id: 'enc-unset', text: 'Export compliance is not answered (apple.usesNonExemptEncryption).', fix: 'Decide it with the export-compliance skill; false only when the app uses no encryption beyond the OS. storebound never guesses it.' }, + { area: 'appPrivacy', id: 'ap-linked', text: 'App Privacy asks per data type whether it is linked to the user\'s identity and whether it is used for tracking; the config cannot prove either.', fix: 'Answer both in App Store Connect > App Privacy for each type below.' }, + ], + }, +}; +export const LISTING_TEXT: Record = { + 'p-prism': { play: { path: `${HOME}/apps/prism-puddle/store/listing.md`, text: '## en-US\n\n### title\n```\nPrism Puddle\n```\n' }, apple: { path: `${HOME}/apps/prism-puddle/store/appstore.md`, text: '## en-US\n\n### name\n```\nPrism Puddle\n```\n' } }, + 'p-tidy': { play: { path: `${HOME}/apps/tidy-lists/store/listing.md`, text: '## en-US\n' }, apple: { path: `${HOME}/apps/tidy-lists/store/appstore.md`, text: '## en-US\n' } }, +}; + +// ---- store art: drawn stand-ins for the renders ---- +const COPY: Record = { + en: [['Catch every', 'color drop!'], ['Chain splashes,', 'stack combos'], ['A new challenge', 'every day'], ['Clear levels,', 'earn 3 stars']], + tr: [['Renkli damlaları', 'yakala!'], ['Sıçrat, eşleştir,', 'komboyu büyüt'], ['Her gün', 'yeni bir görev'], ['Bölümleri geç,', '3 yıldız topla']], + ja: [['カラフルなしずくを', 'キャッチ!'], ['しずくをそろえて', 'コンボをつなげ'], ['毎日あたらしい', 'チャレンジ'], ['ステージクリアで', '星を3つゲット']], + ar: [['التقط كل', 'قطرة ملوّنة!'], ['طابق القطرات', 'وضاعف الكومبو'], ['تحدٍّ جديد', 'كل يوم'], ['أنهِ المراحل', 'واجمع 3 نجوم']], +}; +const PAL = [['#7c5cff', '#ff5fa2', '#ffd36e'], ['#ff7a59', '#ff3d7f', '#ffe08a'], ['#2fb5ff', '#5b6cff', '#b8f3ff'], ['#ffb03b', '#ff7a1a', '#fff1b8']]; +const esc = (s: string) => s.replace(/&/g, '&').replace(/ h; + const fs = Math.round((land ? h : w) * 0.085); + const pw = land ? h * 0.42 : w * 0.62, ph = pw * 2.05, px = land ? w * 0.62 : (w - pw) / 2, py = land ? h * 0.18 : h * 0.3; + const drops = Array.from({ length: 7 }, (_, i) => ``).join(''); + const tx = land ? w * 0.08 : w / 2, anchor = land ? 'start' : 'middle'; + return `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(`${esc(t[0]!)}${esc(t[1]!)}${drops}`)))}`; +} +const SIZES: [string, string, 'apple' | 'play', number, number][] = [ + ['ios69', 'App Store iPhone 6.9"', 'apple', 1320, 2868], ['ios65', 'App Store iPhone 6.5"', 'apple', 1284, 2778], ['ipad13', 'App Store iPad 13"', 'apple', 2064, 2752], + ['play', 'Google Play phone', 'play', 1080, 1920], ['feature', 'Google Play feature graphic', 'play', 1024, 500], +]; +const ART: Record = {}; +function renders(langs: string[], variants: string[]): RendersResult { + let images = 0, errors = 0, warnings = 0, videos = 0; + const out: RendersResult = { title: 'store renders', generated: day(0) + ' 09:12', dir: 'store/renders', variants: [], totals: { images: 0, videos: 0, errors: 0, warnings: 0 } }; + for (const v of ['', ...variants]) { + out.variants.push({ id: v, label: v ? `variant ${v}` : 'base', langs: langs.map(lang => ({ + lang, + rows: [...SIZES.filter(s => !(v && s[0] === 'feature')).map(([size, label, store, w, h]) => { + const n = size === 'feature' ? 1 : lang === 'ar' && size === 'ipad13' ? 0 : 4; + const tiles: RenderTile[] = Array.from({ length: n }, (_, i) => { + const src = `${v ? `${v}/` : ''}${lang}/${size}/${size === 'feature' ? '1024x500' : String(i + 1).padStart(2, '0')}.png`; + ART[src] = shot(i, lang, w, h, v); + const issues = lang === 'ja' && size === 'play' && i === 1 ? [{ level: 'warn' as const, code: 'overflow', msg: 'title line 2 shrunk to 72 %: consider shorter words' }] + : lang === 'tr' && size === 'feature' ? [{ level: 'warn' as const, code: 'bytes', msg: 'PNG is 1.4 MB: the JPEG copy uploads 4x faster (storebound shots jpeg)' }] : []; + images++; warnings += issues.length; + return { src, kind: 'image' as const, name: src.split('/').pop()!, w, h, bytes: Math.round(w * h * 0.42), issues }; + }); + const rowIssues = n === 0 ? [{ level: 'error' as const, code: 'count', msg: `no ${label} images (needs 1-10)` }] : []; + errors += rowIssues.length; + return { size, label, store, tiles, issues: rowIssues }; + }), ...(!v && lang !== 'ar' ? [{ size: 'preview/iphone', label: 'App preview iPhone', store: 'apple' as const, issues: [], tiles: [(() => { + const src = `${lang}/preview/iphone/01.mp4`, poster = `${lang}/preview/iphone/01-poster.png`; + ART[poster] = shot(1, lang, 886, 1920, ''); + videos++; + return { src, kind: 'video' as const, poster, name: '01.mp4', w: 886, h: 1920, bytes: 18_400_000, issues: [] }; + })()] }] : [])], + })) }); + } + out.totals = { images, videos, errors, warnings }; + return out; +} +export const RENDERS: Record = { 'p-prism': renders(['en', 'tr', 'ja', 'ar'], ['b']), 'p-tidy': renders(['en', 'tr'], []) }; +export const renderArt = (file: string): string | null => ART[file] ?? null; + +// ---- Product Page Optimization ---- +export const PPO: Record = { + 'p-prism': { tests: [ + { id: 'e2', name: 'storebound b', state: 'ACCEPTED', trafficProportion: 30, startDate: day(6), endDate: null, treatments: [{ id: 't1', name: 'b', locales: 4 }] }, + { id: 'e1', name: 'night palette', state: 'COMPLETED', trafficProportion: 50, startDate: day(70), endDate: day(40), treatments: [] }, + ] }, + 'p-tidy': { tests: [] }, +}; +export const PPO_STORE: PpoStatus = { tests: [{ id: 'e9', name: 'calm icons', state: 'PREPARE_FOR_SUBMISSION', trafficProportion: 20, startDate: null, endDate: null, treatments: [{ id: 't9', name: 'calm', locales: 2 }] }] }; + +// ---- analytics ---- +function analytics(days: number, seed: number): AnalyticsCompare { + const apple: AnalyticsCompare['series']['apple'] = [], play: AnalyticsCompare['series']['play'] = []; + for (let i = days; i >= 1; i--) { + const d = day(i), k = days - i; + const wave = 1 + Math.sin(k / 3.2 + seed) * 0.12 + (k % 7 >= 5 ? 0.18 : 0); + const lift = k > days * 0.55 ? 1.16 : 1; + const imp = Math.round(4200 * wave * (1 + k / days * 0.25)), views = Math.round(imp * 0.31); + apple.push({ date: d, impressions: imp, uniqueImpressions: Math.round(imp * 0.72), pageViews: views, uniquePageViews: Math.round(views * 0.8), downloads: Math.round(imp * 0.041 * lift), firstTimeDownloads: Math.round(imp * 0.033 * lift) }); + const vis = Math.round(2600 * wave * (1 + k / days * 0.2)); + play.push({ date: d, visitors: vis, acquisitions: Math.round(vis * 0.27 * lift), installs: Math.round(vis * 0.3 * lift) }); + } + const ev = (daysAgo: number, commit: string, subject: string, files: string[]) => ({ date: day(daysAgo), commit, subject, files }); + const events = [ev(Math.round(days * 0.45), 'a41c9e2', 'store: combo screenshot first (variant b won)', ['store/shots/copy.json', 'storebound.config.ts']), ev(Math.round(days * 0.75), '9be03d1', 'listing: shorter subtitle and keywords', ['store/appstore.md']), ev(Math.round(days * 0.2), 'c07f5aa', 'listing: new full description', ['store/listing.md'])]; + const tot = (xs: { a: number; b: number }[]) => { const a = xs.reduce((n, x) => n + x.a, 0), b = xs.reduce((n, x) => n + x.b, 0); return { a, b, conv: a ? b / a : null }; }; + const effects: AnalyticsCompare['effects'] = []; + for (const e of events) { + for (const store of ['apple', 'play'] as const) { + const s = store === 'apple' ? apple.map(x => ({ date: x.date, a: x.impressions, b: x.downloads })) : play.map(x => ({ date: x.date, a: x.visitors, b: x.acquisitions })); + const i = s.findIndex(x => x.date >= e.date); + if (i < 0) continue; + const before = tot(s.slice(Math.max(0, i - 7), i)), after = tot(s.slice(i, i + 7)); + effects.push({ event: e, store, daysBefore: Math.min(7, i), daysAfter: Math.min(7, s.length - i), + before: store === 'apple' ? { impressions: before.a, downloads: before.b, conversion: before.conv } : { visitors: before.a, acquisitions: before.b, conversion: before.conv }, + after: store === 'apple' ? { impressions: after.a, downloads: after.b, conversion: after.conv } : { visitors: after.a, acquisitions: after.b, conversion: after.conv } }); + } + } + return { snapshots: Math.ceil(days / 28) + 1, since: day(days), series: { apple, play }, effects }; +} +export const ANALYTICS: Record = { 'p-prism': analytics(56, 1), 'p-tidy': null }; diff --git a/apps/desktop/src/dev/fixtures.ts b/apps/desktop/src/dev/fixtures.ts index 9d265579..5d0c3442 100644 --- a/apps/desktop/src/dev/fixtures.ts +++ b/apps/desktop/src/dev/fixtures.ts @@ -7,6 +7,7 @@ import { type Account, type AccountCheck, type AppsListResult, type AppStatus, t type PortfolioResult, type Project, type ProjectSummary, type Settings, type StoreApp, type StoreRelease, type Studio, type ToolResult } from '../api'; import { buildApps, type Overrides } from '../lib/identity'; import type { CatalogDiff, HealthSnapshot, MetricRow, Review, TestFlightStatus, ValidateResult } from '../lib/model'; +import { ANALYTICS, DECLARATIONS, LISTING_TEXT, PPO, PPO_STORE, PRICE_DIFF, PRICES, renderArt, RENDERS } from './fixtures-more'; export const FIXTURE_MARKER = 'storebound-dev-fixtures'; @@ -395,13 +396,14 @@ const STORE_REVIEWS: Review[] = [ R('play', 's-p2', 2, 'Too many ads', 'An ad after every round is too much.', 'en', 5), R('apple', 's-a3', 5, 'Harika', 'Her gün kullanıyorum, çok sade.', 'TUR', 7), ]; -function read(method: string, id: string): ToolResult { +function read(method: string, id: string, args: Record = {}): ToolResult { if (id.startsWith('store:')) { const play = /android:/.test(id); switch (method) { case 'health': return ok(method, play ? HEALTH['p-tidy'] : { date: day(0), apple: HEALTH['p-tidy']!.apple }); case 'reviews.list': return ok(method, STORE_REVIEWS.filter(r => (play || r.store === 'apple') && (/ios:/.test(id) || r.store === 'play'))); case 'apple.testflight_status': return ok(method, TF['p-tidy']); + case 'apple.ppo_status': return ok(method, /ios:/.test(id) ? PPO_STORE : { tests: [] }); default: return { method, ok: false, exitCode: 1, dryRun: false, command: `storebound ${method}`, output: `fixture: ${method} needs an app folder` }; } } @@ -414,13 +416,21 @@ function read(method: string, id: string): ToolResult { case 'apple.testflight_status': return ok(method, TF[id]); case 'catalog.diff': return ok(method, CATALOG[id]); case 'validate': return ok(method, VALIDATE[id]); + case 'project.declarations': return ok(method, DECLARATIONS[id]); + case 'project.listing_text': return ok(method, LISTING_TEXT[id]); + case 'project.renders': return ok(method, RENDERS[id]); + case 'project.render': return ok(method, { file: String(args.file), dataUrl: renderArt(String(args.file)), bytes: 1_200_000 }); + case 'prices.current': return ok(method, PRICES[id]); + case 'prices.diff': return ok(method, PRICE_DIFF[id]); + case 'apple.ppo_status': return ok(method, PPO[id]); + case 'analytics.compare': return ANALYTICS[id] ? ok(method, ANALYTICS[id]) : { method, ok: false, exitCode: 1, dryRun: false, command: 'storebound analytics compare --json', output: `error: no snapshots in ${HOME}/apps/tidy-lists/.storebound/analytics (storebound analytics snapshot)` }; case 'check': return { method, ok: true, exitCode: 0, dryRun: false, command: 'storebound check', output: '12:00:01 [check] config ok: storebound.config.ts\n12:00:01 [check] listing: 4 languages\n12:00:01 [check] 0 problems, 2 warnings' }; default: return { method, ok: false, exitCode: 1, dryRun: false, command: `storebound ${method}`, output: `fixture: no data for ${method}` }; } } -const CACHED_AGO: Record = { health: 60 * 3, 'reviews.list': 45, 'apple.testflight_status': 60 * 5, 'catalog.diff': 60 * 26, validate: 60 * 2 }; -const NETWORK = new Set(['health', 'reviews.list', 'apple.testflight_status', 'catalog.diff', 'validate']); +const CACHED_AGO: Record = { health: 60 * 3, 'reviews.list': 45, 'apple.testflight_status': 60 * 5, 'catalog.diff': 60 * 26, validate: 60 * 2, 'prices.current': 60 * 4, 'apple.ppo_status': 60 * 6 }; +const NETWORK = new Set(['health', 'reviews.list', 'apple.testflight_status', 'catalog.diff', 'validate', 'prices.current', 'prices.diff', 'apple.ppo_status']); async function progressLines(job: string | null, lines: string[]) { for (const line of lines) { await sleep(260); if (job) emit('sidecar-progress', { params: { requestId: 1, line, stream: 'stderr' }, job }); } @@ -494,7 +504,7 @@ async function answer(cmd: string, a: Record): Promise if (NETWORK.has(method)) await progressLines(job, [`[${method}] reading App Store Connect`, `[${method}] reading Google Play`, `[${method}] done`]); else await sleep(150); if (job && cancelled.has(job)) throw { code: -32800, message: 'Request cancelled' }; - return read(method, id); + return read(method, id, ((a.params as { args?: Record } | null)?.args) ?? {}); } case 'job_cancel': cancelled.add(a.job as string); return true; case 'write_with_confirm': { @@ -508,7 +518,10 @@ async function answer(cmd: string, a: Record): Promise const res: ToolResult = { method, ok: true, exitCode: 0, dryRun: false, command: `storebound ${method.replace('.', ' ')}`, output: `[${method}] done (fixture)` }; return { confirmed: true, stage: 'done', dryRun: { ...res, dryRun: true }, result: res }; } - case 'project_add': case 'project_init': await sleep(300); return null; + case 'project_add': case 'project_init': case 'project_import_fastlane': await sleep(300); return null; + case 'export_save': await sleep(200); return `~/Downloads/${String(a.name)}.${String(a.kind)}`; + case 'price_sheet_pick': return `${HOME}/Downloads/prices-autumn.csv`; + case 'project_reveal': return null; case 'project_remove': projects = projects.filter(p => p.id !== a.id); return null; case 'project_set_accounts': { const p = projects.find(x => x.id === a.id)!; p.playAccount = (a.play as string | null) ?? null; p.appleAccount = (a.apple as string | null) ?? null; return p; } case 'account_add_play': case 'account_add_apple': return null; diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts index 2750f5b0..631477f4 100644 --- a/apps/desktop/src/i18n/en.ts +++ b/apps/desktop/src/i18n/en.ts @@ -527,7 +527,7 @@ export const en = { 'wz.footer': 'You can open this guide again from Settings or the command palette.', 'wz.footerSafe': 'Nothing is submitted or released from here.', 'wz.welcomeTitle': 'Every app, both stores, one window', - 'wz.welcomeLead': 'storebound desktop shows where each of your apps stands on the App Store and Google Play, and runs the storebound CLI for you. Five short steps get you there.', + 'wz.welcomeLead': 'storebound desktop shows where each of your apps stands on the App Store and Google Play, and runs the storebound CLI for you. Six short steps get you there.', 'wz.p1t': 'One portfolio', 'wz.p1s': 'Releases, rollouts, catalog parity, health and reviews of every app.', 'wz.p2t': 'Safe by design', @@ -552,7 +552,7 @@ export const en = { 'wz.readLead': 'One read-only pass over App Store Connect and Google Play fills the portfolio: versions, review state, rollouts and catalog parity.', 'wz.readNow': 'Read the stores now', 'wz.readDone': '{count} apps read {when}', - 'wz.needApp': 'Add an app folder first (step 2).', + 'wz.needApp': 'Add an app folder first (step 3).', 'wz.skip': 'Skip for now', 'wz.back': 'Back', 'wz.next': 'Next', @@ -871,5 +871,355 @@ export const en = { 'reviews.tooLong': 'Longer than the store allows ({limit} characters)', 'reviews.sendNoteD3': 'Replies are public. Save, approve, then Send: each step shows a system dialog first.', + // ---- every CLI area in the window: prices, store art, growth, app info, exports, onboarding ---- + 'tab.prices': 'Prices', + 'tab.art': 'Store art', + 'tab.growth': 'Growth', + 'tab.appinfo': 'App info', + 'col.date': 'Date', + 'common.yes': 'Yes', + 'common.no': 'No', + 'export.button': 'Export', + 'export.hint': 'Save what this screen shows as a file (CSV or Markdown)', + 'export.saved': 'Saved', + 'export.failed': 'Export failed', + 'export.readFirst': 'Read it first', + 'export.personal': 'personal data', + 'export.prices': 'Prices (CSV, price sheet format)', + 'export.reviews': 'Reviews (CSV)', + 'export.health': 'Health report (Markdown)', + 'export.validate': 'Store readiness report (Markdown)', + 'export.catalog': 'Catalog parity (Markdown)', + 'export.listings': 'Listings (Markdown)', + 'export.noListings': 'No listing files in this app folder', + 'export.portfolio': 'Portfolio (CSV)', + 'export.noApps': 'No apps yet', + 'export.declarations': 'Store declarations (Markdown)', + 'export.dataSafety': 'Data safety (Play CSV)', + 'export.noDataSafety': 'The config has no Data safety answers', + 'export.analytics': 'Analytics, daily (CSV)', + + 'palette.gExport': 'Export', + 'palette.export': 'Export: {what}', + 'palette.prices': '{name} · Prices and price sheet', + 'palette.art': '{name} · Store art gallery', + + 'hint.keys': 'Map a store account to this app in App folders, or add the key in Studios & accounts.', + 'hint.permission': 'The key works but lacks a permission: Studios & accounts > Test shows the fix.', + 'hint.config': 'Set that value in storebound.config.ts (the Checks tab lists what is missing).', + 'hint.renders': 'Render the screenshots first: Store art > Render.', + 'hint.ffmpeg': 'Download ffmpeg on the Dependencies screen (one click, checked by hash).', + 'hint.chrome': 'Download Chrome for Testing on the Dependencies screen.', + 'hint.snapshot': 'Take a snapshot first: Growth > Take a snapshot.', + 'hint.bucket': 'Set play.reportsBucket in the config (Play Console > Download reports > Statistics > Copy Cloud Storage URI).', + 'hint.analyticsSetup': 'Start the App Store reports once: Growth > Start App Store reports (Admin key); data comes 1-2 days later.', + 'hint.version': 'Create the version first: Listings > Push App Store version and text.', + 'hint.fastlane': 'Pick the folder that contains fastlane/ (or ios/fastlane, android/fastlane).', + 'hint.priceSheet': 'Write the sheet first: Prices > Write store/prices.csv, or pick a CSV.', + 'hint.pricePoint': 'App Store prices must be one of Apple\'s price points: export with equalized prices to see them.', + 'hint.network': 'Check the internet connection and try again.', + 'hint.confirm': 'This step needs your confirmation in the dialog; run it again and press the button.', + 'hint.git': 'The app folder must be a git repository with history (analytics compare reads git log).', + + 'prices.readTitle': 'Prices', + 'prices.sheetTitle': 'Price sheet', + 'prices.sheetSub': 'Every product x store x region in one CSV: export it, edit it, compare it, apply it', + 'prices.exportCsv': 'Export prices CSV', + 'prices.getSheet': 'Get the sheet', + 'prices.readFirst': 'Read prices first', + 'prices.writeProject': 'Write store/prices.csv', + 'prices.writeHint': 'Writes the current prices into the app folder for `storebound prices import` (dry run first)', + 'prices.compareHead': 'Compare and apply', + 'prices.pickSheet': 'Compare a sheet…', + 'prices.pickFailed': 'Could not open the sheet', + 'prices.compareProject': 'Compare store/prices.csv', + 'prices.showSheet': 'Show the sheet in the folder', + 'prices.noSheetYet': 'No price sheet yet', + 'prices.sheetNote': 'Reading changes nothing. Applying a sheet is your decision: storebound shows the dry run in a system dialog and writes only after you press its button. An App Store price increase cannot be undone once it starts.', + 'prices.compareTitle': 'Compare the price sheet', + 'prices.diffTitle': 'Sheet {file} against the stores', + 'prices.diffSub': 'What would change on each store', + 'prices.compareAgain': 'Compare again', + 'prices.apply': 'Apply {count} changes', + 'prices.apply_one': 'Apply 1 change', + 'prices.applied': 'Prices written', + 'prices.applyNote': 'Owner action: the stores apply new prices within hours, users see them then. Play regions without a price get Play\'s conversion of the US price.', + 'prices.upToDate': 'Prices match the sheet', + 'prices.upToDateText': 'Nothing to apply. Edit the sheet, then compare again.', + 'prices.dChanged': '{count} changed', + 'prices.dNew': '{count} new', + 'prices.dUp': '{count} up', + 'prices.dDown': '{count} down', + 'prices.dProducts': 'Products: {list}', + 'prices.colStarts': 'Starts', + 'prices.colNow': 'Now', + 'prices.colNew': 'New', + 'prices.colKind': 'Set by', + 'prices.now': 'now', + 'prices.new': 'New', + 'prices.more': '{count} more rows in the sheet', + 'prices.emptyTitle': 'No in-app products in the config', + 'prices.emptyText': 'Prices are read for the products of storebound.config.ts. Add them there (store-iap-setup skill), then create them on the stores from the Catalog tab.', + 'prices.emptyHint': 'in storebound.config.ts', + 'prices.notReadTitle': 'Prices not read yet', + 'prices.notReadText': 'One read-only pass over App Store Connect and Google Play lists every product\'s price in every territory. It uses the accounts\' API quota.', + 'prices.readNow': 'Read prices', + 'prices.kProducts': 'Products', + 'prices.kProductsSub': '{count} prices read', + 'prices.kRegions': 'Territories', + 'prices.kRegionsAuto': 'App Store equalized prices included', + 'prices.kRegionsManual': 'App Store manual prices only', + 'prices.kGaps': 'Price gaps', + 'prices.kGapsSub': '≥ {pct} % apart in the same currency', + 'prices.kMissing': 'Not on a store', + 'prices.kMissingNone': 'Every product is on its stores', + 'prices.overview': 'Products x key territories', + 'prices.withAuto': 'App Store equalized prices', + 'prices.auto': 'Equalized', + 'prices.manual': 'Manual', + 'prices.autoLegend': 'grey: App Store equalized from the base territory', + 'prices.gapLegend': 'Δ: gap between the stores ≥ {pct} %', + 'prices.perRegion': '{product} in every territory', + 'prices.perRegionSub': '{count} territories', + 'prices.searchRegion': 'Territory or currency', + 'prices.otherCurrency': 'other currency', + 'prices.scheduled': 'from {date}: {price}', + 'prices.missingNote': 'Not on the store yet: {list}. Create them from the Catalog tab, then read again.', + 'cat.openPrices': 'Open prices', + 'cat.pricesHere': 'Prices per territory, the price sheet and applying it are on the Prices tab.', + + 'art.title': 'Store art', + 'art.images': 'Images', + 'art.imagesSub': '{count} languages', + 'art.imagesSub_one': '1 language', + 'art.videos': 'App previews', + 'art.videosSub': 'App Store and promo videos', + 'art.errors': 'Store errors', + 'art.errorsSub': 'Size, alpha, format, count', + 'art.warnings': 'Warnings', + 'art.rendered': 'Scanned {when}', + 'art.variant': 'Variant', + 'art.base': 'Base', + 'art.onlyIssues': 'Only issues', + 'art.openFolder': 'Open folder', + 'art.openPage': 'Open review page', + 'art.openPageHint': 'Opens the gallery page (index.html) in your browser', + 'art.writePage': 'Write review page', + 'art.render': 'Render {lang}', + 'art.notThere': 'Not there yet', + 'art.count': '{count} files', + 'art.count_one': '1 file', + 'art.open': 'Open {name}', + 'art.tooBig': 'too big to preview', + 'art.prev': 'Previous', + 'art.next': 'Next', + 'art.emptyTitle': 'No renders yet', + 'art.emptyText': 'Render the store screenshots from the frames and the copy file: press Render. It runs locally (ffmpeg and Chrome) and uploads nothing.', + 'art.noIssues': 'No issues here', + 'art.noIssuesText': 'Every file of this language passes the local store checks.', + 'art.foot': 'Local files only, read {when}. Uploading is on the Listings tab.', + + 'gr.analytics': 'Store analytics', + 'gr.analyticsSub': '{count} snapshots since {since}', + 'gr.analyticsSubNone': 'Snapshots in .storebound/analytics, next to the listing changes in git', + 'gr.setup': 'Start App Store reports', + 'gr.setupDone': 'Report request created', + 'gr.setupHint': 'Creates the ongoing App Store analytics report request once (Admin key). Changes nothing public.', + 'gr.snapshot': 'Take a snapshot', + 'gr.snapshotDone': 'Snapshot saved', + 'gr.snapshotHint': 'Reads impressions, page views, downloads (App Store) and visitors, installs (Play) into .storebound/analytics', + 'gr.noneTitle': 'No analytics snapshots yet', + 'gr.noneText': 'A snapshot keeps 28 days of store traffic in the app folder (.storebound/analytics). With a few of them, this tab shows each listing change from git next to the conversion before and after it.', + 'gr.noBucket': 'For Google Play, set play.reportsBucket in the config first.', + 'gr.impressions': 'Impressions', + 'gr.downloads': 'Downloads', + 'gr.visitors': 'Listing visitors', + 'gr.acquisitions': 'Acquisitions', + 'gr.conversion': 'Conversion', + 'gr.conversionSub': 'Installs per reach, whole window', + 'gr.days': '{count} days', + 'gr.days_one': '1 day', + 'gr.daysN': '{count} days', + 'gr.daysN_one': '1 day', + 'gr.chartAria': 'Daily store traffic on {store} with listing changes', + 'gr.changes': '{count} listing changes', + 'gr.changes_one': '1 listing change', + 'gr.oneDay': 'One day of data so far: the chart starts with the second day.', + 'gr.change': 'Listing change (git)', + 'gr.before': 'Before', + 'gr.after': 'After', + 'gr.reading': 'A change needs several days on both sides and enough traffic; seasonality, featuring and ads move these numbers too.', + 'gr.ppo': 'Product Page Optimization', + 'gr.ppoSub': 'App Store A/B tests of the screenshots', + 'gr.ppoRead': 'Read tests', + 'gr.ppoNotRead': 'Tests not read yet', + 'gr.ppoNotReadText': 'Read-only: the tests, their state, traffic share and treatments. Results per treatment are only in App Store Connect.', + 'gr.ppoNone': 'No tests yet', + 'gr.ppoNoneText': 'Create a test from a screenshot variant below, upload its screenshots, then start it.', + 'gr.ppoNoVariants': 'Add a screenshot variant to shots.variants in the config (store-screenshots skill) and render it; each variant becomes one treatment.', + 'gr.results': 'Results in App Store Connect', + 'gr.test': 'Test', + 'gr.state': 'State', + 'gr.traffic': 'Traffic', + 'gr.dates': 'Running', + 'gr.treatments': 'Treatments', + 'gr.owner': 'Owner action', + 'gr.running': 'running', + 'gr.notStarted': 'not started', + 'gr.treatment': '{name} ({count} locales)', + 'gr.treatment_one': '{name} (1 locale)', + 'gr.startBtn': 'Start', + 'gr.stopBtn': 'Stop', + 'gr.start': 'Start the test "{name}"', + 'gr.stop': 'Stop the test "{name}"', + 'gr.started': 'Test start requested', + 'gr.stopped': 'Test stop requested', + 'gr.create': 'New test', + 'gr.variant': 'Variant {id}', + 'gr.createBtn': 'Create test', + 'gr.createTitle': 'Create a Product Page Optimization test', + 'gr.created': 'Test created (not started)', + 'gr.upload': 'Treatment screenshots', + 'gr.uploadBtn': 'Upload screenshots', + 'gr.uploadTitle': 'Upload the screenshots of variant {id}', + 'gr.uploadInto': 'Into the editable test "{name}"', + 'gr.uploadNoTest': 'Create a test first: uploads go into the editable test.', + 'gr.ppoNote': 'Create and upload change nothing visitors see. Start and stop are your decision: each shows a system dialog that names the action; a stopped test cannot be restarted.', + 'gr.ppoStoreOnly': 'Read-only for a store-only app: link an app folder to create and run tests.', + 'gr.playExp': 'Store listing experiments', + 'gr.playExpSub': 'Google Play: no API', + 'gr.playExpText': 'Google Play has no API for store listing experiments: create and run them in Play Console > Grow > Store listing experiments, with the variant screenshots storebound renders.', + 'gr.seeVariants': 'See the variant renders', + + 'ai.askTitle': '{count} questions only you can answer', + 'ai.askTitle_one': '1 question only you can answer', + 'ai.askSub': 'The config does not prove these answers. storebound never guesses a compliance answer: decide, then set it in the config.', + 'ai.allAnswered': 'Every declaration this tab shows comes from the config. The answers are still yours: review them before each submission.', + 'ai.aDataSafety': 'Data safety', + 'ai.aAppPrivacy': 'App Privacy', + 'ai.aAppInfo': 'App info', + 'ai.aEncryption': 'Export compliance', + 'ai.aReview': 'App Review', + 'ai.askedHere': '{count} open questions about this form above', + 'ai.askedHere_one': '1 open question about this form above', + 'ai.dsTitle': 'Data safety', + 'ai.dsSub': 'Google Play, from dataSafety in the config', + 'ai.dsUpload': 'Upload Data safety', + 'ai.dsUploadHint': 'Replaces the whole Play Data safety form (dry run and system dialog first)', + 'ai.dsUploaded': 'Data safety uploaded', + 'ai.dsNoneTitle': 'No Data safety answers', + 'ai.dsNoneText': 'Add dataSafety to storebound.config.ts (store-declarations skill): what the app and every SDK collect, why, and whether it is shared.', + 'ai.dsCollects': 'Collects or shares data', + 'ai.dsEncrypted': 'Encrypted in transit', + 'ai.dsDeletion': 'Users can ask for deletion', + 'ai.dsAccounts': 'Account creation', + 'ai.dsNever': 'Play cannot read this form back. Once you upload from here, this tab shows what changed since.', + 'ai.dsSame': 'Same as the last upload ({when}).', + 'ai.dsChanged': '{count} answers changed since the last upload ({when}): upload again to bring Play up to date.', + 'ai.dsChanged_one': '1 answer changed since the last upload ({when}): upload again to bring Play up to date.', + 'ai.show': 'Show', + 'ai.hide': 'Hide', + 'ai.colType': 'Data type', + 'ai.colCollected': 'Collected for', + 'ai.colShared': 'Shared for', + 'ai.notShared': 'not shared', + 'ai.optional': 'optional', + 'ai.ephemeral': 'ephemeral', + 'ai.dsFoot': 'The upload sends {rows} CSV rows (Play\'s import format) and replaces every earlier answer.', + 'ai.apTitle': 'App Privacy', + 'ai.apSub': 'App Store, suggested from the Data safety answers', + 'ai.apOpen': 'Open App Privacy', + 'ai.apNote': 'App Privacy has no API: enter these answers in App Store Connect > App Privacy. Apple also asks per type whether it is linked to the user and used for tracking.', + 'ai.apNoneTitle': 'No data collected', + 'ai.apNoneText': 'The Data safety answers list no data types: in App Store Connect answer "Data Not Collected", if that is true for every SDK.', + 'ai.apUnknownTitle': 'Nothing to suggest yet', + 'ai.apUnknownText': 'Answer the data collection once in dataSafety; the App Privacy answers follow from it.', + 'ai.colAppleType': 'Data type', + 'ai.colPurposes': 'Purposes', + 'ai.colLinked': 'Linked to user', + 'ai.colTracking': 'Tracking', + 'ai.ask': 'Your answer', + 'ai.askLikely': 'Check: shared', + 'ai.noPlay': 'Not on Google Play', + 'ai.noPlayText': 'The config has no play section.', + 'ai.noApple': 'Not on the App Store', + 'ai.noAppleText': 'The config has no apple section.', + 'ai.infoTitle': 'App info', + 'ai.infoSub': 'Categories, age rating, content rights', + 'ai.infoPush': 'Push the App Store app info', + 'ai.push': 'Push', + 'ai.pushed': 'Pushed to App Store Connect', + 'ai.category': 'Category', + 'ai.age': 'Age rating', + 'ai.ageAllNone': 'Every question "none": confirm', + 'ai.rights': 'Content rights', + 'ai.rightsOwn': 'No third-party content', + 'ai.rightsThird': 'Third-party content, rights held', + 'ai.price': 'Price', + 'ai.free': 'Free, every territory', + 'ai.paid': 'Paid (set in App Store Connect)', + 'ai.notSet': 'Not set', + 'ai.notAnswered': 'Not answered', + 'ai.encTitle': 'Export compliance', + 'ai.encSub': 'Encryption answer for every build', + 'ai.encAnswer': 'Answer builds', + 'ai.encPush': 'Answer export compliance for the builds', + 'ai.encYes': 'Uses non-exempt encryption', + 'ai.encNo': 'Only exempt encryption', + 'ai.encYesText': 'Builds are linked to the approved encryption declaration in App Store Connect.', + 'ai.encNoText': 'Builds without an answer get usesNonExemptEncryption = false. Better: ITSAppUsesNonExemptEncryption = NO in Info.plist.', + 'ai.encUnset': 'apple.usesNonExemptEncryption is not set. Decide it with the export-compliance skill; storebound never guesses it.', + 'ai.encUnsetHint': 'Answer apple.usesNonExemptEncryption in the config first', + 'ai.reviewTitle': 'App Review details', + 'ai.reviewSub': 'Contact, demo account, notes', + 'ai.reviewPush': 'Push the App Review details', + 'ai.signIn': 'Sign-in needed', + 'ai.contact': 'Contact', + 'ai.demo': 'Demo account', + 'ai.demoNone': 'none needed', + 'ai.missing': 'Missing', + 'ai.notes': 'Notes for the reviewer', + 'ai.notesBytes': '{n} / {max} bytes', + 'ai.notesNone': 'No notes (apple.info.reviewNotes, reviewAccess.instructions).', + 'ai.reviewSafe': 'Contact and demo account stay in the app folder\'s .storebound/ (gitignored); shown masked, never the password.', + 'ai.foot': 'From the config and .storebound/, read {when}. Nothing here was sent anywhere.', + 'ds.functionality': 'App functionality', + 'ds.analytics': 'Analytics', + 'ds.communications': 'Developer communications', + 'ds.fraud': 'Fraud prevention, security', + 'ds.advertising': 'Advertising or marketing', + 'ds.personalization': 'Personalization', + 'ds.account': 'Account management', + + 'folders.fastlane': 'Import from fastlane', + 'folders.fastlaneHint': 'Pick a folder with a fastlane setup: storebound shows the import plan in a system dialog, then writes its files next to fastlane (never overwrites)', + 'folders.imported': '{name} imported from fastlane', + 'folders.importedDetail': 'Config, listing files and screenshot frames written. Next: replace the placeholders, then Checks.', + 'folders.startShort': 'Start an app folder', + 'folders.newNote': 'Both ask for a folder in a system dialog, show what they would write, and write only after you press Apply. Existing files are kept.', + 'folders.open': 'Open', + 'folders.openApp': 'Open this app', + 'folders.reveal': 'Show in the file manager', + + 'wz.s0': 'Your studio', + 'wz.studioTitle': 'Which studio are these apps from?', + 'wz.studioLead': 'A studio groups store accounts and their apps (a company, a client, a side project). Pick one or create it; the keys of the next steps go into it. You can move things later.', + 'wz.studioPick': 'Studio', + 'wz.studioAccounts': '{count} store accounts', + 'wz.studioAccounts_one': '1 store account', + 'wz.studioPicked': 'Selected', + 'wz.studioNoneHint': 'Keep accounts without a studio', + 'wz.studioNew': 'Create your studio', + 'wz.studioAnother': 'Or create another studio', + 'wz.studioNewText': 'A name and a colour; a logo can come later in Studios & accounts.', + 'wz.studioPlaceholder': 'For example: Example Games', + 'wz.studioCreate': 'Create studio', + 'wz.fastlaneTitle': 'Import from fastlane', + 'wz.fastlaneText': 'The folder has a fastlane setup (deliver, supply). storebound turns it into its config and listing files and leaves fastlane untouched.', + 'wz.fastlaneGo': 'Choose the folder and import', + 'wz.fastlaneNote': 'You see the import plan and what it does not map before anything is written.', + 'wz.keysInto': 'New keys go into {name}.', + 'wz.keysNoStudio': 'New keys stay without a studio.', + 'wz.change': 'Change', } as const; diff --git a/apps/desktop/src/i18n/tr.ts b/apps/desktop/src/i18n/tr.ts index d91d1ed7..96558ffd 100644 --- a/apps/desktop/src/i18n/tr.ts +++ b/apps/desktop/src/i18n/tr.ts @@ -529,7 +529,7 @@ export const tr: Record = { 'wz.footer': 'Bu rehberi Ayarlar\'dan veya komut paletinden yeniden açabilirsiniz.', 'wz.footerSafe': 'Buradan hiçbir şey gönderilmez veya yayınlanmaz.', 'wz.welcomeTitle': 'Her uygulama, iki mağaza, tek pencere', - 'wz.welcomeLead': 'storebound desktop her uygulamanızın App Store ve Google Play\'deki durumunu gösterir ve storebound CLI\'yi sizin için çalıştırır. Beş kısa adımda hazır.', + 'wz.welcomeLead': 'storebound desktop her uygulamanızın App Store ve Google Play\'deki durumunu gösterir ve storebound CLI\'yi sizin için çalıştırır. Altı kısa adımda hazır.', 'wz.p1t': 'Tek portföy', 'wz.p1s': 'Her uygulamanın sürümleri, dağıtımları, katalog eşleşmesi, sağlığı ve yorumları.', 'wz.p2t': 'Tasarımı gereği güvenli', @@ -554,7 +554,7 @@ export const tr: Record = { 'wz.readLead': 'App Store Connect ve Google Play üzerinde salt okunur bir tur portföyü doldurur: sürümler, inceleme durumu, dağıtımlar ve katalog eşleşmesi.', 'wz.readNow': 'Mağazaları şimdi oku', 'wz.readDone': '{count} uygulama {when} okundu', - 'wz.needApp': 'Önce bir uygulama klasörü ekleyin (2. adım).', + 'wz.needApp': 'Önce bir uygulama klasörü ekleyin (3. adım).', 'wz.skip': 'Şimdilik geç', 'wz.back': 'Geri', 'wz.next': 'İleri', @@ -873,5 +873,355 @@ export const tr: Record = { 'reviews.tooLong': 'Mağazanın izin verdiğinden uzun ({limit} karakter)', 'reviews.sendNoteD3': 'Yanıtlar herkese açıktır. Kaydet, onayla, sonra Gönder: her adım önce bir sistem penceresi gösterir.', + // ---- her CLI alanı pencerede: fiyatlar, mağaza görselleri, büyüme, uygulama bilgisi, dışa aktarma, başlangıç ---- + 'tab.prices': 'Fiyatlar', + 'tab.art': 'Mağaza görselleri', + 'tab.growth': 'Büyüme', + 'tab.appinfo': 'Uygulama bilgisi', + 'col.date': 'Tarih', + 'common.yes': 'Evet', + 'common.no': 'Hayır', + 'export.button': 'Dışa aktar', + 'export.hint': 'Bu ekranın gösterdiğini dosya olarak kaydet (CSV veya Markdown)', + 'export.saved': 'Kaydedildi', + 'export.failed': 'Dışa aktarma başarısız', + 'export.readFirst': 'Önce okuyun', + 'export.personal': 'kişisel veri', + 'export.prices': 'Fiyatlar (CSV, fiyat tablosu biçimi)', + 'export.reviews': 'Yorumlar (CSV)', + 'export.health': 'Sağlık raporu (Markdown)', + 'export.validate': 'Mağaza hazırlık raporu (Markdown)', + 'export.catalog': 'Katalog eşleşmesi (Markdown)', + 'export.listings': 'Mağaza metinleri (Markdown)', + 'export.noListings': 'Bu uygulama klasöründe mağaza metni dosyası yok', + 'export.portfolio': 'Portföy (CSV)', + 'export.noApps': 'Henüz uygulama yok', + 'export.declarations': 'Mağaza beyanları (Markdown)', + 'export.dataSafety': 'Veri güvenliği (Play CSV)', + 'export.noDataSafety': 'Ayarda Veri güvenliği yanıtı yok', + 'export.analytics': 'Analiz, günlük (CSV)', + + 'palette.gExport': 'Dışa aktar', + 'palette.export': 'Dışa aktar: {what}', + 'palette.prices': '{name} · Fiyatlar ve fiyat tablosu', + 'palette.art': '{name} · Mağaza görselleri galerisi', + + 'hint.keys': 'Uygulama klasörlerinde bu uygulamaya bir mağaza hesabı atayın veya anahtarı Stüdyolar ve hesaplar\'dan ekleyin.', + 'hint.permission': 'Anahtar çalışıyor ama bir izin eksik: Stüdyolar ve hesaplar > Sına çözümü gösterir.', + 'hint.config': 'Bu değeri storebound.config.ts içinde ayarlayın (Kontroller sekmesi eksikleri listeler).', + 'hint.renders': 'Önce ekran görüntülerini oluşturun: Mağaza görselleri > Oluştur.', + 'hint.ffmpeg': 'ffmpeg\'i Bağımlılıklar ekranından indirin (tek tık, özetle doğrulanır).', + 'hint.chrome': 'Chrome for Testing\'i Bağımlılıklar ekranından indirin.', + 'hint.snapshot': 'Önce bir anlık görüntü alın: Büyüme > Anlık görüntü al.', + 'hint.bucket': 'Ayarda play.reportsBucket değerini girin (Play Console > Raporları indir > İstatistikler > Cloud Storage URI\'sini kopyala).', + 'hint.analyticsSetup': 'App Store raporlarını bir kez başlatın: Büyüme > App Store raporlarını başlat (Admin anahtarı); veriler 1-2 gün sonra gelir.', + 'hint.version': 'Önce sürümü oluşturun: Mağaza metinleri > App Store sürümünü ve metni gönder.', + 'hint.fastlane': 'İçinde fastlane/ (veya ios/fastlane, android/fastlane) olan klasörü seçin.', + 'hint.priceSheet': 'Önce tabloyu yazın: Fiyatlar > store/prices.csv yaz, ya da bir CSV seçin.', + 'hint.pricePoint': 'App Store fiyatları Apple\'ın fiyat noktalarından biri olmalı: eşitlenmiş fiyatlarla dışa aktarıp görün.', + 'hint.network': 'İnternet bağlantısını kontrol edip yeniden deneyin.', + 'hint.confirm': 'Bu adım pencerede onayınızı ister; yeniden çalıştırıp düğmeye basın.', + 'hint.git': 'Uygulama klasörü geçmişi olan bir git deposu olmalı (analiz karşılaştırması git log okur).', + + 'prices.readTitle': 'Fiyatlar', + 'prices.sheetTitle': 'Fiyat tablosu', + 'prices.sheetSub': 'Her ürün x mağaza x bölge tek bir CSV\'de: dışa aktarın, düzenleyin, karşılaştırın, uygulayın', + 'prices.exportCsv': 'Fiyatları CSV olarak aktar', + 'prices.getSheet': 'Tabloyu alın', + 'prices.readFirst': 'Önce fiyatları oku', + 'prices.writeProject': 'store/prices.csv yaz', + 'prices.writeHint': 'Güncel fiyatları `storebound prices import` için uygulama klasörüne yazar (önce deneme)', + 'prices.compareHead': 'Karşılaştır ve uygula', + 'prices.pickSheet': 'Bir tablo karşılaştır…', + 'prices.pickFailed': 'Tablo açılamadı', + 'prices.compareProject': 'store/prices.csv karşılaştır', + 'prices.showSheet': 'Tabloyu klasörde göster', + 'prices.noSheetYet': 'Henüz fiyat tablosu yok', + 'prices.sheetNote': 'Okumak hiçbir şeyi değiştirmez. Bir tabloyu uygulamak sizin kararınızdır: storebound denemeyi bir sistem penceresinde gösterir ve yalnızca düğmesine bastığınızda yazar. App Store\'da başlayan bir fiyat artışı geri alınamaz.', + 'prices.compareTitle': 'Fiyat tablosunu karşılaştır', + 'prices.diffTitle': '{file} tablosu mağazalara karşı', + 'prices.diffSub': 'Her mağazada neyin değişeceği', + 'prices.compareAgain': 'Yeniden karşılaştır', + 'prices.apply': '{count} değişikliği uygula', + 'prices.apply_one': '1 değişikliği uygula', + 'prices.applied': 'Fiyatlar yazıldı', + 'prices.applyNote': 'Sahip işlemi: mağazalar yeni fiyatları saatler içinde uygular, kullanıcılar o zaman görür. Fiyatı olmayan Play bölgeleri ABD fiyatının Play dönüşümünü alır.', + 'prices.upToDate': 'Fiyatlar tabloyla aynı', + 'prices.upToDateText': 'Uygulanacak bir şey yok. Tabloyu düzenleyip yeniden karşılaştırın.', + 'prices.dChanged': '{count} değişti', + 'prices.dNew': '{count} yeni', + 'prices.dUp': '{count} arttı', + 'prices.dDown': '{count} düştü', + 'prices.dProducts': 'Ürünler: {list}', + 'prices.colStarts': 'Başlangıç', + 'prices.colNow': 'Şimdi', + 'prices.colNew': 'Yeni', + 'prices.colKind': 'Belirleyen', + 'prices.now': 'şimdi', + 'prices.new': 'Yeni', + 'prices.more': 'Tabloda {count} satır daha', + 'prices.emptyTitle': 'Ayarda uygulama içi ürün yok', + 'prices.emptyText': 'Fiyatlar storebound.config.ts içindeki ürünler için okunur. Ürünleri oraya ekleyin (store-iap-setup becerisi), sonra Katalog sekmesinden mağazalarda oluşturun.', + 'prices.emptyHint': 'storebound.config.ts içinde', + 'prices.notReadTitle': 'Fiyatlar henüz okunmadı', + 'prices.notReadText': 'App Store Connect ve Google Play üzerinde salt okunur bir tur, her ürünün her bölgedeki fiyatını listeler. Hesapların API kotasını kullanır.', + 'prices.readNow': 'Fiyatları oku', + 'prices.kProducts': 'Ürünler', + 'prices.kProductsSub': '{count} fiyat okundu', + 'prices.kRegions': 'Bölgeler', + 'prices.kRegionsAuto': 'App Store eşitlenmiş fiyatlar dahil', + 'prices.kRegionsManual': 'Yalnızca App Store elle girilen fiyatlar', + 'prices.kGaps': 'Fiyat farkları', + 'prices.kGapsSub': 'Aynı para biriminde ≥ %{pct} fark', + 'prices.kMissing': 'Mağazada değil', + 'prices.kMissingNone': 'Her ürün kendi mağazalarında', + 'prices.overview': 'Ürünler x ana bölgeler', + 'prices.withAuto': 'App Store eşitlenmiş fiyatları', + 'prices.auto': 'Eşitlenmiş', + 'prices.manual': 'Elle', + 'prices.autoLegend': 'gri: temel bölgeden eşitlenen App Store fiyatı', + 'prices.gapLegend': 'Δ: mağazalar arasında ≥ %{pct} fark', + 'prices.perRegion': '{product} her bölgede', + 'prices.perRegionSub': '{count} bölge', + 'prices.searchRegion': 'Bölge veya para birimi', + 'prices.otherCurrency': 'farklı para birimi', + 'prices.scheduled': '{date} itibarıyla: {price}', + 'prices.missingNote': 'Henüz mağazada değil: {list}. Katalog sekmesinden oluşturup yeniden okuyun.', + 'cat.openPrices': 'Fiyatları aç', + 'cat.pricesHere': 'Bölge bazında fiyatlar, fiyat tablosu ve uygulanması Fiyatlar sekmesinde.', + + 'art.title': 'Mağaza görselleri', + 'art.images': 'Görseller', + 'art.imagesSub': '{count} dil', + 'art.imagesSub_one': '1 dil', + 'art.videos': 'Uygulama önizlemeleri', + 'art.videosSub': 'App Store ve tanıtım videoları', + 'art.errors': 'Mağaza hataları', + 'art.errorsSub': 'Boyut, alfa, biçim, adet', + 'art.warnings': 'Uyarılar', + 'art.rendered': '{when} tarandı', + 'art.variant': 'Varyant', + 'art.base': 'Temel', + 'art.onlyIssues': 'Yalnızca sorunlar', + 'art.openFolder': 'Klasörü aç', + 'art.openPage': 'İnceleme sayfasını aç', + 'art.openPageHint': 'Galeri sayfasını (index.html) tarayıcınızda açar', + 'art.writePage': 'İnceleme sayfasını yaz', + 'art.render': '{lang} oluştur', + 'art.notThere': 'Henüz yok', + 'art.count': '{count} dosya', + 'art.count_one': '1 dosya', + 'art.open': '{name} aç', + 'art.tooBig': 'önizleme için çok büyük', + 'art.prev': 'Önceki', + 'art.next': 'Sonraki', + 'art.emptyTitle': 'Henüz görsel yok', + 'art.emptyText': 'Mağaza ekran görüntülerini karelerden ve metin dosyasından oluşturun: Oluştur\'a basın. Yerelde çalışır (ffmpeg ve Chrome) ve hiçbir şey yüklemez.', + 'art.noIssues': 'Burada sorun yok', + 'art.noIssuesText': 'Bu dilin her dosyası yerel mağaza kontrollerinden geçiyor.', + 'art.foot': 'Yalnızca yerel dosyalar, {when} okundu. Yükleme Mağaza metinleri sekmesinde.', + + 'gr.analytics': 'Mağaza analizleri', + 'gr.analyticsSub': '{since} tarihinden beri {count} anlık görüntü', + 'gr.analyticsSubNone': '.storebound/analytics içindeki anlık görüntüler, git\'teki mağaza metni değişikliklerinin yanında', + 'gr.setup': 'App Store raporlarını başlat', + 'gr.setupDone': 'Rapor isteği oluşturuldu', + 'gr.setupHint': 'Sürekli App Store analiz raporu isteğini bir kez oluşturur (Admin anahtarı). Herkese açık hiçbir şeyi değiştirmez.', + 'gr.snapshot': 'Anlık görüntü al', + 'gr.snapshotDone': 'Anlık görüntü kaydedildi', + 'gr.snapshotHint': 'Gösterim, sayfa görüntüleme, indirme (App Store) ve ziyaretçi, yükleme (Play) verilerini .storebound/analytics içine okur', + 'gr.noneTitle': 'Henüz analiz anlık görüntüsü yok', + 'gr.noneText': 'Bir anlık görüntü 28 günlük mağaza trafiğini uygulama klasöründe tutar (.storebound/analytics). Birkaç tane olunca bu sekme git\'teki her mağaza metni değişikliğini öncesi ve sonrası dönüşümle yan yana gösterir.', + 'gr.noBucket': 'Google Play için önce ayarda play.reportsBucket değerini girin.', + 'gr.impressions': 'Gösterimler', + 'gr.downloads': 'İndirmeler', + 'gr.visitors': 'Sayfa ziyaretçileri', + 'gr.acquisitions': 'Edinimler', + 'gr.conversion': 'Dönüşüm', + 'gr.conversionSub': 'Erişim başına yükleme, tüm aralık', + 'gr.days': '{count} gün', + 'gr.days_one': '1 gün', + 'gr.daysN': '{count} gün', + 'gr.daysN_one': '1 gün', + 'gr.chartAria': '{store} üzerinde günlük mağaza trafiği ve mağaza metni değişiklikleri', + 'gr.changes': '{count} mağaza metni değişikliği', + 'gr.changes_one': '1 mağaza metni değişikliği', + 'gr.oneDay': 'Şimdilik bir günlük veri var: grafik ikinci günle başlar.', + 'gr.change': 'Mağaza değişikliği (git)', + 'gr.before': 'Önce', + 'gr.after': 'Sonra', + 'gr.reading': 'Bir değişiklik iki tarafta da birkaç gün ve yeterli trafik ister; mevsim, öne çıkarılma ve reklamlar da bu sayıları oynatır.', + 'gr.ppo': 'Ürün Sayfası Optimizasyonu', + 'gr.ppoSub': 'Ekran görüntülerinin App Store A/B testleri', + 'gr.ppoRead': 'Testleri oku', + 'gr.ppoNotRead': 'Testler henüz okunmadı', + 'gr.ppoNotReadText': 'Salt okunur: testler, durumları, trafik payı ve varyantları. Varyant sonuçları yalnızca App Store Connect\'te.', + 'gr.ppoNone': 'Henüz test yok', + 'gr.ppoNoneText': 'Aşağıdan bir ekran görüntüsü varyantıyla test oluşturun, ekran görüntülerini yükleyin, sonra başlatın.', + 'gr.ppoNoVariants': 'Ayardaki shots.variants içine bir ekran görüntüsü varyantı ekleyip oluşturun (store-screenshots becerisi); her varyant bir deneme kolu olur.', + 'gr.results': 'Sonuçlar App Store Connect\'te', + 'gr.test': 'Test', + 'gr.state': 'Durum', + 'gr.traffic': 'Trafik', + 'gr.dates': 'Süre', + 'gr.treatments': 'Varyantlar', + 'gr.owner': 'Sahip işlemi', + 'gr.running': 'sürüyor', + 'gr.notStarted': 'başlamadı', + 'gr.treatment': '{name} ({count} yerel ayar)', + 'gr.treatment_one': '{name} (1 yerel ayar)', + 'gr.startBtn': 'Başlat', + 'gr.stopBtn': 'Durdur', + 'gr.start': '"{name}" testini başlat', + 'gr.stop': '"{name}" testini durdur', + 'gr.started': 'Testin başlatılması istendi', + 'gr.stopped': 'Testin durdurulması istendi', + 'gr.create': 'Yeni test', + 'gr.variant': '{id} varyantı', + 'gr.createBtn': 'Test oluştur', + 'gr.createTitle': 'Ürün Sayfası Optimizasyonu testi oluştur', + 'gr.created': 'Test oluşturuldu (başlamadı)', + 'gr.upload': 'Varyant ekran görüntüleri', + 'gr.uploadBtn': 'Ekran görüntülerini yükle', + 'gr.uploadTitle': '{id} varyantının ekran görüntülerini yükle', + 'gr.uploadInto': 'Düzenlenebilir "{name}" testine', + 'gr.uploadNoTest': 'Önce bir test oluşturun: yüklemeler düzenlenebilir teste gider.', + 'gr.ppoNote': 'Oluşturmak ve yüklemek ziyaretçilerin gördüğü hiçbir şeyi değiştirmez. Başlatmak ve durdurmak sizin kararınızdır: her biri işlemin adını veren bir sistem penceresi gösterir; durdurulan test yeniden başlatılamaz.', + 'gr.ppoStoreOnly': 'Yalnızca mağazadaki uygulamada salt okunur: test oluşturup yürütmek için bir uygulama klasörü bağlayın.', + 'gr.playExp': 'Mağaza girişi deneyleri', + 'gr.playExpSub': 'Google Play: API yok', + 'gr.playExpText': 'Google Play\'in mağaza girişi deneyleri için API\'si yok: bunları storebound\'un oluşturduğu varyant ekran görüntüleriyle Play Console > Büyüme > Mağaza girişi deneyleri bölümünde oluşturup yürütün.', + 'gr.seeVariants': 'Varyant görsellerini gör', + + 'ai.askTitle': 'Yalnızca sizin yanıtlayabileceğiniz {count} soru', + 'ai.askTitle_one': 'Yalnızca sizin yanıtlayabileceğiniz 1 soru', + 'ai.askSub': 'Ayar bu yanıtları kanıtlamıyor. storebound bir uyum yanıtını asla tahmin etmez: karar verin, sonra ayara yazın.', + 'ai.allAnswered': 'Bu sekmedeki her beyan ayardan geliyor. Yanıtlar yine sizin: her gönderimden önce gözden geçirin.', + 'ai.aDataSafety': 'Veri güvenliği', + 'ai.aAppPrivacy': 'Uygulama Gizliliği', + 'ai.aAppInfo': 'Uygulama bilgisi', + 'ai.aEncryption': 'İhracat uyumu', + 'ai.aReview': 'App Review', + 'ai.askedHere': 'Bu form hakkında yukarıda {count} açık soru var', + 'ai.askedHere_one': 'Bu form hakkında yukarıda 1 açık soru var', + 'ai.dsTitle': 'Veri güvenliği', + 'ai.dsSub': 'Google Play, ayardaki dataSafety\'den', + 'ai.dsUpload': 'Veri güvenliğini yükle', + 'ai.dsUploadHint': 'Play Veri güvenliği formunun tamamını değiştirir (önce deneme ve sistem penceresi)', + 'ai.dsUploaded': 'Veri güvenliği yüklendi', + 'ai.dsNoneTitle': 'Veri güvenliği yanıtı yok', + 'ai.dsNoneText': 'storebound.config.ts içine dataSafety ekleyin (store-declarations becerisi): uygulama ve her SDK neyi, neden topluyor ve paylaşıyor mu.', + 'ai.dsCollects': 'Veri topluyor veya paylaşıyor', + 'ai.dsEncrypted': 'Aktarımda şifreli', + 'ai.dsDeletion': 'Kullanıcılar silme isteyebilir', + 'ai.dsAccounts': 'Hesap oluşturma', + 'ai.dsNever': 'Play bu formu geri okuyamaz. Buradan bir kez yükledikten sonra bu sekme o zamandan beri neyin değiştiğini gösterir.', + 'ai.dsSame': 'Son yüklemeyle aynı ({when}).', + 'ai.dsChanged': 'Son yüklemeden beri {count} yanıt değişti ({when}): Play\'i güncellemek için yeniden yükleyin.', + 'ai.dsChanged_one': 'Son yüklemeden beri 1 yanıt değişti ({when}): Play\'i güncellemek için yeniden yükleyin.', + 'ai.show': 'Göster', + 'ai.hide': 'Gizle', + 'ai.colType': 'Veri türü', + 'ai.colCollected': 'Toplama amacı', + 'ai.colShared': 'Paylaşma amacı', + 'ai.notShared': 'paylaşılmıyor', + 'ai.optional': 'isteğe bağlı', + 'ai.ephemeral': 'geçici', + 'ai.dsFoot': 'Yükleme {rows} CSV satırı gönderir (Play\'in içe aktarma biçimi) ve önceki tüm yanıtların yerine geçer.', + 'ai.apTitle': 'Uygulama Gizliliği', + 'ai.apSub': 'App Store, Veri güvenliği yanıtlarından önerilen', + 'ai.apOpen': 'Uygulama Gizliliği\'ni aç', + 'ai.apNote': 'Uygulama Gizliliği\'nin API\'si yok: bu yanıtları App Store Connect > Uygulama Gizliliği bölümüne girin. Apple ayrıca her tür için kullanıcıyla ilişkili mi ve takip için mi kullanıldığını sorar.', + 'ai.apNoneTitle': 'Veri toplanmıyor', + 'ai.apNoneText': 'Veri güvenliği yanıtları hiçbir veri türü listelemiyor: her SDK için doğruysa App Store Connect\'te "Veri Toplanmıyor" yanıtını verin.', + 'ai.apUnknownTitle': 'Henüz önerilecek bir şey yok', + 'ai.apUnknownText': 'Veri toplamayı dataSafety içinde bir kez yanıtlayın; Uygulama Gizliliği yanıtları ondan çıkar.', + 'ai.colAppleType': 'Veri türü', + 'ai.colPurposes': 'Amaçlar', + 'ai.colLinked': 'Kullanıcıyla ilişkili', + 'ai.colTracking': 'Takip', + 'ai.ask': 'Sizin yanıtınız', + 'ai.askLikely': 'Kontrol edin: paylaşılıyor', + 'ai.noPlay': 'Google Play\'de değil', + 'ai.noPlayText': 'Ayarda play bölümü yok.', + 'ai.noApple': 'App Store\'da değil', + 'ai.noAppleText': 'Ayarda apple bölümü yok.', + 'ai.infoTitle': 'Uygulama bilgisi', + 'ai.infoSub': 'Kategoriler, yaş sınırı, içerik hakları', + 'ai.infoPush': 'App Store uygulama bilgisini gönder', + 'ai.push': 'Gönder', + 'ai.pushed': 'App Store Connect\'e gönderildi', + 'ai.category': 'Kategori', + 'ai.age': 'Yaş sınırı', + 'ai.ageAllNone': 'Her soru "yok": onaylayın', + 'ai.rights': 'İçerik hakları', + 'ai.rightsOwn': 'Üçüncü taraf içerik yok', + 'ai.rightsThird': 'Üçüncü taraf içerik, haklar alınmış', + 'ai.price': 'Fiyat', + 'ai.free': 'Ücretsiz, her bölgede', + 'ai.paid': 'Ücretli (App Store Connect\'te ayarlanır)', + 'ai.notSet': 'Ayarlanmadı', + 'ai.notAnswered': 'Yanıtlanmadı', + 'ai.encTitle': 'İhracat uyumu', + 'ai.encSub': 'Her derleme için şifreleme yanıtı', + 'ai.encAnswer': 'Derlemeleri yanıtla', + 'ai.encPush': 'Derlemeler için ihracat uyumunu yanıtla', + 'ai.encYes': 'Muaf olmayan şifreleme kullanıyor', + 'ai.encNo': 'Yalnızca muaf şifreleme', + 'ai.encYesText': 'Derlemeler App Store Connect\'teki onaylı şifreleme beyanına bağlanır.', + 'ai.encNoText': 'Yanıtsız derlemeler usesNonExemptEncryption = false alır. Daha iyisi: Info.plist içinde ITSAppUsesNonExemptEncryption = NO.', + 'ai.encUnset': 'apple.usesNonExemptEncryption ayarlanmadı. export-compliance becerisiyle karar verin; storebound bunu asla tahmin etmez.', + 'ai.encUnsetHint': 'Önce ayarda apple.usesNonExemptEncryption yanıtını verin', + 'ai.reviewTitle': 'App Review bilgileri', + 'ai.reviewSub': 'İletişim, demo hesabı, notlar', + 'ai.reviewPush': 'App Review bilgilerini gönder', + 'ai.signIn': 'Giriş gerekli', + 'ai.contact': 'İletişim', + 'ai.demo': 'Demo hesabı', + 'ai.demoNone': 'gerekmiyor', + 'ai.missing': 'Eksik', + 'ai.notes': 'İnceleyene notlar', + 'ai.notesBytes': '{n} / {max} bayt', + 'ai.notesNone': 'Not yok (apple.info.reviewNotes, reviewAccess.instructions).', + 'ai.reviewSafe': 'İletişim ve demo hesabı uygulama klasörünün .storebound/ klasöründe kalır (gitignore); maskeli gösterilir, parola asla gösterilmez.', + 'ai.foot': 'Ayardan ve .storebound/ klasöründen {when} okundu. Buradan hiçbir şey bir yere gönderilmedi.', + 'ds.functionality': 'Uygulama işlevi', + 'ds.analytics': 'Analiz', + 'ds.communications': 'Geliştirici iletişimi', + 'ds.fraud': 'Dolandırıcılık önleme, güvenlik', + 'ds.advertising': 'Reklam veya pazarlama', + 'ds.personalization': 'Kişiselleştirme', + 'ds.account': 'Hesap yönetimi', + + 'folders.fastlane': 'fastlane\'den içe aktar', + 'folders.fastlaneHint': 'fastlane kurulumu olan bir klasör seçin: storebound içe aktarma planını bir sistem penceresinde gösterir, sonra dosyalarını fastlane\'in yanına yazar (asla üzerine yazmaz)', + 'folders.imported': '{name} fastlane\'den içe aktarıldı', + 'folders.importedDetail': 'Ayar, mağaza metni dosyaları ve ekran kareleri yazıldı. Sırada yer tutucuları değiştirmek, sonra Kontroller var.', + 'folders.startShort': 'Uygulama klasörü başlat', + 'folders.newNote': 'İkisi de bir sistem penceresinde klasör ister, ne yazacaklarını gösterir ve yalnızca Uygula\'ya bastığınızda yazar. Var olan dosyalar korunur.', + 'folders.open': 'Aç', + 'folders.openApp': 'Bu uygulamayı aç', + 'folders.reveal': 'Dosya yöneticisinde göster', + + 'wz.s0': 'Stüdyonuz', + 'wz.studioTitle': 'Bu uygulamalar hangi stüdyonun?', + 'wz.studioLead': 'Stüdyo, mağaza hesaplarını ve uygulamalarını bir araya toplar (bir şirket, bir müşteri, bir yan proje). Birini seçin veya oluşturun; sonraki adımların anahtarları ona gider. Sonradan taşıyabilirsiniz.', + 'wz.studioPick': 'Stüdyo', + 'wz.studioAccounts': '{count} mağaza hesabı', + 'wz.studioAccounts_one': '1 mağaza hesabı', + 'wz.studioPicked': 'Seçili', + 'wz.studioNoneHint': 'Hesapları stüdyosuz tut', + 'wz.studioNew': 'Stüdyonuzu oluşturun', + 'wz.studioAnother': 'Ya da başka bir stüdyo oluşturun', + 'wz.studioNewText': 'Bir ad ve bir renk; logo sonra Stüdyolar ve hesaplar\'dan eklenebilir.', + 'wz.studioPlaceholder': 'Örneğin: Example Games', + 'wz.studioCreate': 'Stüdyo oluştur', + 'wz.fastlaneTitle': 'fastlane\'den içe aktar', + 'wz.fastlaneText': 'Klasörde fastlane kurulumu var (deliver, supply). storebound onu kendi ayarına ve mağaza metni dosyalarına çevirir, fastlane\'e dokunmaz.', + 'wz.fastlaneGo': 'Klasörü seç ve içe aktar', + 'wz.fastlaneNote': 'Herhangi bir şey yazılmadan önce içe aktarma planını ve eşlenmeyenleri görürsünüz.', + 'wz.keysInto': 'Yeni anahtarlar {name} stüdyosuna gider.', + 'wz.keysNoStudio': 'Yeni anahtarlar stüdyosuz kalır.', + 'wz.change': 'Değiştir', }; diff --git a/apps/desktop/src/lib/exports.ts b/apps/desktop/src/lib/exports.ts new file mode 100644 index 00000000..8a310d64 --- /dev/null +++ b/apps/desktop/src/lib/exports.ts @@ -0,0 +1,111 @@ +// Exports the window offers (top right of a screen and the command palette): CSV and Markdown built from what the +// screen already read. Pure, so tests can pin the formats. The prices CSV has the exact columns of `storebound prices +// import`, so an exported sheet can be edited and compared again. +import type { AnalyticsCompare, AppStatus, DeclarationsResult, ListingText, PricesCurrent } from '../api'; +import type { CatalogDiff, HealthSnapshot, Review, ValidateResult } from './model'; +import { isError } from './model'; + +type Cell = string | number | boolean | null | undefined; + +const cell = (v: Cell): string => { + const s = v === null || v === undefined ? '' : String(v); + return /[",\n\r]/.test(s) || /^\s|\s$/.test(s) ? `"${s.replace(/"/g, '""')}"` : s; +}; +/** RFC 4180 CSV with a header row; spreadsheet formula prefixes (= + - @) in text cells are quoted with a ' first. */ +export function csv(head: string[], rows: Cell[][]): string { + const safe = (v: Cell) => (typeof v === 'string' && /^[=+\-@\t]/.test(v) && !/^-?\d+(\.\d+)?$/.test(v) ? `'${v}` : v); + return [head, ...rows.map(r => r.map(safe))].map(r => r.map(cell).join(',')).join('\n') + '\n'; +} + +const pipe = (s: Cell) => String(s ?? '').replace(/\|/g, '\\|').replace(/\r?\n/g, ' '); +export function mdTable(head: string[], rows: Cell[][]): string { + if (!rows.length) return '_none_\n'; + return [`| ${head.map(pipe).join(' | ')} |`, `| ${head.map(() => '---').join(' | ')} |`, ...rows.map(r => `| ${r.map(pipe).join(' | ')} |`)].join('\n') + '\n'; +} + +/** "Prism Puddle prices 2026-10-11" (the dialog adds the extension). */ +export const exportName = (app: string, what: string, now = new Date()): string => `${app} ${what} ${now.toISOString().slice(0, 10)}`; + +/** The price sheet: product, store, region, currency, price, start_date, kind (the `prices import` format). */ +export function pricesCsv(p: PricesCurrent): string { + // one row per product x store x region x start date (the import refuses doubles): a manual price wins over Apple's equalized one + const key = (r: PricesCurrent['rows'][number]) => `${r.product}|${r.store}|${r.region}|${r.startDate ?? ''}`; + const manual = new Set(p.rows.filter(r => r.kind !== 'auto').map(key)); + const rows = p.rows.filter(r => r.kind !== 'auto' || !manual.has(key(r))).sort((a, b) => a.product.localeCompare(b.product) || a.store.localeCompare(b.store) || a.region.localeCompare(b.region)); + return csv(['product', 'store', 'region', 'currency', 'price', 'start_date', 'kind'], rows.map(r => [r.product, r.store, r.region, r.currency, r.price, r.startDate ?? '', r.kind ?? 'manual'])); +} + +/** Reviews as a CSV (personal data: the window warns before saving). */ +export function reviewsCsv(rs: Review[]): string { + return csv(['store', 'date', 'rating', 'territory', 'version', 'title', 'review', 'replied', 'reply'], + rs.map(r => [r.store === 'apple' ? 'App Store' : 'Google Play', r.date.slice(0, 10), r.rating, r.where ?? '', r.appVersion ?? '', r.title ?? '', r.body, r.reply ? 'yes' : 'no', r.reply?.text ?? ''])); +} + +const pctOf = (v: number | null | undefined, d = 2): string => (v === null || v === undefined ? '–' : `${(v * 100).toFixed(d)} %`); + +export function healthMd(app: string, h: HealthSnapshot): string { + const out = [`# ${app}: health ${h.date}`, '']; + if (h.play && !isError(h.play)) { + const last = (xs: T[]): T | undefined => xs[xs.length - 1]; + const c = last(h.play.crash)?.values, a = last(h.play.anr)?.values; + out.push('## Google Play', '', `Window: ${h.play.window.start} to ${h.play.window.end}`, '', + mdTable(['metric', 'last day', '28 days (user-weighted)', 'bad behavior threshold'], [ + ['User-perceived crash rate', pctOf(c?.userPerceivedCrashRate), pctOf(c?.userPerceivedCrashRate28dUserWeighted), '1.09 %'], + ['User-perceived ANR rate', pctOf(a?.userPerceivedAnrRate), pctOf(a?.userPerceivedAnrRate28dUserWeighted), '0.47 %'], + ]), '### Worst devices', '', mdTable(['device', 'crash rate', 'users'], (h.play.devices ?? []).map(d => [d.model, pctOf(d.crash), d.users ?? ''])), + '### Top issues', '', mdTable(['type', 'cause', 'where', 'reports', 'users', 'last version'], h.play.issues.map(i => [i.type, i.cause, i.location, i.reports, i.users, i.lastVersion]))); + } else if (h.play) out.push('## Google Play', '', `Not read: ${(h.play as { error: string }).error}`, ''); + if (h.apple && !isError(h.apple)) { + out.push('## App Store', '', mdTable(['category', 'metric', 'version', 'value', 'goal'], h.apple.metrics.map(m => [m.category, m.metric, m.version, `${m.value} ${m.unit}`, m.goal])), + '### Diagnostic signatures', '', mdTable(['build', 'type', 'signature', 'weight'], h.apple.signatures.map(s => [s.build, s.type, s.signature, pctOf(s.weight, 0)]))); + } else if (h.apple) out.push('## App Store', '', `Not read: ${(h.apple as { error: string }).error}`, ''); + return out.join('\n'); +} + +export function validateMd(app: string, v: ValidateResult, at: string | null): string { + const lvl = (l: string) => (l === 'blocker' ? 'Blocker' : l === 'warn' ? 'Warning' : 'OK'); + return [`# ${app}: store readiness`, '', `Read ${at ?? 'now'} · ${v.blockers} blocker(s), ${v.findings.filter(f => f.level === 'warn').length} warning(s)`, '', + mdTable(['store', 'level', 'check', 'finding', 'fix'], v.findings.map(f => [f.store === 'apple' ? 'App Store' : 'Google Play', lvl(f.level), f.code, f.msg, f.fix ?? ''])), + ].join('\n'); +} + +export function catalogMd(app: string, c: CatalogDiff): string { + return [`# ${app}: catalog parity`, '', `${c.errors} error(s)`, '', '## Items', '', + mdTable(['item', 'store', 'level', 'code', 'note'], c.rows.map(r => [r.id, r.store === 'apple' ? 'App Store' : 'Google Play', r.level, r.code, r.msg])), + '## Price gaps between the stores', '', mdTable(['item', 'region', 'currency', 'App Store', 'Google Play', 'difference'], c.parity.map(g => [g.id, g.region, g.currency, g.apple, g.play, `${g.diffPct.toFixed(1)} %`])), + ].join('\n'); +} + +export function listingsMd(app: string, l: ListingText): string { + const part = (title: string, f: { path: string; text: string } | null) => (f ? [``, f.text.trim(), ''] : []); + return [`# ${app}: store listings`, '', ...part('Google Play', l.play), ...part('App Store', l.apple)].join('\n'); +} + +export function portfolioCsv(rows: { name: string; studio: string; s?: AppStatus }[]): string { + return csv(['app', 'studio', 'ios bundle id', 'android package', 'ios version', 'ios state', 'android version', 'android state', 'next version', 'config problems', 'config warnings'], + rows.map(({ name, studio, s }) => { + const cur = s?.release.current; + return [name, studio, s?.app?.platforms.ios?.bundleId ?? '', s?.app?.platforms.android?.packageName ?? '', cur?.ios?.version ?? '', cur?.ios?.phase ?? '', cur?.android?.version ?? '', + cur?.android?.phase ?? '', s?.release.next?.version ?? '', s?.check?.problems.length ?? '', s?.check?.warnings.length ?? '']; + })); +} + +export function declarationsMd(app: string, d: DeclarationsResult): string { + const yes = (b: boolean | null | undefined) => (b === null || b === undefined ? 'not answered' : b ? 'yes' : 'no'); + const out = [`# ${app}: store declarations`, '', 'From storebound.config.ts and .storebound/ (contact and demo account masked).', '']; + if (d.ask.length) out.push('## Ask the owner', '', mdTable(['area', 'question', 'how to answer'], d.ask.map(a => [a.area, a.text, a.fix]))); + if (d.dataSafety) out.push('## Google Play Data safety', '', `Collects data: ${yes(d.dataSafety.collectsData)} · encrypted in transit: ${yes(d.dataSafety.encryptedInTransit)} · deletion request: ${yes(d.dataSafety.deletionRequest)}`, '', + mdTable(['data type', 'category', 'collected for', 'shared for', 'optional', 'ephemeral'], d.dataSafety.types.map(x => [x.id, x.category, x.collect.join(', '), x.shared ? x.share.join(', ') : 'not shared', yes(x.optional), yes(x.ephemeral)]))); + if (d.appPrivacy) out.push('## App Store App Privacy (enter in App Store Connect)', '', mdTable(['data type', 'category', 'purposes', 'third party', 'from'], d.appPrivacy.items.map(x => [x.apple, x.category, x.purposes.join(', '), yes(x.thirdParty), x.from.join(', ')]))); + if (d.appInfo) out.push('## App Store app info', '', `Category: ${d.appInfo.categories ? [d.appInfo.categories.primary, d.appInfo.categories.primarySubOne, d.appInfo.categories.primarySubTwo].filter(Boolean).join(' / ') : 'not set'}`, + `Age rating overrides: ${d.appInfo.ageRating.map(a => `${a.question}=${a.value}`).join(', ') || 'none (every question none / false)'}`, `Content rights: ${d.appInfo.contentRights ?? 'not set'}`, `Export compliance (non-exempt encryption): ${yes(d.encryption)}`, ''); + out.push('## App Review', '', `Sign-in required: ${yes(d.review.signInRequired)} · contact: ${d.review.contact ?? 'missing'} · demo account: ${d.review.demoAccount ?? 'none'} · notes: ${d.review.notesBytes} / ${d.review.notesMax} bytes`, ''); + return out.join('\n'); +} + +export function analyticsCsv(a: AnalyticsCompare): string { + const dates = [...new Set([...a.series.apple.map(d => d.date), ...a.series.play.map(d => d.date)])].sort(); + const ap = new Map(a.series.apple.map(d => [d.date, d] as const)), pl = new Map(a.series.play.map(d => [d.date, d] as const)); + return csv(['date', 'app store impressions', 'app store page views', 'app store downloads', 'play visitors', 'play acquisitions', 'play installs'], + dates.map(d => [d, ap.get(d)?.impressions ?? '', ap.get(d)?.pageViews ?? '', ap.get(d)?.downloads ?? '', pl.get(d)?.visitors ?? '', pl.get(d)?.acquisitions ?? '', pl.get(d)?.installs ?? ''])); +} diff --git a/apps/desktop/src/lib/format.ts b/apps/desktop/src/lib/format.ts index f8f0f27a..d640ab16 100644 --- a/apps/desktop/src/lib/format.ts +++ b/apps/desktop/src/lib/format.ts @@ -16,6 +16,12 @@ export function share(x: number): string { export const num = (n: number, digits = 0): string => new Intl.NumberFormat(loc(), { maximumFractionDigits: digits, minimumFractionDigits: digits }).format(n); +/** 4.99 USD -> "$4.99" (Turkish: "$4,99"); an unknown currency code keeps the code. */ +export function money(n: number, currency: string): string { + try { return new Intl.NumberFormat(loc(), { style: 'currency', currency, maximumFractionDigits: n % 1 ? 2 : 0, minimumFractionDigits: n % 1 ? 2 : 0 }).format(n); } + catch { return `${num(n, n % 1 ? 2 : 0)} ${currency}`; } +} + export function bytes(n: number | null | undefined): string { if (!n) return '–'; const mb = n / 1e6; diff --git a/apps/desktop/src/lib/views.ts b/apps/desktop/src/lib/views.ts new file mode 100644 index 00000000..382fc412 --- /dev/null +++ b/apps/desktop/src/lib/views.ts @@ -0,0 +1,128 @@ +// Pure view models of the screens added for full CLI coverage: the price matrix (product x territory, both stores), +// the price sheet diff summary, the analytics chart series, render grids, and the "how to fix it" hint of an error. +import type { AnalyticsCompare, PriceDiffRow, PriceRowData, PricesCurrent, RendersResult } from '../api'; +import type { Key } from '../i18n'; + +/** Territories shown first in the price overview (big stores, several currencies). */ +export const KEY_REGIONS = ['US', 'GB', 'DE', 'FR', 'JP', 'KR', 'BR', 'IN', 'TR', 'MX'] as const; + +export interface PriceCell { price: number; currency: string; kind: 'manual' | 'auto'; startDate?: string } +export interface RegionRow { region: string; apple: PriceCell | null; play: PriceCell | null; scheduled: PriceCell | null; gapPct: number | null } + +const cellOf = (r: PriceRowData): PriceCell => ({ price: r.price, currency: r.currency, kind: r.kind ?? 'manual', ...(r.startDate ? { startDate: r.startDate } : {}) }); + +/** One product across every region either store sells it in. Current prices only (a future App Store start date is + * `scheduled`); the gap is |apple - play| / max, only when both use the same currency. */ +export function regionRows(p: PricesCurrent, product: string): RegionRow[] { + const by = new Map(); + const row = (region: string) => { + let r = by.get(region); + if (!r) by.set(region, (r = { region, apple: null, play: null, scheduled: null, gapPct: null })); + return r; + }; + for (const x of p.rows.filter(r => r.product === product)) { + const r = row(x.region); + if (x.store === 'apple' && x.startDate) { r.scheduled = cellOf(x); continue; } + // a manual Apple price wins over the equalized one of the same territory + if (x.store === 'apple' && (!r.apple || (r.apple.kind === 'auto' && x.kind !== 'auto'))) r.apple = cellOf(x); + if (x.store === 'play') r.play = cellOf(x); + } + for (const r of by.values()) { + if (r.apple && r.play && r.apple.currency === r.play.currency && Math.max(r.apple.price, r.play.price) > 0) + r.gapPct = (Math.abs(r.apple.price - r.play.price) / Math.max(r.apple.price, r.play.price)) * 100; + } + const key = (x: string) => { const i = (KEY_REGIONS as readonly string[]).indexOf(x); return i < 0 ? 100 : i; }; + return [...by.values()].sort((a, b) => key(a.region) - key(b.region) || a.region.localeCompare(b.region)); +} + +/** The overview matrix: products x the key regions (and only regions somebody sells in). */ +export function priceMatrix(p: PricesCurrent, regions: readonly string[] = KEY_REGIONS): { regions: string[]; rows: { product: string; cells: Record }[] } { + const rows = p.products.map(product => ({ product, cells: Object.fromEntries(regionRows(p, product).map(r => [r.region, r] as const)) })); + const used = regions.filter(r => rows.some(x => x.cells[r])); + return { regions: used, rows }; +} + +export interface PriceStats { products: number; regions: number; rows: number; manual: number; auto: number; gaps: number; missing: number } +export function priceStats(p: PricesCurrent, threshold = 10): PriceStats { + const regions = new Set(p.rows.map(r => r.region)); + const gaps = p.products.flatMap(x => regionRows(p, x)).filter(r => r.gapPct !== null && r.gapPct >= threshold).length; + return { products: p.products.length, regions: regions.size, rows: p.rows.length, manual: p.rows.filter(r => r.kind !== 'auto').length, auto: p.rows.filter(r => r.kind === 'auto').length, gaps, missing: p.missing.length }; +} + +export interface DiffSummary { changed: number; added: number; same: number; up: number; down: number; products: string[]; pairs: number } +export function diffSummary(rows: PriceDiffRow[], changedPairs: string[]): DiffSummary { + const live = rows.filter(r => r.change !== 'same'); + return { + changed: live.filter(r => r.change === 'change').length, added: live.filter(r => r.change === 'new').length, same: rows.length - live.length, + up: live.filter(r => r.from !== null && r.to > r.from).length, down: live.filter(r => r.from !== null && r.to < r.from).length, + products: [...new Set(live.map(r => r.product))].sort(), pairs: changedPairs.length, + }; +} +export const changePct = (r: Pick): number | null => (r.from ? ((r.to - r.from) / r.from) * 100 : null); + +// ---- analytics chart ---- + +export interface ChartSeries { dates: string[]; reach: number[]; installs: number[]; conversion: (number | null)[]; events: { date: string; subject: string; commit: string }[] } +/** Daily reach (App Store impressions / Play store listing visitors), installs (downloads / acquisitions) and + * conversion, with the store changes from git as markers. */ +export function chartSeries(a: AnalyticsCompare, store: 'apple' | 'play'): ChartSeries { + const pts = store === 'apple' + ? a.series.apple.map(d => ({ date: d.date, reach: d.impressions, installs: d.downloads })) + : a.series.play.map(d => ({ date: d.date, reach: d.visitors, installs: d.acquisitions })); + const first = pts[0]?.date ?? '', last = pts[pts.length - 1]?.date ?? ''; + const seen = new Set(); + const events = a.effects.filter(e => e.store === store && e.event.date >= first && e.event.date <= last) + .filter(e => (seen.has(e.event.commit) ? false : (seen.add(e.event.commit), true))).map(e => ({ date: e.event.date, subject: e.event.subject, commit: e.event.commit })); + return { dates: pts.map(p => p.date), reach: pts.map(p => p.reach), installs: pts.map(p => p.installs), conversion: pts.map(p => (p.reach ? p.installs / p.reach : null)), events }; +} + +/** Conversion before vs after one change (null when a side has no data). */ +export const effectDelta = (before?: number | null, after?: number | null): number | null => (before && after !== undefined && after !== null ? ((after - before) / before) * 100 : null); + +// ---- store art ---- + +export interface ArtFilter { variant: string; lang: string; onlyIssues: boolean } +/** The rows of one variant and language, optionally only those with issues. */ +export function artRows(r: RendersResult, f: ArtFilter) { + const v = r.variants.find(x => x.id === f.variant) ?? r.variants[0]; + const l = v?.langs.find(x => x.lang === f.lang) ?? v?.langs[0]; + if (!l) return []; + return l.rows.map(row => ({ ...row, tiles: f.onlyIssues ? row.tiles.filter(t => t.issues.length || row.issues.length) : row.tiles })) + .filter(row => !f.onlyIssues || row.tiles.length || row.issues.length); +} +/** Issue counts per language of a variant (for the language picker). */ +export function langIssues(r: RendersResult, variant: string): Record { + const v = r.variants.find(x => x.id === variant) ?? r.variants[0]; + const out: Record = {}; + for (const l of v?.langs ?? []) { + const all = l.rows.flatMap(row => [...row.issues, ...row.tiles.flatMap(t => t.issues)]); + out[l.lang] = { errors: all.filter(i => i.level === 'error').length, warnings: all.filter(i => i.level === 'warn').length, tiles: l.rows.reduce((n, row) => n + row.tiles.length, 0) }; + } + return out; +} + +// ---- errors that say how to fix them ---- + +const HINTS: [RegExp, Key][] = [ + [/service[ _]account|ASC_KEY_ID|ASC_ISSUER_ID|App Store Connect key not found/i, 'hint.keys'], + [/401|403|unauthori[sz]ed|forbidden|permission|caller does not have/i, 'hint.permission'], + [/not set in storebound\.config|storebound\.config\.ts: .* is not set|is not set in storebound/i, 'hint.config'], + [/no renders|shots render|nothing in .*renders/i, 'hint.renders'], + [/ffmpeg|ffprobe/i, 'hint.ffmpeg'], + [/playwright|chrom(e|ium)/i, 'hint.chrome'], + [/no snapshots|analytics snapshot/i, 'hint.snapshot'], + [/reportsBucket/i, 'hint.bucket'], + [/analytics report request|analytics setup/i, 'hint.analyticsSetup'], + [/no editable (App Store )?version|apple listing --version/i, 'hint.version'], + [/no fastlane folder/i, 'hint.fastlane'], + [/no prices CSV|prices export writes one/i, 'hint.priceSheet'], + [/price point/i, 'hint.pricePoint'], + [/ENOTFOUND|ECONNRESET|ETIMEDOUT|network|fetch failed|timed out/i, 'hint.network'], + [/confirm token|confirm-required|terminal only/i, 'hint.confirm'], + [/git log|not a git repository/i, 'hint.git'], +]; +/** The fix of a known error in words (an i18n key), or null. */ +export function fixHint(msg: string | null | undefined): Key | null { + if (!msg) return null; + return HINTS.find(([re]) => re.test(msg))?.[1] ?? null; +} diff --git a/apps/desktop/src/main.tsx b/apps/desktop/src/main.tsx index 556428a4..4045aa20 100644 --- a/apps/desktop/src/main.tsx +++ b/apps/desktop/src/main.tsx @@ -6,6 +6,7 @@ import { setLang } from './i18n'; import { applyPrefs, loadPrefs, type Prefs, resolveLang, savePrefs } from './prefs'; import { PrefsContext } from './prefs-ctx'; import { DataProvider } from './store'; +import { ExportProvider } from './ui/Exports'; import './styles.css'; const systemLang = (): string => (typeof navigator !== 'undefined' ? navigator.language : 'en'); @@ -30,7 +31,7 @@ function Root() { update({ ...prefs, theme: dark ? 'light' : 'dark' }); }, [prefs, update]); // a language change re-renders the whole tree in the new language - return ; + return ; } createRoot(document.getElementById('root')!).render(); diff --git a/apps/desktop/src/nav.ts b/apps/desktop/src/nav.ts index f5fe8d71..bb4d335e 100644 --- a/apps/desktop/src/nav.ts +++ b/apps/desktop/src/nav.ts @@ -4,13 +4,20 @@ import { createContext, useContext } from 'react'; import type { Key } from './i18n'; import type { IconName } from './ui/icons'; -export const APP_TABS = ['releases', 'catalog', 'listings', 'health', 'reviews', 'testflight', 'checks'] as const; +export const APP_TABS = ['releases', 'catalog', 'prices', 'listings', 'art', 'health', 'reviews', 'testflight', 'growth', 'appinfo', 'checks'] as const; export type AppTab = (typeof APP_TABS)[number]; -/** Tabs of a store-only app: store reads only (catalog, listings and checks need the app folder). */ -export const STORE_TABS: readonly AppTab[] = ['releases', 'health', 'reviews', 'testflight']; +/** Tabs of a store-only app: store reads only (catalog, prices, listings, art, app info and checks need the app folder; + * Growth shows the Product Page Optimization tests only). */ +export const STORE_TABS: readonly AppTab[] = ['releases', 'health', 'reviews', 'testflight', 'growth']; export const tabsFor = (hasFolder: boolean): readonly AppTab[] => (hasFolder ? APP_TABS : STORE_TABS); -export const TAB_KEY: Record = { releases: 'tab.releases', catalog: 'tab.catalog', listings: 'tab.listings', health: 'tab.health', reviews: 'tab.reviews', testflight: 'tab.testflight', checks: 'tab.checks' }; -export const TAB_ICON: Record = { releases: 'rocket', catalog: 'tag', listings: 'text', health: 'activity', reviews: 'message', testflight: 'plane', checks: 'shield' }; +export const TAB_KEY: Record = { + releases: 'tab.releases', catalog: 'tab.catalog', prices: 'tab.prices', listings: 'tab.listings', art: 'tab.art', health: 'tab.health', reviews: 'tab.reviews', + testflight: 'tab.testflight', growth: 'tab.growth', appinfo: 'tab.appinfo', checks: 'tab.checks', +}; +export const TAB_ICON: Record = { + releases: 'rocket', catalog: 'tag', prices: 'coins', listings: 'text', art: 'grid', health: 'activity', reviews: 'message', testflight: 'plane', growth: 'chart', + appinfo: 'clipboard', checks: 'shield', +}; export const WORKSPACE = ['apps', 'accounts', 'ignored', 'dependencies', 'settings'] as const; export type WorkspaceScreen = (typeof WORKSPACE)[number]; diff --git a/apps/desktop/src/screens/Accounts.tsx b/apps/desktop/src/screens/Accounts.tsx index 673e88a5..bac3cc85 100644 --- a/apps/desktop/src/screens/Accounts.tsx +++ b/apps/desktop/src/screens/Accounts.tsx @@ -23,7 +23,7 @@ export function HealthChip({ h }: { h: AccountHealth | undefined }) { return {t(key)}; } -function Swatches({ value, onChange, name }: { value: StudioColor; onChange: (c: StudioColor) => void; name: string }) { +export function Swatches({ value, onChange, name }: { value: StudioColor; onChange: (c: StudioColor) => void; name: string }) { return (
{STUDIO_COLORS.map(c => ( diff --git a/apps/desktop/src/screens/AppFolders.tsx b/apps/desktop/src/screens/AppFolders.tsx index ce4243b3..eaba8085 100644 --- a/apps/desktop/src/screens/AppFolders.tsx +++ b/apps/desktop/src/screens/AppFolders.tsx @@ -5,6 +5,7 @@ import { api, errorText, newJob, onProgress, type Project, type ToolResult, type import { devSwitch } from '../dev/switches'; import { t } from '../i18n'; import { shortPath, tildeText } from '../paths'; +import { useNav } from '../nav'; import { useData } from '../store'; import { Icon, StoreGlyph } from '../ui/icons'; import { AppIcon, Card, Chip, Empty, Notice, Seg, StoreBadge } from '../ui/kit'; @@ -15,6 +16,7 @@ interface Run { title: string; project: string; job: string; lines: string[]; re export function AppFolders() { const d = useData(); + const nav = useNav(); const [error, setError] = useState(null); const [busy, setBusy] = useState(null); const [run, setRun] = useState(null); @@ -33,6 +35,7 @@ export function AppFolders() { }; const add = () => act('add', async () => { const p = await api.addProject(); if (p) { await d.reload(); d.toast({ kind: 'ok', title: t('folders.added', { name: p.name }) }); } }); const init = () => act('init', async () => { const p = await api.initProject(profile); if (p) { await d.reload(); d.toast({ kind: 'ok', title: t('folders.started', { name: p.name }), detail: t('folders.startedDetail') }); } }); + const fastlane = () => act('fastlane', async () => { const p = await api.importFastlane(profile); if (p) { await d.reload(); d.toast({ kind: 'ok', title: t('folders.imported', { name: p.name }), detail: t('folders.importedDetail') }); } }); const remove = (p: Project) => act(`rm-${p.id}`, async () => { await api.removeProject(p.id); await d.reload(); }); const setAcc = (p: Project, play: string | null, apple: string | null) => act(`acc-${p.id}`, async () => { await api.setProjectAccounts(p.id, play, apple); await d.reload(); }); @@ -66,12 +69,20 @@ export function AppFolders() {

{t('nav.apps')}

{t('folders.lead')}

-
+
+ + + +
{error && {error}} {!d.projects.length ? ( - {t('folders.emptyText')} + + + + + }>{t('folders.emptyText')} ) : (
@@ -102,6 +113,8 @@ export function AppFolders() {
+ + @@ -119,8 +132,12 @@ export function AppFolders() { {t(`folders.profileHint.${profile}` as 'folders.profileHint.app')}
- +
+ + +
+

{t('folders.newNote')}

{run && ( diff --git a/apps/desktop/src/screens/AppView.tsx b/apps/desktop/src/screens/AppView.tsx index c469c484..a4284bd0 100644 --- a/apps/desktop/src/screens/AppView.tsx +++ b/apps/desktop/src/screens/AppView.tsx @@ -10,10 +10,14 @@ import { type AppTab, TAB_ICON, TAB_KEY, tabsFor, useNav } from '../nav'; import { useData } from '../store'; import { Icon } from '../ui/icons'; import { AppIcon, Chip, Notice, PhaseChip, StoreBadge, StoreOnlyTag, StudioMark } from '../ui/kit'; +import { AppInfoTab } from './tabs/AppInfo'; +import { ArtTab } from './tabs/Art'; import { CatalogTab } from './tabs/Catalog'; import { ChecksTab } from './tabs/Checks'; import { HealthTab } from './tabs/Health'; +import { GrowthTab } from './tabs/Growth'; import { ListingsTab } from './tabs/Listings'; +import { PricesTab } from './tabs/Prices'; import { ReleasesTab } from './tabs/Releases'; import { ReviewsTab } from './tabs/Reviews'; import { TestFlightTab } from './tabs/TestFlight'; @@ -59,24 +63,25 @@ function StoreOnlyBanner({ app }: { app: UnifiedApp }) { const d = useData(); const [busy, setBusy] = useState(false); const [profile, setProfile] = useState<'app' | 'game' | 'subscription-app'>('app'); - const link = async (init: boolean) => { + const link = async (how: 'add' | 'init' | 'fastlane') => { setBusy(true); try { - const p = init ? await api.initProject(profile) : await api.addProject(); + const p = how === 'init' ? await api.initProject(profile) : how === 'fastlane' ? await api.importFastlane(profile) : await api.addProject(); if (p) { await d.updateOverrides(o => withLink(o, app, p.id)); await d.reload(); - d.toast({ kind: 'ok', title: t('app.linked', { name: p.name }), detail: init ? t('folders.startedDetail') : undefined }); + d.toast({ kind: 'ok', title: t('app.linked', { name: p.name }), detail: how === 'init' ? t('folders.startedDetail') : how === 'fastlane' ? t('folders.importedDetail') : undefined }); } } catch (e) { d.toast({ kind: 'bad', title: t('app.linkFailed'), detail: errorText(e) }); } finally { setBusy(false); } }; return ( - + - + +
}> {t('app.storeOnlyTitle')} {t('app.storeOnlyText')} @@ -144,10 +149,14 @@ export function AppView({ app, tab }: { app: UnifiedApp; tab: AppTab }) {
{tab === 'releases' && } {tab === 'catalog' && app.project && } + {tab === 'prices' && app.project && } {tab === 'listings' && app.project && } + {tab === 'art' && app.project && } {tab === 'health' && } {tab === 'reviews' && } {tab === 'testflight' && } + {tab === 'growth' && } + {tab === 'appinfo' && app.project && } {tab === 'checks' && app.project && }
diff --git a/apps/desktop/src/screens/Onboarding.tsx b/apps/desktop/src/screens/Onboarding.tsx index c4c25af4..ca535fbd 100644 --- a/apps/desktop/src/screens/Onboarding.tsx +++ b/apps/desktop/src/screens/Onboarding.tsx @@ -1,25 +1,31 @@ -// First-run guide: what the app does, add or start an app folder, store keys into the keychain, local tools, and the -// first read of the stores. Every step can be skipped; it opens again from Settings or the command palette. +// First-run guide: what the app does, the studio the keys belong to (pick one or create it), add / start / import an +// app folder (fastlane import: plan in a native dialog first), store keys into the keychain, local tools, and the first +// read of the stores. Every step can be skipped; it opens again from Settings or the command palette. import { type KeyboardEvent, useEffect, useRef, useState } from 'react'; -import { api, errorText, newJob } from '../api'; +import { api, errorText, newJob, type StudioColor } from '../api'; import { devSwitch } from '../dev/switches'; import { type Key, t } from '../i18n'; import { ago } from '../lib/format'; import { useData } from '../store'; import { Icon, type IconName, Mark } from '../ui/icons'; import { Illo } from '../ui/illustrations'; -import { AppIcon, Chip, Notice, Seg } from '../ui/kit'; +import { AppIcon, Chip, Notice, Seg, StudioMark } from '../ui/kit'; +import { Swatches } from './Accounts'; -const STEPS: [Key, IconName][] = [['wz.s1', 'sparkle'], ['wz.s2', 'folder'], ['wz.s3', 'key'], ['wz.s4', 'package'], ['wz.s5', 'refresh']]; +const STEPS: [Key, IconName][] = [['wz.s1', 'sparkle'], ['wz.s0', 'building'], ['wz.s2', 'folder'], ['wz.s3', 'key'], ['wz.s4', 'package'], ['wz.s5', 'refresh']]; +const LAST = STEPS.length - 1; type Profile = 'app' | 'game' | 'subscription-app'; export function Onboarding({ onClose }: { onClose: () => void }) { const d = useData(); const v = devSwitch('start'); - const [step, setStep] = useState(() => (v.startsWith('welcome:') ? Math.max(0, Math.min(4, Number(v.split(':')[1]) - 1)) : 0)); + const [step, setStep] = useState(() => (v.startsWith('welcome:') ? Math.max(0, Math.min(LAST, Number(v.split(':')[1]) - 1)) : 0)); const [busy, setBusy] = useState(null); const [error, setError] = useState(null); - const [mode, setMode] = useState<'add' | 'init'>('add'); + const [mode, setMode] = useState<'add' | 'init' | 'fastlane'>('add'); + const [studio, setStudio] = useState(() => d.studios[0]?.id ?? null); + const [studioName, setStudioName] = useState(''); + const [studioColor, setStudioColor] = useState('indigo'); const [profile, setProfile] = useState('app'); const [playLabel, setPlayLabel] = useState(''); const [appleLabel, setAppleLabel] = useState(''); @@ -57,7 +63,12 @@ export function Onboarding({ onClose }: { onClose: () => void }) { try { const r = await api.installTool(tool, job); d.updateToast(tid, { kind: 'ok', title: t('deps.installedToast', { tool }), detail: r, job: undefined, progress: undefined }); } catch (e) { d.updateToast(tid, { kind: 'bad', title: t('deps.failed'), detail: errorText(e), job: undefined, progress: undefined }); } }); - const done = [d.projects.length > 0 || step > 0, d.projects.length > 0, d.accounts.length > 0, tools.length > 0 && tools.filter(x => x.id === 'ffmpeg' || x.id === 'chrome').every(x => x.found), !!d.live]; + const studioOf = d.studios.find(x => x.id === studio) ?? null; + const createStudio = () => act('studio', async () => { + const s = await api.saveStudio(null, studioName.trim(), studioColor); + setStudio(s.id); setStudioName(''); + }); + const done = [d.projects.length > 0 || step > 0, d.studios.length > 0 || step > 1, d.projects.length > 0, d.accounts.length > 0, tools.length > 0 && tools.filter(x => x.id === 'ffmpeg' || x.id === 'chrome').every(x => x.found), !!d.live]; const liveApps = d.live?.value.apps.length ?? 0; return ( @@ -91,27 +102,62 @@ export function Onboarding({ onClose }: { onClose: () => void }) { )} {step === 1 && ( + <> +

{t('wz.studioTitle')}

+

{t('wz.studioLead')}

+ {d.studios.length > 0 && ( +
+ {d.studios.map(x => ( + + ))} + +
+ )} +
{ e.preventDefault(); if (studioName.trim()) createStudio(); }}> + + {d.studios.length ? t('wz.studioAnother') : t('wz.studioNew')} + {t('wz.studioNewText')} +
+ setStudioName(e.target.value)} placeholder={t('wz.studioPlaceholder')} aria-label={t('studio.name')} maxLength={60} /> + +
+
+
+ + )} + {step === 2 && ( <>

{t('wz.appsTitle')}

{t('wz.appsLead')}

-
+
+
- {mode === 'init' && ( + {mode !== 'add' && (
{t(`folders.profileHint.${profile}` as Key)}
)}
- {mode === 'add' - ? - : } + {mode === 'add' ? + : mode === 'init' ? + : } + {mode === 'fastlane' && {t('wz.fastlaneNote')}}
{d.projects.length > 0 && (
@@ -120,17 +166,18 @@ export function Onboarding({ onClose }: { onClose: () => void }) { )} )} - {step === 2 && ( + {step === 3 && ( <>

{t('wz.keysTitle')}

{t('wz.keysLead')}

+ {studioOf ? t('wz.keysInto', { name: studioOf.name }) : t('wz.keysNoStudio')}
-
{ e.preventDefault(); act('play', async () => { if (await api.addPlayAccount(playLabel)) setPlayLabel(''); }); }}> + { e.preventDefault(); act('play', async () => { if (await api.addPlayAccount(playLabel, studio)) setPlayLabel(''); }); }}> Google Play{t('accounts.playHow')} setPlayLabel(e.target.value)} placeholder={t('accounts.playPlaceholder')} aria-label={t('accounts.label')} maxLength={60} />
-
{ e.preventDefault(); act('apple', async () => { if (await api.addAppleAccount(appleLabel, keyId, issuerId)) { setAppleLabel(''); setKeyId(''); setIssuerId(''); } }); }}> + { e.preventDefault(); act('apple', async () => { if (await api.addAppleAccount(appleLabel, keyId, issuerId, studio)) { setAppleLabel(''); setKeyId(''); setIssuerId(''); } }); }}> App Store Connect{t('accounts.appleSub')} setAppleLabel(e.target.value)} placeholder={t('accounts.applePlaceholder')} aria-label={t('accounts.label')} maxLength={60} />
setKeyId(e.target.value.toUpperCase())} placeholder={t('accounts.keyId')} aria-label={t('accounts.keyId')} maxLength={10} /> @@ -157,7 +204,7 @@ export function Onboarding({ onClose }: { onClose: () => void }) { {t('accounts.safety')} )} - {step === 3 && ( + {step === 4 && ( <>

{t('wz.toolsTitle')}

{t('wz.toolsLead')}

@@ -176,7 +223,7 @@ export function Onboarding({ onClose }: { onClose: () => void }) {

{t('wz.toolsNote')} storebound doctor

)} - {step === 4 && ( + {step === 5 && ( <>

{t('wz.readTitle')}

@@ -191,10 +238,10 @@ export function Onboarding({ onClose }: { onClose: () => void }) { {error && {error}}
- + {step > 0 && } - {step < 4 ? + {step < LAST ? : }
diff --git a/apps/desktop/src/screens/Portfolio.tsx b/apps/desktop/src/screens/Portfolio.tsx index 94c2a441..c5adb18a 100644 --- a/apps/desktop/src/screens/Portfolio.tsx +++ b/apps/desktop/src/screens/Portfolio.tsx @@ -9,6 +9,8 @@ import { filterSort, groupByStudio, type ListRow, type SortBy, studioCounts, typ import { type Attention, attention, healthSeries, type HealthSnapshot, isError, laneOf, PLAY_THRESHOLDS, STAGES, storeNow, type Tone } from '../lib/model'; import { useNav } from '../nav'; import { useData } from '../store'; +import { exportName, portfolioCsv } from '../lib/exports'; +import { useExports } from '../ui/Exports'; import { Icon, StoreGlyph } from '../ui/icons'; import { AppIcon, Card, Chip, Empty, Kpi, Notice, PhaseChip, Seg, Skeleton, Sparkline, StudioMark } from '../ui/kit'; @@ -141,6 +143,8 @@ export function Portfolio() { const studioOk = view.studio === 'all' || view.studio === 'none' || d.studios.some(s => s.id === view.studio); const rows = filterSort(all as (ListRow & typeof all[number])[], { studio: studioOk ? view.studio : 'all', query, sort: view.sort }) as typeof all; const grouped = view.group && d.studios.length ? groupByStudio(rows, d.studios) : [{ studio: undefined as string | null | undefined, rows }]; + useExports('portfolio', [{ id: 'portfolio-csv', label: t('export.portfolio'), icon: 'portfolio', kind: 'csv', file: exportName('storebound', 'portfolio'), disabled: visible.length ? false : t('export.noApps'), + build: () => portfolioCsv(rows.map(r => ({ name: r.app.name, studio: d.studios.find(s => s.id === r.app.studio)?.name ?? '', s: r.l ?? r.e }))) }]); if (d.ready && !visible.length) { return ( diff --git a/apps/desktop/src/screens/tabs/AppInfo.tsx b/apps/desktop/src/screens/tabs/AppInfo.tsx new file mode 100644 index 00000000..bd466abf --- /dev/null +++ b/apps/desktop/src/screens/tabs/AppInfo.tsx @@ -0,0 +1,184 @@ +// App info & privacy: the store declarations from the config (`inspect --declarations --json`, offline) with every +// question only the owner can answer at the top. Google Play Data safety (upload: dry run, native dialog, real run; +// Play cannot read the form back, so the tab compares with the CSV storebound uploaded last), App Store App Privacy +// (no API: the answers to enter in App Store Connect), app info, export compliance and the App Review details. +import { useState } from 'react'; +import { api, type DeclarationsResult, type DeclAsk, type Project } from '../../api'; +import { type Key, t } from '../../i18n'; +import { declarationsMd, exportName } from '../../lib/exports'; +import { ago, num } from '../../lib/format'; +import { useData, useRead, useWrite } from '../../store'; +import { useExports, useRunExport } from '../../ui/Exports'; +import { Icon, StoreGlyph } from '../../ui/icons'; +import { Bar, Card, Chip, Empty, ErrorNotice, Notice, Skeleton } from '../../ui/kit'; +import { WriteButton } from '../../ui/WriteButton'; +import { ascUrl } from '../AppView'; + +const AREA: Record = { dataSafety: 'ai.aDataSafety', appPrivacy: 'ai.aAppPrivacy', appInfo: 'ai.aAppInfo', encryption: 'ai.aEncryption', review: 'ai.aReview' }; +const PURPOSE: Record = { + functionality: 'ds.functionality', analytics: 'ds.analytics', communications: 'ds.communications', fraud: 'ds.fraud', advertising: 'ds.advertising', personalization: 'ds.personalization', account: 'ds.account', +}; +/** "PSL_DEVICE_ID" -> "Device ID". */ +export const typeLabel = (id: string): string => { + const s = id.replace(/^PSL_/, '').toLowerCase().replace(/_/g, ' '); + return (s.charAt(0).toUpperCase() + s.slice(1)).replace(/\bid\b/g, 'ID').replace(/\bsms\b/g, 'SMS'); +}; +const yes = (b: boolean | null | undefined): string => (b === null || b === undefined ? t('ai.notAnswered') : b ? t('common.yes') : t('common.no')); + +function AskCard({ ask }: { ask: DeclAsk[] }) { + if (!ask.length) return {t('ai.allAnswered')}; + return ( + +
+ {ask.map(a => ( +
+ +
{a.text}{a.fix}
+ {t(AREA[a.area])} +
+ ))} +
+
+ ); +} + +function DataSafety({ project, d, onDone }: { project: Project; d: DeclarationsResult; onDone: () => void }) { + const w = useWrite(project.id); + const run = useRunExport(); + const [open, setOpen] = useState(false); + const ds = d.dataSafety; + const up = ds?.uploaded ?? null; + const asked = d.ask.filter(a => a.area === 'dataSafety').length; + return ( + {t('ai.dsSub')}} pad={false} + actions={ds ? <> + + {t('ai.dsUpload')} + : undefined}> + {!ds ? {t('ai.dsNoneText')} : ( + <> +
+
+
{t('ai.dsCollects')}
{yes(ds.collectsData)}
+
{t('ai.dsEncrypted')}
{yes(ds.encryptedInTransit)}
+
{t('ai.dsDeletion')}
{yes(ds.deletionRequest)}
+
{t('ai.dsAccounts')}
{ds.accountCreation.map(x => typeLabel(x.replace('ACM_', ''))).join(', ')}
+
+ {up === null ? {t('ai.dsNever')} + : !up.changes.length ? {t('ai.dsSame', { when: ago(up.at) })} + : setOpen(o => !o)} aria-expanded={open}>{open ? t('ai.hide') : t('ai.show')}}>{t('ai.dsChanged', { count: up.changes.length, when: ago(up.at) })}} + {open && up && up.changes.length > 0 && ( +
    {up.changes.slice(0, 40).map((c, i) =>
  • {c.question.replace(/^PSL_DATA_USAGE_RESPONSES:/, '')}{c.response ? ` · ${c.response}` : ''}: {c.from || '∅'} → {c.to || '∅'}
  • )}
+ )} + {asked > 0 && {t('ai.askedHere', { count: asked })}} +
+ {ds.types.length > 0 && ( + + + + {ds.types.map(x => ( + + + + + + ))} + +
{t('ai.colType')}{t('ai.colCollected')}{t('ai.colShared')}
{typeLabel(x.id)}
{x.category}{x.optional ? ` · ${t('ai.optional')}` : ''}{x.ephemeral ? ` · ${t('ai.ephemeral')}` : ''}
{x.collect.map(p => {t(PURPOSE[p] ?? 'ds.functionality')})}
{x.shared ?
{x.share.map(p => {t(PURPOSE[p] ?? 'ds.functionality')})}
: {t('ai.notShared')}}
+ )} +
{t('ai.dsFoot', { rows: ds.rows })}
+ + )} +
+ ); +} + +function AppPrivacy({ d, appId }: { d: DeclarationsResult; appId: string | null | undefined }) { + const ap = d.appPrivacy; + if (!ap) return null; + return ( + {t('ai.apSub')}} pad={false} + actions={}> +
{t('ai.apNote')}
+ {!ap.items.length ? {ap.fromDataSafety ? t('ai.apNoneText') : t('ai.apUnknownText')} : ( + + + + {ap.items.map(x => ( + + + + + + + ))} + +
{t('ai.colAppleType')}{t('ai.colPurposes')}{t('ai.colLinked')}{t('ai.colTracking')}
{x.apple}
{x.category} · {x.from.map(typeLabel).join(', ')}
{x.purposes.map(p => {p})}
{t('ai.ask')}{x.thirdParty ? t('ai.askLikely') : t('ai.ask')}
+ )} +
+ ); +} + +export function AppInfoTab({ project }: { project: Project }) { + const data = useData(); + const e = data.statusOf(project); + const r = useRead(project.id, 'project.declarations', { network: false }); + const w = useWrite(project.id); + const name = e?.summary?.name ?? project.name; + useExports('appinfo', [ + { id: 'decl-md', label: t('export.declarations'), icon: 'clipboard', kind: 'md', file: exportName(name, 'store declarations'), disabled: r.data ? false : t('export.readFirst'), build: () => declarationsMd(name, r.data!) }, + { id: 'ds-csv', label: t('export.dataSafety'), icon: 'shield', kind: 'csv', file: exportName(name, 'data safety'), disabled: r.data?.dataSafety ? false : t('export.noDataSafety'), build: () => r.data!.dataSafety!.csv }, + ]); + if (!r.data) return r.error ? : ; + const d = r.data; + const info = d.appInfo; + const enc = d.encryption; + const rv = d.review; + const cat = info?.categories ? [info.categories.primary, info.categories.primarySubOne, info.categories.primarySubTwo].filter(Boolean).join(' / ') : null; + return ( + <> + +
+ {d.stores.play ? : {t('ai.noPlayText')}} + {d.stores.apple ? : {t('ai.noAppleText')}} +
+ {d.stores.apple && ( +
+ {t('ai.push')}}> +
+
{t('ai.category')}
{cat ?? {t('ai.notSet')}}
+
{t('ai.age')}
{info!.ageRating.length ? {info!.ageRating.map(a => `${a.question} = ${a.value}`).join(', ')} : {t('ai.ageAllNone')}}
+
{t('ai.rights')}
{info!.contentRights ? {info!.contentRights === 'USES_THIRD_PARTY_CONTENT' ? t('ai.rightsThird') : t('ai.rightsOwn')} : {t('ai.notSet')}}
+
{t('ai.price')}
{info!.free ? t('ai.free') : t('ai.paid')}
+
+
+ {t('ai.encAnswer')}}> +
+ {enc === null ? {t('ai.notAnswered')} : {enc ? t('ai.encYes') : t('ai.encNo')}} + {enc === null ? t('ai.encUnset') : enc ? t('ai.encYesText') : t('ai.encNoText')} +
+
+ {t('ai.push')}}> +
+
+
{t('ai.signIn')}
{rv.signInRequired === null ? {t('ai.notAnswered')} : yes(rv.signInRequired)}
+
{t('ai.contact')}
{rv.contact ? {rv.contact} : {t('ai.missing')}}
+
{t('ai.demo')}
{rv.demoAccount ? {rv.demoAccount} · •••••••• : rv.signInRequired ? {t('ai.missing')} : {t('ai.demoNone')}}
+
+
+
{t('ai.notes')}{t('ai.notesBytes', { n: num(rv.notesBytes), max: num(rv.notesMax) })}
+ rv.notesMax ? 'bad' : rv.notesBytes > rv.notesMax * 0.9 ? 'warn' : 'ok'} thin label={t('ai.notes')} /> + {rv.notes ?
{rv.notes}
: {t('ai.notesNone')}} +
+ {t('ai.reviewSafe')} +
+
+
+ )} +

{t('ai.foot', { when: ago(r.at) })}

+ + ); +} diff --git a/apps/desktop/src/screens/tabs/Art.tsx b/apps/desktop/src/screens/tabs/Art.tsx new file mode 100644 index 00000000..d501fd7c --- /dev/null +++ b/apps/desktop/src/screens/tabs/Art.tsx @@ -0,0 +1,168 @@ +// Store art: every rendered screenshot, feature graphic and app preview of the app folder per variant, language and +// size (`shots gallery --json`, offline), store check issues outlined. Images load one by one as they scroll into view +// (`project.render`, a data: URL each: the window loads no files itself). Re-render (dry run, dialog, real run), write +// the review page, open it or the folder. +import { type KeyboardEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { api, errorText, type Project, type RenderImage, type RendersResult, type RenderTile, type ToolResult } from '../../api'; +import { t } from '../../i18n'; +import { ago, bytes, num } from '../../lib/format'; +import { artRows, langIssues } from '../../lib/views'; +import { useData, useRead, useWrite } from '../../store'; +import { Icon } from '../../ui/icons'; +import { Card, Chip, Empty, ErrorNotice, Kpi, Seg, Skeleton } from '../../ui/kit'; +import { WriteButton } from '../../ui/WriteButton'; + +// loaded images by project + file + render time, three at a time +const cache = new Map(); +const waiting: (() => Promise)[] = []; +let active = 0; +function pump() { + while (active < 3 && waiting.length) { + const job = waiting.shift()!; + active++; + job().finally(() => { active--; pump(); }); + } +} +function loadRender(projectId: string, file: string, stamp: string): Promise { + const key = `${projectId}|${file}|${stamp}`; + if (cache.has(key)) return Promise.resolve(cache.get(key)!); + return new Promise(resolve => { + waiting.push(async () => { + try { + const r = await api.call('project.render', projectId, { args: { file } }); + cache.set(key, r.data?.dataUrl ?? null); + } catch { cache.set(key, null); } + resolve(cache.get(key) ?? null); + }); + pump(); + }); +} + +function Thumb({ projectId, tile, stamp, onOpen }: { projectId: string; tile: RenderTile; stamp: string; onOpen: () => void }) { + const ref = useRef(null); + const file = tile.kind === 'video' ? tile.poster : tile.src; + const [src, setSrc] = useState(file ? cache.get(`${projectId}|${file}|${stamp}`) : null); + useEffect(() => { + if (!file || src !== undefined) return; + const el = ref.current; + if (!el) return; + let alive = true; + const io = new IntersectionObserver(es => { + if (!es.some(x => x.isIntersecting)) return; + io.disconnect(); + loadRender(projectId, file, stamp).then(u => { if (alive) setSrc(u); }); + }, { rootMargin: '300px' }); + io.observe(el); + return () => { alive = false; io.disconnect(); }; + }, [projectId, file, stamp, src]); + const lvl = tile.issues.some(i => i.level === 'error') ? 'err' : tile.issues.length ? 'warn' : ''; + return ( +
+ +
{tile.name}{tile.w}×{tile.h}{tile.bytes ? ` · ${bytes(tile.bytes)}` : ''}
+ {tile.issues.length > 0 &&
    {tile.issues.slice(0, 2).map((i, k) =>
  • {i.msg}
  • )}
} +
+ ); +} + +function Lightbox({ projectId, tiles, index, stamp, onClose, onMove }: { projectId: string; tiles: RenderTile[]; index: number; stamp: string; onClose: () => void; onMove: (i: number) => void }) { + const tile = tiles[index]!; + const file = tile.kind === 'video' ? tile.poster : tile.src; + const [src, setSrc] = useState(null); + const root = useRef(null); + useEffect(() => { setSrc(null); if (file) loadRender(projectId, file, stamp).then(setSrc); }, [projectId, file, stamp]); + useEffect(() => { root.current?.focus(); }, []); + const onKey = (e: KeyboardEvent) => { + if (e.key === 'Escape') { e.preventDefault(); onClose(); } + if (e.key === 'ArrowRight') { e.preventDefault(); onMove((index + 1) % tiles.length); } + if (e.key === 'ArrowLeft') { e.preventDefault(); onMove((index - 1 + tiles.length) % tiles.length); } + }; + return ( +
{ if (e.target === e.currentTarget) onClose(); }}> +
+
{src ? {tile.name} : }
+
+
{tile.src}
{tile.w}×{tile.h} · {bytes(tile.bytes)} · {num(index + 1)} / {num(tiles.length)}
+ {tile.issues.map((i, k) =>
{i.msg}
)}
+ + + +
+
+
+ ); +} + +export function ArtTab({ project }: { project: Project }) { + const d = useData(); + const r = useRead(project.id, 'project.renders', { network: false }); + const w = useWrite(project.id); + const [variant, setVariant] = useState(''); + const [lang, setLang] = useState(''); + const [onlyIssues, setOnlyIssues] = useState(false); + const [open, setOpen] = useState<{ tiles: RenderTile[]; i: number } | null>(null); + const data = r.data; + const v = data?.variants.find(x => x.id === variant) ?? data?.variants[0]; + const langs = v?.langs.map(l => l.lang) ?? []; + const lg = langs.includes(lang) ? lang : langs[0] ?? ''; + const rows = useMemo(() => (data ? artRows(data, { variant: v?.id ?? '', lang: lg, onlyIssues }) : []), [data, v, lg, onlyIssues]); + const counts = useMemo(() => (data ? langIssues(data, v?.id ?? '') : {}), [data, v]); + const dir = data?.dir ?? 'store/renders'; + const reveal = useCallback((rel: string, openIt = false) => { api.reveal(project.id, rel, openIt).catch(e => d.toast({ kind: 'info', title: t('art.notThere'), detail: errorText(e) })); }, [project.id, d]); + const stamp = data?.generated ?? ''; + + if (!data) return r.error ? : ; + const total = data.totals.images + data.totals.videos; + const toolbar = ( + <> + + + {t('art.writePage')} + {t('art.render', { lang: lg || t('act.allLangs') })} + + ); + return ( + <> +
+ + + + +
+ {dir}} actions={toolbar} pad={false}> +
+ {data.variants.length > 1 && [x.id, x.id ? t('gr.variant', { id: x.id }) : t('art.base')] as [string, string])} />} +
+ {langs.map(l => ( + + ))} +
+ + +
+ {!total ? ( + {t('art.emptyText')} + ) : !rows.length ? {t('art.noIssuesText')} : ( +
+ {rows.map(row => ( +
i.level === 'error') ? ' bad' : ''}`} key={row.size}> +

{row.label}{lg}/{row.size}{row.store === 'apple' ? 'App Store' : 'Google Play'}{t('art.count', { count: row.tiles.length })}

+ {row.issues.length > 0 &&
    {row.issues.map((i, k) =>
  • {i.msg}
  • )}
} +
row.tiles[0].h ? '260px' : '150px' }}> + {row.tiles.map((tile, i) => setOpen({ tiles: row.tiles, i })} />)} +
+
+ ))} +
+ )} +
{t('art.foot', { when: ago(r.at) })}
+
+ {open && setOpen(null)} onMove={i => setOpen(o => (o ? { ...o, i } : o))} />} + + ); +} diff --git a/apps/desktop/src/screens/tabs/Catalog.tsx b/apps/desktop/src/screens/tabs/Catalog.tsx index a9fb1cae..cc90e053 100644 --- a/apps/desktop/src/screens/tabs/Catalog.tsx +++ b/apps/desktop/src/screens/tabs/Catalog.tsx @@ -7,7 +7,10 @@ import { type CatalogDiff, type CellState, parityMatrix } from '../../lib/model' import { useData, useRead, useWrite } from '../../store'; import { Icon, type IconName, StoreGlyph } from '../../ui/icons'; import { WriteButton } from '../../ui/WriteButton'; -import { Card, Chip, Empty, Kpi, Notice, Skeleton } from '../../ui/kit'; +import { Card, Chip, Empty, ErrorNotice, Kpi, Skeleton } from '../../ui/kit'; +import { catalogMd, exportName } from '../../lib/exports'; +import { useExports } from '../../ui/Exports'; +import { useNav } from '../../nav'; const CELL: Record = { ok: ['check', 'cat.ok'], warn: ['alert', 'cat.warn'], error: ['x', 'cat.error'], na: ['dot', 'cat.na'], unknown: ['info', 'cat.unknown'] }; @@ -24,6 +27,7 @@ function Cell({ c }: { c: { state: CellState; notes: string[] } }) { /** Create / update the catalog on both stores from the config (prices included), and export the price sheet. */ function CatalogActions({ project, products, subs, refresh }: { project: Project; products: number; subs: number; refresh: () => void }) { const d = useData(); + const nav = useNav(); const w = useWrite(project.id); const e = d.statusOf(project); const ios = !!e?.app?.platforms.ios, android = !!e?.app?.platforms.android; @@ -45,9 +49,10 @@ function CatalogActions({ project, products, subs, refresh }: { project: Project
)}
-
{t('act.prices')}
+
{t('act.prices')}
+ {t('act.pricesExport')} - {t('act.pricesImport')} storebound prices import + {t('cat.pricesHere')}

{t('act.catalogNote')}

@@ -60,6 +65,10 @@ export function CatalogTab({ project }: { project: Project }) { const e = d.statusOf(project); const diff = useRead(project.id, 'catalog.diff', { network: true, title: t('tab.catalog') }); const s = e?.summary ?? null; + const name = s?.name ?? project.name; + useExports('catalog', [ + { id: 'catalog-md', label: t('export.catalog'), icon: 'layers', kind: 'md', file: exportName(name, 'catalog parity'), disabled: diff.data ? false : t('export.readFirst'), build: () => catalogMd(name, diff.data!) }, + ]); if (!e) return ; const rows = parityMatrix(s, diff.data); const read = !!diff.data; @@ -77,7 +86,7 @@ export function CatalogTab({ project }: { project: Project }) { r.kind !== 'extra').length}` : '–'} sub={read ? t('cat.parityRead', { when: ago(diff.at) }) : t('kpi.notRead')} tone={read && inParity < rows.length ? 'warn' : undefined} /> - {diff.error && {t('common.readFailedKeep', { error: diff.error })}} + {diff.error && } { diff.refresh(); }} /> {read ? t('action.refresh') : t('cat.compare')}}> diff --git a/apps/desktop/src/screens/tabs/Checks.tsx b/apps/desktop/src/screens/tabs/Checks.tsx index 186d162c..16972f2f 100644 --- a/apps/desktop/src/screens/tabs/Checks.tsx +++ b/apps/desktop/src/screens/tabs/Checks.tsx @@ -6,7 +6,9 @@ import { ago } from '../../lib/format'; import type { Finding, ValidateResult } from '../../lib/model'; import { useData, useRead } from '../../store'; import { Icon } from '../../ui/icons'; -import { Card, Chip, Empty, Notice, Skeleton } from '../../ui/kit'; +import { Card, Chip, Empty, ErrorNotice, Skeleton } from '../../ui/kit'; +import { exportName, validateMd } from '../../lib/exports'; +import { useExports } from '../../ui/Exports'; const LEVEL: Record = { blocker: ['bad', 'alertCircle'], warn: ['warn', 'alert'], ok: ['ok', 'check'] }; @@ -14,6 +16,8 @@ export function ChecksTab({ project }: { project: Project }) { const d = useData(); const e = d.statusOf(project); const v = useRead(project.id, 'validate', { network: true, title: t('checks.validate') }); + const name = e?.summary?.name ?? project.name; + useExports('checks', [{ id: 'validate-md', label: t('export.validate'), icon: 'shield', kind: 'md', file: exportName(name, 'store readiness'), disabled: v.data ? false : t('export.readFirst'), build: () => validateMd(name, v.data!, v.at) }]); const problems = [...(e?.errors ?? []), ...(e?.check?.problems ?? [])]; const warnings = e?.check?.warnings ?? []; const findings = [...(v.data?.findings ?? [])].sort((a, b) => ['blocker', 'warn', 'ok'].indexOf(a.level) - ['blocker', 'warn', 'ok'].indexOf(b.level)); @@ -32,7 +36,7 @@ export function ChecksTab({ project }: { project: Project }) { {v.data ? t('action.refresh') : t('checks.run')}}> - {v.error &&
{v.error}
} + {v.error &&
} {!v.data ? ( v.loading && !v.error ?
: {t('checks.validateEmptyText')} ) : !findings.length ? {t('checks.readyText')} : ( diff --git a/apps/desktop/src/screens/tabs/Growth.tsx b/apps/desktop/src/screens/tabs/Growth.tsx new file mode 100644 index 00000000..0dc229b1 --- /dev/null +++ b/apps/desktop/src/screens/tabs/Growth.tsx @@ -0,0 +1,189 @@ +// Growth: store analytics snapshots against the listing changes from git (`analytics compare --json`, offline; a new +// snapshot and the App Store report request are confirm-gated writes), App Store Product Page Optimization tests +// (status read; create and upload treatments: dry run, dialog, real run; start / stop are owner actions with their +// own dialog, never MCP tools), and Google Play store listing experiments (no API: Play Console). +import { useMemo, useState } from 'react'; +import { type AnalyticsCompare, api, type PpoStatus, type PpoTest } from '../../api'; +import { t } from '../../i18n'; +import type { UnifiedApp } from '../../lib/identity'; +import { analyticsCsv, exportName } from '../../lib/exports'; +import { ago, date, num, pct } from '../../lib/format'; +import { chartSeries, effectDelta } from '../../lib/views'; +import { useNav } from '../../nav'; +import { useData, useRead, useWrite } from '../../store'; +import { useExports } from '../../ui/Exports'; +import { Icon, StoreGlyph } from '../../ui/icons'; +import { Card, Chip, Empty, ErrorNotice, Kpi, Notice, Seg, Skeleton } from '../../ui/kit'; +import { LineChart } from '../../ui/LineChart'; +import { WriteButton } from '../../ui/WriteButton'; +import { ascUrl, PLAY_CONSOLE } from '../AppView'; + +const DONE = ['COMPLETED', 'STOPPED']; +const started = (x: PpoTest) => !!x.startDate && !x.endDate && !DONE.includes(x.state); +const stateTone = (s: string): 'ok' | 'warn' | 'bad' | 'info' | 'neutral' | 'accent' => + s === 'REJECTED' ? 'bad' : DONE.includes(s) ? 'neutral' : ['WAITING_FOR_REVIEW', 'IN_REVIEW'].includes(s) ? 'warn' : ['ACCEPTED', 'APPROVED'].includes(s) ? 'ok' : 'info'; + +function Analytics({ projectId, hasApple, hasPlay, name, playReports }: { projectId: string; hasApple: boolean; hasPlay: boolean; name: string; playReports: boolean }) { + const r = useRead(projectId, 'analytics.compare', { network: false }); + const w = useWrite(projectId); + const a = r.data; + const stores = ([hasApple && 'apple', hasPlay && 'play'].filter(Boolean) as ('apple' | 'play')[]).filter(s => !a || (s === 'apple' ? a.series.apple.length : a.series.play.length)); + const [store, setStore] = useState<'apple' | 'play'>(hasApple ? 'apple' : 'play'); + const st = stores.includes(store) ? store : stores[0] ?? store; + const s = useMemo(() => (a ? chartSeries(a, st) : null), [a, st]); + useExports('growth', [{ id: 'analytics-csv', label: t('export.analytics'), icon: 'chart', kind: 'csv', file: exportName(name, 'analytics'), disabled: a ? false : t('export.readFirst'), build: () => analyticsCsv(a!) }]); + const none = !!r.error && /no snapshots/i.test(r.error); + const actions = ( + <> + {hasApple && {t('gr.setup')}} + {t('gr.snapshot')} + + ); + const sum = (xs: number[]) => xs.reduce((n, v) => n + v, 0); + const reach = s ? sum(s.reach) : 0, inst = s ? sum(s.installs) : 0; + const effects = (a?.effects ?? []).filter(e => e.store === st).slice(-8).reverse(); + return ( + {stores.length > 1 && }{actions}}> + {none ? ( + {t('gr.noneText')}{hasPlay && !playReports ? ` ${t('gr.noBucket')}` : ''} + ) : r.error ?
: !a || !s ?
: ( +
+
+ + + +
+ {s.dates.length > 1 ? ( + + ) : {t('gr.oneDay')}} + {effects.length > 0 && ( + + + + {effects.map((e, i) => { + const dlt = effectDelta(e.before.conversion, e.after.conversion); + return ( + + + + + + + + ); + })} + +
{t('gr.change')}{t('col.date')}{t('gr.before')}{t('gr.after')}{t('col.diff')}
{e.event.subject}
{e.event.commit} · {e.event.files.slice(0, 3).join(', ')}
{date(e.event.date)}{pct(e.before.conversion ?? null, 1)}
{t('gr.daysN', { count: e.daysBefore })}
{pct(e.after.conversion ?? null, 1)}
{t('gr.daysN', { count: e.daysAfter })}
{dlt === null ? '–' : = 0 ? 'ok' : 'warn'} dot={false}>{`${dlt >= 0 ? '+' : ''}${num(dlt, 1)} %`}}
+ )} +

{t('gr.reading')}

+
+ )} +
+ ); +} + +function Experiments({ app }: { app: UnifiedApp }) { + const d = useData(); + const target = app.project?.id ?? app.target; + const r = useRead(target, 'apple.ppo_status', { network: true, title: t('gr.ppo') }); + const w = useWrite(app.project?.id ?? null); + const variants = d.statusFor(app)?.summary?.variants ?? []; + const [pickV, setPickV] = useState([]); + const [traffic, setTraffic] = useState(30); + const [up, setUp] = useState(''); + const chosen = pickV.length ? pickV : variants.slice(0, 1); + const upV = up || variants[0] || ''; + const tests = r.data?.tests ?? []; + const editable = tests.find(x => !started(x) && !DONE.includes(x.state)); + const asc = app.ios ? ascUrl(app.ios.app.id) : ascUrl(d.statusFor(app)?.app?.platforms.ios?.ascAppId); + return ( + {r.data ? (r.fromCache ? t('common.cachedFrom', { when: ago(r.at) }) : t('common.readWhen', { when: ago(r.at) })) : t('gr.ppoSub')}} pad={false} + actions={<> + + + }> + {r.error &&
} + {!r.data ? (r.loading && !r.error ?
: {t('gr.ppoNotReadText')}) + : !tests.length ? {variants.length ? t('gr.ppoNoneText') : t('gr.ppoNoVariants')} : ( + + + + {tests.map(x => ( + + + + + + + + + ))} + +
{t('gr.test')}{t('gr.state')}{t('gr.traffic')}{t('gr.dates')}{t('gr.treatments')}{t('gr.owner')}
{x.name}{x.state.replace(/_/g, ' ').toLowerCase()}{x.trafficProportion !== undefined ? `${x.trafficProportion} %` : '–'}{x.startDate ? `${date(x.startDate)} → ${x.endDate ? date(x.endDate) : t('gr.running')}` : t('gr.notStarted')}{x.treatments.length ? x.treatments.map(tr => t('gr.treatment', { name: tr.name, count: tr.locales })).join(' · ') : '–'} + {app.project && !DONE.includes(x.state) && (started(x) + ? {t('gr.stopBtn')} + : {t('gr.startBtn')})} +
+ )} + {app.project ? ( +
+ {!variants.length ? {t('gr.ppoNoVariants')} : ( +
+
+
{t('gr.create')}
+
{variants.map(v => ( + + ))}
+ + {t('gr.createBtn')} +
+
+
{t('gr.upload')}
+ + {t('gr.uploadBtn')} + {editable ? t('gr.uploadInto', { name: editable.name }) : t('gr.uploadNoTest')} +
+
+ )} +

{t('gr.ppoNote')}

+
+ ) :
{t('gr.ppoStoreOnly')}
} +
+ ); +} + +function PlayExperiments({ app }: { app: UnifiedApp }) { + const nav = useNav(); + return ( + {t('gr.playExpSub')}} + actions={}> +
+

{t('gr.playExpText')}

+ {app.project &&
} +
+
+ ); +} + +export function GrowthTab({ app }: { app: UnifiedApp }) { + const d = useData(); + const s = d.statusFor(app)?.summary; + const hasApple = !!(s?.apple ?? app.ios), hasPlay = !!(s?.play ?? app.android); + if (app.project && !s) return ; + return ( + <> + {app.project && } +
+ {hasApple && } + {hasPlay && } +
+ + ); +} diff --git a/apps/desktop/src/screens/tabs/Health.tsx b/apps/desktop/src/screens/tabs/Health.tsx index 4f4c900b..2feb20a0 100644 --- a/apps/desktop/src/screens/tabs/Health.tsx +++ b/apps/desktop/src/screens/tabs/Health.tsx @@ -6,7 +6,9 @@ import { ago, date, num, pct } from '../../lib/format'; import { type AppleHealth, healthSeries, type HealthSnapshot, isError, PLAY_THRESHOLDS, type PlayHealth, type Series } from '../../lib/model'; import { useRead } from '../../store'; import { Icon } from '../../ui/icons'; -import { Bar, Card, Chip, Empty, Notice, Skeleton, Sparkline } from '../../ui/kit'; +import { Bar, Card, Chip, Empty, ErrorFoot, Notice, Skeleton, Sparkline } from '../../ui/kit'; +import { exportName, healthMd } from '../../lib/exports'; +import { useExports } from '../../ui/Exports'; function Metric({ title, s }: { title: string; s: Series }) { return ( @@ -124,13 +126,14 @@ function Apple({ h }: { h: AppleHealth }) { export function HealthTab({ app }: { app: UnifiedApp }) { const r = useRead(app.target, 'health', { network: true, title: t('tab.health'), appName: app.name }); + useExports('health', [{ id: 'health-md', label: t('export.health'), icon: 'activity', kind: 'md', file: exportName(app.name, 'health'), disabled: r.data ? false : t('export.readFirst'), build: () => healthMd(app.name, r.data!) }]); const refresh = ; if (!r.data) { if (r.loading && !r.error) return ; return ( {t('health.read')}}>{t('health.emptyText')} - {r.error &&
{r.error}
} + {r.error && }
); } diff --git a/apps/desktop/src/screens/tabs/Listings.tsx b/apps/desktop/src/screens/tabs/Listings.tsx index c5fde1c1..a171b1a3 100644 --- a/apps/desktop/src/screens/tabs/Listings.tsx +++ b/apps/desktop/src/screens/tabs/Listings.tsx @@ -7,7 +7,10 @@ import { ago, num } from '../../lib/format'; import { useData, useRead, useWrite } from '../../store'; import { Icon, StoreGlyph } from '../../ui/icons'; import { WriteButton } from '../../ui/WriteButton'; -import { Card, Chip, Empty, Kpi, Notice, Skeleton } from '../../ui/kit'; +import { Card, Chip, Empty, ErrorNotice, Kpi, Notice, Skeleton } from '../../ui/kit'; +import { reads } from '../../api'; +import { exportName, listingsMd } from '../../lib/exports'; +import { useExports } from '../../ui/Exports'; const FIELD_KEY: Record = { title: 'lst.title', short: 'lst.short', full: 'lst.full', whatsNew: 'lst.whatsNew', name: 'lst.name', subtitle: 'lst.subtitle', @@ -111,8 +114,11 @@ function StoreActions({ project, langs }: { project: Project; langs: string[] }) export function ListingsTab({ project }: { project: Project }) { const r = useRead(project.id, 'project.listings', { network: false }); + useExports('listings', [{ id: 'listings-md', label: t('export.listings'), icon: 'text', kind: 'md', file: exportName(project.name, 'listings'), + disabled: r.data && (r.data.files.play || r.data.files.apple) ? false : t('export.noListings'), + build: async () => { const x = await reads.listingText(project.id); if (!x.data) throw new Error(x.output || t('export.failed')); return listingsMd(project.name, x.data); } }]); if (!r.data) { - if (r.error) return {r.error}; + if (r.error) return ; return ; } const L = r.data; diff --git a/apps/desktop/src/screens/tabs/Prices.tsx b/apps/desktop/src/screens/tabs/Prices.tsx new file mode 100644 index 00000000..aa0496eb --- /dev/null +++ b/apps/desktop/src/screens/tabs/Prices.tsx @@ -0,0 +1,205 @@ +// Prices: what every product costs in every territory on both stores (`prices export --json`, read-only), the price +// sheet as a CSV (save it anywhere, or write store/prices.csv for the terminal), and a price sheet compared with the +// stores (`prices import --dry --json`) and applied as an owner action: dry run, native dialog, then the real run. +import { useEffect, useMemo, useState } from 'react'; +import { api, errorText, type PricesCurrent, type PricesDiff, type Project } from '../../api'; +import { t } from '../../i18n'; +import { exportName, pricesCsv } from '../../lib/exports'; +import { ago, money, num } from '../../lib/format'; +import { changePct, diffSummary, priceMatrix, priceStats, type RegionRow, regionRows } from '../../lib/views'; +import { type ReadState, useData, useRead, useWrite } from '../../store'; +import { type ExportItem, useExports, useRunExport } from '../../ui/Exports'; +import { Icon, StoreGlyph } from '../../ui/icons'; +import { Card, Chip, Empty, ErrorNotice, Kpi, Notice, Skeleton } from '../../ui/kit'; +import { WriteButton } from '../../ui/WriteButton'; + +const GAP = 10; + +function PriceStack({ r, apple, play }: { r: RegionRow | undefined; apple: boolean; play: boolean }) { + if (!r) return –; + return ( +
+ {apple && {r.apple ? money(r.apple.price, r.apple.currency) : '–'}} + {play && {r.play ? money(r.play.price, r.play.currency) : '–'}} + {r.gapPct !== null && r.gapPct >= GAP && 25 ? 'bad' : 'warn'} dot={false}>{`Δ ${num(r.gapPct, 0)} %`}} +
+ ); +} + +/** The sheet against the stores, and the owner's Apply. */ +function SheetDiff({ project, diff, sheet, onApplied }: { project: Project; diff: ReadState; sheet: { csv?: string }; onApplied: () => void }) { + const w = useWrite(project.id); + const d = diff.data; + const rows = (d?.diff ?? []).filter(r => r.change !== 'same'); + const sum = d ? diffSummary(d.diff, d.changed) : null; + const name = sheet.csv ? sheet.csv.split(/[\\/]/).pop() : d?.csv.split(/[\\/]/).pop() ?? 'prices.csv'; + return ( + + + {sum && sum.pairs > 0 && {t('prices.apply', { count: sum.pairs })}} + }> + {diff.error &&
} + {!d ? (diff.loading ?
: null) : !rows.length ? ( + {t('prices.upToDateText')} + ) : ( + <> +
+ {t('prices.dChanged', { count: sum!.changed })} + {t('prices.dNew', { count: sum!.added })} + {sum!.up > 0 && {t('prices.dUp', { count: sum!.up })}} + {sum!.down > 0 && {t('prices.dDown', { count: sum!.down })}} + {t('prices.dProducts', { list: sum!.products.join(', ') })} +
+
+ + + + {rows.slice(0, 200).map((r, i) => { + const c = changePct(r); + return ( + + + + + + + + + + ); + })} + +
{t('col.item')}{t('col.store')}{t('col.region')}{t('prices.colStarts')}{t('prices.colNow')}{t('prices.colNew')}{t('col.diff')}
{r.product}{r.store === 'apple' ? 'App Store' : 'Google Play'}{r.region}{r.startDate ?? t('prices.now')}{r.from === null ? '–' : money(r.from, r.currency)}{money(r.to, r.currency)}{r.change === 'new' ? {t('prices.new')} : c === null ? '–' : 0 ? 'warn' : 'ok'} dot={false}>{`${c > 0 ? '+' : ''}${num(c, 1)} %`}}
+
+ {rows.length > 200 &&
{t('prices.more', { count: rows.length - 200 })}
} +
{t('prices.applyNote')}
+ + )} +
+ ); +} + +export function PricesTab({ project }: { project: Project }) { + const d = useData(); + const e = d.statusOf(project); + const s = e?.summary ?? null; + const w = useWrite(project.id); + const runExport = useRunExport(); + const [withAuto, setWithAuto] = useState(true); + const cur = useRead(project.id, 'prices.current', { network: true, args: withAuto ? { with_automatic: true } : {}, title: t('prices.readTitle') }); + const [sheet, setSheet] = useState<{ csv?: string } | null>(null); + const sheetKey = JSON.stringify(sheet); + const diff = useRead(project.id, 'prices.diff', { network: true, args: sheet ?? {}, title: t('prices.compareTitle'), skip: sheet === null }); + useEffect(() => { if (sheet) diff.refresh(); }, [sheetKey]); // eslint-disable-line react-hooks/exhaustive-deps + const [product, setProduct] = useState(''); + const [q, setQ] = useState(''); + const p = cur.data; + const name = s?.name ?? project.name; + const exportItem: ExportItem = { id: 'prices-csv', label: t('export.prices'), icon: 'coins', kind: 'csv', file: exportName(name, 'prices'), disabled: p ? false : t('export.readFirst'), build: () => pricesCsv(p!) }; + useExports('prices', [exportItem]); + + const stats = useMemo(() => (p ? priceStats(p, GAP) : null), [p]); + const matrix = useMemo(() => (p ? priceMatrix(p) : null), [p]); + const sel = product || p?.products[0] || ''; + const regions = useMemo(() => (p && sel ? regionRows(p, sel).filter(r => !q || r.region.toLowerCase().includes(q.toLowerCase()) || (r.apple?.currency ?? r.play?.currency ?? '').toLowerCase().includes(q.toLowerCase())) : []), [p, sel, q]); + const apple = !!s?.apple, play = !!s?.play; + const rel = (abs: string) => (abs.startsWith(`${project.path}/`) ? abs.slice(project.path.length + 1) : ''); + const pick = async () => { + try { const f = await api.pickPriceSheet(project.id); if (f) setSheet({ csv: f }); } catch (x) { d.toast({ kind: 'bad', title: t('prices.pickFailed'), detail: errorText(x) }); } + }; + + if (!e) return ; + if (!s?.products) { + return ( + + {t('prices.emptyText')} +
products: [{'{'} id, type, usd {'}'}]{t('prices.emptyHint')}
+
+ ); + } + return ( + <> + runExport(exportItem)} disabled={!p}>{t('prices.exportCsv')}}> +
+
+
{t('prices.getSheet')}
+ + {t('prices.writeProject')} +
+
+
{t('prices.compareHead')}
+ + + {p && rel(p.csv) && } +
+
+

{t('prices.sheetNote')}

+
+ + {sheet && { cur.refresh(); diff.refresh(); }} />} + + {cur.error && } + {!p ? ( + cur.loading && !cur.error ? : ( + + {t('prices.readNow')}}>{t('prices.notReadText')} + + ) + ) : ( + <> +
+ + + + `${m.product} (${m.store === 'apple' ? 'App Store' : 'Play'})`).join(', ') : t('prices.kMissingNone')} tone={stats!.missing ? 'bad' : undefined} /> +
+ + + + }> +
+ + {matrix!.regions.map(r => )} + + {matrix!.rows.map(row => ( + setProduct(row.product)}> + + {matrix!.regions.map(r => )} + + ))} + +
{t('col.item')}{r}
{row.product}
+
+
App StoreGoogle Play{t('prices.autoLegend')}{t('prices.gapLegend', { pct: GAP })}
+
+ + +
setQ(ev.target.value)} placeholder={t('prices.searchRegion')} aria-label={t('prices.searchRegion')} />
+ }> +
+ + {apple && }{apple && }{play && } + + {regions.map(r => ( + + + {apple && } + {apple && } + {play && } + + + ))} + +
{t('col.region')}App Store{t('prices.colKind')}Google Play{t('col.priceGap')}
{r.region}{r.apple ? money(r.apple.price, r.apple.currency) : –}{r.scheduled &&
{t('prices.scheduled', { price: money(r.scheduled.price, r.scheduled.currency), date: r.scheduled.startDate ?? '' })}
}
{r.apple ? {r.apple.kind === 'auto' ? t('prices.auto') : t('prices.manual')} : null}{r.play ? money(r.play.price, r.play.currency) : –}{r.gapPct === null ? {r.apple && r.play ? t('prices.otherCurrency') : '–'} : 25 ? 'bad' : r.gapPct >= GAP ? 'warn' : 'ok'} dot={false}>{`${num(r.gapPct, 1)} %`}}
+
+
+ {p.missing.length > 0 && {t('prices.missingNote', { list: p.missing.map(m => `${m.product} (${m.store === 'apple' ? 'App Store' : 'Google Play'})`).join(', ') })}} + + )} + + ); +} diff --git a/apps/desktop/src/screens/tabs/Reviews.tsx b/apps/desktop/src/screens/tabs/Reviews.tsx index 0f04b370..09984406 100644 --- a/apps/desktop/src/screens/tabs/Reviews.tsx +++ b/apps/desktop/src/screens/tabs/Reviews.tsx @@ -10,7 +10,9 @@ import { draftName, filterReviews, type Review, type ReviewFilter, starStats } f import { useRead, useWrite } from '../../store'; import { WriteButton } from '../../ui/WriteButton'; import { Icon, StoreGlyph } from '../../ui/icons'; -import { Bar, Card, Chip, Empty, Notice, Seg, Skeleton, Stars } from '../../ui/kit'; +import { Bar, Card, Chip, Empty, ErrorFoot, Notice, Seg, Skeleton, Stars } from '../../ui/kit'; +import { exportName, reviewsCsv } from '../../lib/exports'; +import { useExports } from '../../ui/Exports'; const base = (f: string) => f.split(/[\\/]/).pop() ?? f; @@ -92,13 +94,15 @@ export function ReviewsTab({ app }: { app: UnifiedApp }) { const cur = shown.find(r => `${r.store}:${r.id}` === sel) ?? shown.find(r => !r.reply && byFile.has(draftName(r))) ?? shown[0]; const changed = () => { drafts.refresh(); }; + useExports('reviews', [{ id: 'reviews-csv', label: t('export.reviews'), icon: 'message', kind: 'csv', personal: true, file: exportName(app.name, 'reviews'), + disabled: list.data ? false : t('export.readFirst'), build: () => reviewsCsv(shown.length ? shown : all) }]); if (!list.data) { if (list.loading && !list.error) return ; return ( {t('reviews.read')}}>{t('reviews.emptyText')} - {list.error &&
{list.error}
} + {list.error && }
); } diff --git a/apps/desktop/src/store.tsx b/apps/desktop/src/store.tsx index 75d919f5..2fc6860b 100644 --- a/apps/desktop/src/store.tsx +++ b/apps/desktop/src/store.tsx @@ -10,6 +10,7 @@ import { t } from './i18n'; import { buildApps, NO_OVERRIDES, type Overrides, type UnifiedApp } from './lib/identity'; import { isError, type HealthSnapshot, type Review } from './lib/model'; import { crashCrossed, newLowReviews, releaseChanges } from './lib/notify'; +import { fixHint } from './lib/views'; export type ToastKind = 'job' | 'ok' | 'bad' | 'info'; export interface Toast { @@ -77,6 +78,8 @@ export const useData = (): Data => { }; const lastLine = (s: string): string => s.trim().split('\n').filter(Boolean).at(-1)?.replace(/^\S+ \[[^\]]+\] /, '') ?? ''; +/** A failure line with how to fix it, when the error is a known one. */ +const withHint = (msg: string | undefined): string | undefined => { const h = fixHint(msg); return h && msg ? `${msg} · ${t(h)}` : msg; }; export function DataProvider({ children }: { children: ReactNode }) { const [ready, setReady] = useState(false); @@ -322,10 +325,10 @@ export function useWrite(projectId: string | null) { const tid = d.toast({ id: job, kind: 'job', title: w.title, detail: t('write.dryRunning'), progress: null, job }); try { const o = await api.writeWithConfirm(w.method, projectId, w.args, job); - if (o.stage === 'dry-run') d.updateToast(tid, { kind: 'bad', title: t('write.dryFailed'), detail: lastLine(o.dryRun.output) || undefined, progress: undefined, job: undefined }); + if (o.stage === 'dry-run') d.updateToast(tid, { kind: 'bad', title: t('write.dryFailed'), detail: withHint(lastLine(o.dryRun.output) || undefined), progress: undefined, job: undefined }); else if (o.stage === 'dialog') d.updateToast(tid, { kind: 'info', title: t('write.notApplied'), detail: t('write.notAppliedDetail'), progress: undefined, job: undefined }); else if (o.result?.ok) { d.updateToast(tid, { kind: 'ok', title: w.done, detail: lastLine(o.result.output) || undefined, progress: undefined, job: undefined }); w.after?.(); } - else d.updateToast(tid, { kind: 'bad', title: t('write.failed'), detail: lastLine(o.result?.output ?? '') || undefined, progress: undefined, job: undefined }); + else d.updateToast(tid, { kind: 'bad', title: t('write.failed'), detail: withHint(lastLine(o.result?.output ?? '') || undefined), progress: undefined, job: undefined }); return o; } catch (e) { const msg = errorText(e); @@ -377,7 +380,7 @@ export function useRead(target: string, method: string, o: { network: boolean } else { const msg = lastLine(r.output) || t('common.exit', { code: r.exitCode }); set(x => ({ ...x, loading: false, error: msg, command: r.command })); - if (tid) d.updateToast(tid, { kind: 'bad', title: t('toast.readFailedWhat', { what: o.title ?? method }), detail: msg, progress: undefined, job: undefined }); + if (tid) d.updateToast(tid, { kind: 'bad', title: t('toast.readFailedWhat', { what: o.title ?? method }), detail: withHint(msg), progress: undefined, job: undefined }); } } catch (e) { if (my !== seq.current) return; diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css index 6c2a0109..af4fa652 100644 --- a/apps/desktop/src/styles.css +++ b/apps/desktop/src/styles.css @@ -771,3 +771,114 @@ textarea.input { height: auto; padding: 8px 10px; line-height: 1.45; resize: ver .table.pf th:last-child, .table.pf td:last-child { padding-right: 18px; } .table.pf .cell-app .s { max-width: 200px; } .table.pf .mini-health .spark { width: 56px; } + + +/* ---- full CLI coverage: export menu, prices, store art, growth chart, app info, onboarding studio ---- */ +.tabs { overflow-x: auto; scrollbar-width: none; } +.tabs::-webkit-scrollbar { display: none; } +.tab { flex: none; } +.menu-wrap { position: relative; } +.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 280px; max-width: 360px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); display: grid; gap: 1px; animation: rise var(--speed) var(--ease); } +.menu-item { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--ink-2); } +.menu-item > svg { width: 16px; height: 16px; color: var(--muted); flex: none; } +.menu-item .grow { flex: 1; min-width: 0; display: grid; gap: 1px; } +.menu-item .mi-t { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.menu-item .mi-s { font-size: var(--t-micro); color: var(--muted); } +.menu-item:hover, .menu-item:focus-visible { background: var(--accent-soft); outline: none; } +.menu-item:hover > svg, .menu-item:focus-visible > svg { color: var(--accent-solid); } +.menu-item[aria-disabled="true"] .mi-t { color: var(--muted); } +.fix-hint { display: inline-flex; align-items: flex-start; gap: 6px; font-weight: 560; color: var(--ink-2); } +.fix-hint svg { width: 13px; height: 13px; margin-top: 2px; flex: none; color: var(--accent-solid); } +.notice .fix-hint { color: inherit; } +.err-foot { align-items: flex-start; color: var(--bad-ink); } +.err-foot .grow { display: grid; gap: 4px; } +.err-foot .fix-hint { color: var(--ink-2); } +.chips { display: flex; flex-wrap: wrap; gap: 4px; } +.bad-ink { color: var(--bad-ink); } .warn-ink { color: var(--warn-ink); } + +/* prices */ +.px-matrix td { vertical-align: top; } +.px-matrix tbody tr.sel td { background: var(--accent-soft); } +.px-matrix tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent-solid); } +.px-stack { display: grid; gap: 3px; justify-items: start; } +.px-line { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-meta); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; } +.px-line svg { width: 12px; height: 12px; color: var(--muted); } +.px-line.auto { color: var(--muted); font-weight: 500; } + +/* app info */ +.ask-card { border-color: color-mix(in srgb, var(--warn-solid) 45%, var(--line)); box-shadow: var(--shadow-1), inset 3px 0 0 var(--warn-solid); } +.ask-card .card-head h2 > svg { color: var(--warn-solid); } +.ask-card .fix { margin-top: 4px; } +.notes-preview { max-height: 120px; overflow: auto; font-size: var(--t-meta); } +.ds-changes { max-height: 180px; overflow: auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); } +.ds-changes code { font-size: 10.5px; } + +/* store art */ +.art-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; border-bottom: 1px solid var(--line); } +.art-bar .grow { flex: 1; } +.art-rows { display: grid; } +.art-row { padding: 14px 18px; border-top: 1px solid var(--line); display: grid; gap: 10px; } +.art-row:first-child { border-top: 0; } +.art-row.bad { box-shadow: inset 3px 0 0 var(--bad-solid); } +.art-row h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--t-body); font-weight: 650; } +.art-row h3 code { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 450; } +.art-tiles { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; } +.art-tile { margin: 0; flex: none; width: var(--tw, 150px); display: grid; gap: 5px; align-content: start; } +.art-pic { all: unset; box-sizing: border-box; display: block; width: 100%; aspect-ratio: var(--ar); background: var(--bg-sunken); border-radius: 10px; overflow: hidden; cursor: zoom-in; position: relative; border: 2px solid transparent; box-shadow: var(--shadow-1); transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease); } +.art-pic:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); } +.art-pic:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } +.art-pic img { width: 100%; height: 100%; object-fit: contain; display: block; } +.art-tile.err .art-pic { border-color: var(--bad-solid); } +.art-tile.warn .art-pic { border-color: var(--warn-solid); } +.art-ph { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--faint); font-size: var(--t-micro); padding: 10px; text-align: center; } +.art-ph svg { width: 20px; height: 20px; } +.art-ph .sk-block { width: 100%; height: 100%; border-radius: 0; position: absolute; inset: 0; } +.art-play { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; display: grid; place-items: center; background: rgba(10, 15, 26, .62); color: #fff; } +.art-play svg { width: 16px; height: 16px; margin-left: 2px; } +.art-tile figcaption { display: flex; justify-content: space-between; gap: 6px; font-size: 10.5px; } +.art-tile figcaption .muted { font-variant-numeric: tabular-nums; white-space: nowrap; } +.art-issues li { padding-left: 12px; position: relative; overflow-wrap: anywhere; } +.art-issues li::before { content: ""; position: absolute; left: 1px; top: .45em; width: 6px; height: 6px; border-radius: 50%; background: var(--warn-solid); } +.art-issues li.error { color: var(--bad-ink); } +.art-issues li.error::before { background: var(--bad-solid); } +.fchip .tag-count { margin-left: -2px; } +.lightbox { place-items: center; padding: 28px; } +.lb { width: min(1100px, 100%); max-height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-3); overflow: hidden; outline: none; animation: rise var(--speed) var(--ease); } +.lb-img { min-height: 0; display: grid; place-items: center; background: var(--bg-sunken); padding: 16px; } +.lb-img img { max-width: 100%; max-height: calc(100vh - 190px); object-fit: contain; border-radius: 8px; box-shadow: var(--shadow-2); } +.lb-img .stack { width: 320px; } +.lb-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); } +.lb-foot .grow { flex: 1; min-width: 0; display: grid; gap: 2px; } + +/* growth chart */ +.lchart { display: grid; gap: 8px; } +.lchart svg { width: 100%; height: auto; display: block; overflow: visible; outline: none; border-radius: 8px; } +.lchart svg:focus-visible { box-shadow: 0 0 0 2px var(--focus); } +.lchart .grid-l line { stroke: var(--line); stroke-width: 1; } +.lchart text { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; } +.lchart .stop-a { stop-color: var(--accent-solid); stop-opacity: .18; } +.lchart .stop-b { stop-color: var(--accent-solid); stop-opacity: 0; } +.lchart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } +.lchart .ln.l1 { stroke: var(--accent-solid); } +.lchart .ln.l2 { stroke: var(--ok-solid); } +.lchart .ln.l3 { stroke: var(--warn-solid); stroke-dasharray: 5 4; } +.lchart circle.l1 { fill: var(--accent-solid); } .lchart circle.l2 { fill: var(--ok-solid); } .lchart circle.l3 { fill: var(--warn-solid); } +.lchart .ev line { stroke: var(--info-solid); stroke-width: 1.25; stroke-dasharray: 3 4; } +.lchart .ev circle { fill: var(--info-solid); stroke: var(--surface); stroke-width: 2; cursor: help; } +.lchart .hov line { stroke: var(--line-2); stroke-width: 1; } +.lchart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--t-meta); color: var(--muted); align-items: center; } +.lchart-legend .lg { display: inline-flex; align-items: center; gap: 6px; } +.lchart-legend b { color: var(--ink); font-weight: 650; } +.lchart-legend .sw { width: 14px; height: 3px; border-radius: 2px; background: var(--accent-solid); } +.lchart-legend .sw.l2 { background: var(--ok-solid); } +.lchart-legend .sw.l3 { background: repeating-linear-gradient(90deg, var(--warn-solid) 0 5px, transparent 5px 8px); } +.lchart-legend .sw.ev { width: 8px; height: 8px; border-radius: 50%; background: var(--info-solid); } + +/* onboarding: three choices, studio pick */ +.choice-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } +button.ck.ck-pick { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; } +button.ck.ck-pick:hover { border-color: var(--accent-line); } +button.ck.ck-pick:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } +button.ck.ck-pick[aria-checked="true"] { border-color: var(--accent-solid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-solid) 16%, transparent); } +.studio-new { cursor: default; } +.studio-new:hover { border-color: var(--line); box-shadow: none; } diff --git a/apps/desktop/src/ui/Exports.tsx b/apps/desktop/src/ui/Exports.tsx new file mode 100644 index 00000000..ed9cf76c --- /dev/null +++ b/apps/desktop/src/ui/Exports.tsx @@ -0,0 +1,106 @@ +// Exports of the current screen: each screen registers what it can save (useExports); the top bar shows them in one +// "Export" menu at the top right of every screen, and the command palette lists them under "Export". Saving goes +// through the host's native save dialog (Downloads first); exports with personal data get the host's note first. +import { createContext, type ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; +import { api, errorText, type ExportKind } from '../api'; +import { t } from '../i18n'; +import { useData } from '../store'; +import { Icon, type IconName } from './icons'; + +export interface ExportItem { + id: string; + label: string; + icon?: IconName; + kind: ExportKind; + /** File name without the extension ("Prism Puddle prices 2026-10-11"). */ + file: string; + /** Reviewer names, texts: the host shows the personal-data note before the save dialog. */ + personal?: boolean; + /** Not available yet (nothing read): the menu says why. */ + disabled?: string | false; + build: () => string | Promise; +} + +interface Ctx { items: ExportItem[]; set: (owner: string, items: ExportItem[] | null) => void } +const ExportCtx = createContext(null); + +export function ExportProvider({ children }: { children: ReactNode }) { + const [map, setMap] = useState>({}); + const set = useCallback((owner: string, items: ExportItem[] | null) => setMap(m => { + const next = { ...m }; + if (items) next[owner] = items; else delete next[owner]; + return next; + }), []); + const items = useMemo(() => Object.values(map).flat(), [map]); + return ({ items, set }), [items, set])}>{children}; +} + +export const useExportItems = (): ExportItem[] => useContext(ExportCtx)?.items ?? []; + +/** Registers this screen's exports while it is shown. `build` closures always see the latest data. */ +export function useExports(owner: string, items: ExportItem[]) { + const ctx = useContext(ExportCtx); + const ref = useRef(items); + ref.current = items; + const key = items.map(i => `${i.id}:${i.label}:${i.disabled || ''}:${i.file}`).join('|'); + useEffect(() => { + if (!ctx) return; + ctx.set(owner, ref.current.map((it, n) => ({ ...it, build: () => ref.current[n]!.build() }))); + return () => ctx.set(owner, null); + }, [owner, key]); // eslint-disable-line react-hooks/exhaustive-deps +} + +/** Runs one export: build, native save dialog, a toast with where it went. */ +export function useRunExport() { + const d = useData(); + return useCallback(async (it: ExportItem) => { + if (it.disabled) { d.toast({ kind: 'info', title: it.label, detail: it.disabled }); return; } + try { + const content = await it.build(); + const path = await api.exportSave(it.file, it.kind, content, !!it.personal); + if (path) d.toast({ kind: 'ok', title: t('export.saved'), detail: path }); + } catch (e) { d.toast({ kind: 'bad', title: t('export.failed'), detail: errorText(e) }); } + }, [d]); +} + +/** The top-right "Export" button and its menu (hidden when the screen has nothing to export). */ +export function ExportMenu() { + const items = useExportItems(); + const run = useRunExport(); + const [open, setOpen] = useState(false); + const root = useRef(null); + useEffect(() => { + if (!open) return; + const close = (e: MouseEvent) => { if (!root.current?.contains(e.target as Node)) setOpen(false); }; + const key = (e: KeyboardEvent) => { if (e.key === 'Escape') { setOpen(false); root.current?.querySelector('button')?.focus(); } }; + window.addEventListener('mousedown', close); + window.addEventListener('keydown', key); + root.current?.querySelector('[role="menuitem"]')?.focus(); + return () => { window.removeEventListener('mousedown', close); window.removeEventListener('keydown', key); }; + }, [open]); + if (!items.length) return null; + const onMenuKey = (e: React.KeyboardEvent) => { + const els = [...(root.current?.querySelectorAll('[role="menuitem"]') ?? [])]; + const i = els.indexOf(document.activeElement as HTMLElement); + if (e.key === 'ArrowDown') { e.preventDefault(); els[(i + 1) % els.length]?.focus(); } + if (e.key === 'ArrowUp') { e.preventDefault(); els[(i - 1 + els.length) % els.length]?.focus(); } + }; + return ( +
+ + {open && ( +
+ {items.map(it => ( + + ))} +
+ )} +
+ ); +} diff --git a/apps/desktop/src/ui/LineChart.tsx b/apps/desktop/src/ui/LineChart.tsx new file mode 100644 index 00000000..4775e0c6 --- /dev/null +++ b/apps/desktop/src/ui/LineChart.tsx @@ -0,0 +1,59 @@ +// A small two-axis line chart for daily store analytics: counts on the left axis (reach, installs), a rate on the +// right (conversion), store changes from git as dashed markers. Hover (or arrow keys when focused) shows one day. +import { type KeyboardEvent, useId, useState } from 'react'; +import { date, num, pct } from '../lib/format'; + +export interface ChartLine { label: string; values: (number | null)[]; cls: 'l1' | 'l2' | 'l3'; axis: 'left' | 'right' } + +export function LineChart({ dates, lines, events, label, eventsLabel }: { dates: string[]; lines: ChartLine[]; events: { date: string; subject: string }[]; label: string; eventsLabel: string }) { + const W = 800, H = 230, L = 46, R = 46, T = 12, B = 26; + const gid = useId().replace(/:/g, ''); + const [hover, setHover] = useState(null); + const n = dates.length; + if (n < 2) return null; + const x = (i: number) => L + (i / (n - 1)) * (W - L - R); + const max = (axis: 'left' | 'right') => Math.max(...lines.filter(l => l.axis === axis).flatMap(l => l.values.filter((v): v is number => v !== null)), axis === 'right' ? 0.001 : 1) * 1.1; + const mL = max('left'), mR = max('right'); + const y = (v: number, axis: 'left' | 'right') => H - B - (v / (axis === 'left' ? mL : mR)) * (H - T - B); + const path = (l: ChartLine) => l.values.map((v, i) => (v === null ? '' : `${i && l.values[i - 1] !== null ? 'L' : 'M'}${x(i).toFixed(1)} ${y(v, l.axis).toFixed(1)}`)).join(' '); + const ticks = [0, 0.5, 1]; + const onMove = (ev: React.MouseEvent) => { + const r = ev.currentTarget.getBoundingClientRect(); + const px = ((ev.clientX - r.left) / r.width) * W; + setHover(Math.max(0, Math.min(n - 1, Math.round(((px - L) / (W - L - R)) * (n - 1))))); + }; + const onKey = (ev: KeyboardEvent) => { + if (ev.key === 'ArrowRight') { ev.preventDefault(); setHover(h => Math.min(n - 1, (h ?? -1) + 1)); } + if (ev.key === 'ArrowLeft') { ev.preventDefault(); setHover(h => Math.max(0, (h ?? n) - 1)); } + }; + const fmt = (l: ChartLine, v: number | null) => (v === null ? '–' : l.axis === 'right' ? pct(v, 1) : num(v)); + return ( +
+ setHover(null)} onKeyDown={onKey} onBlur={() => setHover(null)}> + + {ticks.map(f => ( + + + {num(f * mL / 1.1)} + {pct(f * mR / 1.1, 1)} + + ))} + {events.map((e, i) => { + const k = dates.indexOf(e.date); + if (k < 0) return null; + return {`${date(e.date)} · ${e.subject}`}; + })} + {lines[0] && } + {lines.map(l => )} + {hover !== null && {lines.map(l => (l.values[hover] === null ? null : ))}} + {date(dates[0])} + {date(dates[n - 1])} + +
+ {hover !== null && {date(dates[hover])}} + {lines.map(l => {l.label}{hover !== null && {fmt(l, l.values[hover] ?? null)}})} + {events.length > 0 && {eventsLabel}} +
+
+ ); +} diff --git a/apps/desktop/src/ui/icons.tsx b/apps/desktop/src/ui/icons.tsx index ca560fb1..2a27d893 100644 --- a/apps/desktop/src/ui/icons.tsx +++ b/apps/desktop/src/ui/icons.tsx @@ -61,6 +61,14 @@ const P = { sliders: 'M4 6.5h9M17 6.5h3M4 12h3M11 12h9M4 17.5h11M19 17.5h1M15 4.5v4M9 10v4M17 15.5v4', rotate: 'M4 12a8 8 0 1 0 2.4-5.7L4 8.5M4 4v4.5h4.5', cloud: 'M7 18.5h10.5a4 4 0 0 0 .6-8 6 6 0 0 0-11.6 1.6A3.3 3.3 0 0 0 7 18.5z', + coins: 'M9 10c3.3 0 6-1.1 6-2.5S12.3 5 9 5 3 6.1 3 7.5 5.7 10 9 10zM3 7.5v4C3 12.9 5.7 14 9 14s6-1.1 6-2.5v-4M9 18c3.3 0 6-1.1 6-2.5v-4M3 11.5v4C3 16.9 5.7 18 9 18M15.5 10.2c3 .2 5.5 1.2 5.5 2.3v4c0 1.4-2.7 2.5-6 2.5-1.3 0-2.5-.2-3.5-.5', + chart: 'M4 19.5h16M6.5 16l4-5 3 3 5-7M15.5 7h3v3', + flask: 'M9.5 3.5h5M10.5 3.5v5.2L5 18.2a1.5 1.5 0 0 0 1.3 2.3h11.4a1.5 1.5 0 0 0 1.3-2.3l-5.5-9.5V3.5M7.5 14.5h9', + grid: 'M4 4h4.5v6H4zM9.75 4h4.5v6h-4.5zM15.5 4H20v6h-4.5zM4 14h4.5v6H4zM9.75 14h4.5v6h-4.5zM15.5 14H20v6h-4.5z', + clipboard: 'M9 4.5H6.5A1.5 1.5 0 0 0 5 6v13.5A1.5 1.5 0 0 0 6.5 21h11a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H15M9 3h6v3H9zM8.5 11.5l2 2 4-4M8.5 17h7', + share: 'M12 15V3.5M7.5 8 12 3.5 16.5 8M5 12.5v6A1.5 1.5 0 0 0 6.5 20h11a1.5 1.5 0 0 0 1.5-1.5v-6', + lock: 'M6.5 10.5h11A1.5 1.5 0 0 1 19 12v7a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 5 19v-7a1.5 1.5 0 0 1 1.5-1.5zM8.5 10.5V7.5a3.5 3.5 0 0 1 7 0v3', + question: 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9.6 9.3a2.5 2.5 0 0 1 4.8.9c0 1.7-2.4 2.2-2.4 3.8M12 17v.1', } as const; export type IconName = keyof typeof P; diff --git a/apps/desktop/src/ui/kit.tsx b/apps/desktop/src/ui/kit.tsx index f7746d3c..adacf5b2 100644 --- a/apps/desktop/src/ui/kit.tsx +++ b/apps/desktop/src/ui/kit.tsx @@ -5,6 +5,7 @@ import type { ReleasePhase, StoreRelease } from '../api'; import { t } from '../i18n'; import { share } from '../lib/format'; import { hueOf, monogram, type Tone } from '../lib/model'; +import { fixHint } from '../lib/views'; import { Icon, type IconName, StoreGlyph } from './icons'; import { Illo, type IlloName } from './illustrations'; @@ -109,6 +110,25 @@ export function Notice({ tone, children, icon, action }: { tone: 'bad' | 'warn' return
{children}
{action}
; } +/** A failed read or write in words, with how to fix it when the error is a known one ("errors that say how to fix"). */ +export function ErrorNotice({ error, tone = 'warn', keep, action }: { error: string; tone?: 'bad' | 'warn'; keep?: boolean; action?: ReactNode }) { + const hint = fixHint(error); + return ( + +
+ {keep ? t('common.readFailedKeep', { error }) : error} + {hint && {t(hint)}} +
+
+ ); +} + +/** A card footer with a failed read and, when known, how to fix it. */ +export function ErrorFoot({ error }: { error: string }) { + const hint = fixHint(error); + return
{error}{hint && {t(hint)}}
; +} + export function Skeleton({ lines = 3, block }: { lines?: number; block?: boolean }) { return (
diff --git a/apps/desktop/tests/complete.test.ts b/apps/desktop/tests/complete.test.ts new file mode 100644 index 00000000..a22b5289 --- /dev/null +++ b/apps/desktop/tests/complete.test.ts @@ -0,0 +1,65 @@ +// Full CLI coverage, window side: export formats (the prices CSV re-imports), price matrix, diff summary, chart +// series, store art filters and the "how to fix it" hints. +import { describe, expect, test } from 'bun:test'; +import type { PricesCurrent } from '../src/api'; +import { csv, mdTable, pricesCsv, reviewsCsv } from '../src/lib/exports'; +import { chartSeries, diffSummary, fixHint, priceMatrix, priceStats, regionRows } from '../src/lib/views'; +import { parsePriceCsv } from '../../../cli/lib/prices'; + +const P: PricesCurrent = { + csv: '/x/store/prices.csv', products: ['a', 'b'], stores: ['apple', 'play'], missing: [{ product: 'b', store: 'play' }], + rows: [ + { product: 'a', store: 'apple', region: 'US', currency: 'USD', price: 0.99, kind: 'manual' }, + { product: 'a', store: 'apple', region: 'TR', currency: 'TRY', price: 39.99, kind: 'auto' }, + { product: 'a', store: 'apple', region: 'TR', currency: 'TRY', price: 29.99, kind: 'manual' }, + { product: 'a', store: 'play', region: 'US', currency: 'USD', price: 0.99 }, + { product: 'a', store: 'play', region: 'TR', currency: 'TRY', price: 19.99 }, + { product: 'a', store: 'apple', region: 'BR', currency: 'BRL', price: 6.9, startDate: '2030-01-01', kind: 'manual' }, + { product: 'b', store: 'apple', region: 'US', currency: 'USD', price: 4.99, kind: 'manual' }, + ], +}; + +describe('exports', () => { + test('CSV quoting and formula guard', () => { + expect(csv(['a', 'b'], [['x,y', '=SUM(A1)'], [-1, null]])).toBe('a,b\n"x,y",\'=SUM(A1)\n-1,\n'); + expect(mdTable(['a'], [['x|y']])).toBe('| a |\n| --- |\n| x\\|y |\n'); + }); + test('the prices CSV is the `prices import` sheet', () => { + const rows = parsePriceCsv(pricesCsv(P), { products: ['a', 'b'], today: '2026-01-01' }); + expect(rows.filter(r => r.kind !== 'auto').length).toBe(6); + expect(rows.filter(r => r.region === 'TR' && r.store === 'apple').map(r => r.price)).toEqual([29.99]); + expect(rows.find(r => r.region === 'BR')?.startDate).toBe('2030-01-01'); + }); + test('reviews CSV', () => { + expect(reviewsCsv([{ store: 'play', id: '1', rating: 2, body: 'Crash, again', date: '2026-10-01T10:00:00Z', where: 'en' }]).split('\n')[1]).toBe('Google Play,2026-10-01,2,en,,,"Crash, again",no,'); + }); +}); + +describe('views', () => { + test('region rows: manual wins over equalized, scheduled apart, gap in one currency', () => { + const r = regionRows(P, 'a'); + expect(r.map(x => x.region)).toEqual(['US', 'BR', 'TR']); + const tr = r.find(x => x.region === 'TR')!; + expect(tr.apple).toEqual({ price: 29.99, currency: 'TRY', kind: 'manual' }); + expect(Math.round(tr.gapPct!)).toBe(33); + expect(r.find(x => x.region === 'BR')!.scheduled?.startDate).toBe('2030-01-01'); + expect(priceMatrix(P).regions).toEqual(['US', 'BR', 'TR']); + expect(priceStats(P).gaps).toBe(1); + }); + test('diff summary', () => { + expect(diffSummary([{ product: 'a', store: 'play', region: 'TR', currency: 'TRY', from: 10, to: 12, change: 'change' }, { product: 'b', store: 'play', region: 'KR', currency: 'KRW', from: null, to: 1, change: 'new' }, + { product: 'a', store: 'apple', region: 'US', currency: 'USD', from: 1, to: 1, change: 'same' }], ['a|play', 'b|play'])).toEqual({ changed: 1, added: 1, same: 1, up: 1, down: 0, products: ['a', 'b'], pairs: 2 }); + }); + test('chart series and events', () => { + const s = chartSeries({ snapshots: 1, since: '2026-01-01', series: { apple: [{ date: '2026-01-01', impressions: 100, uniqueImpressions: 0, pageViews: 0, uniquePageViews: 0, downloads: 5, firstTimeDownloads: 0 }, { date: '2026-01-02', impressions: 0, uniqueImpressions: 0, pageViews: 0, uniquePageViews: 0, downloads: 0, firstTimeDownloads: 0 }], play: [] }, + effects: [{ event: { date: '2026-01-02', commit: 'abc', subject: 'x', files: [] }, store: 'apple', before: {}, after: {}, daysBefore: 1, daysAfter: 1 }] }, 'apple'); + expect(s.conversion).toEqual([0.05, null]); + expect(s.events).toEqual([{ date: '2026-01-02', subject: 'x', commit: 'abc' }]); + }); + test('errors that say how to fix them', () => { + expect(fixHint('PLAY_SERVICE_ACCOUNT is not set (env ...)')).toBe('hint.keys'); + expect(fixHint('no snapshots in /x/.storebound/analytics (storebound analytics snapshot)')).toBe('hint.snapshot'); + expect(fixHint('ffmpeg not found')).toBe('hint.ffmpeg'); + expect(fixHint('something else')).toBeNull(); + }); +}); diff --git a/docs/desktop.md b/docs/desktop.md index 3e486f37..a4c795da 100644 --- a/docs/desktop.md +++ b/docs/desktop.md @@ -9,8 +9,8 @@ development; this page is for contributors. (`storebound serve --stdio`, compiled with `bun tools/build-sidecars.ts`) and asks it for everything. - **App-centric.** One app = one product with up to two platforms (iOS bundle id / App Store Connect app id, Android package name), one `storebound.config.ts` per app folder, many apps per workspace. Navigation: Portfolio -> App - (Releases, Catalog, Listings, Health, Reviews, TestFlight) plus the workspace screens (App folders, Accounts, - Dependencies, Settings). + (Releases, Catalog, Prices, Listings, Store art, Health, Reviews, TestFlight, Growth, App info, Checks) plus the + workspace screens (App folders, Accounts, Dependencies, Settings). - **Release trains.** A version (for example 2.3.0) spans both stores: iOS build and Android versionCode, per-store state (TestFlight, review, live, phased release, rollout fraction). `portfolio.status` returns per app the current train (highest version live on a store) and the next one (highest version above it anywhere). @@ -114,8 +114,8 @@ host state file (`overrides_set`, every key checked in `workspace.rs`). - The host checks the target and the account kinds, and passes `virtual: { name, apple, play }`. The sidecar writes a minimal `storebound.config.json` (store ids, placeholder links) into its temp folder. - Only `apple.status`, `play.status`, `health`, `reviews.list`, `apple.testflight_status` and `apple.ppo_status` work - this way, and `portfolio.status` takes store-only entries. -- "Link a folder" or "Start an app folder here" turn it into a full app. + this way (tabs Releases, Health, Reviews, TestFlight, Growth), and `portfolio.status` takes store-only entries. +- "Link a folder", "Start an app folder here" or "Import from fastlane" turn it into a full app. ### Settings @@ -138,12 +138,62 @@ Each write is a dry run, then the native dialog, then the real run, with one pro - **Listings tab:** Play listing text, App Store version and text, Play graphics, App Store screenshots and previews; local render jobs (screenshots, previews, icons, gallery). -- **Catalog tab:** Play products and subscriptions, App Store IAPs and subscriptions, price export. Price import - stays a terminal step. +- **Catalog tab:** Play products and subscriptions, App Store IAPs and subscriptions, price export. +- **Prices tab:** the price sheet compared with the stores and applied (`owner.prices_import`, an owner action). +- **App info tab:** Play Data safety upload, App Store app info, export compliance, App Review details. +- **Growth tab:** analytics snapshot and report request, PPO create and treatment upload; PPO start / stop + (`owner.ppo_start`, `owner.ppo_stop`, owner actions). +- **Store art tab:** render, review page. - **Releases tab:** rollout and phased release owner actions. - **TestFlight tab:** What to Test, internal groups, testers. - **Reviews tab:** reply editor (`reviews.reply`), approve, send (owner action). +## Every CLI area in the window + +| CLI | where in the window | +|---|---| +| `prices export --json` (new, read-only) | Prices: product x territory matrix (both stores, Apple manual / equalized), per-territory table with gaps | +| `prices export` | Prices: "Write store/prices.csv" (confirm flow); "Export prices CSV" saves the same sheet anywhere | +| `prices import --dry --json` / `prices import` | Prices: compare store/prices.csv or a picked CSV (`price_sheet_pick`), diff table, Apply = `owner.prices_import` | +| `inspect --declarations --json` (new) | App info: Data safety, App Privacy suggestions, app info, encryption, review details, "ask the owner" items | +| `play data-safety` | App info: Upload (keeps `.storebound/data-safety.uploaded.csv`, so the tab shows changes since; Play cannot read the form back) | +| `apple appinfo`, `apple encryption`, `apple review-details` | App info: Push buttons (confirm flow) | +| `apple ppo status / create / upload / start / stop` | Growth: tests table, create, upload, Start / Stop owner actions | +| Play store listing experiments | no API: Growth links Play Console and the variant renders | +| `analytics compare --json`, `snapshot`, `setup` | Growth: chart (reach, installs, conversion, listing changes as markers), before / after table, snapshot and setup buttons | +| `shots gallery --json`, `inspect --render` (new) | Store art: grid per variant / language / size, issues, lightbox; images load lazily one at a time as data: URLs (never cached) | +| `shots render`, `shots gallery` | Store art: Render (language, variant), Write review page, Open review page / folder (`project_reveal`) | +| `inspect --listing-text --json` (new) | Listings export (Markdown) | +| `import fastlane` | First-run guide, App folders, store-only app banner (`project_import_fastlane`: plan in a native dialog first) | + +**Exports.** Every screen registers what it can save (`src/ui/Exports.tsx`): the "Export" menu at the top right of +the top bar and the "Export" group of the command palette. Files: prices CSV (the `prices import` format), listings +(md), reviews CSV, health report (md), catalog parity (md), store readiness report (md), store declarations (md), +Data safety CSV, analytics CSV, portfolio CSV. `export_save` writes only through a native save dialog (Downloads +first), only csv / md / json / txt, sanitized names, at most 16 MB; the reviews export shows a native personal-data +note first. + +## UX audit (full CLI coverage) + +- **Two clicks.** From an app page every action is one tab plus one button: prices, Data safety, app info, review + details, PPO, analytics, renders. The command palette jumps to Prices and Store art and runs every export. +- **One place for exports.** Before, the only export was a write button in Catalog. Now each screen's exports sit in + one menu at the top right (the same spot on every screen) and in the palette; disabled items say why. +- **Buttons.** Card head actions go from secondary (ghost: open, show) to the primary action at the right end; owner + actions are named on the button and in their native dialog. App folders: Import from fastlane, Start an app folder, + Add app folder (primary) in the page header, the same three in the empty state; each folder row has Open and Show. +- **Empty states say what to do.** Prices not read (Read prices), no products (where to add them), no snapshots (what + a snapshot is, the bucket for Play), no PPO tests (create from a variant, or add variants), no renders (Render), no + Data safety answers (which skill), store-only app (Link a folder / Start / Import). +- **Errors say how to fix.** `fixHint` (src/lib/views.ts) maps known CLI errors (keys, permissions, config values, + ffmpeg, Chrome, renders, snapshots, bucket, editable version, fastlane folder, price sheet, price points, network, + history) to the step that fixes them, shown under read errors and in failure toasts. +- **Ask, never guess.** App info opens with the questions only the owner can answer (age rating, App Privacy linked / + tracking, encryption, sign-in, contact), highlighted in amber, each with how to answer. +- **First run.** The guide now starts with the studio (pick or create, with a colour), so the keys added two steps + later land in it; the app step offers add / start / import from fastlane side by side. +- **Tabs.** Eleven app tabs fit 1440 px; narrower windows scroll the tab bar sideways instead of wrapping. + R&D on a fastlane importer and a RevenueCat adapter: `docs/research/fastlane-revenuecat.md`. ## Dependencies screen