flows, listing translate, scan 2.2 + --originality, prices export with subscriptions, site sections
- storebound flow list|validate|run: repo-local workflows (store/workflows/*.yml, storebound.workflows.*), writes dry unless --apply, owner steps never run, --from / --resume; init templates for app and game; MCP flow_list + dry flow_run; release-flows skill - storebound listing translate|check|reviewed: per-language listing drafts with store limits and keyword rules, agent or --translate hook, marked until reviewed; MCP listing_translate / listing_check; listing-localization skill - scan: Apple 2.2 beta/demo/test wording rule; scan --originality [--against] - prices export includes subscriptions; prices import skips their rows - site: rejection scan section, Desktop app section with fixture-mode screenshots, Everything else grid, FAQ 4.3 answer - README, CHANGELOG, adapters, API tables
This commit is contained in:
parent
e44897ca4e
commit
526dfd3b09
45 changed files with 2176 additions and 53 deletions
|
|
@ -1,5 +1,8 @@
|
|||
// In-app product prices for many products and regions from one CSV (both stores).
|
||||
// storebound prices export [--out store/prices.csv] [--store apple|play] [--only ids] [--with-automatic] [--dry] [--json]
|
||||
// storebound prices export [--out store/prices.csv] [--store apple|play] [--only ids] [--with-automatic] [--no-subscriptions] [--dry] [--json]
|
||||
// one-time products and (unless --no-subscriptions) auto-renewable subscriptions: Apple's current and scheduled
|
||||
// subscription prices per territory, Play's regional prices of the base plan. Subscription rows use the same
|
||||
// columns; `apple subscriptions --csv` / `play subscriptions --csv` read them back (prices import skips them).
|
||||
// storebound prices import [--csv store/prices.csv] [--store apple|play] [--only ids] [--reconvert] [--all] [--dry] [--yes]
|
||||
// storebound prices ppp [--base <USD>] [...] purchasing power price sheet (prices-ppp.ts)
|
||||
// CSV columns: product, store (apple | play | both), region (ISO alpha-2), currency, price, start_date (App Store
|
||||
|
|
@ -21,6 +24,7 @@ import {
|
|||
pointKey, type PriceRow, pricesCsv, sameSchedule,
|
||||
} from './lib/prices';
|
||||
import { playClient, type PlayClient } from './play/client';
|
||||
import { allSubscriptions, appleSubPriceRows, basePlanId, type PlaySubscription, playSubPriceRows } from './lib/subscriptions';
|
||||
|
||||
const TAG = 'prices';
|
||||
|
||||
|
|
@ -60,7 +64,9 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
const useApple = (!store || store === 'apple') && !!config.apple;
|
||||
const usePlay = (!store || store === 'play') && !!config.play;
|
||||
const only = a.list('only');
|
||||
const products = need(config.products, 'products').filter(p => !only.length || only.includes(p.id));
|
||||
const products = (config.products ?? []).filter(p => !only.length || only.includes(p.id));
|
||||
const subs = sub === 'export' && !a.has('no-subscriptions') ? allSubscriptions(config.subscriptions).map(x => x.sub).filter(s => !only.length || only.includes(s.id)) : [];
|
||||
if (!products.length && !subs.length) need(undefined, sub === 'export' ? 'products or subscriptions' : 'products');
|
||||
const csvPath = resolve(a.get(sub === 'export' ? 'out' : 'csv') ?? config.prices?.csv ?? 'store/prices.csv');
|
||||
const dry = a.has('dry');
|
||||
|
||||
|
|
@ -87,22 +93,46 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
if (sub === 'export' && subs.length) {
|
||||
const appleSubs = new Map<string, string>();
|
||||
if (c) for (const g of await c.all(`/v1/apps/${appId}/subscriptionGroups?limit=200`))
|
||||
for (const x of await c.all(`/v1/subscriptionGroups/${g.id}/subscriptions?limit=200`)) appleSubs.set(String(x.attributes.productId), x.id);
|
||||
for (const [i, s] of subs.entries()) {
|
||||
log(TAG, `${step(i + 1, subs.length, s.id)}: reading subscription prices`);
|
||||
if (c) {
|
||||
const id = appleSubs.get(s.id);
|
||||
if (!id) { warn(TAG, `${s.id}: subscription not on App Store Connect (storebound apple subscriptions creates it)`); missing.push({ product: s.id, store: 'apple' }); }
|
||||
else current.push(...appleSubPriceRows(s.id, await pages(c, `/v1/subscriptions/${id}/prices?include=subscriptionPricePoint,territory&limit=200`)));
|
||||
}
|
||||
if (play) {
|
||||
let ps: PlaySubscription | null = null;
|
||||
try { ps = await play.call<PlaySubscription>('GET', `${play.API}/subscriptions/${encodeURIComponent(s.id)}`); } catch (e) { if (!/-> 404/.test(String(e))) throw e; }
|
||||
if (!ps) { warn(TAG, `${s.id}: subscription not on Google Play (storebound play subscriptions creates it)`); missing.push({ product: s.id, store: 'play' }); }
|
||||
else current.push(...playSubPriceRows(ps, basePlanId(s)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sub === 'export') {
|
||||
// --json: the current prices as data (the desktop price view); read-only, never writes the CSV
|
||||
if (a.has('json')) {
|
||||
printJson({ csv: csvPath, products: products.map(p => p.id), stores: [...(useApple ? ['apple'] : []), ...(usePlay ? ['play'] : [])], missing,
|
||||
printJson({ csv: csvPath, products: products.map(p => p.id), subscriptions: subs.map(s => s.id), stores: [...(useApple ? ['apple'] : []), ...(usePlay ? ['play'] : [])], missing,
|
||||
rows: current.map(({ pointId: _p, ...r }) => r) });
|
||||
return;
|
||||
}
|
||||
const csv = pricesCsv(current);
|
||||
if (dry) { console.log(csv); done(TAG, `dry run: would write ${current.length} rows to ${csvPath}`); return; }
|
||||
writeFileSync(csvPath, csv);
|
||||
done(TAG, `${current.length} rows -> ${csvPath} (edit, then storebound prices import --dry)`);
|
||||
done(TAG, `${current.length} rows -> ${csvPath} (edit, then storebound prices import --dry${subs.length ? '; subscription rows: apple subscriptions --csv / play subscriptions --csv' : ''})`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!existsSync(csvPath)) throw new Error(`no prices CSV at ${csvPath} (storebound prices export writes one)`);
|
||||
const wantedAll = parsePriceCsv(readFileSync(csvPath, 'utf8'), { products: config.products!.map(p => p.id) })
|
||||
const subIds = allSubscriptions(config.subscriptions).map(x => x.sub.id);
|
||||
const sheet = parsePriceCsv(readFileSync(csvPath, 'utf8'), { products: [...(config.products ?? []).map(p => p.id), ...subIds] });
|
||||
const subRows = sheet.filter(r => subIds.includes(r.product));
|
||||
if (subRows.length) log(TAG, `${subRows.length} subscription row(s) skipped here: storebound apple subscriptions --csv ${a.get('csv') ?? config.prices?.csv ?? 'store/prices.csv'} --dry (and play subscriptions --csv) apply them`);
|
||||
const wantedAll = sheet
|
||||
.filter(r => products.some(p => p.id === r.product) && ((r.store === 'apple' && useApple) || (r.store === 'play' && usePlay)));
|
||||
const diff = diffPrices(current, wantedAll);
|
||||
const changed = new Set(diff.filter(d => d.change !== 'same').map(d => `${d.product}|${d.store}`));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue