Open in Google Play Console deep-links the app: Play developer id per credential profile (accounts play-developer, desktop Accounts), shared playAppUrl builder for desktop, CLI and watch; developer chooser instead of the console root
This commit is contained in:
parent
7c769c18f4
commit
4a74989a95
33 changed files with 311 additions and 40 deletions
|
|
@ -25,7 +25,7 @@ export interface SidecarStatus { running: boolean; version: string; protocol: st
|
|||
/** An app folder (one storebound.config.ts = one app on iOS and / or Android) and the accounts it uses. */
|
||||
export interface Project { id: string; path: string; name: string; playAccount: string | null; appleAccount: string | null; added: string; /** The folder is gone (moved, renamed, deleted): shown as "Folder not found". */ missing?: boolean; /** The storebound version the folder's package.json pins, when it is not this app's. */ storeboundPin?: string | null }
|
||||
export type AccountKind = 'play' | 'apple';
|
||||
export interface Account { id: string; label: string; kind: AccountKind; created: string; studio?: string | null; /** The machine profile that holds the key (~/.storebound, shared with the CLI); null while an old keychain key has not moved. */ profile?: string | null }
|
||||
export interface Account { id: string; label: string; kind: AccountKind; created: string; studio?: string | null; /** The machine profile that holds the key (~/.storebound, shared with the CLI); null while an old keychain key has not moved. */ profile?: string | null; /** Play: the developer account id (PLAY_DEVELOPER_ID in the profile) for Play Console deep links. */ developerId?: string | null }
|
||||
export const STUDIO_COLORS = ['indigo', 'violet', 'rose', 'amber', 'emerald', 'teal', 'sky', 'slate'] as const;
|
||||
export type StudioColor = (typeof STUDIO_COLORS)[number];
|
||||
/** A user-named group of store accounts (and so of apps). */
|
||||
|
|
@ -110,6 +110,7 @@ export const api = {
|
|||
addAppleAccount: (label: string, keyId: string, issuerId: string, studio: string | null = null) => invoke<Account | null>('account_add_apple', { label, keyId, issuerId, studio }),
|
||||
removeAccount: (id: string) => invoke<void>('account_remove', { id }),
|
||||
updateAccount: (id: string, label: string, studio: string | null) => invoke<Account>('account_update', { id, label, studio }),
|
||||
setPlayDeveloper: (id: string, developerId: string | null) => invoke<Account>('account_set_play_developer', { id, developerId }),
|
||||
/** Does the key work, can it see apps (live, not cached). */
|
||||
checkAccount: (id: string, job?: string) => invoke<AccountCheck>('account_check', { id, job: job ?? null }),
|
||||
/** Reads the apps an account can see from its store and keeps the list. */
|
||||
|
|
|
|||
|
|
@ -565,6 +565,7 @@ async function answer(cmd: string, a: Record<string, unknown>): Promise<unknown>
|
|||
}
|
||||
case 'studio_remove': studios = studios.filter(s => s.id !== a.id); accounts = accounts.map(x => (x.studio === a.id ? { ...x, studio: null } : x)); return null;
|
||||
case 'studio_logo': return null;
|
||||
case 'account_set_play_developer': { const x = accounts.find(y => y.id === a.id)!; const v = (a.developerId as string | null) ?? null; if (v && !/^\d{1,25}$/.test(v)) throw new Error('the Play developer id is digits'); (x as { developerId?: string | null }).developerId = v; return x; }
|
||||
case 'account_update': { const x = accounts.find(y => y.id === a.id)!; x.label = a.label as string; x.studio = (a.studio as string | null) ?? null; return x; }
|
||||
case 'overrides_set': overrides = a.overrides as Overrides; return overrides;
|
||||
case 'settings_set': settings = a.settings as Settings; return settings;
|
||||
|
|
|
|||
|
|
@ -2041,6 +2041,10 @@ export const en = {
|
|||
'cm.refreshing': "Reading {name} again",
|
||||
'cm.ignoredNoReads': "Ignored apps are not read",
|
||||
'cm.ignore': "Ignore",
|
||||
'acct.devId': 'Play developer id {id}',
|
||||
'acct.noDevId': 'no Play developer id',
|
||||
'acct.devIdLabel': 'Play developer account id',
|
||||
'acct.devIdHint': "The digits in play.google.com/console/u/0/developers/<id>. With it, Play Console links open each app's own page; the CLI uses it too.",
|
||||
'cm.more': "More actions",
|
||||
'cm.showIgnored': "Show ignored apps",
|
||||
'cm.copyVersion': "Copy version",
|
||||
|
|
|
|||
|
|
@ -2043,6 +2043,10 @@ export const tr: Record<keyof typeof en, string> = {
|
|||
'cm.refreshing': "{name} yeniden okunuyor",
|
||||
'cm.ignoredNoReads': "Yok sayılan uygulamalar okunmaz",
|
||||
'cm.ignore': "Yok say",
|
||||
'acct.devId': 'Play geliştirici kimliği {id}',
|
||||
'acct.noDevId': 'Play geliştirici kimliği yok',
|
||||
'acct.devIdLabel': 'Play geliştirici hesabı kimliği',
|
||||
'acct.devIdHint': 'play.google.com/console/u/0/developers/<id> içindeki rakamlar. Girilince Play Console bağlantıları her uygulamanın kendi sayfasını açar; CLI de kullanır.',
|
||||
'cm.more': "Diğer işlemler",
|
||||
'cm.showIgnored': "Yok sayılanları göster",
|
||||
'cm.copyVersion': "Sürümü kopyala",
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ function AccountRow({ a, busy, setBusy, onError }: { a: Account; busy: string |
|
|||
const [edit, setEdit] = useState(false);
|
||||
const [label, setLabel] = useState(a.label);
|
||||
const [studio, setStudio] = useState(a.studio ?? '');
|
||||
const [dev, setDev] = useState(a.developerId ?? '');
|
||||
const devOk = !dev.trim() || /^\d{1,25}$/.test(dev.trim());
|
||||
const h = d.accountHealth[a.id];
|
||||
const list = d.storeApps[a.id];
|
||||
const ignored = d.overrides.ignored.includes(`account:${a.id}`);
|
||||
|
|
@ -54,7 +56,7 @@ function AccountRow({ a, busy, setBusy, onError }: { a: Account; busy: string |
|
|||
setBusy(key); onError(null);
|
||||
try { await fn(); } catch (e) { onError(errorText(e)); } finally { setBusy(null); }
|
||||
};
|
||||
const save = (e: FormEvent) => { e.preventDefault(); run(`ed-${a.id}`, async () => { await api.updateAccount(a.id, label, studio || null); await d.reload(); setEdit(false); }); };
|
||||
const save = (e: FormEvent) => { e.preventDefault(); run(`ed-${a.id}`, async () => { await api.updateAccount(a.id, label, studio || null); if (a.kind === 'play' && a.profile && dev.trim() !== (a.developerId ?? '')) await api.setPlayDeveloper(a.id, dev.trim() || null); await d.reload(); setEdit(false); }); };
|
||||
const check = h?.check;
|
||||
const cm = useContextMenu();
|
||||
return (
|
||||
|
|
@ -81,6 +83,7 @@ function AccountRow({ a, busy, setBusy, onError }: { a: Account; busy: string |
|
|||
{' · '}{a.profile ? <span className="mono-id selectable" title="~/.storebound">{t('acct.profile', { name: a.profile })}</span> : t('acct.noProfile')}
|
||||
{' · '}{list ? t('acct.appsRead', { count: list.value.apps.length, when: ago(list.at) }) : t('acct.notImported')}
|
||||
{used ? ` · ${t('acct.folders', { count: used })}` : ''}
|
||||
{a.kind === 'play' && (a.developerId ? <> · <span className="mono-id selectable" title={t('acct.devIdHint')}>{t('acct.devId', { id: a.developerId })}</span></> : <> · <span title={t('acct.devIdHint')}>{t('acct.noDevId')}</span></>)}
|
||||
{check?.principal ? <> · <span className="mono-id selectable">{check.principal}</span></> : null}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -100,7 +103,10 @@ function AccountRow({ a, busy, setBusy, onError }: { a: Account; busy: string |
|
|||
<option value="">{t('studio.none')}</option>
|
||||
{d.studios.map(s => <option key={s.id} value={s.id}>{s.name}</option>)}
|
||||
</select></div>
|
||||
<div className="actions"><button className="btn btn-primary btn-sm" type="submit" disabled={!label.trim() || !!busy}><Icon name="check" />{t('common.save')}</button><button type="button" className="btn btn-sm btn-ghost" onClick={() => setEdit(false)}>{t('common.cancel')}</button></div>
|
||||
{a.kind === 'play' && a.profile && <div className="field"><label htmlFor={`ad-${a.id}`}>{t('acct.devIdLabel')}</label>
|
||||
<input id={`ad-${a.id}`} className="input mono" inputMode="numeric" value={dev} onChange={e => setDev(e.target.value)} placeholder="5550000000000000001" aria-invalid={!devOk} aria-describedby={`adh-${a.id}`} />
|
||||
<small id={`adh-${a.id}`} className="muted">{t('acct.devIdHint')}</small></div>}
|
||||
<div className="actions"><button className="btn btn-primary btn-sm" type="submit" disabled={!label.trim() || !devOk || !!busy}><Icon name="check" />{t('common.save')}</button><button type="button" className="btn btn-sm btn-ghost" onClick={() => setEdit(false)}>{t('common.cancel')}</button></div>
|
||||
</form>
|
||||
)}
|
||||
{check && check.status !== 'ok' && check.fix && (
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// app folder) shows its store reads (releases, health, reviews, TestFlight) read-only, with "Link a folder" and
|
||||
// "Start an app folder here" to make it a full app.
|
||||
import { useContextMenu, useMenuButton } from '../ui/ContextMenu';
|
||||
import { appMenu } from '../ui/app-menu';
|
||||
import { appMenu, playUrlFor } from '../ui/app-menu';
|
||||
import { useShowIgnored } from '../lib/show-ignored';
|
||||
import { useState } from 'react';
|
||||
import { api, errorText } from '../api';
|
||||
|
|
@ -34,7 +34,6 @@ import { StoreListingEditor } from './editors/StoreListingEditor';
|
|||
import { useEdits } from '../ui/Editor';
|
||||
|
||||
export const ascUrl = (appId: string | null | undefined): string => (appId ? `https://appstoreconnect.apple.com/apps/${encodeURIComponent(appId)}/distribution` : 'https://appstoreconnect.apple.com/apps');
|
||||
export const PLAY_CONSOLE = 'https://play.google.com/console/';
|
||||
|
||||
const PAIRING: Record<UnifiedApp['pairing'], Key> = { folder: 'pair.folder', manual: 'pair.manual', id: 'pair.id', close: 'pair.close', name: 'pair.name', single: 'pair.single' };
|
||||
|
||||
|
|
@ -135,7 +134,7 @@ export function AppView({ app, tab }: { app: UnifiedApp; tab: AppTab }) {
|
|||
</>}
|
||||
links={(ios || android) && <>
|
||||
{ios && <button className="btn btn-sm btn-ghost" onClick={() => open(ascUrl(ios.ascAppId))} title={t('app.consoleHint')}><Icon name="external" />App Store Connect</button>}
|
||||
{android && <button className="btn btn-sm btn-ghost" onClick={() => open(PLAY_CONSOLE)} title={t('app.consoleHint')}><Icon name="external" />Play Console</button>}
|
||||
{android && <button className="btn btn-sm btn-ghost" onClick={() => open(playUrlFor(d, app))} title={t('app.consoleHint')}><Icon name="external" />Play Console</button>}
|
||||
</>}
|
||||
all={all} ios={!!ios} android={!!android} next={l?.release.next?.version ?? null}
|
||||
cta={nextStep({ project: !!app.project, att, all, next: l?.release.next?.version ?? null })} onCta={setTab} />
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Catalog: products and subscriptions defined once in the config against both stores (catalog diff): a parity
|
||||
// matrix (present, mismatched, missing, not sold there, not read), and price gaps between the stores per region.
|
||||
import { useContextMenu } from '../../ui/ContextMenu';
|
||||
import { copyToast, projectConsoles } from '../../ui/app-menu';
|
||||
import { copyToast, playUrlFor, projectConsoles } from '../../ui/app-menu';
|
||||
import '../../styles/catalog.css';
|
||||
import type { Project } from '../../api';
|
||||
import { type Key, t } from '../../i18n';
|
||||
|
|
@ -110,7 +110,7 @@ export function CatalogTab({ project }: { project: Project }) {
|
|||
{ label: t('cm.copyProductId'), icon: 'copy', shortcut: r.id, onSelect: () => copyToast(d, r.id) },
|
||||
{ label: t('cm.showPrices'), icon: 'coins', onSelect: () => nav.go({ screen: 'app', appId: project.id, tab: 'prices' }) },
|
||||
'sep',
|
||||
...projectConsoles(d, plat?.ios?.ascAppId, !!plat?.ios, !!plat?.android),
|
||||
...projectConsoles(d, plat?.ios?.ascAppId, !!plat?.ios, !!plat?.android, playUrlFor(d, d.appByKey(project.id))),
|
||||
])}>
|
||||
<div className="cat-card-h">
|
||||
<span className="cat-ic" aria-hidden="true"><Icon name={r.kind === 'subscription' ? 'refresh' : 'tag'} /></span>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ import '../../styles/growth.css';
|
|||
import { LineChart } from '../../ui/LineChart';
|
||||
import { RankChart } from '../../ui/RankChart';
|
||||
import { WriteButton } from '../../ui/WriteButton';
|
||||
import { ascUrl, PLAY_CONSOLE } from '../AppView';
|
||||
import { ascUrl } from '../AppView';
|
||||
import { playUrlFor } from '../../ui/app-menu';
|
||||
|
||||
const DONE = ['COMPLETED', 'STOPPED'];
|
||||
const started = (x: PpoTest) => !!x.startDate && !x.endDate && !DONE.includes(x.state);
|
||||
|
|
@ -243,10 +244,11 @@ function Experiments({ app }: { app: UnifiedApp }) {
|
|||
}
|
||||
|
||||
function PlayExperiments({ app }: { app: UnifiedApp }) {
|
||||
const d = useData();
|
||||
const nav = useNav();
|
||||
return (
|
||||
<Section title={t('gr.playExp')} icon="flask" sub={<span className="row" style={{ gap: 6 }}><StoreGlyph store="android" className="ic13" />{t('gr.playExpSub')}</span>}
|
||||
actions={<button className="btn btn-sm" onClick={() => api.openExternal(PLAY_CONSOLE).catch(() => {})}><Icon name="external" />Play Console</button>}>
|
||||
actions={<button className="btn btn-sm" onClick={() => api.openExternal(playUrlFor(d, app)).catch(() => {})}><Icon name="external" />Play Console</button>}>
|
||||
<div className="gr-body">
|
||||
<p className="gr-text">{t('gr.playExpText')}</p>
|
||||
{app.project && <div><button className="btn btn-sm" onClick={() => nav.go({ screen: 'app', appId: app.key, tab: 'art' })}><Icon name="grid" />{t('gr.seeVariants')}</button></div>}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ import { Icon, StoreGlyph } from '../../ui/icons';
|
|||
import { Chip, ErrorNotice, Notice, ReadControl, Seg, Skeleton } from '../../ui/kit';
|
||||
import { EmptyState, StatusPill } from '../../ui/ds';
|
||||
import { OwnerAction } from '../../ui/OwnerAction';
|
||||
import { ascUrl, PLAY_CONSOLE } from '../AppView';
|
||||
import { ascUrl } from '../AppView';
|
||||
import { playUrlFor } from '../../ui/app-menu';
|
||||
import '../../styles/submit.css';
|
||||
|
||||
const SUB_KIND: Record<SubmissionKind, ['ok' | 'warn' | 'bad' | 'info' | 'neutral', Key]> = {
|
||||
|
|
@ -219,7 +220,7 @@ export function PlayProductionCard({ app, project }: { app: UnifiedApp; project:
|
|||
sub={r.data ? (r.fromCache ? t('common.cachedFrom', { when: ago(r.at) }) : t('common.readWhen', { when: ago(r.at) })) : r.loading ? t('read.waiting') : t('sub.playSub')}
|
||||
actions={<>
|
||||
<ReadControl r={r} label={t('sub.read')} />
|
||||
<button className="btn btn-sm btn-ghost" onClick={() => api.openExternal(PLAY_CONSOLE).catch(() => {})}><Icon name="external" />Play Console</button>
|
||||
<button className="btn btn-sm btn-ghost" onClick={() => api.openExternal(playUrlFor(d, app)).catch(() => {})}><Icon name="external" />Play Console</button>
|
||||
</>} />
|
||||
<div className="sub-body">
|
||||
{r.error && <ErrorNotice error={r.error} keep={!!r.data} />}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,18 @@ import { setShowIgnored } from '../lib/show-ignored';
|
|||
import { type AppTab, type Nav, TAB_ICON, TAB_KEY, tabsFor } from '../nav';
|
||||
import type { Data } from '../store';
|
||||
import type { MenuInput, MenuItem } from './menu-logic';
|
||||
import { pickConsoleId, playAppUrl } from '../../../../cli/lib/console-links';
|
||||
|
||||
export const ASC_APP = (id: string | null | undefined): string => (id ? `https://appstoreconnect.apple.com/apps/${encodeURIComponent(id)}/distribution` : 'https://appstoreconnect.apple.com/apps');
|
||||
export const PLAY_HOME = 'https://play.google.com/console/';
|
||||
/** The Play Console page of one app (console-links playAppUrl, shared with the CLI and watch): the app's dashboard when
|
||||
* the developer id (status from the config / profile, else the app's Play account) and the console app id are known,
|
||||
* else the developer's app list, else the developer chooser. Never the bare console root. */
|
||||
export function playUrlFor(d: Data, app: UnifiedApp | null | undefined): string {
|
||||
const st = app ? d.statusFor(app)?.app?.platforms.android : null;
|
||||
const accId = app?.android?.account ?? app?.project?.playAccount ?? null;
|
||||
const acc = accId ? d.accounts.find(a => a.id === accId) : undefined;
|
||||
return playAppUrl({ developerId: pickConsoleId(st?.developerId, acc?.developerId), appId: st?.appId ?? null });
|
||||
}
|
||||
|
||||
export function openUrl(d: Data, url: string): void {
|
||||
api.openExternal(url).catch(e => d.toast({ kind: 'bad', title: t('link.openFailed'), detail: errorText(e) }));
|
||||
|
|
@ -31,7 +40,7 @@ export function appMenu(app: UnifiedApp, d: Data, nav: Nav, opts: { showIgnored:
|
|||
'sep',
|
||||
(ios || android) && { label: t('cm.openConsole'), icon: 'external', submenu: [
|
||||
ios && { label: 'App Store Connect', icon: 'external', onSelect: () => openUrl(d, ASC_APP(ios.id)) },
|
||||
android && { label: 'Google Play Console', icon: 'external', onSelect: () => openUrl(d, PLAY_HOME) },
|
||||
android && { label: 'Google Play Console', icon: 'external', onSelect: () => openUrl(d, playUrlFor(d, app)) },
|
||||
] },
|
||||
p && !p.missing && { label: t('cm.openFolder'), icon: 'folder', onSelect: () => { api.reveal(p.id).catch(e => d.toast({ kind: 'bad', title: t('cm.folderFailed'), detail: errorText(e) })); } },
|
||||
{ label: t('cm.copy'), icon: 'copy', submenu: [
|
||||
|
|
@ -68,7 +77,7 @@ export function appMenu(app: UnifiedApp, d: Data, nav: Nav, opts: { showIgnored:
|
|||
export function consoleItem(d: Data, app: UnifiedApp, store: 'ios' | 'android'): MenuItem {
|
||||
return store === 'ios'
|
||||
? { label: t('cm.openIn', { place: 'App Store Connect' }), icon: 'external', onSelect: () => openUrl(d, ASC_APP(app.ios?.app.id)) }
|
||||
: { label: t('cm.openIn', { place: 'Google Play Console' }), icon: 'external', onSelect: () => openUrl(d, PLAY_HOME) };
|
||||
: { label: t('cm.openIn', { place: 'Google Play Console' }), icon: 'external', onSelect: () => openUrl(d, playUrlFor(d, app)) };
|
||||
}
|
||||
|
||||
/** Menu of one store release: copy version / build, open the console. */
|
||||
|
|
@ -82,9 +91,9 @@ export function releaseMenu(d: Data, app: UnifiedApp, store: 'ios' | 'android',
|
|||
}
|
||||
|
||||
/** Both consoles of an app folder (App Store Connect with the app's id when the status knows it). */
|
||||
export function projectConsoles(d: Data, ascAppId: string | null | undefined, ios: boolean, android: boolean): MenuInput {
|
||||
export function projectConsoles(d: Data, ascAppId: string | null | undefined, ios: boolean, android: boolean, playUrl: string): MenuInput {
|
||||
return [
|
||||
ios && { label: t('cm.openIn', { place: 'App Store Connect' }), icon: 'external', onSelect: () => openUrl(d, ASC_APP(ascAppId)) },
|
||||
android && { label: t('cm.openIn', { place: 'Google Play Console' }), icon: 'external', onSelect: () => openUrl(d, PLAY_HOME) },
|
||||
android && { label: t('cm.openIn', { place: 'Google Play Console' }), icon: 'external', onSelect: () => openUrl(d, playUrl) },
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue