Navigation after sign-in (navPlan + navigate): App Store Connect Apps > + > New App (EN/TR), App Privacy by /apps/<appId>/distribution/privacy or the app list, Play app list by package name > Policy and programs > App content > Start / Manage. Every navigation click goes through navClick: the click gate stays absolute, only a link named exactly Start / Manage / Başla / Yönet passes. Each step is logged; a step not found in time or two matching apps -> the printed steps and wait (no crash). The TR gate now refuses "uygula" (apply) but not "uygulama" (app). Browser (cli/console/session.ts): attach to a Chrome with remote debugging (--cdp or DevToolsActivePort), else on macOS a temporary profile with only Local State and the profile's Cookies filtered to the console hosts, opened in real Chrome and deleted at the end, else storebound's own profile (--fresh-profile). Cookies are never printed. Desktop: fresh_profile option, the dialog says it uses the Chrome sign-in. Tests: navigation fixtures (ASC EN/TR, Play list, App content, missing step, duplicates, deny-listed decoys), session file selection, host filter, cleanup, and a real-Chrome copy-mode test on a throwaway profile and a local site.
235 lines
18 KiB
TypeScript
235 lines
18 KiB
TypeScript
// Answers for console forms that have no API (`storebound console fill <form>`), built from the config only. Pure.
|
|
// AGENTS.md rule 5: an answer is `certain` only when the config proves it; everything else has value null, stays EMPTY
|
|
// in the page, is highlighted and is listed for the owner. Forms:
|
|
// apple-app-record App Store Connect > Apps > + > New App
|
|
// apple-age-rating guide only: `storebound apple appinfo` sets every question through the API
|
|
// apple-app-privacy App Store Connect > the app > App Privacy (no API)
|
|
// play-content-rating Play Console > Policy > App content > Content rating (IARC questionnaire)
|
|
// play-target-audience Play Console > Policy > App content > Target audience and content (+ the Ads declaration)
|
|
// Sources (checked October 2026):
|
|
// https://developer.apple.com/help/app-store-connect/create-an-app-record/add-a-new-app
|
|
// https://developer.apple.com/help/app-store-connect/manage-app-information/manage-app-privacy
|
|
// https://developer.apple.com/app-store/app-privacy-details/ (data types, purposes)
|
|
// https://developer.apple.com/tutorials/data/documentation/appstoreconnectapi/ageratingdeclaration/attributes-data.dictionary.json
|
|
// https://support.google.com/googleplay/android-developer/answer/9859655 (content ratings)
|
|
// https://support.google.com/googleplay/android-developer/answer/9867159 (target audience and content)
|
|
import { AGE_RATING_NONE } from '../apple/appinfo';
|
|
import { type AgeGroup, AGE_GROUPS, IARC_QUESTIONS, type IarcQuestion, profileOf, type ShipConfig } from './config';
|
|
import { APPLE_PRIVACY, applePurpose } from './declarations';
|
|
import { maskUser } from './credentials';
|
|
|
|
export const FORM_IDS = ['apple-app-record', 'apple-age-rating', 'apple-app-privacy', 'play-content-rating', 'play-target-audience'] as const;
|
|
export type FormId = typeof FORM_IDS[number];
|
|
export type Store = 'apple' | 'play';
|
|
|
|
export type AnswerValue = string | boolean | null;
|
|
export interface Answer { id: string; label: string; value: AnswerValue; certain: boolean; source: string; note?: string }
|
|
|
|
export interface FormMeta {
|
|
id: FormId; store: Store; title: string; url: string;
|
|
/** What the owner clicks to open the form when storebound cannot open it itself (a navigation step was not found). */
|
|
open: string[];
|
|
/** What the owner still clicks after storebound opened the page (a control the click gate refuses, e.g. Get Started). */
|
|
then?: string;
|
|
/** The control storebound stops before; the owner presses it. */
|
|
stopBefore: string;
|
|
/** false: no page filling at all, guidance only (the API covers it). */
|
|
fillable: boolean;
|
|
}
|
|
|
|
/** The `--dry --json` result (and the head of a fill run's result). */
|
|
export interface ConsoleResult { form: FormId; store: Store; title: string; url: string; answers: Answer[]; uncertain: number; guidance: string[] }
|
|
|
|
export const DISCLAIMER = [
|
|
'storebound console fill is AI-assisted autofill. Console pages change without notice and it may misplace an answer.',
|
|
'Review every field yourself. storebound never saves, submits or publishes: you press the final button.',
|
|
'storebound never types passwords or touches sign-in pages: you sign in in the browser window yourself.',
|
|
];
|
|
|
|
const ASC = 'https://appstoreconnect.apple.com';
|
|
const PLAY = 'https://play.google.com/console';
|
|
|
|
export const isForm = (s: string | undefined): s is FormId => !!s && (FORM_IDS as readonly string[]).includes(s);
|
|
|
|
export function formMeta(id: FormId, config: ShipConfig): FormMeta {
|
|
const app = config.apple?.appId ? `${ASC}/apps/${config.apple.appId}` : `${ASC}/apps`;
|
|
const privacy = config.apple?.appId ? `${app}/distribution/privacy` : app;
|
|
const pickApp = 'Pick the developer account and the app if Play Console asks';
|
|
switch (id) {
|
|
case 'apple-app-record': return { id, store: 'apple', title: 'App Store Connect: New App', url: `${ASC}/apps`, stopBefore: 'Create', fillable: true,
|
|
open: ['Apps > the add button (+) at the top left > New App'] };
|
|
case 'apple-age-rating': return { id, store: 'apple', title: 'App Store Connect: Age Ratings', url: app, stopBefore: 'Save', fillable: false,
|
|
open: ['General > App Information > Age Ratings > Set Up Age Ratings (only to look: `storebound apple appinfo` sets it)'] };
|
|
case 'apple-app-privacy': return { id, store: 'apple', title: 'App Store Connect: App Privacy', url: privacy, stopBefore: 'Publish', fillable: true,
|
|
open: [...(config.apple?.appId ? [] : ['Apps > your app (set apple.appId so storebound opens it directly)']), 'App Privacy in the sidebar > Get Started (or Edit next to Data Types)'],
|
|
then: 'Get Started (or Edit next to Data Types)' };
|
|
case 'play-content-rating': return { id, store: 'play', title: 'Play Console: Content rating (IARC)', url: PLAY, stopBefore: 'Submit', fillable: true,
|
|
open: [pickApp, 'Policy > App content > Content rating > Start (or Start new questionnaire)'] };
|
|
case 'play-target-audience': return { id, store: 'play', title: 'Play Console: Target audience and content', url: PLAY, stopBefore: 'Save', fillable: true,
|
|
open: [pickApp, 'Policy > App content > Target audience and content > Start (or Manage); the Ads declaration is App content > Ads'] };
|
|
}
|
|
}
|
|
|
|
const ok = (id: string, label: string, value: AnswerValue, source: string, note?: string): Answer => ({ id, label, value, certain: true, source, ...(note ? { note } : {}) });
|
|
const ask = (id: string, label: string, source: string, note: string): Answer => ({ id, label, value: null, certain: false, source, note });
|
|
|
|
/** App Store Connect primary language names for the common locales (the dialog shows names, not codes). */
|
|
const LANGUAGE_NAMES: Record<string, string> = {
|
|
'en-US': 'English (U.S.)', 'en-GB': 'English (U.K.)', 'en-AU': 'English (Australia)', 'en-CA': 'English (Canada)', 'de-DE': 'German', 'fr-FR': 'French',
|
|
'fr-CA': 'French (Canada)', 'es-ES': 'Spanish (Spain)', 'es-MX': 'Spanish (Mexico)', 'it': 'Italian', 'ja': 'Japanese', 'ko': 'Korean', 'pt-BR': 'Portuguese (Brazil)',
|
|
'pt-PT': 'Portuguese (Portugal)', 'nl-NL': 'Dutch', 'ru': 'Russian', 'tr': 'Turkish', 'zh-Hans': 'Chinese (Simplified)', 'zh-Hant': 'Chinese (Traditional)',
|
|
};
|
|
|
|
function appRecord(config: ShipConfig): Answer[] {
|
|
const a = config.apple, r = config.console?.appRecord;
|
|
const locale = a?.primaryLocale ?? config.languages.find(l => l.apple)?.apple;
|
|
const lang = locale ? LANGUAGE_NAMES[locale] : undefined;
|
|
return [
|
|
a ? ok('platform:ios', 'Platforms: iOS', true, 'apple section') : ask('platform:ios', 'Platforms: iOS', 'config', 'The config has no apple section.'),
|
|
ok('name', 'Name', config.app.name, 'app.name', 'Must be unique on the App Store; App Store Connect says so when it is taken.'),
|
|
lang ? ok('language', 'Primary Language', lang, a?.primaryLocale ? 'apple.primaryLocale' : 'languages[0].apple')
|
|
: ask('language', 'Primary Language', 'apple.primaryLocale', locale ? `Pick the language of locale "${locale}".` : 'Set apple.primaryLocale (e.g. en-US).'),
|
|
a?.bundleId ? ok('bundleId', 'Bundle ID', a.bundleId, 'apple.bundleId', 'Register it first if it is not in the list: storebound apple bundle.')
|
|
: ask('bundleId', 'Bundle ID', 'apple.bundleId', 'Set apple.bundleId.'),
|
|
r?.sku ? ok('sku', 'SKU', r.sku, 'console.appRecord.sku')
|
|
: ask('sku', 'SKU', 'console.appRecord.sku', `Your internal id, never shown and never changeable (for example ${a?.bundleId ?? 'the bundle id'}). Set console.appRecord.sku to have it filled.`),
|
|
r?.userAccess ? ok('access', 'User Access', r.userAccess, 'console.appRecord.userAccess')
|
|
: ask('access', 'User Access', 'console.appRecord.userAccess', 'Full Access (everyone in your team) or Limited Access (pick the users).'),
|
|
];
|
|
}
|
|
|
|
/** Every question of the API's ageRatingDeclarations (checked October 2026); appinfo.ts AGE_RATING_NONE plus the newer ones. */
|
|
export const AGE_RATING_API = [...new Set([...Object.keys(AGE_RATING_NONE), 'socialMedia', 'socialMediaAgeRestricted'])];
|
|
|
|
function ageRating(config: ShipConfig): Answer[] {
|
|
const o = config.apple?.info?.ageRating;
|
|
return AGE_RATING_API.map(q => {
|
|
if (o && q in o) return ok(q, q, o[q] ?? 'none', `apple.info.ageRating.${q}`);
|
|
if (!(q in AGE_RATING_NONE)) return ask(q, q, `apple.info.ageRating.${q}`, 'storebound apple appinfo does not send this one unless you set it in apple.info.ageRating; App Store Connect asks it.');
|
|
const none = AGE_RATING_NONE[q] ?? 'none';
|
|
return o ? ok(q, q, none, 'apple.info.ageRating (not overridden)')
|
|
: ask(q, q, 'apple.info.ageRating', `storebound apple appinfo answers ${String(none)} unless you set apple.info.ageRating; confirm that is true.`);
|
|
});
|
|
}
|
|
|
|
/** App Privacy data types (App privacy details on the App Store), in Apple's order: [category, type]. */
|
|
export const APPLE_DATA_TYPES: [string, string][] = [
|
|
['Contact Info', 'Name'], ['Contact Info', 'Email Address'], ['Contact Info', 'Phone Number'], ['Contact Info', 'Physical Address'], ['Contact Info', 'Other User Contact Info'],
|
|
['Health & Fitness', 'Health'], ['Health & Fitness', 'Fitness'], ['Financial Info', 'Payment Info'], ['Financial Info', 'Credit Info'], ['Financial Info', 'Other Financial Info'],
|
|
['Location', 'Precise Location'], ['Location', 'Coarse Location'], ['Sensitive Info', 'Sensitive Info'], ['Contacts', 'Contacts'],
|
|
['User Content', 'Emails or Text Messages'], ['User Content', 'Photos or Videos'], ['User Content', 'Audio Data'], ['User Content', 'Gameplay Content'],
|
|
['User Content', 'Customer Support'], ['User Content', 'Other User Content'], ['Browsing History', 'Browsing History'], ['Search History', 'Search History'],
|
|
['Identifiers', 'User ID'], ['Identifiers', 'Device ID'], ['Purchases', 'Purchase History'], ['Usage Data', 'Product Interaction'], ['Usage Data', 'Advertising Data'],
|
|
['Usage Data', 'Other Usage Data'], ['Diagnostics', 'Crash Data'], ['Diagnostics', 'Performance Data'], ['Diagnostics', 'Other Diagnostic Data'],
|
|
['Surroundings', 'Environment Scanning'], ['Body', 'Hands'], ['Body', 'Head'], ['Other Data', 'Other Data Types'],
|
|
];
|
|
export const APPLE_PURPOSES = ['Third-Party Advertising', 'Developer\'s Advertising or Marketing', 'Analytics', 'Product Personalization', 'App Functionality', 'Other Purposes'];
|
|
|
|
/** Apple data types the config's Data safety answers say are collected: type -> { from, purposes }. */
|
|
export function privacyTypes(config: ShipConfig): Map<string, { from: string[]; purposes: Set<string> }> {
|
|
const m = new Map<string, { from: string[]; purposes: Set<string> }>();
|
|
for (const [id, u] of Object.entries(config.dataSafety?.data ?? {})) {
|
|
const name = APPLE_PRIVACY[id]?.[1] ?? 'Other Data Types';
|
|
const e = m.get(name) ?? { from: [], purposes: new Set<string>() };
|
|
e.from.push(id);
|
|
for (const p of u.collect) e.purposes.add(applePurpose(p, false));
|
|
for (const p of u.shared ? u.share ?? [] : []) e.purposes.add(applePurpose(p, true));
|
|
m.set(name, e);
|
|
}
|
|
return m;
|
|
}
|
|
|
|
function appPrivacy(config: ShipConfig): Answer[] {
|
|
const ds = config.dataSafety;
|
|
const label = 'Do you or your third-party partners collect data from this app?';
|
|
if (!ds) return [ask('collects', label, 'dataSafety', 'The config has no dataSafety answers: answer what the app and every SDK collect (store-declarations skill), then rerun.')];
|
|
const out: Answer[] = [ok('collects', label, ds.collectsData, 'dataSafety.collectsData')];
|
|
if (!ds.collectsData) return out;
|
|
const got = privacyTypes(config);
|
|
const mapped = new Set(Object.values(APPLE_PRIVACY).map(([, n]) => n));
|
|
for (const [cat, name] of APPLE_DATA_TYPES) {
|
|
const g = got.get(name), id = `type:${name}`, l = `Data type: ${cat} > ${name}`;
|
|
if (g && name === 'Other Data Types') out.push(ask(id, l, `dataSafety.data.${g.from.join(', ')}`, `${g.from.join(', ')} has no exact App Store type: decide where it belongs.`));
|
|
else if (g) out.push(ok(id, l, true, `dataSafety.data.${g.from.join(', ')}`));
|
|
else if (mapped.has(name)) out.push(ok(id, l, false, 'dataSafety.data (not listed)'));
|
|
else out.push(ask(id, l, 'none', name === 'Advertising Data' ? 'No Play Data safety equivalent; ad SDKs usually collect it: check each SDK\'s privacy disclosure.' : 'No Play Data safety equivalent: decide from the app and its SDKs.'));
|
|
}
|
|
for (const [name, g] of got) {
|
|
if (name === 'Other Data Types') continue;
|
|
for (const p of APPLE_PURPOSES) out.push(ok(`purpose:${name}:${p}`, `${name}: purpose ${p}`, g.purposes.has(p), `dataSafety.data.${g.from.join(', ')}`));
|
|
out.push(ask(`linked:${name}`, `${name}: linked to the user's identity?`, 'none', 'Only you know whether you or a partner tie it to an account, device or other identity details.'));
|
|
out.push(ask(`tracking:${name}`, `${name}: used for tracking?`, 'none', 'Yes when it is combined with other companies\' data for ads or shared with data brokers; tracking also needs App Tracking Transparency.'));
|
|
}
|
|
return out;
|
|
}
|
|
|
|
export const IARC_LABELS: Record<IarcQuestion, string> = {
|
|
violence: 'Violence', fear: 'Fear / horror', sexuality: 'Sexuality or nudity', language: 'Language (profanity)', controlledSubstances: 'Controlled substances (drugs, alcohol, tobacco)',
|
|
crudeHumor: 'Crude humour', gambling: 'Gambling with real money', simulatedGambling: 'Simulated gambling', lootBoxes: 'Random paid items (loot boxes)',
|
|
userInteraction: 'Users can interact or exchange content', sharesLocation: 'Shares the user\'s location with other users', digitalPurchases: 'Digital purchases',
|
|
unrestrictedInternet: 'Unrestricted internet access (browser)',
|
|
};
|
|
const CATEGORY_LABELS = { game: 'Game', social: 'Social or communication', other: 'All other app types' } as const;
|
|
|
|
function contentRating(config: ShipConfig): Answer[] {
|
|
const cr = config.console?.contentRating;
|
|
const out: Answer[] = [ok('email', 'Email address', maskUser(config.app.contactEmail), 'app.contactEmail', 'IARC writes to this address; the page gets the full address from the config.')];
|
|
const cat = cr?.category ?? (profileOf(config) === 'game' && config.app.profile ? 'game' : undefined);
|
|
out.push(cat ? ok('category', 'Category', CATEGORY_LABELS[cat], cr?.category ? 'console.contentRating.category' : 'app.profile')
|
|
: ask('category', 'Category', 'console.contentRating.category', 'Pick the category; set console.contentRating.category to have it filled.'));
|
|
const sells = (config.products?.length ?? 0) > 0 || (config.subscriptions?.length ?? 0) > 0;
|
|
for (const q of IARC_QUESTIONS) {
|
|
const v = cr?.answers?.[q];
|
|
if (v !== undefined) out.push(ok(`q:${q}`, IARC_LABELS[q], v, `console.contentRating.answers.${q}`));
|
|
else if (q === 'digitalPurchases' && sells) out.push(ok(`q:${q}`, IARC_LABELS[q], true, config.products?.length ? 'products' : 'subscriptions'));
|
|
else out.push(ask(`q:${q}`, IARC_LABELS[q], `console.contentRating.answers.${q}`, 'Answer from the app\'s real content; set console.contentRating.answers to have it filled.'));
|
|
}
|
|
return out;
|
|
}
|
|
|
|
export const AGE_LABELS: Record<AgeGroup, string> = { '5-under': 'Ages 5 and under', '6-8': 'Ages 6-8', '9-12': 'Ages 9-12', '13-15': 'Ages 13-15', '16-17': 'Ages 16-17', '18-over': 'Ages 18 and over' };
|
|
|
|
function targetAudience(config: ShipConfig): Answer[] {
|
|
const ta = config.console?.targetAudience;
|
|
const out: Answer[] = AGE_GROUPS.map(g => ta?.ages ? ok(`age:${g}`, `Target age: ${AGE_LABELS[g]}`, ta.ages.includes(g), 'console.targetAudience.ages')
|
|
: ask(`age:${g}`, `Target age: ${AGE_LABELS[g]}`, 'console.targetAudience.ages', 'Choose the ages you really target; any group under 13 brings the Families policy.'));
|
|
const kids = ta?.ages?.some(g => ['5-under', '6-8', '9-12'].includes(g));
|
|
if (!kids) out.push(ta?.appealsToChildren !== undefined ? ok('appeal', 'Could your app unintentionally appeal to children?', ta.appealsToChildren, 'console.targetAudience.appealsToChildren')
|
|
: ask('appeal', 'Could your app unintentionally appeal to children?', 'console.targetAudience.appealsToChildren', 'Look at your art style, characters and store listing honestly.'));
|
|
const ads = ta?.containsAds ?? (config.ads?.appAdsTxt?.length ? true : undefined);
|
|
out.push(ads !== undefined ? ok('ads', 'Ads: does your app contain ads?', ads, ta?.containsAds !== undefined ? 'console.targetAudience.containsAds' : 'ads.appAdsTxt')
|
|
: ask('ads', 'Ads: does your app contain ads?', 'console.targetAudience.containsAds', profileOf(config) === 'game' ? 'The game profile usually ships ads; confirm and set console.targetAudience.containsAds.' : 'Set console.targetAudience.containsAds.'));
|
|
return out;
|
|
}
|
|
|
|
export function consoleAnswers(id: FormId, config: ShipConfig): Answer[] {
|
|
switch (id) {
|
|
case 'apple-app-record': return appRecord(config);
|
|
case 'apple-age-rating': return ageRating(config);
|
|
case 'apple-app-privacy': return appPrivacy(config);
|
|
case 'play-content-rating': return contentRating(config);
|
|
case 'play-target-audience': return targetAudience(config);
|
|
}
|
|
}
|
|
|
|
/** The value the page gets: the same as the printed one, except the IARC email (printed masked, filled in full). */
|
|
export const fillValue = (form: FormId, a: Answer, config: ShipConfig): AnswerValue =>
|
|
form === 'play-content-rating' && a.id === 'email' && a.certain ? config.app.contactEmail : a.value;
|
|
|
|
export const valueText = (a: Answer): string => a.value === null ? '(you decide)' : a.value === true ? 'Yes' : a.value === false ? 'No' : a.value;
|
|
|
|
/** Step-by-step lines the owner can follow (and copy from) without any autofill. */
|
|
export function guidance(meta: FormMeta, answers: Answer[]): string[] {
|
|
const g: string[] = [];
|
|
if (!meta.fillable) g.push('Nothing to fill here: `storebound apple appinfo --dry`, then `storebound apple appinfo` sets every age rating answer through the App Store Connect API.');
|
|
g.push(...meta.open.map(o => `Open: ${o}`));
|
|
for (const a of answers) g.push(`${a.label}: ${valueText(a)}${a.certain ? '' : ` (check: ${a.note ?? 'not in the config'})`}`);
|
|
g.push(meta.fillable ? `Review every field, then press ${meta.stopBefore} yourself. storebound never saves, submits or publishes.` : 'Answers marked "check" are yours to confirm in storebound.config.ts (apple.info.ageRating).');
|
|
return g;
|
|
}
|
|
|
|
export function consoleResult(id: FormId, config: ShipConfig): ConsoleResult {
|
|
const meta = formMeta(id, config);
|
|
const answers = consoleAnswers(id, config);
|
|
return { form: id, store: meta.store, title: meta.title, url: meta.url, answers, uncertain: answers.filter(a => !a.certain).length, guidance: guidance(meta, answers) };
|
|
}
|