Desktop D2 UI: design system, portfolio, release timeline, catalog parity, listings, health, reviews, TestFlight, checks, command palette, toasts, first-run guide, en + tr with i18n check, 7:1 theme check, dev fixture mode and screenshot harness
This commit is contained in:
parent
7388c8ab37
commit
33e2101d27
44 changed files with 5475 additions and 742 deletions
384
apps/desktop/src/dev/fixtures.ts
Normal file
384
apps/desktop/src/dev/fixtures.ts
Normal file
|
|
@ -0,0 +1,384 @@
|
|||
// DEV-ONLY FIXTURE MODE (VITE_FIXTURES=1). Answers every app command with made-up data built around the two demo apps
|
||||
// of this repo (examples/demo-game "Prism Puddle", examples/demo-app "Tidy Lists"), so every screen can be shown and
|
||||
// screenshotted without store accounts, in a browser or in `tauri dev`. Nothing here is real store data; the window
|
||||
// shows a "DEV FIXTURES" badge. src/api.ts only imports this module behind import.meta.env.DEV, so release builds do
|
||||
// not contain it (tests/webview.test.ts checks the built files for FIXTURE_MARKER).
|
||||
import type { Account, AppStatus, CacheEntry, DownloadEvent, DraftsResult, ListingField, ListingsResult, PortfolioResult, Project, ProjectSummary, StoreRelease, ToolResult } from '../api';
|
||||
import type { CatalogDiff, HealthSnapshot, MetricRow, Review, TestFlightStatus, ValidateResult } from '../lib/model';
|
||||
|
||||
export const FIXTURE_MARKER = 'storebound-dev-fixtures';
|
||||
|
||||
const HOME = '/home/you';
|
||||
const NOW = Date.now();
|
||||
const iso = (minutesAgo: number) => new Date(NOW - minutesAgo * 60_000).toISOString();
|
||||
const day = (daysAgo: number) => new Date(NOW - daysAgo * 86_400_000).toISOString().slice(0, 10);
|
||||
const sleep = (ms: number) => new Promise(r => setTimeout(r, ms));
|
||||
|
||||
// ---- events ----
|
||||
type Cb = (p: unknown) => void;
|
||||
const listeners = new Map<string, Set<Cb>>();
|
||||
export async function mockListen(event: string, cb: Cb): Promise<() => void> {
|
||||
if (!listeners.has(event)) listeners.set(event, new Set());
|
||||
listeners.get(event)!.add(cb);
|
||||
return () => { listeners.get(event)?.delete(cb); };
|
||||
}
|
||||
const emit = (event: string, payload: unknown) => { for (const cb of listeners.get(event) ?? []) cb(payload); };
|
||||
const cancelled = new Set<string>();
|
||||
|
||||
// ---- icons (fixture art, drawn for the demo apps) ----
|
||||
const svg = (s: string) => `data:image/svg+xml;base64,${btoa(s)}`;
|
||||
const ICONS: Record<string, string> = {
|
||||
'p-prism': svg(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#7c5cff"/><stop offset="1" stop-color="#ff5fa2"/></linearGradient></defs><rect width="64" height="64" fill="url(#g)"/><path d="M32 12 50 44H14z" fill="#fff" fill-opacity=".92"/><path d="M32 12 41 44H32z" fill="#ffd36e"/><path d="M46 46c0 4-3 7-6 7s-6-3-6-7 6-10 6-10 6 6 6 10z" fill="#5ee0ff" stroke="#fff" stroke-width="2"/></svg>`),
|
||||
'p-tidy': svg(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><defs><linearGradient id="g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2fd18b"/><stop offset="1" stop-color="#0f9d74"/></linearGradient></defs><rect width="64" height="64" fill="url(#g)"/><rect x="14" y="13" width="36" height="40" rx="7" fill="#fff"/><path d="M20 25l3 3 6-6M20 37l3 3 6-6" stroke="#0f9d74" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round"/><path d="M33 26h11M33 38h11" stroke="#b6e8d4" stroke-width="3" stroke-linecap="round"/></svg>`),
|
||||
};
|
||||
|
||||
// ---- workspace ----
|
||||
let projects: Project[] = [
|
||||
{ id: 'p-prism', path: `${HOME}/apps/prism-puddle`, name: 'Prism Puddle', playAccount: 'a-play', appleAccount: 'a-apple', added: iso(60 * 24 * 12) },
|
||||
{ id: 'p-tidy', path: `${HOME}/apps/tidy-lists`, name: 'Tidy Lists', playAccount: 'a-play', appleAccount: 'a-apple', added: iso(60 * 24 * 5) },
|
||||
];
|
||||
let accounts: Account[] = [
|
||||
{ id: 'a-play', label: 'Example Studio · Play', kind: 'play', created: iso(60 * 24 * 12) },
|
||||
{ id: 'a-apple', label: 'Example Studio · App Store', kind: 'apple', created: iso(60 * 24 * 12) },
|
||||
];
|
||||
if (import.meta.env.VITE_FIXTURES === 'empty') { projects = []; accounts = []; }
|
||||
|
||||
const SUMMARY: Record<string, ProjectSummary> = {
|
||||
'p-prism': {
|
||||
dir: `${HOME}/apps/prism-puddle`, config: `${HOME}/apps/prism-puddle/storebound.config.ts`, name: 'Prism Puddle', languages: ['en', 'tr', 'ja', 'ar'],
|
||||
play: { packageName: 'com.example.prismpuddle' }, apple: { bundleId: 'com.example.prismpuddle', appId: '6400000001' }, platforms: ['ios', 'android'],
|
||||
products: 4, productIds: ['coins_small', 'coins_large', 'no_ads', 'starter_pack'], subscriptions: 1, subscriptionIds: ['vip_pass_monthly'],
|
||||
catalog: { ios: ['coins_small', 'coins_large', 'no_ads', 'starter_pack', 'vip_pass_monthly'], android: ['coins_small', 'coins_large', 'no_ads', 'starter_pack', 'vip_pass_monthly'] },
|
||||
shots: true, testflightGroups: 3, profile: 'game', icon: `${HOME}/apps/prism-puddle/store/icons/app-store-1024.png`,
|
||||
},
|
||||
'p-tidy': {
|
||||
dir: `${HOME}/apps/tidy-lists`, config: `${HOME}/apps/tidy-lists/storebound.config.ts`, name: 'Tidy Lists', languages: ['en', 'tr'],
|
||||
play: { packageName: 'com.example.tidylists' }, apple: { bundleId: 'com.example.tidylists', appId: '6400000002' }, platforms: ['ios', 'android'],
|
||||
products: 1, productIds: ['tip_jar'], subscriptions: 2, subscriptionIds: ['pro_monthly', 'pro_yearly'],
|
||||
catalog: { ios: ['tip_jar', 'pro_monthly', 'pro_yearly'], android: ['tip_jar', 'pro_monthly', 'pro_yearly'] },
|
||||
shots: true, testflightGroups: 2, profile: 'app', icon: `${HOME}/apps/tidy-lists/store/icons/app-store-1024.png`,
|
||||
},
|
||||
};
|
||||
|
||||
const rel = (store: 'ios' | 'android', version: string, phase: StoreRelease['phase'], o: Partial<StoreRelease> = {}): StoreRelease =>
|
||||
({ store, version, build: null, state: phase.toUpperCase(), phase, fraction: null, track: store === 'android' ? 'production' : null, ...o });
|
||||
|
||||
const RELEASES: Record<string, StoreRelease[]> = {
|
||||
'p-prism': [
|
||||
rel('ios', '2.4.0', 'review', { build: '52', state: 'WAITING_FOR_REVIEW', date: iso(60 * 26) }),
|
||||
rel('ios', '2.3.0', 'rollout', { build: '48', state: 'READY_FOR_SALE', fraction: 0.2, phased: { state: 'ACTIVE', day: 5 }, date: iso(60 * 24 * 9) }),
|
||||
rel('ios', '2.2.1', 'other', { build: '44', state: 'REPLACED_WITH_NEW_VERSION', date: iso(60 * 24 * 30) }),
|
||||
rel('android', '2.4.0', 'testing', { build: '240', state: 'completed', track: 'internal' }),
|
||||
rel('android', '2.3.0', 'rollout', { build: '231', state: 'inProgress', fraction: 0.2 }),
|
||||
rel('android', '2.2.1', 'live', { build: '221', state: 'completed' }),
|
||||
],
|
||||
'p-tidy': [
|
||||
rel('ios', '1.5.0', 'draft', { build: '31', state: 'PREPARE_FOR_SUBMISSION', date: iso(60 * 20) }),
|
||||
rel('ios', '1.4.2', 'live', { build: '29', state: 'READY_FOR_SALE', fraction: 1, phased: { state: 'COMPLETE', day: 7 }, date: iso(60 * 24 * 21) }),
|
||||
rel('android', '1.5.0', 'testing', { build: '150', state: 'completed', track: 'beta' }),
|
||||
rel('android', '1.4.2', 'live', { build: '142', state: 'completed' }),
|
||||
],
|
||||
};
|
||||
|
||||
const train = (all: StoreRelease[], v: string) => ({ version: v, ios: all.find(r => r.store === 'ios' && r.version === v) ?? null, android: all.find(r => r.store === 'android' && r.version === v) ?? null });
|
||||
|
||||
function status(id: string, live: boolean): AppStatus {
|
||||
const s = SUMMARY[id]!;
|
||||
const all = RELEASES[id]!;
|
||||
const prism = id === 'p-prism';
|
||||
return {
|
||||
project: s.dir, ok: !prism, summary: s,
|
||||
app: { id: s.dir, name: s.name, platforms: { ios: { bundleId: s.apple!.bundleId, ascAppId: s.apple!.appId }, android: { packageName: s.play!.packageName } } },
|
||||
check: prism ? { ok: true, problems: [], warnings: ['store/listing.md: ja-JP "what\'s new" is empty', 'store/appstore.md: ar-SA subtitle is 31 characters (limit 30)'] } : { ok: true, problems: [], warnings: [] },
|
||||
release: live ? (prism ? { source: 'live', current: train(all, '2.3.0'), next: train(all, '2.4.0'), all } : { source: 'live', current: train(all, '1.4.2'), next: train(all, '1.5.0'), all }) : { source: 'none', current: null, next: null },
|
||||
catalog: live
|
||||
? (prism ? { checked: 'live', products: 4, subscriptions: 1, onlyIos: [], onlyAndroid: [], missingIos: [], missingAndroid: ['starter_pack'], ok: false }
|
||||
: { checked: 'live', products: 1, subscriptions: 2, onlyIos: [], onlyAndroid: [], missingIos: [], missingAndroid: [], ok: true })
|
||||
: { checked: 'config', products: s.products, subscriptions: s.subscriptions, onlyIos: [], onlyAndroid: [], missingIos: [], missingAndroid: [], ok: true },
|
||||
storeErrors: {}, errors: [],
|
||||
};
|
||||
}
|
||||
const portfolio = (live: boolean): PortfolioResult => ({ apps: projects.map(p => status(p.id, live)), at: live ? iso(14) : iso(0) });
|
||||
|
||||
// ---- per-app store reads ----
|
||||
const series = (n: number, base: number, drift: number, seed: number): number[] =>
|
||||
Array.from({ length: n }, (_, i) => Math.max(0.0001, base + drift * (i / n) + Math.sin(i * 1.7 + seed) * base * 0.09 + Math.cos(i * 0.6 + seed) * base * 0.05));
|
||||
function rows(metric: 'Crash' | 'Anr', vals: number[], w28: number): MetricRow[] {
|
||||
return vals.map((v, i) => ({ date: day(vals.length - i), dims: {}, values: {
|
||||
[`userPerceived${metric}Rate`]: v, [`${metric === 'Crash' ? 'crash' : 'anr'}Rate`]: v * 1.4, distinctUsers: 18_000 + i * 140,
|
||||
...(i === vals.length - 1 ? { [`userPerceived${metric}Rate28dUserWeighted`]: w28 } : {}),
|
||||
} }));
|
||||
}
|
||||
const HEALTH: Record<string, HealthSnapshot> = {
|
||||
'p-prism': {
|
||||
date: day(0),
|
||||
play: {
|
||||
window: { start: day(28), end: day(1), days: 28 },
|
||||
crash: rows('Crash', series(28, 0.0068, 0.0032, 1), 0.0091),
|
||||
anr: rows('Anr', series(28, 0.0024, 0.0004, 2), 0.0027),
|
||||
devices: [{ model: 'Galaxy A12', crash: 0.061, users: 1900 }, { model: 'Redmi 9A', crash: 0.042, users: 1400 }, { model: 'Moto G Power (2021)', crash: 0.019, users: 900 }, { model: 'Pixel 6a', crash: 0.008, users: 2100 }, { model: 'Galaxy S23', crash: 0.004, users: 2600 }],
|
||||
issues: [
|
||||
{ type: 'CRASH', cause: 'java.lang.IllegalStateException', location: 'com.example.prismpuddle.combo.ComboMeter.update', reports: 412, users: 268, lastVersion: '231' },
|
||||
{ type: 'ANR', cause: 'Input dispatching timed out', location: 'com.example.prismpuddle.MainActivity', reports: 133, users: 120, lastVersion: '231' },
|
||||
{ type: 'CRASH', cause: 'java.lang.OutOfMemoryError', location: 'android.graphics.Bitmap.createBitmap', reports: 74, users: 61, lastVersion: '221' },
|
||||
],
|
||||
},
|
||||
apple: {
|
||||
metrics: [
|
||||
{ category: 'Hangs', metric: 'Hang rate', unit: 's/h', version: '2.3.0', value: 1.9, goal: 'fair' },
|
||||
{ category: 'Launch', metric: 'Launch time', unit: 's', version: '2.3.0', value: 1.21, goal: 'good' },
|
||||
{ category: 'Memory', metric: 'Peak memory', unit: 'MB', version: '2.3.0', value: 412, goal: 'fair' },
|
||||
{ category: 'Disk', metric: 'Disk writes', unit: 'MB', version: '2.3.0', value: 38, goal: 'good' },
|
||||
{ category: 'Battery', metric: 'Foreground energy', unit: '%/h', version: '2.3.0', value: 9.4, goal: 'poor' },
|
||||
],
|
||||
signatures: [
|
||||
{ build: '48', type: 'HANGS', signature: 'ComboMeter.update(delta:) + 212', weight: 0.31 },
|
||||
{ build: '48', type: 'DISK_WRITES', signature: 'SaveStore.flush() + 88', weight: 0.12 },
|
||||
{ build: '47', type: 'LAUNCHES', signature: 'AssetCache.warmUp() + 64', weight: 0.07 },
|
||||
],
|
||||
betaCrashes: [{ build: '52', count: 3 }, { build: '51', count: 9 }, { build: '50', count: 5 }],
|
||||
},
|
||||
},
|
||||
'p-tidy': {
|
||||
date: day(0),
|
||||
play: { window: { start: day(28), end: day(1), days: 28 }, crash: rows('Crash', series(28, 0.0021, -0.0004, 3), 0.0019), anr: rows('Anr', series(28, 0.0009, 0.0001, 4), 0.001), devices: [{ model: 'Pixel 7', crash: 0.004, users: 800 }, { model: 'Galaxy A54', crash: 0.003, users: 1100 }], issues: [{ type: 'CRASH', cause: 'kotlin.UninitializedPropertyAccessException', location: 'com.example.tidylists.share.ShareSheet', reports: 21, users: 19, lastVersion: '142' }] },
|
||||
apple: { metrics: [{ category: 'Launch', metric: 'Launch time', unit: 's', version: '1.4.2', value: 0.62, goal: 'good' }, { category: 'Hangs', metric: 'Hang rate', unit: 's/h', version: '1.4.2', value: 0.2, goal: 'good' }], signatures: [], betaCrashes: [{ build: '31', count: 1 }] },
|
||||
},
|
||||
};
|
||||
|
||||
const R = (store: 'apple' | 'play', id: string, rating: number, title: string, body: string, where: string, daysAgo: number, reply?: string): Review =>
|
||||
({ store, id, rating, title: title || undefined, body, where, date: new Date(NOW - daysAgo * 86_400_000 - id.length * 3_600_000).toISOString(), appVersion: store === 'play' ? '2.3.0' : undefined, ...(reply ? { reply: { text: reply, date: new Date(NOW - (daysAgo - 1) * 86_400_000).toISOString() } } : {}) });
|
||||
const REVIEWS: Record<string, Review[]> = {
|
||||
'p-prism': [
|
||||
R('apple', 'r-a1', 5, 'Calm and clever', 'The color puzzles are so relaxing. Love that it works offline on the train.', 'USA', 1),
|
||||
R('play', 'r-p1', 2, 'Crashes after combo', 'Game closes when I reach a 20x combo on level 31. Lost my streak twice.', 'en', 1),
|
||||
R('apple', 'r-a2', 4, 'Great, but ads', 'Really pretty game. The ad after every level is a bit much, I bought no ads.', 'GBR', 2, 'Thank you! Remove Ads turns them off for good, and you can restore it on a new device from Settings.'),
|
||||
R('play', 'r-p2', 5, '', 'Çok güzel bir oyun, renkler harika ve müzik çok sakin.', 'tr', 2),
|
||||
R('apple', 'r-a3', 1, 'Lost progress', 'Updated and my map progress is gone. Please fix.', 'DEU', 3),
|
||||
R('play', 'r-p3', 3, 'Okay', 'Nice idea, later levels get repetitive. More star challenges please.', 'en', 4),
|
||||
R('apple', 'r-a4', 5, '最高', '色がきれいで、毎日少しずつ遊んでいます。', 'JPN', 5),
|
||||
R('play', 'r-p4', 4, 'Fun', 'Good time killer. Would love a dark mode for night play.', 'en', 5),
|
||||
R('apple', 'r-a5', 5, 'Perfect puzzle game', 'No timers, no pressure. Exactly what I wanted.', 'CAN', 8, 'Thank you for playing! More calm levels arrive in 2.4.'),
|
||||
R('apple', 'r-a6', 2, 'Hard to read', 'Text on the star map is tiny on my iPad.', 'AUS', 11),
|
||||
R('play', 'r-p5', 5, '', 'Beautiful and offline. Five stars from me.', 'en', 6),
|
||||
R('apple', 'r-a7', 4, 'Very nice', 'I like the new combo meter. Starter pack price feels high in Turkey.', 'TUR', 13),
|
||||
],
|
||||
'p-tidy': [
|
||||
R('apple', 't-a1', 5, 'Finally simple', 'Shared groceries list with my partner in seconds. No clutter.', 'USA', 1),
|
||||
R('play', 't-p1', 4, 'Good', 'Works well. Widgets would be great.', 'en', 2),
|
||||
R('apple', 't-a2', 5, 'Harika', 'Ailecek ortak listeleri burada tutuyoruz, çok pratik.', 'TUR', 3, 'Teşekkürler! Widget\'lar 1.5 ile geliyor.'),
|
||||
R('play', 't-p2', 3, 'Sync delay', 'Sometimes the shared list takes a minute to update.', 'en', 4),
|
||||
R('apple', 't-a3', 5, 'Pro is worth it', 'Unlimited lists and themes. Happy to support a small studio.', 'GBR', 9),
|
||||
],
|
||||
};
|
||||
|
||||
const draft = (store: 'apple' | 'play', reviewId: string, reply: string, approved: boolean, issues: DraftsResult['drafts'][number]['issues'] = []) =>
|
||||
({ file: `${HOME}/apps/prism-puddle/.storebound/replies/${store}-${reviewId}.md`, store, reviewId, approved, sent: null, reply, rating: null, title: null, body: null, date: null, issues });
|
||||
const DRAFTS: Record<string, DraftsResult> = {
|
||||
'p-prism': {
|
||||
dir: `${HOME}/apps/prism-puddle/.storebound/replies`, problems: [], drafts: [
|
||||
draft('play', 'r-p1', 'Sorry about the lost streak! A fix for the crash at high combos is in 2.4.0, now in review. Thank you for the level number, it helped.', true),
|
||||
draft('apple', 'r-a3', 'We are sorry! Your progress is saved in iCloud: open Settings > Restore progress. If it is still missing, write to support@example.com.', false,
|
||||
[{ level: 'warn', msg: 'contains an email address: only your public support address, never a user\'s' }]),
|
||||
draft('play', 'r-p3', '', false),
|
||||
draft('apple', 'r-a6', 'Thanks! Change your rating to 5 stars and we will add bigger text with free coins.', false,
|
||||
[{ level: 'error', msg: 'offers something for a rating or asks to change / give stars: not allowed (no incentives, no rating manipulation)' }]),
|
||||
],
|
||||
},
|
||||
'p-tidy': { dir: `${HOME}/apps/tidy-lists/.storebound/replies`, problems: [], drafts: [] },
|
||||
};
|
||||
|
||||
const TF: Record<string, TestFlightStatus> = {
|
||||
'p-prism': {
|
||||
groups: [
|
||||
{ id: 'g1', name: 'Studio team', internal: true, testers: 6, builds: 'all', publicLink: false },
|
||||
{ id: 'g2', name: 'Friends and family', internal: false, testers: 42, builds: 3, publicLink: true },
|
||||
{ id: 'g3', name: 'Press', internal: false, testers: 8, builds: 1, publicLink: false },
|
||||
],
|
||||
builds: [
|
||||
{ version: '2.4.0', build: '52', processing: 'VALID', internal: 'IN_BETA_TESTING', external: 'WAITING_FOR_BETA_REVIEW', uploaded: iso(60 * 28) },
|
||||
{ version: '2.4.0', build: '51', processing: 'VALID', internal: 'IN_BETA_TESTING', external: 'BETA_APPROVED', uploaded: iso(60 * 50) },
|
||||
{ version: '2.3.0', build: '48', processing: 'VALID', internal: 'IN_BETA_TESTING', external: 'BETA_APPROVED', uploaded: iso(60 * 24 * 10) },
|
||||
{ version: '2.3.0', build: '47', processing: 'VALID', internal: 'EXPIRED', external: 'EXPIRED', uploaded: iso(60 * 24 * 12) },
|
||||
{ version: '2.2.1', build: '44', processing: 'VALID', internal: 'EXPIRED', external: 'EXPIRED', uploaded: iso(60 * 24 * 31) },
|
||||
],
|
||||
missingGroups: [],
|
||||
},
|
||||
'p-tidy': {
|
||||
groups: [{ id: 'g4', name: 'Studio team', internal: true, testers: 4, builds: 'all', publicLink: false }, { id: 'g5', name: 'Beta club', internal: false, testers: 118, builds: 2, publicLink: true }],
|
||||
builds: [{ version: '1.5.0', build: '31', processing: 'VALID', internal: 'IN_BETA_TESTING', external: 'IN_BETA_TESTING', uploaded: iso(60 * 22) }, { version: '1.4.2', build: '29', processing: 'VALID', internal: 'EXPIRED', external: 'EXPIRED', uploaded: iso(60 * 24 * 22) }],
|
||||
missingGroups: ['Accessibility testers'],
|
||||
},
|
||||
};
|
||||
|
||||
const CATALOG: Record<string, CatalogDiff> = {
|
||||
'p-prism': {
|
||||
errors: 1,
|
||||
rows: [
|
||||
{ id: 'starter_pack', store: 'play', level: 'error', code: 'missing', msg: 'not on Google Play (storebound play products)' },
|
||||
{ id: 'vip_pass_monthly', store: 'apple', level: 'warn', code: 'locale', msg: 'no localization for ar-SA' },
|
||||
{ id: 'coins_large', store: 'apple', level: 'warn', code: 'price', msg: 'no US price on the store' },
|
||||
{ id: 'coins_small', store: 'apple', level: 'ok', code: 'ok', msg: 'consumable, 175 region prices' },
|
||||
{ id: 'coins_small', store: 'play', level: 'ok', code: 'ok', msg: 'one_time, 173 region prices' },
|
||||
{ id: 'coins_large', store: 'play', level: 'ok', code: 'ok', msg: 'one_time, 173 region prices' },
|
||||
{ id: 'no_ads', store: 'apple', level: 'ok', code: 'ok', msg: 'non_consumable, 175 region prices' },
|
||||
{ id: 'no_ads', store: 'play', level: 'ok', code: 'ok', msg: 'one_time, 173 region prices' },
|
||||
{ id: 'starter_pack', store: 'apple', level: 'ok', code: 'ok', msg: 'consumable, 175 region prices' },
|
||||
{ id: 'vip_pass_monthly', store: 'play', level: 'ok', code: 'ok', msg: 'subscription P1M, 173 region prices' },
|
||||
{ id: 'legacy_hint_pack', store: 'apple', level: 'warn', code: 'extra', msg: 'on the store but not in the config (consumable, REMOVED_FROM_SALE)' },
|
||||
],
|
||||
parity: [
|
||||
{ id: 'starter_pack', region: 'TR', currency: 'TRY', apple: 149.99, play: 99.99, diffPct: 33.3 },
|
||||
{ id: 'no_ads', region: 'BR', currency: 'BRL', apple: 24.9, play: 19.99, diffPct: 19.7 },
|
||||
{ id: 'coins_large', region: 'IN', currency: 'INR', apple: 899, play: 780, diffPct: 13.2 },
|
||||
],
|
||||
},
|
||||
'p-tidy': { errors: 0, rows: ['tip_jar', 'pro_monthly', 'pro_yearly'].flatMap(id => (['apple', 'play'] as const).map(store => ({ id, store, level: 'ok' as const, code: 'ok', msg: 'matches' }))), parity: [] },
|
||||
};
|
||||
|
||||
const VALIDATE: Record<string, ValidateResult> = {
|
||||
'p-prism': {
|
||||
blockers: 1, findings: [
|
||||
{ store: 'play', level: 'blocker', code: 'product-missing', msg: 'starter_pack is in the config but not on Google Play', fix: 'storebound play products --only starter_pack (dry run first)' },
|
||||
{ store: 'apple', level: 'warn', code: 'screenshots-ipad', msg: 'ar-SA has no 13" iPad screenshots', fix: 'storebound shots render --lang ar, then storebound apple screenshots --only ar-SA' },
|
||||
{ store: 'apple', level: 'warn', code: 'whats-new', msg: '2.4.0 has no "What\'s New" for ja', fix: 'storebound whats-new --since v2.3.0' },
|
||||
],
|
||||
},
|
||||
'p-tidy': { blockers: 0, findings: [] },
|
||||
};
|
||||
|
||||
function field(f: string, length: number, limit: number, required = true): ListingField {
|
||||
return { field: f, length, limit, required, state: !length ? (required ? 'missing' : 'empty-optional') : length > limit ? 'over' : 'ok' };
|
||||
}
|
||||
const LISTINGS: Record<string, ListingsResult> = {
|
||||
'p-prism': {
|
||||
files: { play: `${HOME}/apps/prism-puddle/store/listing.md`, apple: `${HOME}/apps/prism-puddle/store/appstore.md` }, problems: [],
|
||||
locales: [
|
||||
{ lang: 'en', rtl: false, screenshots: 24, complete: 1, play: { code: 'en-US', fields: [field('title', 12, 30), field('short', 74, 80), field('full', 2210, 4000), field('whatsNew', 182, 500, false)] }, apple: { code: 'en-US', fields: [field('name', 12, 30), field('subtitle', 28, 30), field('promotionalText', 141, 170), field('keywords', 97, 100), field('description', 2380, 4000), field('whatsNew', 210, 4000, false)] } },
|
||||
{ lang: 'tr', rtl: false, screenshots: 24, complete: 1, play: { code: 'tr-TR', fields: [field('title', 12, 30), field('short', 79, 80), field('full', 2390, 4000), field('whatsNew', 170, 500, false)] }, apple: { code: 'tr', fields: [field('name', 12, 30), field('subtitle', 26, 30), field('promotionalText', 150, 170), field('keywords', 99, 100), field('description', 2511, 4000), field('whatsNew', 190, 4000, false)] } },
|
||||
{ lang: 'ja', rtl: false, screenshots: 24, complete: 0.89, play: { code: 'ja-JP', fields: [field('title', 9, 30), field('short', 41, 80), field('full', 1310, 4000), field('whatsNew', 0, 500, false)] }, apple: { code: 'ja', fields: [field('name', 9, 30), field('subtitle', 16, 30), field('promotionalText', 0, 170), field('keywords', 88, 100), field('description', 1402, 4000), field('whatsNew', 0, 4000, false)] } },
|
||||
{ lang: 'ar', rtl: true, screenshots: 16, complete: 0.89, play: { code: 'ar', fields: [field('title', 11, 30), field('short', 66, 80), field('full', 1980, 4000), field('whatsNew', 150, 500, false)] }, apple: { code: 'ar-SA', fields: [field('name', 11, 30), field('subtitle', 31, 30), field('promotionalText', 120, 170), field('keywords', 93, 100), field('description', 2005, 4000), field('whatsNew', 160, 4000, false)] } },
|
||||
],
|
||||
},
|
||||
'p-tidy': {
|
||||
files: { play: `${HOME}/apps/tidy-lists/store/listing.md`, apple: `${HOME}/apps/tidy-lists/store/appstore.md` }, problems: [],
|
||||
locales: [
|
||||
{ lang: 'en', rtl: false, screenshots: 16, complete: 1, play: { code: 'en-US', fields: [field('title', 10, 30), field('short', 70, 80), field('full', 1500, 4000), field('whatsNew', 120, 500, false)] }, apple: { code: 'en-US', fields: [field('name', 10, 30), field('subtitle', 24, 30), field('promotionalText', 120, 170), field('keywords', 92, 100), field('description', 1610, 4000), field('whatsNew', 130, 4000, false)] } },
|
||||
{ lang: 'tr', rtl: false, screenshots: 16, complete: 1, play: { code: 'tr-TR', fields: [field('title', 11, 30), field('short', 77, 80), field('full', 1620, 4000), field('whatsNew', 118, 500, false)] }, apple: { code: 'tr', fields: [field('name', 11, 30), field('subtitle', 27, 30), field('promotionalText', 133, 170), field('keywords', 96, 100), field('description', 1700, 4000), field('whatsNew', 128, 4000, false)] } },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const TOOLS = [
|
||||
{ id: 'ffmpeg', name: 'ffmpeg', found: true, path: `${HOME}/Library/Application Support/dev.storebound.desktop/tools/bin/ffmpeg`, version: '9.0.2', source: 'app', usedFor: 'icons, screenshot renders, app preview videos, frame crops', install: { kind: 'download', url: 'https://ffmpeg.org/download.html', note: '' } },
|
||||
{ id: 'ffprobe', name: 'ffprobe', found: true, path: `${HOME}/Library/Application Support/dev.storebound.desktop/tools/bin/ffprobe`, version: '9.0.2', source: 'app', usedFor: 'checks of app preview videos and clips', install: { kind: 'download', url: 'https://ffmpeg.org/download.html', note: '' } },
|
||||
{ id: 'chrome', name: 'Google Chrome', found: false, path: null, version: null, source: null, usedFor: 'screenshot renders, captions, web captures and recordings', install: { kind: 'download', url: 'https://googlechromelabs.github.io/chrome-for-testing/', note: '' } },
|
||||
{ id: 'xcode', name: 'Xcode command line tools', found: true, path: '/Applications/Xcode.app/Contents/Developer', version: '27.0', source: 'system', usedFor: 'iOS builds, the iOS Simulator (simctl)', install: { kind: 'link', url: 'https://developer.apple.com/xcode/', note: '' } },
|
||||
{ id: 'simctl', name: 'simctl (iOS Simulator)', found: true, path: '/Applications/Xcode.app/Contents/Developer/usr/bin/simctl', version: null, source: 'system', usedFor: 'iOS Simulator screenshots and recordings', install: { kind: 'link', url: 'https://developer.apple.com/xcode/', note: '' } },
|
||||
{ id: 'adb', name: 'adb (Android platform tools)', found: false, path: null, version: null, source: null, usedFor: 'Android emulator / device screenshots and recordings', install: { kind: 'link', url: 'https://developer.android.com/tools/releases/platform-tools', note: '' } },
|
||||
{ id: 'git', name: 'git', found: true, path: '/usr/bin/git', version: '2.55.0', source: 'system', usedFor: 'release notes from history, analytics compare', install: { kind: 'link', url: 'https://git-scm.com/downloads', note: '' } },
|
||||
];
|
||||
let chromeInstalled = false;
|
||||
|
||||
const ok = (method: string, data: unknown): ToolResult => ({ method, ok: true, exitCode: 0, dryRun: false, command: `storebound ${method.replace('.', ' ')} --json`, output: '', data });
|
||||
|
||||
function read(method: string, id: string): ToolResult {
|
||||
switch (method) {
|
||||
case 'project.icon': return ok(method, { path: SUMMARY[id]?.icon ?? null, dataUrl: ICONS[id] ?? null });
|
||||
case 'project.listings': return ok(method, LISTINGS[id]);
|
||||
case 'reviews.drafts': return ok(method, DRAFTS[id]);
|
||||
case 'health': return ok(method, HEALTH[id]);
|
||||
case 'reviews.list': return ok(method, REVIEWS[id]);
|
||||
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 '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<string, number> = { 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']);
|
||||
|
||||
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 }); }
|
||||
}
|
||||
|
||||
export async function mockInvoke<T>(cmd: string, a: Record<string, unknown>): Promise<T> {
|
||||
const r = await answer(cmd, a);
|
||||
return r as T;
|
||||
}
|
||||
|
||||
async function answer(cmd: string, a: Record<string, unknown>): Promise<unknown> {
|
||||
const job = (a.job as string | null) ?? null;
|
||||
switch (cmd) {
|
||||
case 'app_info': return { version: '0.1.0', identifier: 'dev.storebound.desktop', platform: 'macos', debug: true, home: HOME };
|
||||
case 'sidecar_status': return { running: true, version: '0.5.0', protocol: 'storebound-desktop/1', methods: Array.from({ length: 64 }, (_, i) => ({ method: `m${i}` })), tools: { tools: TOOLS.map(x => (x.id === 'chrome' && chromeInstalled ? { ...x, found: true, name: 'Chrome for Testing', version: '141.0.7390.54', source: 'app' } : x)) } };
|
||||
case 'projects_list': return projects;
|
||||
case 'accounts_list': return accounts;
|
||||
case 'portfolio_status': {
|
||||
if (a.live) {
|
||||
for (let n = 1; n <= projects.length; n++) {
|
||||
await sleep(700);
|
||||
if (job && cancelled.has(job)) throw { code: -32800, message: 'Request cancelled' };
|
||||
emit('sidecar-progress', { params: { requestId: 0, n, total: projects.length, project: projects[n - 1]!.path }, job });
|
||||
}
|
||||
return portfolio(true);
|
||||
}
|
||||
await sleep(120);
|
||||
return portfolio(false);
|
||||
}
|
||||
case 'cache_get': {
|
||||
const method = a.method as string, id = a.projectId as string;
|
||||
if (id === '*' && method === 'portfolio.status') return projects.length ? { value: portfolio(true), at: iso(14) } satisfies CacheEntry<PortfolioResult> : null;
|
||||
if (method === 'project.icon') return ICONS[id] ? { value: read(method, id), at: iso(60) } : null;
|
||||
if (CACHED_AGO[method] !== undefined && import.meta.env.VITE_FIXTURES !== 'cold') return { value: read(method, id), at: iso(CACHED_AGO[method]!) };
|
||||
return null;
|
||||
}
|
||||
case 'cache_clear': return null;
|
||||
case 'sidecar_call': {
|
||||
const method = a.method as string;
|
||||
if (method === 'system.tools') return { tools: (await answer('sidecar_status', {}) as { tools: { tools: unknown[] } }).tools.tools };
|
||||
const id = a.projectId as string;
|
||||
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);
|
||||
}
|
||||
case 'job_cancel': cancelled.add(a.job as string); return true;
|
||||
case 'write_with_confirm': {
|
||||
await sleep(500);
|
||||
const method = a.method as string, args = (a.args ?? {}) as Record<string, unknown>;
|
||||
if (method === 'reviews.approve') {
|
||||
const d = DRAFTS[a.projectId as string]?.drafts.find(x => x.file.endsWith(`/${String(args.file)}`));
|
||||
if (d) d.approved = !args.undo;
|
||||
}
|
||||
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_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;
|
||||
case 'account_remove': accounts = accounts.filter(x => x.id !== a.id); return null;
|
||||
case 'open_external': return null;
|
||||
case 'tools_info': return [
|
||||
{ tool: 'ffmpeg', available: true, version: '9.0.2', size: 56_713_400, license: 'GPL-3.0-or-later (ffmpeg built with GPL components)', licenseUrl: 'https://ffmpeg.org/legal.html', source: 'https://ffmpeg.martin-riedl.de/', installed: true, folder: 'tools/bin' },
|
||||
{ tool: 'chrome', available: true, version: null, size: null, license: 'Chromium BSD-style license and third-party notices; Google Chrome for Testing terms', licenseUrl: 'https://github.com/GoogleChromeLabs/chrome-for-testing#readme', source: 'https://googlechromelabs.github.io/chrome-for-testing/', installed: chromeInstalled, folder: 'tools/chrome' },
|
||||
];
|
||||
case 'tools_install': {
|
||||
const total = 168_000_000;
|
||||
const ev = (stage: DownloadEvent['stage'], received: number) => emit('tool-download', { job: String(a.job), tool: String(a.tool), stage, received, total } satisfies DownloadEvent);
|
||||
ev('resolve', 0); await sleep(400);
|
||||
for (let i = 1; i <= 20; i++) {
|
||||
if (cancelled.has(a.job as string)) { ev('cancelled', 0); throw 'cancelled'; }
|
||||
ev('download', (total * i) / 20); await sleep(140);
|
||||
}
|
||||
ev('unpack', total); await sleep(400); ev('verify', total); await sleep(400); ev('install', total); await sleep(200);
|
||||
if (a.tool === 'chrome') chromeInstalled = true;
|
||||
return a.tool === 'chrome' ? 'Chrome for Testing 141.0.7390.54' : 'ffmpeg version 9.0.2';
|
||||
}
|
||||
case 'tools_uninstall': if (a.tool === 'chrome') chromeInstalled = false; return null;
|
||||
default: throw { code: -1, message: `fixture: ${cmd} not mocked` };
|
||||
}
|
||||
}
|
||||
10
apps/desktop/src/dev/switches.ts
Normal file
10
apps/desktop/src/dev/switches.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Dev-only switches for screenshots and manual checks: VITE_START / VITE_THEME / VITE_LANG / VITE_AUTORUN, or the same
|
||||
// names as URL query parameters (?start=app:health&theme=dark&lang=tr) in the Vite dev server. Release builds compile
|
||||
// import.meta.env.DEV to false, so this always answers "" there.
|
||||
export type Switch = 'start' | 'theme' | 'lang' | 'autorun';
|
||||
|
||||
export function devSwitch(name: Switch): string {
|
||||
if (!import.meta.env.DEV) return '';
|
||||
const q = typeof location !== 'undefined' ? new URLSearchParams(location.search).get(name) : null;
|
||||
return q ?? String((import.meta.env as Record<string, unknown>)[`VITE_${name.toUpperCase()}`] ?? '');
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue