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:
CRTkafa 2026-10-11 19:48:20 +00:00
parent 96f3df443b
commit 20d34fa0ec
26 changed files with 592 additions and 41 deletions

View file

@ -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` }] : [