From 7e1d839d687cfd0c40ee7002fec8bf53592329aa Mon Sep 17 00:00:00 2001 From: CRT Date: Sat, 10 Oct 2026 17:47:08 +0000 Subject: [PATCH] Review access and account deletion: demo account from .storebound (masked) to App Review, accounts config, profile checks in check and validate, Data safety extra rows --- cli/apple/review-details.ts | 15 ++- cli/check.ts | 13 +- cli/lib/config.ts | 209 ++++++++++++++++++++++++++++- cli/lib/credentials.ts | 23 +++- cli/lib/data-safety.ts | 1 + cli/lib/profile.ts | 36 +++++ cli/lib/review-details.ts | 41 ++++++ cli/lib/validate-rules.ts | 118 +++++++++++++++- cli/validate.ts | 57 +++++++- skills/account-deletion/SKILL.md | 43 ++++++ skills/review-access/SKILL.md | 40 ++++++ templates/credentials.example.json | 3 +- 12 files changed, 578 insertions(+), 21 deletions(-) create mode 100644 cli/lib/profile.ts create mode 100644 cli/lib/review-details.ts create mode 100644 skills/account-deletion/SKILL.md create mode 100644 skills/review-access/SKILL.md diff --git a/cli/apple/review-details.ts b/cli/apple/review-details.ts index d669b48a..5d297ec1 100644 --- a/cli/apple/review-details.ts +++ b/cli/apple/review-details.ts @@ -1,11 +1,14 @@ -// App Review information on the editable version: contact, demo account (none), notes. Idempotent. +// App Review information on the editable version: contact, demo account, notes. Idempotent. // storebound apple review-details [--contact-from ] [--dry] // The contact (name, phone, email) is personal data, so it is never in the config: it comes from // .storebound/credentials.json "reviewContact", or is copied from another app of the same team with --contact-from. -// Notes: apple.info.reviewNotes in storebound.config.ts. +// Demo account (reviewAccess.signInRequired: true): "reviewDemoAccount" in .storebound/credentials.json or +// REVIEW_DEMO_USER / REVIEW_DEMO_PASSWORD; masked in every log line. Notes: apple.info.reviewNotes plus +// reviewAccess.instructions and accounts.inApp (lib/review-details.ts). import type { Ctx } from '../lib/ctx'; import { need } from '../lib/ctx'; -import { reviewContact } from '../lib/credentials'; +import { reviewContact, reviewDemoAccount } from '../lib/credentials'; +import { reviewDetailPlan } from '../lib/review-details'; import { done, log } from '../lib/log'; import { ascClient } from './asc'; @@ -29,11 +32,11 @@ export async function run(ctx: Ctx): Promise { } if (!contact) throw new Error('no review contact: add "reviewContact" to .storebound/credentials.json or pass --contact-from '); - const attributes = { ...contact, demoAccountRequired: false, demoAccountName: null, demoAccountPassword: null, notes: config.apple?.info?.reviewNotes ?? '' }; - if (ctx.args.has('dry')) { log('apple', `would set review details (contact ${from ? 'copied from ' + from : 'from credentials'}, notes ${attributes.notes.length} chars)`); return; } + const { attributes, summary } = reviewDetailPlan(config, contact, reviewDemoAccount(root)); + if (ctx.args.has('dry')) { log('apple', `would set review details (contact ${from ? 'copied from ' + from : 'from credentials'}, ${summary})`); return; } const cur = (await c.maybe(`/v1/appStoreVersions/${version.id}/appStoreReviewDetail`))?.data; if (cur) await c.asc('PATCH', `/v1/appStoreReviewDetails/${cur.id}`, { data: { type: 'appStoreReviewDetails', id: cur.id, attributes } }); else await c.asc('POST', '/v1/appStoreReviewDetails', { data: { type: 'appStoreReviewDetails', attributes, relationships: { appStoreVersion: { data: { type: 'appStoreVersions', id: version.id } } } } }); - done('apple', `review details set on ${version.attributes.versionString} (no demo account, notes ${attributes.notes.length} chars)`); + done('apple', `review details set on ${version.attributes.versionString} (${summary})`); } diff --git a/cli/check.ts b/cli/check.ts index 2743538c..8c4309ff 100644 --- a/cli/check.ts +++ b/cli/check.ts @@ -1,5 +1,6 @@ // Offline sanity check of everything the store commands read: config, both listing files, the screenshot copy, data -// safety answers, product texts vs store limits, and the files the config points at. No network, no credentials. +// safety answers, product texts vs store limits, the app profile (accounts + deletion, demo account for review, +// subscriptions + terms URL) and the files the config points at. No network; credentials are only checked for presence. // storebound check everything above // storebound check --aso keyword audit of both listing files (App Store keyword field, Play stuffing); exit 1 on errors import { existsSync, readFileSync } from 'node:fs'; @@ -8,7 +9,10 @@ import { playCodes } from './lib/config'; import { APPLE_IAP_LIMITS, len, parseAppStoreListing, parsePlayListing } from './lib/copy'; import type { Ctx } from './lib/ctx'; import { dataSafetyRows } from './lib/data-safety'; +import { reviewDemoAccount } from './lib/credentials'; import { log, warn } from './lib/log'; +import { profileIssues } from './lib/profile'; +import { allSubscriptions } from './lib/subscriptions'; import { type CopyFile, validateCopy } from './shots/lib'; function aso(ctx: Ctx): void { @@ -59,8 +63,13 @@ export async function run(ctx: Ctx): Promise { if (e.length) throw new Error(e.join('; ')); return `${Object.keys(copy).length} languages x ${config.shots!.scenes.length} scenes`; }); + for (const i of profileIssues(config, { demoAccount: !!reviewDemoAccount(ctx.loaded.root) })) { + if (i.level === 'error') problems.push(i.msg); else warn('check', i.msg); + } + const subs = allSubscriptions(config.subscriptions); + if (subs.length) log('check', `subscriptions: ${subs.length} in ${config.subscriptions!.length} group(s)`); const files = [config.icons?.composite, config.icons?.foreground, config.icons?.background, config.shots?.logo, - ...(config.products ?? []).map(p => p.reviewScreenshot)].filter((f): f is string => !!f); + ...(config.products ?? []).map(p => p.reviewScreenshot), ...subs.map(x => x.sub.reviewScreenshot)].filter((f): f is string => !!f); for (const f of new Set(files)) if (!existsSync(resolve(f))) problems.push(`missing file: ${f}`); if (existsSync(resolve('.gitignore')) && !/^\/?\.storebound\/?$/m.test(readFileSync(resolve('.gitignore'), 'utf8'))) problems.push('.gitignore does not ignore .storebound/ (credentials live there)'); diff --git a/cli/lib/config.ts b/cli/lib/config.ts index a320f214..93e5d978 100644 --- a/cli/lib/config.ts +++ b/cli/lib/config.ts @@ -1,11 +1,19 @@ -// Per-project config (storebound.config.ts at the project root). Everything game-specific lives here; credentials never +// Per-project config (storebound.config.ts at the project root). Everything app-specific lives here; credentials never // do (see credentials.ts). The file default-exports a plain object; `import type { ShipConfig }` is optional. import { existsSync } from 'node:fs'; import { dirname, isAbsolute, join, resolve } from 'node:path'; import { validateCapture, validateRecord } from '../shots/devices'; +import { validateSubscriptions } from './subscriptions'; import { type TfConfig, validateTestflight } from './testflight'; -export type ProductType = 'consumable' | 'non_consumable'; +/** consumable / non_consumable: both stores. non_renewing: Apple NON_RENEWING_SUBSCRIPTION (access for a fixed time, + * you track the expiry); Google Play has no such type, so it becomes a one-time product your app consumes when the + * access ends (or model it as a prepaid base plan in Play Console). */ +export type ProductType = 'consumable' | 'non_consumable' | 'non_renewing'; + +/** Which stores sell an item (app identity: one catalog, per-platform availability). Default: every store the config + * has a section for (apple = iOS / iPadOS App Store, play = Google Play). */ +export type Platform = 'ios' | 'android'; export interface PriceOverride { /** ISO 3166-1 alpha-2 region for Play, e.g. "TR". */ @@ -36,6 +44,8 @@ export interface Product { /** Apple only: review screenshot (path relative to the project root). */ reviewScreenshot?: string; familySharable?: boolean; + /** Sell this product only on these platforms (default: all of app.platforms). */ + platforms?: Platform[]; } export interface Language { @@ -68,6 +78,13 @@ export interface DataSafety { accountCreation?: string[]; /** Play data type id (e.g. "PSL_DEVICE_ID") -> usage. Types not listed are "not collected". */ data: Record; + /** + * Extra CSV rows for questions storebound does not model, appended as they are. Google does not publish every + * question id (e.g. the delete-account URL asked when accountCreation is not PSL_ACM_NONE): export the form from + * Play Console (App content > Data safety > Export to CSV), copy the exact ids from it, e.g. + * { question: '', value: 'https://example.com/delete-account' }. + */ + extra?: { question: string; response?: string; value: string; label?: string }[]; } export interface ShotBadgeSlot { y: number; side: 'l' | 'r'; icon?: string; iconBg?: string; hot?: boolean; stars?: boolean; rot?: number } @@ -76,6 +93,10 @@ export interface Palette { bg: [string, string, string]; glow: string; ink: stri export interface ShotScene { id: string; palette: string | Palette; hero?: boolean; frames: ShotFrame[]; badges?: ShotBadgeSlot[]; over?: number } export interface ShotsConfig { + /** Look of the rendered screenshots: game (sunburst, sparkles, badges, bold outlined titles) or app (calm gradient, + * device frame, headline + subline, no sparkles or badges). Default: app for the app / subscription-app profiles, + * else game. */ + style?: 'game' | 'app'; /** JSON file: { [languageId]: { [sceneId]: { eyebrow, title: [line1, line2], sub, badges: [[big, small?]] } } } */ copy: string; /** Raw frames: ///.png */ @@ -123,7 +144,7 @@ export interface ShotSpec { export interface ShotsCapture { /** Where frames come from. Default "web". */ source?: 'web' | 'ios-sim' | 'android-emu' | 'folder'; - /** web: URL of the running game, e.g. http://127.0.0.1:5173 */ + /** web: URL of the running app or game, e.g. http://127.0.0.1:5173 */ baseUrl?: string; /** web: appended to every URL, e.g. "lang={lang}&noads=1". */ query?: string; @@ -256,16 +277,157 @@ export interface AppleAppInfo { reviewNotes?: string; } +/** What kind of app this is. Picks the `init` templates, the default screenshot style and the profile checks of + * `check` / `validate`. game = free-to-play game with ads + IAP; app = utility / productivity app (optional account, + * analytics, no ads); subscription-app = app with accounts and auto-renewable subscriptions. */ +export type AppProfile = 'game' | 'app' | 'subscription-app'; +export const PROFILES: readonly AppProfile[] = ['app', 'game', 'subscription-app']; + +/** Accounts in the app (sign-up / sign-in). Both stores then want account deletion: Apple 5.1.1(v) inside the app, + * Google Play inside the app and on the web (the URL goes into Data safety). See the account-deletion skill. */ +export interface AccountsConfig { + /** The app lets people create an account (or sign in with one you create for them). */ + enabled: boolean; + /** Public https page where people request account + data deletion without the app (Play "Delete account URL"). */ + deletionUrl?: string; + /** Where deletion starts inside the app, e.g. "Settings > Account > Delete account" (goes into the review notes). */ + inApp?: string; +} + +/** How a reviewer gets past a sign-in (App Review demo account, Play App content > App access). The credentials + * themselves are never in the config: "reviewDemoAccount" in .storebound/credentials.json or REVIEW_DEMO_USER / + * REVIEW_DEMO_PASSWORD. See the review-access skill. */ +export interface ReviewAccess { + /** Some or all features need a sign-in: App Review gets demoAccountRequired + the demo account. */ + signInRequired: boolean; + /** Steps for the reviewer, appended to the App Review notes, e.g. "Sign in with the demo account, open Projects." */ + instructions?: string; +} + +export type SubscriptionPeriod = 'P1W' | 'P1M' | 'P2M' | 'P3M' | 'P6M' | 'P1Y'; + +/** Introductory offer for new subscribers. Apple: subscriptionIntroductoryOffers (first-time subscribers of the group, + * per territory). Play: an offer on the base plan for users who never had this subscription. */ +export interface IntroOffer { + /** free = free trial; pay-as-you-go = a lower price for `periods` billing periods; pay-up-front = one price for `duration`. */ + type: 'free' | 'pay-as-you-go' | 'pay-up-front'; + /** free / pay-up-front: P3D, P1W, P2W, P1M, P2M, P3M, P6M or P1Y. pay-as-you-go: the subscription period (default). */ + duration?: string; + /** pay-as-you-go: number of discounted periods (1-12). */ + periods?: number; + /** pay-as-you-go: price per period, pay-up-front: the whole price, in USD (Apple: equalized price points; Play: converted). */ + usd?: number; + /** Play offer id (lowercase letters, digits, hyphens). Default "intro". */ + playOfferId?: string; +} + +/** A promotional / developer-determined offer. Apple: subscriptionPromotionalOffers (offerCode = id). Play: a base + * plan offer with offer tag = id and no acquisition targeting (your app decides who sees it). */ +export interface SubscriptionOfferDef { + /** Apple offer code / Play offer id: lowercase letters, digits, hyphens (Play rule; Apple accepts it too). */ + id: string; + /** Apple reference name (default: the id). */ + name?: string; + type: 'free' | 'pay-as-you-go' | 'pay-up-front'; + /** free / pay-up-front: P3D ... P1Y; pay-as-you-go: the subscription period (default). */ + duration?: string; + /** pay-as-you-go: number of discounted periods (1-12). */ + periods?: number; + /** USD price (per period for pay-as-you-go, total for pay-up-front). */ + usd?: number; +} + +/** Apple subscription offer code campaign. Custom codes (e.g. "SPRING26") are created only from a terminal run that + * confirms; one-time-use codes are generated by you in App Store Connect (or later with the API). */ +export interface OfferCodeDef { + /** Reference name of the offer code campaign. */ + name: string; + /** Who may redeem: NEW (never subscribed), EXISTING, EXPIRED. */ + eligibility: ('NEW' | 'EXISTING' | 'EXPIRED')[]; + /** true = stack with the introductory offer (STACK_WITH_INTRO_OFFERS), false = replace it (default). */ + stackWithIntro?: boolean; + type: 'free' | 'pay-as-you-go' | 'pay-up-front'; + duration?: string; + periods?: number; + usd?: number; + /** Custom codes: the code, how many redemptions, optional expiry (YYYY-MM-DD). */ + customCodes?: { code: string; count: number; expires?: string }[]; +} + +export interface SubscriptionListing { + /** Apple display name (30) / Play title. */ + title: string; + /** Apple description (45) / Play description. */ + description: string; + /** Play only: up to 4 benefits shown on the purchase screen (40 characters each). */ + benefits?: string[]; +} + +export interface Subscription { + /** Product id, same on both stores, e.g. "com.example.app.pro_monthly". */ + id: string; + period: SubscriptionPeriod; + /** Rank inside the group, 1 = highest level of service (Apple groupLevel; up / downgrades follow it). */ + level: number; + /** Base price per period in USD. Apple: the USA price point and its equalizations; Play: convertRegionPrices. */ + usd: number; + /** Regions set by hand (Apple needs a price point with exactly that value). */ + overrides?: PriceOverride[]; + /** Language id -> display name + description (+ Play benefits). */ + listings: Record; + /** Apple only: internal reference name (defaults to the first listing title). */ + referenceName?: string; + /** Apple only: note for the reviewer on this subscription. */ + reviewNote?: string; + /** Apple only: review screenshot of the purchase screen (path relative to the project root). */ + reviewScreenshot?: string; + familySharable?: boolean; + intro?: IntroOffer; + /** More offers people get when your app decides (Apple promotional offers, signed by your server; Play offers + * without acquisition targeting, picked by offer tag in your app). */ + offers?: SubscriptionOfferDef[]; + /** Apple subscription offer codes (redeemed in the App Store or in the app), with optional custom codes. */ + offerCodes?: OfferCodeDef[]; + /** Sell this subscription only on these platforms (default: all of app.platforms). */ + platforms?: Platform[]; + /** Play base plan id (lowercase letters, digits, hyphens). Default from the period: weekly, monthly, yearly, ... */ + basePlanId?: string; + /** Play grace period (ISO 8601: P3D, P7D, P14D, P30D). Default: Play's default. */ + gracePeriod?: string; +} + +/** One subscription group. Apple: a subscription group (people can hold one subscription per group and move between + * its levels). Play has no groups: each subscription becomes a Play subscription with one auto-renewing base plan. */ +export interface SubscriptionGroup { + /** Apple reference name of the group (internal, unique per app). */ + name: string; + /** Language id -> group display name on the App Store (+ optional custom app name). */ + listings: Record; + subscriptions: Subscription[]; +} + export interface ShipConfig { app: { name: string; + /** game | app | subscription-app (see AppProfile). Default: game for configs written before 0.5.0. */ + profile?: AppProfile; + /** App identity: the platforms this one app ships on. Default: ios when there is an `apple` section, android when + * there is a `play` section. `apple` / `play` hold the per-platform settings; languages, listings, products and + * subscriptions are shared, with `platforms` on an item to sell it on one store only. */ + platforms?: Platform[]; copyright?: string; privacyPolicyUrl: string; + /** Terms of Use / EULA page. Needed with subscriptions (Apple 3.1.2: in the app and in the metadata). */ + termsUrl?: string; supportUrl: string; marketingUrl?: string; website: string; contactEmail: string; }; + /** Accounts in the app: account deletion checks (Apple 5.1.1(v), Play Data safety delete-account URL). */ + accounts?: AccountsConfig; + /** Sign-in for store reviewers (demo account; credentials live in .storebound/ only). */ + reviewAccess?: ReviewAccess; languages: Language[]; play?: { packageName: string; defaultLanguage?: string; listing?: string; icon?: string; @@ -278,7 +440,7 @@ export interface ShipConfig { apple?: { bundleId: string; appId?: string; primaryLocale?: string; listing?: string; info?: AppleAppInfo; reviewShots?: string; /** - * Export compliance answer for every build (`storebound apple encryption`, `validate`). false ONLY when the game uses + * Export compliance answer for every build (`storebound apple encryption`, `validate`). false ONLY when the app uses * no encryption beyond what the OS provides (HTTPS / TLS through the system, standard auth). Never set it to false * to skip the question: a wrong answer is a legal problem, not a store one. Unset = storebound will not answer. */ @@ -298,6 +460,8 @@ export interface ShipConfig { testflight?: TfConfig; }; products?: Product[]; + /** Auto-renewable subscriptions (`storebound apple subscriptions`, `storebound play subscriptions`). */ + subscriptions?: SubscriptionGroup[]; /** Price sheet for `storebound prices export | import` (product x store x region). */ prices?: { /** CSV path. Default store/prices.csv. */ @@ -314,6 +478,22 @@ export interface ShipConfig { icons?: IconsConfig; } +/** Platforms of the app (app identity): app.platforms, else from the store sections. */ +export const platformsOf = (c: Pick): Platform[] => + c.app.platforms ?? [...(c.apple ? ['ios' as const] : []), ...(c.play ? ['android' as const] : [])]; + +/** Is a catalog item (product / subscription) sold on this store? Pure. */ +export const sellsOn = (c: Pick, item: { platforms?: Platform[] }, store: 'apple' | 'play'): boolean => { + const p: Platform = store === 'apple' ? 'ios' : 'android'; + return platformsOf(c).includes(p) && (!item.platforms || item.platforms.includes(p)); +}; + +/** The profile of a config: app.profile, else "game" (configs written before profiles existed were games). */ +export const profileOf = (c: Pick): AppProfile => c.app.profile ?? 'game'; + +/** Screenshot style: shots.style, else app for the app / subscription-app profiles, else game. */ +export const shotsStyle = (c: Pick): 'game' | 'app' => c.shots?.style ?? (profileOf(c) === 'game' ? 'game' : 'app'); + /** Identity helper for typed configs: `export default defineConfig({...})`. */ export const defineConfig = (c: ShipConfig): ShipConfig => c; @@ -333,7 +513,21 @@ export function validateConfig(c: unknown): string[] { for (const k of ['privacyPolicyUrl', 'supportUrl', 'website'] as const) if (!URL_RE.test(app[k] ?? '')) e.push(`app.${k}: must be an https URL`); if (app.marketingUrl && !URL_RE.test(app.marketingUrl)) e.push('app.marketingUrl: must be an https URL'); if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(app.contactEmail ?? '')) e.push('app.contactEmail: not an email address'); + if (app.termsUrl && !URL_RE.test(app.termsUrl)) e.push('app.termsUrl: must be an https URL'); + if (app.profile !== undefined && !PROFILES.includes(app.profile)) e.push(`app.profile: one of ${PROFILES.join(', ')}`); + if (app.platforms !== undefined) { + if (!Array.isArray(app.platforms) || !app.platforms.length || !app.platforms.every(x => x === 'ios' || x === 'android')) e.push('app.platforms: a list of ios | android'); + else { + if (app.platforms.includes('ios') && !cfg.apple) e.push('app.platforms: ios needs an apple section'); + if (app.platforms.includes('android') && !cfg.play) e.push('app.platforms: android needs a play section'); + } + } } + if (cfg.accounts) { + if (typeof cfg.accounts.enabled !== 'boolean') e.push('accounts.enabled: true | false'); + if (cfg.accounts.deletionUrl !== undefined && !URL_RE.test(cfg.accounts.deletionUrl)) e.push('accounts.deletionUrl: must be an https URL'); + } + if (cfg.reviewAccess && typeof cfg.reviewAccess.signInRequired !== 'boolean') e.push('reviewAccess.signInRequired: true | false'); const langs = cfg.languages; if (!Array.isArray(langs) || !langs.length) e.push('languages: at least one language'); const ids = new Set(); @@ -363,7 +557,8 @@ export function validateConfig(c: unknown): string[] { if (!PRODUCT_RE.test(p.id ?? '')) e.push(`${at}.id: letters, digits, "." and "_" only`); if (seen.has(p.id)) e.push(`${at}.id: duplicate "${p.id}"`); seen.add(p.id); - if (p.type !== 'consumable' && p.type !== 'non_consumable') e.push(`${at}.type: consumable | non_consumable`); + if (p.type !== 'consumable' && p.type !== 'non_consumable' && p.type !== 'non_renewing') e.push(`${at}.type: consumable | non_consumable | non_renewing`); + if (p.platforms !== undefined && !(Array.isArray(p.platforms) && p.platforms.length && p.platforms.every(x => x === 'ios' || x === 'android'))) e.push(`${at}.platforms: a list of ios | android`); if (!(typeof p.usd === 'number' && p.usd > 0)) e.push(`${at}.usd: positive number`); if (!p.listings || !Object.keys(p.listings).length) e.push(`${at}.listings: at least one language`); for (const [lang, l] of Object.entries(p.listings ?? {})) { @@ -378,6 +573,7 @@ export function validateConfig(c: unknown): string[] { if (!(o.price > 0)) e.push(`${at}.overrides: price must be positive`); } } + e.push(...validateSubscriptions(cfg.subscriptions, ids, seen)); if (cfg.prices?.baseTerritory && !/^[A-Z]{3}$/.test(cfg.prices.baseTerritory)) e.push('prices.baseTerritory: App Store territory, alpha-3 (USA)'); if (cfg.dataSafety) { for (const [t, u] of Object.entries(cfg.dataSafety.data ?? {})) { @@ -385,10 +581,13 @@ export function validateConfig(c: unknown): string[] { if (!u.collect?.length) e.push(`dataSafety.data.${t}: at least one collection purpose`); if (u.shared && !u.share?.length) e.push(`dataSafety.data.${t}: shared, so it needs sharing purposes`); } + for (const [i, x] of (cfg.dataSafety.extra ?? []).entries()) if (!/^[A-Z][A-Z0-9_:]+$/.test(x?.question ?? '') || typeof x.value !== 'string') + e.push(`dataSafety.extra[${i}]: { question: "", value: "..." }`); } if (cfg.shots) { const s = cfg.shots; for (const k of ['copy', 'frames', 'out'] as const) if (!s[k]) e.push(`shots.${k}: missing`); + if (s.style !== undefined && s.style !== 'game' && s.style !== 'app') e.push('shots.style: game | app'); if (!s.scenes?.length) e.push('shots.scenes: at least one scene'); for (const sc of s.scenes ?? []) if (!sc.frames?.length) e.push(`shots.scenes[${sc.id}].frames: at least one frame`); e.push(...validateCapture(s.capture)); diff --git a/cli/lib/credentials.ts b/cli/lib/credentials.ts index b70ae0c7..7f5309f0 100644 --- a/cli/lib/credentials.ts +++ b/cli/lib/credentials.ts @@ -3,7 +3,9 @@ // ASC_P8 (path to AuthKey_.p8, or the PEM itself) // 2. /.storebound/credentials.json (gitignored), same names: // { "PLAY_SERVICE_ACCOUNT": "...", "ASC_KEY_ID": "...", "ASC_ISSUER_ID": "...", "ASC_P8": "...", -// "reviewContact": { "firstName": "", "lastName": "", "phone": "", "email": "" } } +// "reviewContact": { "firstName": "", "lastName": "", "phone": "", "email": "" }, +// "reviewDemoAccount": { "username": "", "password": "" } } +// The demo account for App Review can also come from env: REVIEW_DEMO_USER, REVIEW_DEMO_PASSWORD. // 3. ASC_P8 only: ~/.appstoreconnect/private_keys/AuthKey_.p8 (where Xcode / altool keep it) import { existsSync, readFileSync } from 'node:fs'; import { homedir } from 'node:os'; @@ -59,3 +61,22 @@ export function reviewContact(root: string): ReviewContact | null { if (!c?.email) return null; return { firstName: c.firstName ?? '', lastName: c.lastName ?? '', phone: c.phone ?? '', email: c.email }; } + +export interface DemoAccount { username: string; password: string } + +/** App Review demo account (sign-in for the reviewer): env REVIEW_DEMO_USER + REVIEW_DEMO_PASSWORD, else + * "reviewDemoAccount" in .storebound/credentials.json. Never in the config or the repo. */ +export function reviewDemoAccount(root: string): DemoAccount | null { + const eu = process.env.REVIEW_DEMO_USER, ep = process.env.REVIEW_DEMO_PASSWORD; + if (eu && ep) return { username: eu, password: ep }; + const d = fileStore(root).reviewDemoAccount as Partial | undefined; + if (typeof d?.username === 'string' && d.username && typeof d.password === 'string' && d.password) return { username: d.username, password: d.password }; + return null; +} + +/** For logs: "d***@example.com" / "d***"; a password is never shown, only its length class. */ +export const maskUser = (u: string): string => { + const at = u.indexOf('@'); + return at > 0 ? `${u[0]}***${u.slice(at)}` : `${u[0] ?? ''}***`; +}; +export const maskSecret = (s: string): string => (s ? '********' : '(empty)'); diff --git a/cli/lib/data-safety.ts b/cli/lib/data-safety.ts index 05b9c650..c38b7f80 100644 --- a/cli/lib/data-safety.ts +++ b/cli/lib/data-safety.ts @@ -63,6 +63,7 @@ export function dataSafetyRows(ds: DataSafety): string[][] { for (const p of PURPOSES) rows.push([q('DATA_USAGE_COLLECTION_PURPOSE'), p, pick(collect.has(p)), 'MULTIPLE_CHOICE', label + ' / Collection purpose']); for (const p of PURPOSES) rows.push([q('DATA_USAGE_SHARING_PURPOSE'), p, pick(share.has(p)), 'MULTIPLE_CHOICE', label + ' / Sharing purpose']); } + for (const x of ds.extra ?? []) rows.push([x.question, x.response ?? '', x.value, x.response ? 'MULTIPLE_CHOICE' : 'MAYBE_REQUIRED', x.label ?? x.question]); return rows; } diff --git a/cli/lib/profile.ts b/cli/lib/profile.ts new file mode 100644 index 00000000..303a12ec --- /dev/null +++ b/cli/lib/profile.ts @@ -0,0 +1,36 @@ +// Offline profile checks for `storebound check`: what an app with accounts, a sign-in for review or subscriptions +// must have in the config before any store sees it. Pure. The online counterparts (URLs answer, the demo account is +// on App Review, subscription states) are in validate-rules.ts (profileRules, appleSubscriptionRules). +import { profileOf, type ShipConfig } from './config'; +import { allSubscriptions } from './subscriptions'; + +export interface ProfileIssue { level: 'error' | 'warn'; msg: string } + +export function profileIssues(config: ShipConfig, o: { demoAccount: boolean }): ProfileIssue[] { + const out: ProfileIssue[] = []; + const err = (msg: string) => out.push({ level: 'error', msg }); + const warn = (msg: string) => out.push({ level: 'warn', msg }); + const accounts = !!config.accounts?.enabled; + const acm = config.dataSafety?.accountCreation ?? ['PSL_ACM_NONE']; + if (accounts) { + if (config.play && !config.accounts!.deletionUrl) err('accounts.enabled: set accounts.deletionUrl (Play asks for a web page to request account deletion; account-deletion skill)'); + if (config.apple && !config.accounts!.inApp) warn('accounts.enabled: set accounts.inApp to where deletion starts in the app (Apple 5.1.1(v); it goes into the review notes)'); + if (config.dataSafety) { + if (acm.includes('PSL_ACM_NONE')) err('accounts.enabled but dataSafety.accountCreation says PSL_ACM_NONE: list the sign-up methods you offer'); + if (!config.dataSafety.deletionRequest) err('accounts.enabled but dataSafety.deletionRequest is false: people must be able to delete their account and data'); + } + } else if (config.dataSafety && !acm.includes('PSL_ACM_NONE')) warn('dataSafety.accountCreation lists sign-up methods but accounts.enabled is not set: add accounts { enabled: true, deletionUrl, inApp }'); + if (config.reviewAccess?.signInRequired) { + if (!o.demoAccount) err('reviewAccess.signInRequired: no demo account ("reviewDemoAccount" in .storebound/credentials.json, or REVIEW_DEMO_USER / REVIEW_DEMO_PASSWORD; review-access skill)'); + if (!config.reviewAccess.instructions) warn('reviewAccess.instructions: tell the reviewer how to sign in and where the main features are'); + } else if (accounts && config.reviewAccess === undefined) warn('the app has accounts: set reviewAccess { signInRequired } so App Review and Play App access get a demo account when needed'); + const subs = allSubscriptions(config.subscriptions); + if (subs.length) { + if (!config.app.termsUrl) err('subscriptions: set app.termsUrl (Terms of Use / EULA, linked in the app and the metadata; Apple 3.1.2)'); + if (config.apple && subs.some(x => !x.sub.reviewScreenshot)) warn(`subscriptions without reviewScreenshot: ${subs.filter(x => !x.sub.reviewScreenshot).map(x => x.sub.id).join(', ')} (App Store review needs one each)`); + } + const p = profileOf(config); + if (p === 'subscription-app' && !subs.length) warn('app.profile is subscription-app but there are no subscriptions in the config'); + if (p === 'game' && config.shots?.style === 'app') warn('app.profile is game but shots.style is app (fine if intended)'); + return out; +} diff --git a/cli/lib/review-details.ts b/cli/lib/review-details.ts new file mode 100644 index 00000000..f397e3cd --- /dev/null +++ b/cli/lib/review-details.ts @@ -0,0 +1,41 @@ +// App Review information as pure parts: the appStoreReviewDetails attributes from the config, the review contact and +// the demo account, plus the notes (review notes, sign-in instructions, where account deletion is). Apple: the notes +// field takes up to 4000 bytes; a demo account must keep working during the whole review (Guideline 2.1). +// https://developer.apple.com/help/app-store-connect/reference/app-information/platform-version-information +// https://developer.apple.com/documentation/appstoreconnectapi/appstorereviewdetail/attributes-data.dictionary +import type { ShipConfig } from './config'; +import { type DemoAccount, maskSecret, maskUser } from './credentials'; + +export const NOTES_MAX_BYTES = 4000; + +/** Notes for the reviewer: apple.info.reviewNotes, then reviewAccess.instructions, then where account deletion is. */ +export function reviewNotes(config: Pick): string { + const parts = [config.apple?.info?.reviewNotes?.trim() ?? '']; + const ins = config.reviewAccess?.instructions?.trim(); + if (ins && !parts[0]!.includes(ins)) parts.push(`Sign-in: ${ins}`); + const del = config.accounts?.enabled ? config.accounts.inApp?.trim() : ''; + if (del && !parts.join('\n').includes(del)) parts.push(`Account deletion: ${del}`); + return parts.filter(Boolean).join('\n\n'); +} + +export interface ReviewDetailPlan { + attributes: Record; + /** Log line without secrets. */ + summary: string; +} + +/** + * Attributes for POST / PATCH appStoreReviewDetails. With reviewAccess.signInRequired the demo account is required + * (throws when it is missing, so a submission never goes out with "sign-in required" and no account); without it the + * demo fields are cleared. + */ +export function reviewDetailPlan(config: Pick, contact: Record, demo: DemoAccount | null): ReviewDetailPlan { + const notes = reviewNotes(config); + const bytes = new TextEncoder().encode(notes).length; + if (bytes > NOTES_MAX_BYTES) throw new Error(`review notes are ${bytes} bytes; App Store Connect takes ${NOTES_MAX_BYTES}`); + const required = !!config.reviewAccess?.signInRequired; + if (required && !demo) throw new Error('reviewAccess.signInRequired is true but there is no demo account: add "reviewDemoAccount": { "username", "password" } to .storebound/credentials.json (or set REVIEW_DEMO_USER / REVIEW_DEMO_PASSWORD); see the review-access skill'); + const attributes = { ...contact, demoAccountRequired: required, demoAccountName: required ? demo!.username : null, demoAccountPassword: required ? demo!.password : null, notes }; + const summary = `${required ? `demo account ${maskUser(demo!.username)} / ${maskSecret(demo!.password)}` : 'no demo account (no sign-in needed)'}, notes ${bytes} bytes`; + return { attributes, summary }; +} diff --git a/cli/lib/validate-rules.ts b/cli/lib/validate-rules.ts index 303e7c32..8abc413f 100644 --- a/cli/lib/validate-rules.ts +++ b/cli/lib/validate-rules.ts @@ -48,6 +48,40 @@ export interface AppleSnapshot { privacyUrl: UrlCheck; /** Local renders (Apple sizes only), checked before upload. Optional: validate fills it when a renders dir exists. */ renders?: RendersCheck; + /** Auto-renewable subscriptions on App Store Connect (validate reads them when the config has subscriptions). */ + subscriptions?: AppleSubSnapshot[]; + /** Subscription product ids of the config, with the App Store locales their listings need. */ + expectedSubscriptions?: { id: string; group: string; locales: string[] }[]; + /** App profile facts (accounts, sign-in for review, terms URL); see profileRules. */ + profile?: ProfileFacts; +} + +export interface AppleSubSnapshot { + productId: string; + group: string; + state: string; + locales: { locale: string; state?: string }[]; + groupLocales: { locale: string; state?: string }[]; + reviewScreenshot: boolean; +} + +/** What the profile checks need, collected by validate (local config + credentials + public URL checks). */ +export interface ProfileFacts { + profile: 'game' | 'app' | 'subscription-app'; + /** accounts.enabled */ + accounts: boolean; + /** accounts.inApp is set (where in-app deletion is). */ + inAppDeletion: boolean; + /** accounts.deletionUrl, checked (null = not set). */ + deletionUrl: UrlCheck | null; + /** reviewAccess.signInRequired */ + signInRequired: boolean; + /** A demo account exists locally (.storebound/credentials.json reviewDemoAccount or REVIEW_DEMO_USER / _PASSWORD). */ + demoAccountLocal: boolean; + /** The config has subscriptions. */ + subscriptions: boolean; + /** app.termsUrl, checked (null = not set). */ + termsUrl: UrlCheck | null; } export interface PlaySnapshot { @@ -64,6 +98,10 @@ export interface PlaySnapshot { expectedProducts: string[]; /** Local renders (Play sizes only), checked before upload. */ renders?: RendersCheck; + /** Play subscriptions and their base plans (validate reads them when the config has subscriptions). */ + subscriptions?: { productId: string; basePlans: { basePlanId: string; state?: string }[] }[]; + expectedSubscriptions?: { id: string; basePlanId: string }[]; + profile?: ProfileFacts; } const EDITABLE = ['PREPARE_FOR_SUBMISSION', 'DEVELOPER_REJECTED', 'REJECTED', 'METADATA_REJECTED', 'INVALID_BINARY']; @@ -132,7 +170,9 @@ export function appleRules(s: AppleSnapshot): Finding[] { } if (s.iaps.length && !f.some(x => x.code === 'iap')) add('ok', 'iap', `${s.iaps.length} in-app purchases ready`); + f.push(...appleSubscriptionRules(s)); add(urlOk(s.privacyUrl) ? 'ok' : 'blocker', 'privacy-url', `privacy policy ${s.privacyUrl.url}: ${urlMsg(s.privacyUrl)}`, 'privacy-policy skill'); + if (s.profile) f.push(...profileRules('apple', s.profile, { reviewDetail: s.reviewDetail, descriptions: s.locales.map(l => ({ locale: l.locale, text: l.description ?? '' })) })); f.push(...rendersFindings('apple', s.renders)); return sortFindings(f); } @@ -159,11 +199,11 @@ export function playRules(s: PlaySnapshot): Finding[] { if (s.appAdsLines.length || s.adsLikely) { if (!s.website) add('blocker', 'app-ads', 'no developer website on the listing (app-ads.txt is looked up there)', 'storebound play listing (app.website)'); - else if (!s.appAds || !urlOk(s.appAds)) add(s.appAdsLines.length ? 'blocker' : 'warn', 'app-ads', `${s.website.replace(/\/$/, '')}/app-ads.txt: ${s.appAds ? urlMsg(s.appAds) : 'not checked'}`, 'ads-levelplay-checks skill'); + else if (!s.appAds || !urlOk(s.appAds)) add(s.appAdsLines.length ? 'blocker' : 'warn', 'app-ads', `${s.website.replace(/\/$/, '')}/app-ads.txt: ${s.appAds ? urlMsg(s.appAds) : 'not checked'}`, 'ads-mediation-checks skill'); else if (s.appAdsLines.length) { const body = new Set((s.appAds.body ?? '').split(/\r?\n/).map(normAdsLine).filter(Boolean)); const missing = s.appAdsLines.filter(l => !body.has(normAdsLine(l))); - if (missing.length) add('blocker', 'app-ads', `app-ads.txt lacks ${missing.length} line(s): ${missing.slice(0, 3).join(' | ')}${missing.length > 3 ? ' ...' : ''}`, 'ads-levelplay-checks skill'); + if (missing.length) add('blocker', 'app-ads', `app-ads.txt lacks ${missing.length} line(s): ${missing.slice(0, 3).join(' | ')}${missing.length > 3 ? ' ...' : ''}`, 'ads-mediation-checks skill'); else add('ok', 'app-ads', `app-ads.txt has all ${s.appAdsLines.length} lines`); } else add('warn', 'app-ads', 'app-ads.txt reachable; set ads.appAdsTxt in the config to check its lines'); } @@ -183,10 +223,84 @@ export function playRules(s: PlaySnapshot): Finding[] { else if (!p.states.includes('ACTIVE')) add('blocker', 'products', `${id}: purchase option ${p.states.join(',') || 'no state'}`, 'storebound play products'); } if (s.expectedProducts.length && !f.some(x => x.code === 'products')) add('ok', 'products', `${s.expectedProducts.length} products active`); + const subs = new Map((s.subscriptions ?? []).map(x => [x.productId, x] as const)); + for (const e of s.expectedSubscriptions ?? []) { + const cur = subs.get(e.id); + const bp = cur?.basePlans.find(b => b.basePlanId === e.basePlanId); + if (!cur) add('blocker', 'subscriptions', `${e.id}: subscription not on Play`, 'storebound play subscriptions'); + else if (!bp) add('blocker', 'subscriptions', `${e.id}: no base plan ${e.basePlanId}`, 'storebound play subscriptions'); + else if (bp.state !== 'ACTIVE') add('blocker', 'subscriptions', `${e.id}: base plan ${e.basePlanId} is ${bp.state ?? 'not active'}`, 'storebound play subscriptions (activates it)'); + } + if (s.expectedSubscriptions?.length && !f.some(x => x.code === 'subscriptions')) add('ok', 'subscriptions', `${s.expectedSubscriptions.length} subscriptions with an active base plan`); + if (s.profile) f.push(...profileRules('play', s.profile, {})); f.push(...rendersFindings('play', s.renders)); return sortFindings(f); } +const SUB_OK = ['READY_TO_SUBMIT', 'WAITING_FOR_REVIEW', 'IN_REVIEW', 'APPROVED', 'PENDING_BINARY_APPROVAL']; + +/** Subscriptions on App Store Connect vs the config: present, state, localizations (and their review state), group + * display names, review screenshot. */ +export function appleSubscriptionRules(s: Pick): Finding[] { + const f: Finding[] = []; + const add = (level: Level, msg: string, fix?: string) => f.push({ store: 'apple', level, code: 'subscriptions', msg, fix }); + const have = new Map((s.subscriptions ?? []).map(x => [x.productId, x] as const)); + const groupsDone = new Set(); + for (const e of s.expectedSubscriptions ?? []) { + const cur = have.get(e.id); + if (!cur) { add('blocker', `${e.id}: subscription not on App Store Connect`, 'storebound apple subscriptions'); continue; } + if (!groupsDone.has(cur.group)) { + groupsDone.add(cur.group); + if (!cur.groupLocales.length) add('blocker', `group "${cur.group}": no localization (display name)`, 'storebound apple subscriptions'); + for (const l of cur.groupLocales) if (l.state === 'REJECTED') add('blocker', `group "${cur.group}" ${l.locale}: localization rejected`, 'fix the group display name, then storebound apple subscriptions'); + } + if (cur.state === 'MISSING_METADATA') add('blocker', `${e.id}: MISSING_METADATA (localization, price, availability or review screenshot missing)`, 'storebound apple subscriptions'); + else if (!SUB_OK.includes(cur.state)) add('blocker', `${e.id}: ${cur.state}`, cur.state === 'REJECTED' || cur.state === 'DEVELOPER_ACTION_NEEDED' ? 'review-rejections skill; fix and resubmit with a version' : 'store-subscriptions skill'); + const locs = new Map(cur.locales.map(l => [l.locale, l] as const)); + for (const loc of e.locales) if (!locs.has(loc)) add('blocker', `${e.id}: no ${loc} localization`, 'storebound apple subscriptions'); + for (const l of cur.locales) if (l.state === 'REJECTED') add('blocker', `${e.id} ${l.locale}: localization rejected`, 'fix the display name / description, then storebound apple subscriptions'); + if (!cur.reviewScreenshot && cur.state !== 'APPROVED') add('blocker', `${e.id}: no review screenshot`, 'subscriptions[].reviewScreenshot, then storebound apple subscriptions'); + } + if (s.expectedSubscriptions?.length && !f.length) add('ok', `${s.expectedSubscriptions.length} subscriptions ready (state, localizations, review screenshots)`); + return f; +} + +/** + * App profile checks. Accounts: Apple 5.1.1(v) wants deletion inside the app (no API can see it: a reminder unless + * accounts.inApp says where), Play wants a reachable delete-account URL as well. Sign-in for review: the demo account + * must exist locally and be on the App Review details. Subscriptions: a reachable Terms of Use (EULA) URL, and Apple + * metadata (description) that links it (3.1.2). + */ +export function profileRules(store: 'apple' | 'play', p: ProfileFacts, o: { reviewDetail?: AppleSnapshot['reviewDetail']; descriptions?: { locale: string; text: string }[] }): Finding[] { + const f: Finding[] = []; + const add = (level: Level, code: string, msg: string, fix?: string) => f.push({ store, level, code, msg, fix }); + if (p.accounts) { + if (store === 'play') { + if (!p.deletionUrl) add('blocker', 'account-deletion', 'the app has accounts but accounts.deletionUrl is not set (Play Data safety asks for a delete-account URL)', 'account-deletion skill'); + else if (!urlOk(p.deletionUrl)) add('blocker', 'account-deletion', `delete-account page ${p.deletionUrl.url}: ${urlMsg(p.deletionUrl)}`, 'account-deletion skill'); + else add('ok', 'account-deletion', `delete-account page ${p.deletionUrl.url} answers`); + } else if (!p.inAppDeletion) add('warn', 'account-deletion', 'the app has accounts: deletion must start inside the app (5.1.1(v)); set accounts.inApp to where it is, it goes into the review notes', 'account-deletion skill'); + else add('ok', 'account-deletion', 'in-app account deletion named in the config (5.1.1(v); test it before review)'); + } + if (p.signInRequired) { + if (!p.demoAccountLocal) add('blocker', 'demo-account', 'sign-in required for review but no demo account in .storebound/credentials.json (reviewDemoAccount) or REVIEW_DEMO_USER / REVIEW_DEMO_PASSWORD', 'review-access skill'); + if (store === 'apple' && o.reviewDetail && !(o.reviewDetail.demoAccountRequired && o.reviewDetail.demoAccountName)) + add('blocker', 'demo-account', 'App Review information has no demo account although the app needs a sign-in (Guideline 2.1)', 'storebound apple review-details'); + if (store === 'play') add('warn', 'app-access', 'sign-in required: Play Console > App content > App access must list the demo credentials and steps (no API)', 'review-access skill'); + if (!f.some(x => x.code === 'demo-account')) add('ok', 'demo-account', 'demo account for review present'); + } + if (p.subscriptions) { + if (!p.termsUrl) add('blocker', 'terms-url', 'subscriptions need a Terms of Use (EULA) link in the app and the metadata: app.termsUrl is not set', 'store-subscriptions skill'); + else if (!urlOk(p.termsUrl)) add('blocker', 'terms-url', `terms of use ${p.termsUrl.url}: ${urlMsg(p.termsUrl)}`, 'store-subscriptions skill'); + else { + add('ok', 'terms-url', `terms of use ${p.termsUrl.url} answers`); + const missing = (o.descriptions ?? []).filter(d => d.text && !d.text.includes(p.termsUrl!.url) && !/terms of use|\beula\b|license agreement/i.test(d.text)).map(d => d.locale); + if (store === 'apple' && missing.length) add('warn', 'terms-url', `description without a Terms of Use link: ${missing.join(', ')} (3.1.2; or set a custom EULA in App Information)`, 'store-subscriptions skill'); + } + } + return f; +} + /** Blockers first, then warnings, then ok; stable inside a level (rule order). */ export function sortFindings(f: Finding[]): Finding[] { const rank: Record = { blocker: 0, warn: 1, ok: 2 }; diff --git a/cli/validate.ts b/cli/validate.ts index 9ffe816e..81799224 100644 --- a/cli/validate.ts +++ b/cli/validate.ts @@ -5,21 +5,41 @@ // of the public privacy policy and app-ads.txt URLs. Also checks the local renders folder (if there is one) with the // `shots check` rules: wrong pixel size, alpha, too few / many images, Play 8 MB and feature graphic format are // blockers (the upload would fail), text overflow flags from the last render are warnings. --no-local skips it. +// Subscriptions (when the config has them): App Store states, localizations, group names, review screenshots; Play +// subscriptions with an active base plan. App profile: delete-account URL answers (accounts), demo account locally and +// on App Review (sign-in required), Terms of Use URL answers and is linked in the description (subscriptions). // Live apps: crash / ANR vitals (Play Reporting API) and App Store diagnostics, as in `storebound health`: over a Play // bad behavior threshold is a blocker, near it a warning; a store without vitals access is only noted. --no-health skips. import { ascClient, type J } from './apple/asc'; import { requiredDisplayTypes } from './apple/screenshots'; -import { playCodes } from './lib/config'; +import { type Loaded, playCodes, profileOf, sellsOn } from './lib/config'; +import { reviewDemoAccount } from './lib/credentials'; +import { allSubscriptions, basePlanId } from './lib/subscriptions'; import type { Ctx } from './lib/ctx'; import { checkUrl } from './lib/http'; import { collectHealth } from './health'; import { healthFindings } from './lib/health'; import { log, warn } from './lib/log'; -import { type AppleSnapshot, appleRules, type Finding, formatFindings, PLAY_REQUIRED_IMAGES, type PlaySnapshot, playRules, rendersFindings, sortFindings } from './lib/validate-rules'; +import { type AppleSnapshot, appleRules, type Finding, formatFindings, PLAY_REQUIRED_IMAGES, type PlaySnapshot, playRules, type ProfileFacts, rendersFindings, sortFindings } from './lib/validate-rules'; import { rendersCheck } from './shots/check'; import { playClient } from './play/client'; import { listOneTimeProducts } from './play/products'; +/** Profile facts for the checks: config + local credentials + public URL checks (no store API). */ +export async function collectProfile(loaded: Loaded): Promise { + const { config, root } = loaded; + return { + profile: profileOf(config), + accounts: !!config.accounts?.enabled, + inAppDeletion: !!config.accounts?.inApp, + deletionUrl: config.accounts?.enabled && config.accounts.deletionUrl ? await checkUrl(config.accounts.deletionUrl) : null, + signInRequired: !!config.reviewAccess?.signInRequired, + demoAccountLocal: !!reviewDemoAccount(root), + subscriptions: !!allSubscriptions(config.subscriptions).length, + termsUrl: config.app.termsUrl ? await checkUrl(config.app.termsUrl) : null, + }; +} + export async function collectApple(ctx: Ctx): Promise { const { config, root } = ctx.loaded; const c = await ascClient(root, config.apple!.bundleId, config.apple?.appId); @@ -58,14 +78,31 @@ export async function collectApple(ctx: Ctx): Promise { const shot = (await c.maybe(`/v2/inAppPurchases/${p.id}/appStoreReviewScreenshot`))?.data; iaps.push({ productId: p.attributes.productId, state: p.attributes.state, reviewScreenshot: !!shot }); } + const wantSubs = allSubscriptions(config.subscriptions).filter(x => sellsOn(config, x.sub, 'apple')); + const subscriptions: NonNullable = []; + if (wantSubs.length) { + log('validate', 'apple: subscriptions'); + for (const g of await c.all(`/v1/apps/${appId}/subscriptionGroups?limit=200`)) { + const groupLocales = (await c.all(`/v1/subscriptionGroups/${g.id}/subscriptionGroupLocalizations?limit=200`)).map((l: J) => ({ locale: l.attributes.locale, state: l.attributes.state })); + for (const sub of await c.all(`/v1/subscriptionGroups/${g.id}/subscriptions?limit=200`)) { + const locales = (await c.all(`/v1/subscriptions/${sub.id}/subscriptionLocalizations?limit=200`)).map((l: J) => ({ locale: l.attributes.locale, state: l.attributes.state })); + const shot = !!(await c.maybe(`/v1/subscriptions/${sub.id}/appStoreReviewScreenshot`))?.data; + subscriptions.push({ productId: sub.attributes.productId, group: g.attributes.referenceName, state: sub.attributes.state, locales, groupLocales, reviewScreenshot: shot }); + } + } + } + const appleLocale = new Map(config.languages.map(l => [l.id, l.apple] as const)); return { + subscriptions, expectedSubscriptions: wantSubs.map(({ group, sub }) => ({ id: sub.id, group: group.name, + locales: Object.keys(sub.listings).map(id => appleLocale.get(id)).filter((x): x is string => !!x) })), + profile: await collectProfile(ctx.loaded), version: v ? { versionString: v.attributes.versionString, state: v.attributes.appVersionState ?? v.attributes.appStoreState } : null, build, locales, reviewDetail, ageRating, expectedLocales: config.languages.map(l => l.apple).filter((x): x is string => !!x), requiredDisplayTypes: requiredDisplayTypes(config.apple), priceSchedule: !!sched?.included?.some((x: J) => x.type === 'appPrices'), availability: !!avail?.data, - iaps, expectedProducts: (config.products ?? []).map(p => p.id), + iaps, expectedProducts: (config.products ?? []).filter(p => sellsOn(config, p, 'apple')).map(p => p.id), privacyUrl: await checkUrl(config.app.privacyPolicyUrl), }; } @@ -95,10 +132,22 @@ export async function collectPlay(ctx: Ctx): Promise { if (website && (appAdsLines.length || adsLikely)) { try { appAds = await checkUrl(new URL('/app-ads.txt', website).href, { body: true }); } catch { appAds = { url: website, status: null, error: 'bad website URL' }; } } + const wantSubs = allSubscriptions(config.subscriptions).filter(x => sellsOn(config, x.sub, 'play')); + const subscriptions: NonNullable = []; + if (wantSubs.length) { + let page = ''; + do { + const r = await play.call<{ subscriptions?: { productId: string; basePlans?: { basePlanId: string; state?: string }[] }[]; nextPageToken?: string }>('GET', `${play.API}/subscriptions?pageSize=100${page ? '&pageToken=' + page : ''}`); + for (const x of r.subscriptions ?? []) subscriptions.push({ productId: x.productId, basePlans: (x.basePlans ?? []).map(b => ({ basePlanId: b.basePlanId, state: b.state })) }); + page = r.nextPageToken ?? ''; + } while (page); + } return { + subscriptions, expectedSubscriptions: wantSubs.map(({ sub }) => ({ id: sub.id, basePlanId: basePlanId(sub) })), + profile: await collectProfile(ctx.loaded), defaultLanguage: details.defaultLanguage ?? config.play?.defaultLanguage ?? 'en-US', expectedLanguages: config.languages.flatMap(playCodes), listings, tracks, products, - expectedProducts: (config.products ?? []).map(p => p.id), + expectedProducts: (config.products ?? []).filter(p => sellsOn(config, p, 'play')).map(p => p.id), privacyUrl: await checkUrl(config.app.privacyPolicyUrl), website, appAds, appAdsLines, adsLikely, }; } finally { diff --git a/skills/account-deletion/SKILL.md b/skills/account-deletion/SKILL.md new file mode 100644 index 00000000..5392c39a --- /dev/null +++ b/skills/account-deletion/SKILL.md @@ -0,0 +1,43 @@ +--- +name: account-deletion +description: Make account deletion pass App Store and Google Play review for an app with sign-up or sign-in - Apple Guideline 5.1.1(v) in-app deletion (the whole account, not deactivation; Sign in with Apple token revocation; subscription billing note), Google Play's in-app path plus a public web page declared in Data safety, the config (accounts.enabled, deletionUrl, inApp) and the storebound checks. Use when the app has accounts, when the user adds sign-up, or after a 5.1.1(v) / Play account deletion rejection. +--- + +# Account deletion (both stores) + +Applies to every app that lets people create an account (email, phone, social sign-in, Sign in with Apple). Games +without accounts can skip it. Sources: Apple, "Offering account deletion in your app" +(https://developer.apple.com/support/offering-account-deletion-in-your-app/) and App Review Guideline 5.1.1(v) +(https://developer.apple.com/app-store/review/guidelines/); Google Play, "Understanding Google Play's app account +deletion requirements" (https://support.google.com/googleplay/android-developer/answer/13327111). + +## What the stores require +- **Apple 5.1.1(v)**: people can **start** deleting their account **inside the app**, easy to find (e.g. Settings > + Account > Delete account). Delete the whole account and its personal data, not only deactivate it. A link to a web + page that completes the deletion is fine; "email or call us" is only acceptable in highly regulated industries. + With Sign in with Apple, revoke the user's tokens (Sign in with Apple REST API). With auto-renewable + subscriptions, tell people that billing continues through Apple until they cancel, and how to cancel. +- **Google Play**: if the app lets people create an account, it must offer deletion **in the app** and on a **web + page** people can reach without the app (no reinstall needed). The URL goes into the Data safety form ("Data + deletion"). People can also ask to delete some data without deleting the account; say how. + +## Steps +1. Config: `accounts: { enabled: true, deletionUrl: 'https://example.com/delete-account', inApp: 'Settings > Account > + Delete account' }`. `storebound check` errors without `deletionUrl` (Play) and warns without `inApp` (Apple); + `storebound apple review-details` adds "Account deletion: " to the review notes. +2. Web page at `deletionUrl`: names the app and developer, the steps to request deletion (sign in, or a form that + verifies the email), what is deleted and what is kept (and for how long, e.g. invoices for tax law), and how long it + takes. No login wall to read it. `storebound validate --play` checks that it answers. +3. In the app: a clear entry, a confirmation step, then the deletion (or the web page). Sign people out afterwards. +4. Play Data safety: `dataSafety.deletionRequest: true`, `accountCreation` set to the sign-up methods you offer (not + `PSL_ACM_NONE`). Google does not publish the question ids for the delete-account URL: export the form once + (Play Console > App content > Data safety > Export to CSV), copy the id, and add it as + `dataSafety.extra: [{ question: '', value: '' }]`; otherwise enter the URL in the Console after + `storebound play data-safety`. +5. Privacy policy: a "Deleting your account" section with both paths (`privacy-policy` skill). +6. Test it on a fresh account before every submission; the reviewer will. + +## Gotchas +- "Deactivate" or "contact support" is not deletion for Apple. +- Deleting the account does not cancel a store subscription: say so in the app and on the web page. +- Keep the in-app path, the web page, Data safety and the privacy policy saying the same thing. diff --git a/skills/review-access/SKILL.md b/skills/review-access/SKILL.md new file mode 100644 index 00000000..615b4848 --- /dev/null +++ b/skills/review-access/SKILL.md @@ -0,0 +1,40 @@ +--- +name: review-access +description: Give App Store and Google Play reviewers working access to an app behind a sign-in - a demo account that never expires and needs no 2FA, App Review demoAccountName / demoAccountPassword through storebound apple review-details (credentials only in .storebound/credentials.json or env, masked in logs), the Play App content "App access" declaration (console only), and notes that say where every feature is. Use when the app needs a login, after a Guideline 2.1 "we were unable to sign in" rejection, or a Play "App access" policy issue. +--- + +# Review access (demo account) + +Sources: App Store Review Guideline 2.1 (https://developer.apple.com/app-store/review/guidelines/), App Review +Information (https://developer.apple.com/help/app-store-connect/reference/app-information/platform-version-information), +Google Play sign-in details (https://support.google.com/googleplay/android-developer/answer/15748846 and +https://support.google.com/googleplay/android-developer/answer/9859455). + +## Rules from the stores +- The account must work for the whole review, must not expire, needs **no 2FA / one-time code** (or give a bypass), + and must reach every feature, paid ones included (sandbox purchases work on Apple's side). +- Apple: sign-in required + user name + password in App Review Information, plus notes (up to 4000 bytes). Keep your + backend live. A demo mode instead of an account is possible only when Apple approves it. +- Google Play: Policy and programs > App content > **App access**: "All or some functionality is restricted", then the + credentials and steps (in English). There is no API for it. + +## Never commit credentials +The demo account lives only in the project's gitignored `.storebound/credentials.json`: +`"reviewDemoAccount": { "username": "demo@example.com", "password": "..." }`, or in `REVIEW_DEMO_USER` / +`REVIEW_DEMO_PASSWORD`. Never ask for it in chat, never write it into the config, docs, issues or commits. The owner +creates the account and pastes it into that file. storebound prints it masked (`d***@example.com / ********`). + +## Steps +1. Create a dedicated demo account with realistic sample data (no real user data), on production. +2. Config: `reviewAccess: { signInRequired: true, instructions: 'Sign in with the demo account, then ...' }`. + `storebound check` errors while the demo account is missing. +3. `storebound apple review-details --dry`, then without `--dry`: sets demoAccountRequired, demoAccountName, + demoAccountPassword, the contact and the notes (review notes + instructions + where account deletion is). +4. Play: App content > App access with the same credentials and steps (agent with browser tools or the owner). +5. `storebound validate`: blocker when sign-in is required and App Review has no demo account. +6. Before each submission sign in with it on a clean device; reset its data if a test changed it. + +## Gotchas +- A password change or an expired trial on the demo account means a rejection: tell the owner to keep it stable. +- Region locks, IP allow-lists or SMS checks block reviewers; switch them off for the demo account. +- If sign-in is optional (everything works signed out), set `signInRequired: false`; the demo fields are cleared. diff --git a/templates/credentials.example.json b/templates/credentials.example.json index 05b0c5ac..d4a11c21 100644 --- a/templates/credentials.example.json +++ b/templates/credentials.example.json @@ -3,5 +3,6 @@ "ASC_KEY_ID": "YOUR_KEY_ID", "ASC_ISSUER_ID": "00000000-0000-0000-0000-000000000000", "ASC_P8": "/absolute/path/to/AuthKey_.p8", - "reviewContact": { "firstName": "", "lastName": "", "phone": "+1 555 0100", "email": "review-contact@example.com" } + "reviewContact": { "firstName": "", "lastName": "", "phone": "+1 555 0100", "email": "review-contact@example.com" }, + "reviewDemoAccount": { "username": "", "password": "" } }