growth extras: prices ppp, ads apple, web, apple adhoc, play share, revenuecat, console fill (+ desktop button)

This commit is contained in:
CRTkafa 2026-10-11 16:14:00 +00:00
parent 02d90de77a
commit e778373fb6
65 changed files with 6307 additions and 27 deletions

View file

@ -3,7 +3,7 @@
// 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, type AccountCheck, type AppsListResult, type AppStatus, type CacheEntry, DEFAULT_SETTINGS, type DownloadEvent, type DraftsResult, type ListingField, type ListingsResult,
import { type Account, type AccountCheck, type ConsoleFillResult, type ConsoleForm, type AppsListResult, type AppStatus, type CacheEntry, DEFAULT_SETTINGS, type DownloadEvent, type DraftsResult, type ListingField, type ListingsResult,
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';
@ -409,6 +409,7 @@ function read(method: string, id: string, args: Record<string, unknown> = {}): T
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 'console.fill': return { ...ok(method, CONSOLE_FILL[args.form as ConsoleForm]), dryRun: true, command: `storebound console fill ${String(args.form)} --dry --json` };
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)` };
@ -417,6 +418,24 @@ function read(method: string, id: string, args: Record<string, unknown> = {}): T
}
}
// ---- console.fill: the answers `console fill <form> --dry --json` would type (made up, from the demo configs) ----
const CF = (form: ConsoleForm, title: string, url: string, answers: [string, string, string | null, string][], guidance: string[]): ConsoleFillResult => {
const list = answers.map(([id, label, value, source]) => ({ id, label, value: value ?? '', certain: value !== null, source, ...(value === null ? { note: 'Only you know this: answer it in the console' } : {}) }));
return { form, store: form.startsWith('apple') ? 'apple' : 'play', title, url, answers: list, uncertain: list.filter(a => !a.certain).length, guidance };
};
const ASC = 'https://appstoreconnect.apple.com/apps', PLAY = 'https://play.google.com/console';
const CONSOLE_FILL: Record<ConsoleForm, ConsoleFillResult> = {
'apple-app-record': CF('apple-app-record', 'New App', ASC, [['platform', 'Platforms', 'iOS', 'app.platforms'], ['name', 'Name', 'Prism Puddle', 'app.name'], ['language', 'Primary language', 'English (U.S.)', 'languages[0].apple'],
['bundleId', 'Bundle ID', 'com.example.prismpuddle', 'apple.bundleId'], ['sku', 'SKU', 'prismpuddle', 'apple.sku'], ['access', 'User access', 'Full access', 'default']], ['After Create, copy the Apple ID into apple.appId.']),
'apple-age-rating': CF('apple-age-rating', 'Age rating', ASC, [['violenceCartoonOrFantasy', 'Cartoon or fantasy violence', 'Infrequent/Mild', 'apple.ageRating'], ['gamblingSimulated', 'Simulated gambling', 'None', 'apple.ageRating'],
['messagingAndChat', 'Messaging and chat', null, ''], ['advertising', 'Advertising', 'Yes', 'ads.enabled']], ['The age rating follows from your answers; check it before you save.']),
'apple-app-privacy': CF('apple-app-privacy', 'App Privacy', ASC, [['collects', 'Do you collect data from this app?', 'Yes', 'play.dataSafety'], ['deviceId', 'Device ID', 'Third-party advertising, Analytics', 'play.dataSafety'],
['linked', 'Device ID linked to the user', null, ''], ['tracking', 'Device ID used for tracking', null, '']], ['App Privacy has no API: publish the answers in App Store Connect yourself.']),
'play-content-rating': CF('play-content-rating', 'Content rating', PLAY, [['category', 'Category', 'Game', 'app.profile'], ['violence', 'Violence', 'No', 'play.contentRating'], ['userInteraction', 'Users can interact', 'No', 'play.contentRating'],
['ads', 'Contains ads', 'Yes', 'ads.enabled'], ['purchases', 'Digital purchases', 'Yes', 'products']], ['Submitting the questionnaire is yours; storebound stops before it.']),
'play-target-audience': CF('play-target-audience', 'Target audience and content', PLAY, [['ages', 'Target age groups', '13-15, 16-17, 18 and over', 'play.targetAudience'], ['appeal', 'Could appeal to children', null, '']], []),
};
const CACHED_AGO: Record<string, number> = { 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']);
@ -497,6 +516,15 @@ async function answer(cmd: string, a: Record<string, unknown>): Promise<unknown>
case 'job_cancel': cancelled.add(a.job as string); return true;
case 'write_with_confirm': {
const method = a.method as string, args = (a.args ?? {}) as Record<string, unknown>;
if (method === 'console.fill') {
// the real run lasts until the owner closes the browser: here a few seconds, or until Cancel
const r = CONSOLE_FILL[args.form as ConsoleForm];
await progressLines(job, ['[console] opening Chromium (profile in ~/.storebound/console-profile/apple)', '[console] waiting for you to sign in', `[console] ${r.title}: filling ${r.answers.length - r.uncertain} fields`, `[console] ${r.uncertain} fields marked for you`]);
for (let i = 0; i < 20 && !(job && cancelled.has(job)); i++) await sleep(250);
if (job && cancelled.has(job)) throw { code: -32800, message: 'Request cancelled' };
const res: ToolResult = { method, ok: true, exitCode: 0, dryRun: false, command: `storebound console fill ${String(args.form)} --json`, output: '[console] browser closed', data: { ...r, filled: r.answers.length - r.uncertain, highlighted: r.uncertain, fallback: false, stoppedAt: null } };
return { confirmed: true, stage: 'done', dryRun: { ...res, dryRun: true, data: r }, result: res };
}
await progressLines(job, [`[${method}] dry run`, `[${method}] confirmed in the dialog`, `[${method}] applying`]);
if (job && cancelled.has(job)) throw { code: -32800, message: 'Request cancelled' };
const d = DRAFTS[a.projectId as string]?.drafts.find(x => x.file.endsWith(`/${String(args.file)}`));