console fill play-app-record: Play Console's Create app form (account picked by developerId / workspace / play.developerAccount, else stop and list; Create app opener allowlisted only on the app list, never in the form, EN + TR; name, default language, app or game, free or paid as an owner check; declarations never ticked; package name set by the first AAB upload)
This commit is contained in:
parent
96f3df443b
commit
20d34fa0ec
26 changed files with 592 additions and 41 deletions
|
|
@ -5,6 +5,9 @@
|
|||
// from play.developerId (config), STOREBOUND_PLAY_DEVELOPER_ID (a workspace account's developerId, set by
|
||||
// `ws`), or the cache; else storebound reads every developer account link on the chooser
|
||||
// (/console/u/0/developers) and looks for play.packageName in each app list.
|
||||
// play-app-record (Create app) is a FIRST create: no account has the package yet, so the account is picked, not
|
||||
// searched: play.developerId / the workspace's id / the cache, else the one account the login sees, else the
|
||||
// chooser entry named exactly play.developerAccount. Ambiguous or not set -> storebound stops and lists them.
|
||||
// Apple: the team is switched in the account menu at the top right (the team list; Apple's help "Switch between
|
||||
// teams"). The order tried: the cached team, the menu entry that names apple.teamId, then every other team; the
|
||||
// app is found by its list entry (App Privacy) or, for a new app, by the bundle id in the New App dialog's Bundle ID
|
||||
|
|
@ -192,6 +195,39 @@ export async function openAcross(page: Page, o: AcrossOpts): Promise<{ nav: NavR
|
|||
}
|
||||
}
|
||||
|
||||
/** Play account names compare by whole name, spaces and case aside. */
|
||||
const sameName = (a: string, b: string) => a.trim().replace(/\s+/g, ' ').toLocaleLowerCase('tr') === b.trim().replace(/\s+/g, ' ').toLocaleLowerCase('tr');
|
||||
|
||||
/**
|
||||
* play-app-record: the developer account to create the app in. Never guessed among several: play.developerId (or the
|
||||
* workspace's STOREBOUND_PLAY_DEVELOPER_ID, or the remembered one for this package), else the only account the login
|
||||
* sees, else the chooser entry named play.developerAccount. Remembered under play.packageName once the form is open.
|
||||
*/
|
||||
async function pickPlayAccount(page: Page, config: ShipConfig, o: AcrossOpts, cache: AccountsCache, file: string,
|
||||
nav: (plan: NavStep[], ms?: number) => Promise<NavResult>, quick: number, stop: Stop): Promise<{ nav: NavResult; plan: NavStep[] }> {
|
||||
const say = o.say, bases = o.bases ?? NAV_BASES, pkg = config.play?.packageName, want = config.play?.developerAccount;
|
||||
const planFor = (id?: string) => navPlan(o.form, id ? { ...config, play: { ...config.play!, developerId: id } } : config, bases);
|
||||
const go = async (id: string, account?: string) => {
|
||||
const plan = planFor(id), r = await nav(plan);
|
||||
if (r.ok && pkg) rememberPlay(pkg, { developerId: id, ...(account ? { account } : {}) }, file);
|
||||
return { nav: r, plan };
|
||||
};
|
||||
const known = config.play?.developerId ?? (pkg ? cache.play[pkg]?.developerId : undefined);
|
||||
if (known) { say(`creating the app in developer account ${known}${config.play?.developerId ? ' (play.developerId)' : ` (remembered in ${file})`}`); return go(known, pkg ? cache.play[pkg]?.account : undefined); }
|
||||
const all = await playAccounts(page, bases.play, quick, stop);
|
||||
const list = all.map(a => a.name ? `${a.name} (${a.id})` : a.id).join(', ');
|
||||
const stopHere = (why: string) => ({ nav: { ok: false, steps: [], failed: 'the developer account', why, ...(all.length ? { candidates: all.map(a => a.name || a.id) } : {}) } as NavResult, plan: planFor() });
|
||||
if (want) {
|
||||
const hits = all.filter(a => a.name && sameName(a.name, want));
|
||||
if (hits.length === 1) { say(`creating the app in developer account "${hits[0]!.name}" (play.developerAccount)`); return go(hits[0]!.id, hits[0]!.name); }
|
||||
return stopHere(hits.length ? `more than one developer account is named "${want}" (${list}): set play.developerId`
|
||||
: `no developer account named "${want}" (play.developerAccount) on the chooser${all.length ? `: ${list}` : ''}. Set play.developerAccount to one of them, or play.developerId`);
|
||||
}
|
||||
if (all.length === 1) { say(`this Google login has one developer account: ${all[0]!.name || all[0]!.id}`); return go(all[0]!.id, all[0]!.name || undefined); }
|
||||
if (all.length > 1) return stopHere(`this Google login sees ${all.length} developer accounts (${list}): set play.developerAccount (the name) or play.developerId to pick the one for the new app`);
|
||||
return stopHere('could not read the developer accounts on the "Choose a developer account" page: set play.developerId (or play.developerAccount)');
|
||||
}
|
||||
|
||||
async function across(page: Page, o: AcrossOpts): Promise<{ nav: NavResult; plan: NavStep[] }> {
|
||||
const config = withAccountIds(o.config, o.env), file = o.file ?? accountsFile(), cache = readAccounts(file);
|
||||
const bases = o.bases ?? NAV_BASES, say = o.say;
|
||||
|
|
@ -201,6 +237,7 @@ async function across(page: Page, o: AcrossOpts): Promise<{ nav: NavResult; plan
|
|||
const store = o.form.startsWith('play-') ? 'play' : 'apple';
|
||||
const quick = Math.min(o.navMs, 8000);
|
||||
|
||||
if (store === 'play' && o.form === 'play-app-record') return pickPlayAccount(page, config, o, cache, file, nav, quick, stop);
|
||||
if (store === 'play') {
|
||||
const pkg = config.play?.packageName;
|
||||
const planFor = (id?: string) => navPlan(o.form, id ? { ...config, play: { ...config.play!, developerId: id } } : config, bases);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
// storebound console fill <form> --dry [--json] the answers and the step-by-step guidance; opens no browser
|
||||
// storebound console fill <form> [--store apple|play] [--json] [--profile <dir>]
|
||||
// Forms: apple-app-record, apple-age-rating (guide only: `storebound apple appinfo` sets it), apple-app-privacy,
|
||||
// play-content-rating, play-target-audience. Answers come from the config only (cli/lib/console-answers.ts); anything
|
||||
// play-app-record (Play Console's Create app form: the Play Developer API cannot create apps), play-content-rating,
|
||||
// play-target-audience. Answers come from the config only (cli/lib/console-answers.ts); anything
|
||||
// it does not prove stays EMPTY and highlighted (AGENTS.md rule 5).
|
||||
// Safety: storebound never types passwords, never touches sign-in pages (it waits while the owner signs in), never reads
|
||||
// cookies or storage, and never clicks Save / Submit / Publish / Create / Next: every click goes through safeClick and
|
||||
|
|
@ -28,7 +29,7 @@ import { join } from 'node:path';
|
|||
import type { Ctx } from '../lib/ctx';
|
||||
import { type Answer, type ConsoleResult, consoleResult, DISCLAIMER, FORM_IDS, type FormId, fillValue, formMeta, isForm, valueText } from '../lib/console-answers';
|
||||
import type { ShipConfig } from '../lib/config';
|
||||
import { consoleReached, type FieldDef, type FormDef, formDef, FORM_OPENERS, forbiddenControl, hasToken, isSignInText, isSignInUrl, type Name, navAllowed, type NavBases, type NavStep, navPlan } from '../lib/console-forms';
|
||||
import { ALL_APPS, consoleReached, CREATE_FORM_FIELD, createAppAllowed, type FieldDef, type FormDef, formDef, FORM_OPENERS, forbiddenControl, hasToken, isSignInText, isSignInUrl, type Name, navAllowed, type NavBases, type NavStep, navPlan } from '../lib/console-forms';
|
||||
import { log, printJson, warn } from '../lib/log';
|
||||
import { openAcross, withAccountIds } from './accounts';
|
||||
import { type ConsoleBrowser, openConsoleBrowser } from './session';
|
||||
|
|
@ -145,16 +146,21 @@ async function setField(r: Resolved, v: string | boolean): Promise<boolean> {
|
|||
const exact = labels.indexOf(want);
|
||||
if (exact >= 0) return exact;
|
||||
const near = labels.map((l, i) => [l, i] as const).filter(([l]) => l.endsWith(` - ${want}`) || l.endsWith(`(${want})`) || l.includes(want));
|
||||
return near.length === 1 ? near[0]![1] : -1;
|
||||
if (near.length === 1) return near[0]![1];
|
||||
// a Play language ("English (United States) – en-US") in a console of another UI language: by its code suffix
|
||||
const code = /\s[–-]\s([A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,4})?)$/.exec(want)?.[1];
|
||||
if (!code) return -1;
|
||||
const byCode = labels.map((l, i) => [l, i] as const).filter(([l]) => l.endsWith(` – ${code}`) || l.endsWith(` - ${code}`));
|
||||
return byCode.length === 1 ? byCode[0]![1] : -1;
|
||||
}, String(v));
|
||||
if (idx < 0) return false;
|
||||
await r.loc.selectOption({ index: idx });
|
||||
return true;
|
||||
}
|
||||
|
||||
async function mark(r: Resolved): Promise<void> {
|
||||
if (r.loc) return highlight(r.loc);
|
||||
for (const o of Object.values(r.options ?? {})) await highlight(o);
|
||||
async function mark(r: Resolved, text = CHECK): Promise<void> {
|
||||
if (r.loc) return highlight(r.loc, text);
|
||||
for (const o of Object.values(r.options ?? {})) await highlight(o, text);
|
||||
}
|
||||
|
||||
export interface FillStep {
|
||||
|
|
@ -197,8 +203,10 @@ export async function fillPage(page: Page, def: FormDef, answers: Answer[], done
|
|||
if (!r.ok) continue;
|
||||
const a = byId.get(r.field.id);
|
||||
if (!a) continue;
|
||||
// an agreement is never ticked, whatever the answer says: highlighted for the owner
|
||||
if (r.field.agreement || a.agreement) { await mark(r, 'storebound: you agree to this, never ticked'); highlighted.push(a.id); continue; }
|
||||
const set = a.certain && a.value !== null ? await setField(r, a.value) : false;
|
||||
if (set) filled.push(a.id); else { await mark(r); highlighted.push(a.id); }
|
||||
if (set) { filled.push(a.id); if (a.ownerCheck) await mark(r, 'storebound: owner check'); } else { await mark(r); highlighted.push(a.id); }
|
||||
}
|
||||
done.add(i);
|
||||
return { section: i, title: sec.title, filled, highlighted, missing, fallback: false };
|
||||
|
|
@ -251,13 +259,27 @@ export async function realRole(loc: Locator): Promise<string> {
|
|||
* so (the click gate stays absolute: never Save / Submit / Publish / Create / Send / Next ...; only a link named exactly
|
||||
* Start / Manage / Başla / Yönet is let through). Every navigation click goes through here.
|
||||
*/
|
||||
export async function navClick(loc: Locator): Promise<{ clicked: boolean; name: string }> {
|
||||
export async function navClick(loc: Locator, createApp = false): Promise<{ clicked: boolean; name: string }> {
|
||||
const name = await accName(loc), role = await realRole(loc);
|
||||
if (!navAllowed(name, role)) { warn(TAG, `not clicking "${name}" while opening the form: storebound never presses save, submit, publish, next or similar`); return { clicked: false, name }; }
|
||||
if (createApp ? !await createAppHere(loc, name, role) : !navAllowed(name, role)) { warn(TAG, `not clicking "${name}" while opening the form: storebound never presses save, submit, publish, next or similar`); return { clicked: false, name }; }
|
||||
await loc.click();
|
||||
return { clicked: true, name };
|
||||
}
|
||||
|
||||
/**
|
||||
* The Create app opener check (createAppAllowed) with what the page shows now: the app list (an All apps / Home heading
|
||||
* or an /app-list URL), no Create app form open (no App name field), and the control not inside a form or dialog.
|
||||
*/
|
||||
export async function createAppHere(loc: Locator, name: string, role: string): Promise<boolean> {
|
||||
const page: Page = loc.page();
|
||||
const inForm: boolean = await loc.evaluate((el: any) => !!el.closest('form, [role="form"], [role="dialog"], dialog'));
|
||||
const formOpen = (await findAny(page, ['textbox'], CREATE_FORM_FIELD)).state !== 'none';
|
||||
let appList = false;
|
||||
try { appList = /\/app-list(?:[/?#]|$)/.test(new URL(page.url()).pathname); } catch { /* about:blank */ }
|
||||
if (!appList) for (const n of ALL_APPS) if (await vis(page.getByRole('heading', nameOpts(n))).count() > 0) { appList = true; break; }
|
||||
return createAppAllowed(name, role, { appList, formOpen, inForm });
|
||||
}
|
||||
|
||||
export interface NavResult {
|
||||
ok: boolean;
|
||||
/** Labels of the steps done (["already open"] when the form was already on the page). */
|
||||
|
|
@ -400,7 +422,7 @@ export async function navigate(page: Page, plan: NavStep[], opts: NavOpts = {}):
|
|||
const f = await poll(s.optional ? Math.min(ms, 2000) : ms, async () => { const r = await findAny(page, s.roles, s.names); return r.state === 'none' ? null : r; }, stop);
|
||||
if (!f) { if (s.optional) { say(' (not on this page, skipped)'); continue; } return fail(s, 'not found'); }
|
||||
if (f.state !== 'ok') return fail(s, 'more than one match');
|
||||
const c = await navClick(f.loc);
|
||||
const c = await navClick(f.loc, !!s.createApp);
|
||||
if (!c.clicked) return fail(s, `refused to click "${c.name}"`);
|
||||
} else if (s.kind === 'pickApp') {
|
||||
if (!s.tokens.length && !s.name) return fail(s, 'no bundle id, package name or app name in the config');
|
||||
|
|
@ -451,7 +473,10 @@ export async function resumeAt(page: Page, plan: NavStep[]): Promise<number | nu
|
|||
|
||||
function printText(res: ConsoleResult): void {
|
||||
console.log(`${res.title}\n${res.url}\n`);
|
||||
for (const a of res.answers) console.log(` ${a.certain ? '[ok] ' : '[check]'} ${a.label}: ${valueText(a)} (${a.source})${a.certain || !a.note ? '' : `\n ${a.note}`}`);
|
||||
for (const a of res.answers) {
|
||||
const tag = a.agreement ? '[you] ' : a.ownerCheck ? '[owner]' : a.certain ? '[ok] ' : '[check]';
|
||||
console.log(` ${tag} ${a.label}: ${a.agreement ? '(you tick it; storebound never does)' : valueText(a)} (${a.source})${(a.certain && !a.ownerCheck) || !a.note ? '' : `\n ${a.note}`}`);
|
||||
}
|
||||
console.log(`\n${res.uncertain} answer(s) to check yourself.\n\nSteps:\n${res.guidance.map(g => ` - ${g}`).join('\n')}`);
|
||||
}
|
||||
|
||||
|
|
@ -587,10 +612,12 @@ export async function fillSession(b: ConsoleBrowser, o: FillSessionOpts): Promis
|
|||
// refused / ambiguous: not retried on this page; "not found" / "did not appear" is retried when the step shows up
|
||||
if (!/^(not found|did not appear)$/.test(r.why ?? '')) tried = `${(active() ?? b.page).url()}#${plan.findIndex(s => s.label === r.failed)}`;
|
||||
warn(TAG, `could not open the form by itself at step "${r.failed}" (${r.why}). Open it yourself; storebound keeps watching and fills it when it appears:`);
|
||||
if (r.candidates) say(`apps that match: ${r.candidates.join(' | ')} (set apple.appId / play.packageName in the config to pick one)`);
|
||||
if (r.candidates) say(r.failed === 'the developer account' ? `developer accounts: ${r.candidates.join(' | ')} (set play.developerAccount or play.developerId to pick one)`
|
||||
: `apps that match: ${r.candidates.join(' | ')} (set apple.appId / play.packageName in the config to pick one)`);
|
||||
if (first) for (const s of meta.open) say(`open the form: ${s}`);
|
||||
};
|
||||
|
||||
for (const n of meta.notes ?? []) say(n);
|
||||
await b.page.goto(startUrl ?? meta.url).catch(() => { /* the owner can navigate */ });
|
||||
await signedIn();
|
||||
|
||||
|
|
|
|||
|
|
@ -472,6 +472,14 @@ export interface ShipConfig {
|
|||
* one Google login in several developer accounts, `storebound console fill` finds the app by package name and
|
||||
* remembers the account (~/.storebound/console-accounts.json); this skips that search. */
|
||||
developerId?: string;
|
||||
/** The developer account's display name on Play Console's "Choose a developer account" page (e.g. an
|
||||
* organisation account). `storebound console fill play-app-record` picks the account by it when there is no
|
||||
* package in any account yet and no developerId; ambiguous or unknown -> it stops and lists the accounts. */
|
||||
developerAccount?: string;
|
||||
/** The Play app name when it differs from app.name (Create app form; at most 30 characters). */
|
||||
name?: string;
|
||||
/** Free (true) or paid (false) on Play. A free app can never become paid later; storebound flags it for the owner. */
|
||||
free?: boolean;
|
||||
/** Promo video: a YouTube URL (public or unlisted, ads off, embeddable). Play takes no video upload. Sent by `play listing`. */
|
||||
video?: string;
|
||||
/** Cloud Storage bucket of the Play Console report exports, e.g. "pubsite_prod_rev_<number>" (Play Console >
|
||||
|
|
@ -643,6 +651,10 @@ export function validateExtras(cfg: Partial<ShipConfig>): string[] {
|
|||
const e: string[] = [];
|
||||
if (cfg.apple?.teamId !== undefined && !/^[A-Z0-9]{10}$/.test(cfg.apple.teamId)) e.push('apple.teamId: the 10-character Team ID (Membership details)');
|
||||
if (cfg.play?.developerId !== undefined && !/^\d{1,25}$/.test(cfg.play.developerId)) e.push('play.developerId: the digits of play.google.com/console/u/0/developers/<id>');
|
||||
if (cfg.play?.developerAccount !== undefined && !(typeof cfg.play.developerAccount === 'string' && cfg.play.developerAccount.trim() && cfg.play.developerAccount.length <= 100))
|
||||
e.push('play.developerAccount: the developer account name as Play Console shows it (1-100 characters)');
|
||||
if (cfg.play?.name !== undefined && !(typeof cfg.play.name === 'string' && cfg.play.name.trim() && [...cfg.play.name].length <= 30)) e.push('play.name: 1-30 characters (Play app name)');
|
||||
if (cfg.play?.free !== undefined && typeof cfg.play.free !== 'boolean') e.push('play.free: true (free) | false (paid)');
|
||||
const ad = cfg.apple?.adhoc;
|
||||
if (ad?.method !== undefined && ad.method !== 'release-testing' && ad.method !== 'ad-hoc') e.push('apple.adhoc.method: release-testing | ad-hoc');
|
||||
const ppp = cfg.prices?.ppp;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
// 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-app-record Play Console > Home (All apps) > Create app (the Play Developer API cannot create apps)
|
||||
// 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):
|
||||
|
|
@ -11,6 +12,7 @@
|
|||
// 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/9859152 (create and set up your app)
|
||||
// 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';
|
||||
|
|
@ -18,12 +20,19 @@ import { type AgeGroup, AGE_GROUPS, IARC_QUESTIONS, type IarcQuestion, profileOf
|
|||
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 const FORM_IDS = ['apple-app-record', 'apple-age-rating', 'apple-app-privacy', 'play-app-record', '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 Answer {
|
||||
id: string; label: string; value: AnswerValue; certain: boolean; source: string; note?: string;
|
||||
/** Filled from the config but still the owner's call (Play free or paid: free can never become paid): highlighted
|
||||
* in the page even when filled, and printed with its note. */
|
||||
ownerCheck?: boolean;
|
||||
/** An agreement (Play's Developer Program Policies / US export laws boxes): NEVER ticked by storebound, only highlighted. */
|
||||
agreement?: boolean;
|
||||
}
|
||||
|
||||
export interface FormMeta {
|
||||
id: FormId; store: Store; title: string; url: string;
|
||||
|
|
@ -35,6 +44,8 @@ export interface FormMeta {
|
|||
stopBefore: string;
|
||||
/** false: no page filling at all, guidance only (the API covers it). */
|
||||
fillable: boolean;
|
||||
/** Lines said at the start of a fill run and printed in the guidance (what this form does not set, owner checks). */
|
||||
notes?: string[];
|
||||
}
|
||||
|
||||
/** The `--dry --json` result (and the head of a fill run's result). */
|
||||
|
|
@ -63,6 +74,13 @@ export function formMeta(id: FormId, config: ShipConfig): FormMeta {
|
|||
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-app-record': return { id, store: 'play', title: 'Play Console: Create app', url: PLAY, stopBefore: 'Create app', fillable: true,
|
||||
open: ['Pick the developer account if Play Console asks (play.developerId or play.developerAccount picks it)', 'Home (All apps) > Create app'],
|
||||
notes: [
|
||||
'The package name is not part of this form: the first AAB upload sets it for good (storebound play upload --track internal, or storebound flow run release).',
|
||||
'Free or paid is an owner check: a free app can never become paid later on Google Play.',
|
||||
'The Developer Program Policies and US export laws boxes are agreements: storebound never ticks them. Read and tick them yourself, then press Create app.',
|
||||
] };
|
||||
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,
|
||||
|
|
@ -98,6 +116,58 @@ function appRecord(config: ShipConfig): Answer[] {
|
|||
];
|
||||
}
|
||||
|
||||
/** Play Console's default language entries ("English (United States) – en-US"), by Play listing code. MODELED from
|
||||
* the Play Console language list (help page "Add translations and localized assets"), not recorded. */
|
||||
export const PLAY_LANGUAGE_NAMES: Record<string, string> = {
|
||||
'af': 'Afrikaans', 'am': 'Amharic', 'ar': 'Arabic', 'hy-AM': 'Armenian', 'az-AZ': 'Azerbaijani', 'bn-BD': 'Bangla', 'eu-ES': 'Basque',
|
||||
'be': 'Belarusian', 'bg': 'Bulgarian', 'my-MM': 'Burmese', 'ca': 'Catalan', 'zh-HK': 'Chinese (Hong Kong)', 'zh-CN': 'Chinese (Simplified)',
|
||||
'zh-TW': 'Chinese (Traditional)', 'hr': 'Croatian', 'cs-CZ': 'Czech', 'da-DK': 'Danish', 'nl-NL': 'Dutch', 'en-AU': 'English (Australia)',
|
||||
'en-CA': 'English (Canada)', 'en-IN': 'English (India)', 'en-SG': 'English (Singapore)', 'en-ZA': 'English (South Africa)',
|
||||
'en-GB': 'English (United Kingdom)', 'en-US': 'English (United States)', 'et': 'Estonian', 'fil': 'Filipino', 'fi-FI': 'Finnish',
|
||||
'fr-CA': 'French (Canada)', 'fr-FR': 'French (France)', 'gl-ES': 'Galician', 'ka-GE': 'Georgian', 'de-DE': 'German', 'el-GR': 'Greek',
|
||||
'gu': 'Gujarati', 'iw-IL': 'Hebrew', 'hi-IN': 'Hindi', 'hu-HU': 'Hungarian', 'is-IS': 'Icelandic', 'id': 'Indonesian', 'it-IT': 'Italian',
|
||||
'ja-JP': 'Japanese', 'kn-IN': 'Kannada', 'kk': 'Kazakh', 'km-KH': 'Khmer', 'ko-KR': 'Korean', 'ky-KG': 'Kyrgyz', 'lo-LA': 'Lao',
|
||||
'lv': 'Latvian', 'lt': 'Lithuanian', 'mk-MK': 'Macedonian', 'ms': 'Malay', 'ms-MY': 'Malay (Malaysia)', 'ml-IN': 'Malayalam',
|
||||
'mr-IN': 'Marathi', 'mn-MN': 'Mongolian', 'ne-NP': 'Nepali', 'no-NO': 'Norwegian', 'fa': 'Persian', 'pl-PL': 'Polish',
|
||||
'pt-BR': 'Portuguese (Brazil)', 'pt-PT': 'Portuguese (Portugal)', 'pa': 'Punjabi', 'ro': 'Romanian', 'rm': 'Romansh', 'ru-RU': 'Russian',
|
||||
'sr': 'Serbian', 'si-LK': 'Sinhala', 'sk': 'Slovak', 'sl': 'Slovenian', 'es-419': 'Spanish (Latin America)', 'es-ES': 'Spanish (Spain)',
|
||||
'es-US': 'Spanish (United States)', 'sw': 'Swahili', 'sv-SE': 'Swedish', 'ta-IN': 'Tamil', 'te-IN': 'Telugu', 'th': 'Thai', 'tr-TR': 'Turkish',
|
||||
'uk': 'Ukrainian', 'ur': 'Urdu', 'vi': 'Vietnamese', 'zu': 'Zulu',
|
||||
};
|
||||
/** The Play Console label of a listing language code ("English (United States) – en-US"), or null when unknown. */
|
||||
export const playLanguageLabel = (code: string): string | null => (PLAY_LANGUAGE_NAMES[code] ? `${PLAY_LANGUAGE_NAMES[code]} – ${code}` : null);
|
||||
|
||||
/** The Play app name limit (Create app form and store listing title). */
|
||||
export const PLAY_NAME_MAX = 30;
|
||||
|
||||
function playAppRecord(config: ShipConfig): Answer[] {
|
||||
const p = config.play;
|
||||
const name = p?.name ?? config.app.name, nameSrc = p?.name ? 'play.name' : 'app.name';
|
||||
const len = [...name].length;
|
||||
const first = config.languages.find(l => l.play)?.play;
|
||||
const code = p?.defaultLanguage ?? (Array.isArray(first) ? first[0] : first);
|
||||
const lang = code ? playLanguageLabel(code) : null;
|
||||
const langSrc = p?.defaultLanguage ? 'play.defaultLanguage' : 'languages[0].play';
|
||||
const profile = config.app.profile;
|
||||
const sells = (config.products?.length ?? 0) > 0 || (config.subscriptions?.length ?? 0) > 0, ads = (config.ads?.appAdsTxt?.length ?? 0) > 0;
|
||||
const once = 'A free app can never become paid later on Google Play (a paid app can become free).';
|
||||
const out: Answer[] = [
|
||||
len <= PLAY_NAME_MAX ? ok('name', 'App name', name, nameSrc, 'Shown on Google Play; the store listing can change it later.')
|
||||
: ask('name', 'App name', nameSrc, `"${name}" is ${len} characters; Play allows ${PLAY_NAME_MAX}. Set play.name to a shorter name.`),
|
||||
lang ? ok('language', 'Default language', lang, langSrc)
|
||||
: ask('language', 'Default language', 'play.defaultLanguage', code ? `Pick the language of code "${code}" (storebound does not know its Play Console name).` : 'Set play.defaultLanguage (e.g. en-US) or a play code on the first language.'),
|
||||
profile ? ok('type', 'App or game', profile === 'game' ? 'Game' : 'App', 'app.profile', 'Changeable later in the store settings.')
|
||||
: ask('type', 'App or game', 'app.profile', 'Set app.profile (game | app | subscription-app) to have it filled.'),
|
||||
];
|
||||
if (p?.free !== undefined) out.push({ ...ok('price', 'Free or paid', p.free ? 'Free' : 'Paid', 'play.free', `Owner check: ${once}`), ownerCheck: true });
|
||||
else if (sells || ads) out.push({ ...ok('price', 'Free or paid', 'Free', [sells ? (config.products?.length ? 'products' : 'subscriptions') : '', ads ? 'ads.appAdsTxt' : ''].filter(Boolean).join(' + '),
|
||||
`Owner check: the config earns from in-app purchases / ads only, so Free. ${once} Set play.free to make it explicit.`), ownerCheck: true });
|
||||
else out.push(ask('price', 'Free or paid', 'play.free', `Set play.free. ${once}`));
|
||||
const agree = (id: string, label: string) => ({ ...ask(id, label, 'none', 'An agreement: only you can accept it. storebound never ticks it.'), agreement: true });
|
||||
out.push(agree('agree:policies', 'Declarations: Developer Program Policies'), agree('agree:exportLaws', 'Declarations: US export laws'));
|
||||
return out;
|
||||
}
|
||||
|
||||
/** 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'])];
|
||||
|
||||
|
|
@ -207,6 +277,7 @@ export function consoleAnswers(id: FormId, config: ShipConfig): Answer[] {
|
|||
case 'apple-app-record': return appRecord(config);
|
||||
case 'apple-age-rating': return ageRating(config);
|
||||
case 'apple-app-privacy': return appPrivacy(config);
|
||||
case 'play-app-record': return playAppRecord(config);
|
||||
case 'play-content-rating': return contentRating(config);
|
||||
case 'play-target-audience': return targetAudience(config);
|
||||
}
|
||||
|
|
@ -223,7 +294,8 @@ 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'})`}`);
|
||||
for (const a of answers) g.push(`${a.label}: ${a.agreement ? 'you tick it (an agreement; storebound never does)' : valueText(a)}${a.certain && !a.ownerCheck ? '' : ` (check: ${a.note ?? 'not in the config'})`}`);
|
||||
g.push(...(meta.notes ?? []).map(n => `Note: ${n}`));
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ export interface FieldDef {
|
|||
names?: Name[];
|
||||
/** radio: answer value (String(value)) -> candidate names of that radio button. */
|
||||
options?: Record<string, Name[]>;
|
||||
/** An agreement checkbox: located and highlighted, NEVER ticked (whatever the answer says). */
|
||||
agreement?: boolean;
|
||||
}
|
||||
|
||||
export interface SectionDef {
|
||||
|
|
@ -64,6 +66,14 @@ export function formDef(id: FormId, answers: Answer[]): FormDef {
|
|||
{ id: 'access', kind: 'radio', names: ['User Access'], options: { limited: ['Limited Access'], full: ['Full Access'] } },
|
||||
] }] };
|
||||
case 'apple-age-rating': return { id, sections: [] };
|
||||
case 'play-app-record': return { id, sections: [{ title: 'Create app', fields: [
|
||||
{ id: 'name', kind: 'text', names: ['App name', 'Uygulama adı'] },
|
||||
{ id: 'language', kind: 'select', names: ['Default language', 'Varsayılan dil'] },
|
||||
{ id: 'type', kind: 'radio', names: ['App or game', 'Uygulama veya oyun'], options: { App: ['App', 'Uygulama'], Game: ['Game', 'Oyun'] } },
|
||||
{ id: 'price', kind: 'radio', names: ['Free or paid', 'Ücretsiz veya ücretli'], options: { Free: ['Free', 'Ücretsiz'], Paid: ['Paid', 'Ücretli'] } },
|
||||
{ id: 'agree:policies', kind: 'checkbox', agreement: true, names: [/Developer Program Polic/i, /Geliştirici Program(ı)? Politika/iu] },
|
||||
{ id: 'agree:exportLaws', kind: 'checkbox', agreement: true, names: [/export laws/i, /ihracat yasa/iu] },
|
||||
] }] };
|
||||
case 'apple-app-privacy': {
|
||||
const sections: SectionDef[] = [{ title: 'Data collection', fields: [
|
||||
{ id: 'collects', kind: 'radio', options: yesNo([/^Yes, we collect data/i], [/^No, we do not collect data/i]) },
|
||||
|
|
@ -167,8 +177,9 @@ export function consoleReached(store: 'apple' | 'play', url: string, base?: stri
|
|||
/** One navigation step. Steps are logged by `label`; a failed step is named in the fallback. */
|
||||
export type NavStep =
|
||||
| { kind: 'goto'; label: string; url: string }
|
||||
/** Click the one visible control of one of `roles` named like one of `names`. `optional`: skipped when absent or when `unless` is already visible. */
|
||||
| { kind: 'click'; label: string; roles: string[]; names: Name[]; optional?: boolean; unless?: { roles: string[]; names: Name[] } }
|
||||
/** Click the one visible control of one of `roles` named like one of `names`. `optional`: skipped when absent or when `unless` is already visible.
|
||||
* `createApp`: the Play app list's Create app opener (createAppAllowed decides, never the plain gate). */
|
||||
| { kind: 'click'; label: string; roles: string[]; names: Name[]; optional?: boolean; unless?: { roles: string[]; names: Name[] }; createApp?: boolean }
|
||||
/** Pick the app from the list: rows / links whose name contains one of `tokens` (bundle id / package name) as a whole token, else whose name is `name`. */
|
||||
| { kind: 'pickApp'; label: string; tokens: string[]; name?: string; search?: Name[] }
|
||||
/** The Start / Manage link of the App content entry named like `entry`. */
|
||||
|
|
@ -179,6 +190,32 @@ export type NavStep =
|
|||
/** Link names that only open a form (whole name, links only): allowed although "start" is in the click gate. */
|
||||
export const FORM_OPENERS = ['Start', 'Manage', 'Başla', 'Yönet'];
|
||||
|
||||
/**
|
||||
* Play Console's page-level "Create app" button on Home (All apps) only OPENS the Create app form, but the same words
|
||||
* are the form's final submit button. So it is let through only as the navigation step from the app list, never
|
||||
* inside the form: the whole name is exactly one of these, the role is button or link, the page is the app list
|
||||
* (an "All apps" heading or an /app-list URL), the Create app form is not open (no App name field on the page), and
|
||||
* the control is not inside a form or dialog. Everything else named Create app is refused (forbiddenControl).
|
||||
*/
|
||||
export const CREATE_APP_OPENERS = ['Create app', 'Uygulama oluştur'];
|
||||
export interface CreateAppWhere {
|
||||
/** The page is the app list (All apps heading or /app-list URL). */
|
||||
appList: boolean;
|
||||
/** The Create app form is open on the page (its App name field is there). */
|
||||
formOpen: boolean;
|
||||
/** The control sits inside a <form>, role=form or a dialog. */
|
||||
inForm: boolean;
|
||||
}
|
||||
export function createAppAllowed(name: string, role: string, where: CreateAppWhere): boolean {
|
||||
const n = name.trim().replace(/\s+/g, ' ');
|
||||
return CREATE_APP_OPENERS.some(o => o.toLocaleLowerCase('tr') === n.toLocaleLowerCase('tr')) && (role === 'button' || role === 'link')
|
||||
&& where.appList && !where.formOpen && !where.inForm;
|
||||
}
|
||||
/** Headings of Play Console's app list (Home / All apps). */
|
||||
export const ALL_APPS: Name[] = ['All apps', 'Tüm uygulamalar', 'Home', 'Ana sayfa'];
|
||||
/** The Create app form's App name field (its presence means the form is open: Create app is the submit there). */
|
||||
export const CREATE_FORM_FIELD: Name[] = ['App name', 'Uygulama adı'];
|
||||
|
||||
/** URL bases (tests point them at 127.0.0.1 fixtures). */
|
||||
export interface NavBases { asc: string; play: string }
|
||||
export const NAV_BASES: NavBases = { asc: 'https://appstoreconnect.apple.com', play: 'https://play.google.com/console' };
|
||||
|
|
@ -202,6 +239,13 @@ export function navPlan(id: FormId, config: ShipConfig, bases: NavBases = NAV_BA
|
|||
{ kind: 'wait', label: 'the New App dialog', roles: ['dialog'], names: ['New App', 'Yeni Uygulama', /^new app\b/i, /^yeni uygulama\b/iu] },
|
||||
];
|
||||
case 'apple-age-rating': return [];
|
||||
case 'play-app-record': return [
|
||||
config.play?.developerId
|
||||
? { kind: 'goto', label: 'open the app list of the developer account', url: playAppList(play, config.play.developerId) }
|
||||
: { kind: 'goto', label: 'open Play Console', url: play },
|
||||
{ kind: 'click', label: 'Create app on the app list', roles: ['button', 'link'], names: CREATE_APP_OPENERS, createApp: true },
|
||||
{ kind: 'wait', label: 'the Create app form', roles: ['textbox'], names: CREATE_FORM_FIELD },
|
||||
];
|
||||
case 'apple-app-privacy': {
|
||||
const appId = config.apple?.appId;
|
||||
const open: NavStep[] = appId ? [{ kind: 'goto', label: 'open App Privacy of the app (apple.appId)', url: `${asc}/apps/${encodeURIComponent(appId)}/distribution/privacy` }] : [
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ export interface AnalyticsCompare {
|
|||
}
|
||||
/** console.fill (`console fill <form> --json`, cli/console/fill.ts): the answers it types into one console form. The
|
||||
* dry run has the answers only; the real run (it ends when the owner closes the browser) adds what happened. */
|
||||
export type ConsoleForm = 'apple-app-record' | 'apple-age-rating' | 'apple-app-privacy' | 'play-content-rating' | 'play-target-audience';
|
||||
export type ConsoleForm = 'apple-app-record' | 'apple-age-rating' | 'apple-app-privacy' | 'play-app-record' | 'play-content-rating' | 'play-target-audience';
|
||||
export interface ConsoleAnswer { id: string; label: string; value: string; certain: boolean; source: string; note?: string }
|
||||
export interface ConsoleFillResult {
|
||||
form: ConsoleForm; store: 'apple' | 'play'; title: string; url: string; answers: ConsoleAnswer[];
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export const JSON_TOOLS = new Set(['check', 'check_aso', 'scan', 'validate', 'he
|
|||
'project_icon', 'project_listings', 'reviews_drafts', 'project_declarations', 'project_listing_text', 'project_renders', 'project_render', 'prices_current']);
|
||||
|
||||
/** Console forms `storebound console fill` knows (cli/console/fill.ts). */
|
||||
export const CONSOLE_FORMS = ['apple-app-record', 'apple-age-rating', 'apple-app-privacy', 'play-content-rating', 'play-target-audience'];
|
||||
export const CONSOLE_FORMS = ['apple-app-record', 'apple-age-rating', 'apple-app-privacy', 'play-app-record', 'play-content-rating', 'play-target-audience'];
|
||||
/** Write tools that print a structured result with --json in the dry run and the real run (console.fill: the answers). */
|
||||
export const JSON_WRITES = new Set(['console_fill']);
|
||||
/** Write tools whose command may ask its own question (confirm()): a verified host token answers it, as for owner actions. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue