Full IAP catalog: non-renewing products, per-platform availability, catalog diff (cross-store parity report)
This commit is contained in:
parent
346ae8cb56
commit
222a1df9e2
4 changed files with 261 additions and 4 deletions
|
|
@ -4,6 +4,7 @@
|
|||
// storebound apple iap [--dry] [--only id1,id2]
|
||||
// Then `apple iap-review` for the review screenshots. First IAPs can only be submitted together with an app version,
|
||||
// from the IAP page in the web UI (see the store-iap-setup skill).
|
||||
import { sellsOn } from '../lib/config';
|
||||
import { APPLE_IAP_LIMITS } from '../lib/copy';
|
||||
import type { Ctx } from '../lib/ctx';
|
||||
import { need } from '../lib/ctx';
|
||||
|
|
@ -11,11 +12,14 @@ import { done, log, step } from '../lib/log';
|
|||
import { appleTerritory, nearestPrices, samePrice } from '../lib/money';
|
||||
import { ascClient, type J } from './asc';
|
||||
|
||||
/** Product type -> InAppPurchaseType (POST /v2/inAppPurchases). */
|
||||
export const APPLE_IAP_TYPE = { consumable: 'CONSUMABLE', non_consumable: 'NON_CONSUMABLE', non_renewing: 'NON_RENEWING_SUBSCRIPTION' } as const;
|
||||
|
||||
export async function run(ctx: Ctx): Promise<void> {
|
||||
const { config, root } = ctx.loaded;
|
||||
const bundleId = need(config.apple?.bundleId, 'apple.bundleId');
|
||||
const only = ctx.args.list('only');
|
||||
const products = need(config.products, 'products').filter(p => !only.length || only.includes(p.id));
|
||||
const products = need(config.products, 'products').filter(p => (!only.length || only.includes(p.id)) && sellsOn(config, p, 'apple'));
|
||||
const dry = ctx.args.has('dry');
|
||||
const c = await ascClient(root, bundleId, config.apple?.appId);
|
||||
const appId = await c.app();
|
||||
|
|
@ -39,7 +43,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
if (!id) {
|
||||
const first = Object.values(p.listings)[0]!;
|
||||
id = (await c.asc('POST', '/v2/inAppPurchases', { data: { type: 'inAppPurchases',
|
||||
attributes: { name: p.referenceName ?? first.title, productId: p.id, inAppPurchaseType: p.type === 'consumable' ? 'CONSUMABLE' : 'NON_CONSUMABLE',
|
||||
attributes: { name: p.referenceName ?? first.title, productId: p.id, inAppPurchaseType: APPLE_IAP_TYPE[p.type],
|
||||
familySharable: p.familySharable ?? false, ...(p.reviewNote ? { reviewNote: p.reviewNote } : {}) },
|
||||
relationships: { app: { data: { type: 'apps', id: appId } } } } })).data.id;
|
||||
log('apple', `${tag}: created`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue