@sprid/release 1.5.3 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +15 -0
- package/package.json +1 -1
- package/src/asc/index.ts +2 -0
- package/src/asc/retention.ts +222 -0
- package/src/asc/submissions.ts +4 -4
- package/src/asc/submit.ts +3 -1
- package/src/cli.ts +18 -3
- package/src/config.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
@sprid/release follows semver: a breaking change to a command's arguments, its
|
|
4
4
|
output shape or its exit codes is a major release.
|
|
5
5
|
|
|
6
|
+
## 1.6.1 - 2026-11-13
|
|
7
|
+
|
|
8
|
+
- `retention` fails locally on a message body over 144 characters, which App Store
|
|
9
|
+
Connect rejects with a 409 that its help pages do not mention.
|
|
10
|
+
|
|
11
|
+
## 1.6.0 - 2026-11-13
|
|
12
|
+
|
|
13
|
+
- `retention` (`asc-retention`) creates and updates App Store retention messages from
|
|
14
|
+
`ascRetentionMessages`: header and body per locale, and the subscriptions that
|
|
15
|
+
show each message. Prices, percentages, offer words and repeated exclamation
|
|
16
|
+
marks fail locally, because App Review rejects them. Changing an approved message
|
|
17
|
+
creates a new draft version, and the approved one stays live. `--submit` sends
|
|
18
|
+
draft versions to App Review. Retention offers are not managed.
|
|
19
|
+
- `asc-submit` writes a changed App Review note even when the review contact is
|
|
20
|
+
already set, where it used to keep the old note.
|
|
21
|
+
|
|
6
22
|
## 1.5.3 - 2026-11-06
|
|
7
23
|
|
|
8
24
|
- The Google Play metadata push creates the listing for a language the app has not had yet, where it used to fail with a 404.
|
package/README.md
CHANGED
|
@@ -56,6 +56,21 @@ export default defineReleaseConfig({
|
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
### Retention messages
|
|
60
|
+
|
|
61
|
+
`sprid release retention` sets the text Apple shows when a subscriber starts to cancel.
|
|
62
|
+
Each subscription shows one message, and an app can have ten. Every listing locale needs
|
|
63
|
+
copy, with a body of at most 144 characters. App Review rejects prices and offers in the text, so the local check fails on
|
|
64
|
+
them first. `--submit` sends drafts to App Review.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
ascRetentionMessages: [{
|
|
68
|
+
name: "pro_monthly_keep", // reference name, never shown
|
|
69
|
+
products: ["pro_monthly"],
|
|
70
|
+
copy: { en: { header: "Still using your projects?", body: "Pro keeps every project synced across your devices." } },
|
|
71
|
+
}],
|
|
72
|
+
```
|
|
73
|
+
|
|
59
74
|
### App Store header, search results and app previews
|
|
60
75
|
|
|
61
76
|
`ascCreative` holds the creative assets iOS and iPadOS 27 show: a product page
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprid/release",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Build, sign and release mobile apps locally. Store copy, screenshots, binary uploads and review submissions from one app-owned configuration. Dry run by default.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
package/src/asc/index.ts
CHANGED
|
@@ -14,3 +14,5 @@ export { pushCustomProductPages, pushProductPageTest, readProductPageTest, planP
|
|
|
14
14
|
export type { PushPagesOptions, PushTestOptions, PushedPage, TestStatus, PagePlan, TestPlan } from './product-pages.ts';
|
|
15
15
|
export { readPageResults, printPageResults, resultsLabel, downloadsPerView, foldPages } from './page-results.ts';
|
|
16
16
|
export type { PageResults, PageResultsOptions, PageRow } from './page-results.ts';
|
|
17
|
+
export { pushRetentionMessages, planRetention, MAX_RETENTION_MESSAGES, MAX_RETENTION_BODY } from './retention.ts';
|
|
18
|
+
export type { PushRetentionOptions, PushedRetentionMessage, PlannedRetentionMessage } from './retention.ts';
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retention messages: the text Apple shows on the Confirm Cancellation page
|
|
3
|
+
* after a subscriber taps Cancel Subscription. One message per subscription,
|
|
4
|
+
* at most ten per app, localized for every storefront the subscription sells
|
|
5
|
+
* in. The body takes at most 144 characters, and App Review rejects prices and
|
|
6
|
+
* offers in the text, so the local check fails on both before anything is sent.
|
|
7
|
+
*
|
|
8
|
+
* Each message has versions. An approved version cannot be edited: a change
|
|
9
|
+
* goes on a new draft version, the approved one stays live until the draft is
|
|
10
|
+
* approved, and there is no rollback. Retention offers are separate resources
|
|
11
|
+
* and are not managed here.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { AppReleaseConfig, AscRetentionMessage } from '../config.ts';
|
|
15
|
+
import { createAscClient, type AscClient } from './client.ts';
|
|
16
|
+
import { listAll } from './product-pages.ts';
|
|
17
|
+
import { addToReview } from './submissions.ts';
|
|
18
|
+
|
|
19
|
+
export const MAX_RETENTION_MESSAGES = 10;
|
|
20
|
+
/** App Store Connect answers 409 above this; Apple's help pages do not state it. */
|
|
21
|
+
export const MAX_RETENTION_BODY = 144;
|
|
22
|
+
const EDITABLE = new Set(['PREPARE_FOR_SUBMISSION', 'READY_FOR_REVIEW', 'REJECTED', 'DEVELOPER_REJECTED']);
|
|
23
|
+
const IN_REVIEW = new Set(['WAITING_FOR_REVIEW', 'IN_REVIEW']);
|
|
24
|
+
|
|
25
|
+
// Apple: the text "can't reference promotional offers, discounts, or specific
|
|
26
|
+
// prices, such as '$9.99,' '50% off,' or 'one month free.'"
|
|
27
|
+
const PRICE = /(\d[\d\s.,]*\s?(%|kr\b|sek\b|nok\b|dkk\b|eur\b|usd\b|gbp\b|€|\$|£))|((€|\$|£)\s?\d)/i;
|
|
28
|
+
const OFFER = /\b(free|discounts?|offers?|off|gratis|rabatt|rabat|erbjudande|tilbud|tarjous|alennus|ilmai\w*|kostenlos)\b/i;
|
|
29
|
+
|
|
30
|
+
export interface PlannedRetentionMessage {
|
|
31
|
+
name: string;
|
|
32
|
+
products: string[];
|
|
33
|
+
localizations: { locale: string; header: string; body: string }[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Local checks, every problem at once, no network. */
|
|
37
|
+
export function planRetention(config: AppReleaseConfig, localeMap: Record<string, string>): PlannedRetentionMessage[] {
|
|
38
|
+
const messages = config.ascRetentionMessages ?? [];
|
|
39
|
+
const problems: string[] = [];
|
|
40
|
+
if (!messages.length) problems.push('release.config.ts has no `ascRetentionMessages`.');
|
|
41
|
+
if (messages.length > MAX_RETENTION_MESSAGES) problems.push(`${messages.length} messages: Apple allows ${MAX_RETENTION_MESSAGES} per app.`);
|
|
42
|
+
const names = new Set<string>();
|
|
43
|
+
const owner = new Map<string, string>();
|
|
44
|
+
const planned = messages.map((m) => {
|
|
45
|
+
const name = m.name?.trim() ?? '';
|
|
46
|
+
if (!name) problems.push('A retention message has no name.');
|
|
47
|
+
if (names.has(name)) problems.push(`"${name}": duplicate name.`);
|
|
48
|
+
names.add(name);
|
|
49
|
+
if (!m.products?.length) problems.push(`"${name}": no products.`);
|
|
50
|
+
for (const p of m.products ?? []) {
|
|
51
|
+
if (owner.has(p)) problems.push(`${p}: in "${owner.get(p)}" and "${name}". A subscription shows one message.`);
|
|
52
|
+
owner.set(p, name);
|
|
53
|
+
}
|
|
54
|
+
const localizations = Object.entries(localeMap).map(([locale, lang]) => {
|
|
55
|
+
const c = m.copy?.[lang];
|
|
56
|
+
const where = `"${name}" [${locale}]`;
|
|
57
|
+
if (!c) { problems.push(`${where}: no copy for "${lang}". Apple wants every storefront locale.`); return { locale, header: '', body: '' }; }
|
|
58
|
+
const header = c.header?.trim() ?? '', body = c.body?.trim() ?? '';
|
|
59
|
+
if (!header || !body) problems.push(`${where}: header and body are both required.`);
|
|
60
|
+
if ([...body].length > MAX_RETENTION_BODY) problems.push(`${where} body: ${[...body].length} characters, Apple allows ${MAX_RETENTION_BODY}.`);
|
|
61
|
+
for (const [field, text] of [['header', header], ['body', body]] as const) {
|
|
62
|
+
if (PRICE.test(text)) problems.push(`${where} ${field}: mentions a price or percentage. App Review rejects that.`);
|
|
63
|
+
const offer = text.match(OFFER);
|
|
64
|
+
if (offer) problems.push(`${where} ${field}: "${offer[0]}" reads as an offer. App Review rejects offers in the text; attach a retention offer instead.`);
|
|
65
|
+
if (/!{2,}/.test(text)) problems.push(`${where} ${field}: repeated exclamation marks.`);
|
|
66
|
+
}
|
|
67
|
+
return { locale, header, body };
|
|
68
|
+
});
|
|
69
|
+
return { name, products: [...(m.products ?? [])], localizations };
|
|
70
|
+
});
|
|
71
|
+
if (problems.length) throw new Error(`Retention messages are not ready:\n ${problems.join('\n ')}`);
|
|
72
|
+
return planned;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface PushRetentionOptions {
|
|
76
|
+
config: AppReleaseConfig;
|
|
77
|
+
localeMap: Record<string, string>;
|
|
78
|
+
execute?: boolean;
|
|
79
|
+
/** Send changed or unsubmitted versions to App Review. */
|
|
80
|
+
submit?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface PushedRetentionMessage {
|
|
84
|
+
name: string;
|
|
85
|
+
id: string;
|
|
86
|
+
versionId?: string;
|
|
87
|
+
/** What happened to the copy. */
|
|
88
|
+
copy: 'created' | 'updated' | 'unchanged' | 'in-review';
|
|
89
|
+
products: string[];
|
|
90
|
+
review?: 'submitted' | 'drafted';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const sameCopy = (locs: any[], want: PlannedRetentionMessage['localizations']) =>
|
|
94
|
+
want.every((w) => locs.some((l) => l.attributes?.locale === w.locale && l.attributes?.header === w.header && l.attributes?.body === w.body));
|
|
95
|
+
|
|
96
|
+
/** Product id → subscription id for every subscription group of the app. */
|
|
97
|
+
async function subscriptionIds(client: AscClient, appId: string): Promise<Map<string, string>> {
|
|
98
|
+
const out = new Map<string, string>();
|
|
99
|
+
for (const group of await listAll(client, `/apps/${appId}/subscriptionGroups?limit=200`)) {
|
|
100
|
+
for (const sub of await listAll(client, `/subscriptionGroups/${group.id}/subscriptions?limit=200`)) out.set(sub.attributes.productId, sub.id);
|
|
101
|
+
}
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function writeLocalizations(client: AscClient, versionId: string, want: PlannedRetentionMessage['localizations']): Promise<void> {
|
|
106
|
+
const existing = await listAll(client, `/retentionMessageVersions/${versionId}/localizations?limit=200`);
|
|
107
|
+
for (const w of want) {
|
|
108
|
+
const found = existing.find((l) => l.attributes?.locale === w.locale);
|
|
109
|
+
const attributes = { header: w.header, body: w.body };
|
|
110
|
+
if (found) {
|
|
111
|
+
if (found.attributes?.header === w.header && found.attributes?.body === w.body) continue;
|
|
112
|
+
await client.api(`/retentionMessageLocalizations/${found.id}`, { method: 'PATCH',
|
|
113
|
+
body: JSON.stringify({ data: { type: 'retentionMessageLocalizations', id: found.id, attributes } }) });
|
|
114
|
+
} else {
|
|
115
|
+
await client.api('/retentionMessageLocalizations', { method: 'POST', body: JSON.stringify({ data: {
|
|
116
|
+
type: 'retentionMessageLocalizations', attributes: { locale: w.locale, ...attributes },
|
|
117
|
+
relationships: { retentionMessageVersion: { data: { type: 'retentionMessageVersions', id: versionId } } },
|
|
118
|
+
} }) });
|
|
119
|
+
}
|
|
120
|
+
console.log(` [${w.locale}] ${found ? 'updated' : 'added'}`);
|
|
121
|
+
}
|
|
122
|
+
const extra = existing.filter((l) => !want.some((w) => w.locale === l.attributes?.locale)).map((l) => l.attributes?.locale);
|
|
123
|
+
if (extra.length) console.log(` left in place, not in config: ${extra.join(', ')}`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function newVersion(client: AscClient, messageId: string): Promise<string> {
|
|
127
|
+
const created = await client.api('/retentionMessageVersions', { method: 'POST', body: JSON.stringify({ data: {
|
|
128
|
+
type: 'retentionMessageVersions', relationships: { retentionMessage: { data: { type: 'retentionMessages', id: messageId } } },
|
|
129
|
+
} }) });
|
|
130
|
+
return created.data.id;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Create or update each configured message, its copy and which subscriptions
|
|
135
|
+
* show it. A dry run prints the plan and makes no request.
|
|
136
|
+
*/
|
|
137
|
+
export async function pushRetentionMessages({ config, localeMap, execute = false, submit = false }: PushRetentionOptions): Promise<PushedRetentionMessage[]> {
|
|
138
|
+
const plan = planRetention(config, localeMap);
|
|
139
|
+
console.log(`App Store retention messages ${execute ? '(EXECUTE)' : '(DRY RUN)'}`);
|
|
140
|
+
console.log(JSON.stringify(plan, null, 2));
|
|
141
|
+
if (!execute) return [];
|
|
142
|
+
|
|
143
|
+
const client = createAscClient(config);
|
|
144
|
+
const app = await client.findApp();
|
|
145
|
+
const subs = await subscriptionIds(client, app.id);
|
|
146
|
+
const missing = plan.flatMap((m) => m.products).filter((p) => !subs.has(p));
|
|
147
|
+
if (missing.length) throw new Error(`No subscription in App Store Connect for: ${missing.join(', ')}`);
|
|
148
|
+
const existing = await listAll(client, `/apps/${app.id}/retentionMessages?limit=200`);
|
|
149
|
+
const fresh = plan.filter((m) => !existing.some((e) => e.attributes?.referenceName === m.name)).length;
|
|
150
|
+
if (existing.length + fresh > MAX_RETENTION_MESSAGES) {
|
|
151
|
+
throw new Error(`App Store Connect already holds ${existing.length} retention messages; ${fresh} more would pass Apple's ${MAX_RETENTION_MESSAGES}. Delete one in App Store Connect first (it cannot be undone).`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const pushed: PushedRetentionMessage[] = [];
|
|
155
|
+
/** Draft versions (edited or not) that can go to App Review. */
|
|
156
|
+
const drafts = new Set<string>();
|
|
157
|
+
for (const m of plan) {
|
|
158
|
+
console.log(`\n→ ${m.name}`);
|
|
159
|
+
let message = existing.find((e) => e.attributes?.referenceName === m.name);
|
|
160
|
+
if (!message) {
|
|
161
|
+
message = (await client.api('/retentionMessages', { method: 'POST', body: JSON.stringify({ data: {
|
|
162
|
+
type: 'retentionMessages', attributes: { referenceName: m.name }, relationships: { app: { data: { type: 'apps', id: app.id } } },
|
|
163
|
+
} }) })).data;
|
|
164
|
+
console.log(` created message ${message.id}`);
|
|
165
|
+
}
|
|
166
|
+
const versions = await listAll(client, `/retentionMessages/${message.id}/versions?limit=200`);
|
|
167
|
+
const states = versions.map((v) => v.attributes?.state as string);
|
|
168
|
+
const draft = versions.find((v) => EDITABLE.has(v.attributes?.state));
|
|
169
|
+
const reviewing = versions.find((v) => IN_REVIEW.has(v.attributes?.state));
|
|
170
|
+
const live = versions.find((v) => v.attributes?.state === 'APPROVED' || v.attributes?.state === 'ACCEPTED');
|
|
171
|
+
const result: PushedRetentionMessage = { name: m.name, id: message.id, copy: 'unchanged', products: m.products };
|
|
172
|
+
|
|
173
|
+
if (draft) {
|
|
174
|
+
const locs = await listAll(client, `/retentionMessageVersions/${draft.id}/localizations?limit=200`);
|
|
175
|
+
result.versionId = draft.id;
|
|
176
|
+
if (!sameCopy(locs, m.localizations)) { await writeLocalizations(client, draft.id, m.localizations); result.copy = 'updated'; }
|
|
177
|
+
drafts.add(draft.id);
|
|
178
|
+
console.log(` draft ${draft.id} (${draft.attributes.state}): ${result.copy}`);
|
|
179
|
+
} else if (reviewing) {
|
|
180
|
+
const locs = await listAll(client, `/retentionMessageVersions/${reviewing.id}/localizations?limit=200`);
|
|
181
|
+
result.versionId = reviewing.id;
|
|
182
|
+
result.copy = 'in-review';
|
|
183
|
+
console.log(` version ${reviewing.id} is ${reviewing.attributes.state}${sameCopy(locs, m.localizations) ? '' : '; the config differs and is not sent until review finishes'}.`);
|
|
184
|
+
} else {
|
|
185
|
+
const liveLocs = live ? await listAll(client, `/retentionMessageVersions/${live.id}/localizations?limit=200`) : [];
|
|
186
|
+
if (live && sameCopy(liveLocs, m.localizations)) {
|
|
187
|
+
result.versionId = live.id;
|
|
188
|
+
console.log(` approved version ${live.id} already matches`);
|
|
189
|
+
} else {
|
|
190
|
+
const id = await newVersion(client, message.id);
|
|
191
|
+
await writeLocalizations(client, id, m.localizations);
|
|
192
|
+
result.versionId = id;
|
|
193
|
+
drafts.add(id);
|
|
194
|
+
result.copy = live ? 'updated' : 'created';
|
|
195
|
+
console.log(` new draft version ${id}${live ? ', the approved one stays live until this is approved' : ''} (previous: ${states.join(', ') || 'none'})`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
for (const product of m.products) {
|
|
200
|
+
const subId = subs.get(product)!;
|
|
201
|
+
const linked = await client.api(`/subscriptions/${subId}/relationships/retentionMessage`);
|
|
202
|
+
if (linked?.data?.id === message.id) continue;
|
|
203
|
+
await client.api(`/subscriptions/${subId}/relationships/retentionMessage`, { method: 'PATCH',
|
|
204
|
+
body: JSON.stringify({ data: { type: 'retentionMessages', id: message.id } }) });
|
|
205
|
+
console.log(` ${product}: now shows this message${linked?.data?.id ? ` (was ${linked.data.id})` : ''}`);
|
|
206
|
+
}
|
|
207
|
+
pushed.push(result);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (submit) {
|
|
211
|
+
const items = pushed.filter((r) => r.versionId && drafts.has(r.versionId))
|
|
212
|
+
.map((r) => ({ rel: 'retentionMessageVersion' as const, type: 'retentionMessageVersions' as const, id: r.versionId!, label: r.name }));
|
|
213
|
+
if (items.length) {
|
|
214
|
+
console.log('\n→ App Review');
|
|
215
|
+
const review = await addToReview(client, app.id, items, true);
|
|
216
|
+
for (const r of pushed) if (items.some((i) => i.id === r.versionId)) r.review = review;
|
|
217
|
+
} else console.log('\nNothing to send to App Review.');
|
|
218
|
+
} else if (pushed.some((r) => r.copy === 'created' || r.copy === 'updated')) {
|
|
219
|
+
console.log('\nDrafts are saved, not submitted. Sandbox testers already see them. Add --submit to send them to App Review.');
|
|
220
|
+
}
|
|
221
|
+
return pushed;
|
|
222
|
+
}
|
package/src/asc/submissions.ts
CHANGED
|
@@ -84,11 +84,11 @@ export async function cancelSubmission(
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
/** A page version or a
|
|
87
|
+
/** A page version, a test or a retention message version that goes to App Review through a review submission. */
|
|
88
88
|
export interface ReviewItem {
|
|
89
|
-
rel: 'appCustomProductPageVersion' | 'appStoreVersionExperimentV2';
|
|
89
|
+
rel: 'appCustomProductPageVersion' | 'appStoreVersionExperimentV2' | 'retentionMessageVersion';
|
|
90
90
|
/** The JSON:API type. A v2 experiment is still `appStoreVersionExperiments`. */
|
|
91
|
-
type: 'appCustomProductPageVersions' | 'appStoreVersionExperiments';
|
|
91
|
+
type: 'appCustomProductPageVersions' | 'appStoreVersionExperiments' | 'retentionMessageVersions';
|
|
92
92
|
id: string;
|
|
93
93
|
label: string;
|
|
94
94
|
}
|
|
@@ -110,7 +110,7 @@ export async function addToReview(client: AscClient, appId: string, items: Revie
|
|
|
110
110
|
let others = 0;
|
|
111
111
|
const present = new Set<string>();
|
|
112
112
|
if (draft) {
|
|
113
|
-
const res = await client.api(`/reviewSubmissions/${draft.id}/items?include=appStoreVersion,appCustomProductPageVersion,appStoreVersionExperimentV2&limit=50`);
|
|
113
|
+
const res = await client.api(`/reviewSubmissions/${draft.id}/items?include=appStoreVersion,appCustomProductPageVersion,appStoreVersionExperimentV2,retentionMessageVersion&limit=50`);
|
|
114
114
|
for (const item of res.data ?? []) {
|
|
115
115
|
const linked = Object.values(item.relationships ?? {}).map((r: any) => r?.data?.id).filter(Boolean) as string[];
|
|
116
116
|
const ours = linked.filter(id => items.some(i => i.id === id));
|
package/src/asc/submit.ts
CHANGED
|
@@ -26,7 +26,9 @@ async function ensureReviewContact(client: AscClient, versionId: string, config:
|
|
|
26
26
|
const existing = await client.api(`/appStoreVersions/${versionId}/appStoreReviewDetail`).catch(() => null);
|
|
27
27
|
const detail = existing?.data;
|
|
28
28
|
const a = detail?.attributes ?? {};
|
|
29
|
-
|
|
29
|
+
// Notes say what a reviewer needs (dark features, test accounts): a changed note is written even
|
|
30
|
+
// when the contact itself is already there.
|
|
31
|
+
if (a.contactFirstName && a.contactLastName && a.contactEmail && a.contactPhone && (!contact.notes || a.notes === contact.notes)) {
|
|
30
32
|
console.log(` ✓ already set (${a.contactFirstName} ${a.contactLastName}, ${a.contactEmail})`);
|
|
31
33
|
return;
|
|
32
34
|
}
|
package/src/cli.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { submitForReview } from './asc/submit.ts';
|
|
|
16
16
|
import { uploadAab } from './play/upload.ts';
|
|
17
17
|
import { annotate, appSlugFromRepo } from './annotate.ts';
|
|
18
18
|
import { pushCustomProductPages, pushProductPageTest, readProductPageTest } from './asc/product-pages.ts';
|
|
19
|
+
import { pushRetentionMessages } from './asc/retention.ts';
|
|
19
20
|
import { printPageResults, readPageResults, resultsLabel } from './asc/page-results.ts';
|
|
20
21
|
|
|
21
22
|
const has = (...names: string[]) => names.some((n) => process.argv.includes(`--${n}`));
|
|
@@ -49,8 +50,9 @@ const COMMANDS: Record<string, { usage: string; bool: string[]; values?: string[
|
|
|
49
50
|
pages: { usage: 'pages [--execute] [--submit]', bool: ['execute', 'submit'] },
|
|
50
51
|
'page-test': { usage: 'page-test [--execute] [--start|--stop] | page-test --result <text> --annotate', bool: ['execute', 'start', 'stop'], values: ['result'] },
|
|
51
52
|
'page-results': { usage: 'page-results [--days <n>] [--request-reports --execute]', bool: ['execute', 'request-reports'], values: ['days'] },
|
|
53
|
+
retention: { usage: 'retention [--execute] [--submit]', bool: ['execute', 'submit'] },
|
|
52
54
|
};
|
|
53
|
-
for (const name of ['pages', 'page-test', 'page-results']) COMMANDS[`asc-${name}`] = COMMANDS[name];
|
|
55
|
+
for (const name of ['pages', 'page-test', 'page-results', 'retention']) COMMANDS[`asc-${name}`] = COMMANDS[name];
|
|
54
56
|
|
|
55
57
|
function printUsage(command?: string): void {
|
|
56
58
|
const spec = command ? COMMANDS[command] : undefined;
|
|
@@ -60,9 +62,9 @@ function printUsage(command?: string): void {
|
|
|
60
62
|
}
|
|
61
63
|
console.log('Usage: sprid release <command> [flags]\n');
|
|
62
64
|
console.log('Commands:');
|
|
63
|
-
for (const name of ['ship', 'bump', 'credentials-pull', 'credentials-push', 'asc-upload', 'play-upload', 'asc-submit', 'metadata', 'screenshots', 'graphics', 'creative', 'pages', 'page-test', 'page-results']) console.log(` ${COMMANDS[name].usage}`);
|
|
65
|
+
for (const name of ['ship', 'bump', 'credentials-pull', 'credentials-push', 'asc-upload', 'play-upload', 'asc-submit', 'metadata', 'screenshots', 'graphics', 'creative', 'pages', 'page-test', 'page-results', 'retention']) console.log(` ${COMMANDS[name].usage}`);
|
|
64
66
|
console.log('\nWithout --execute every command is a dry run: it prints what it would send.');
|
|
65
|
-
console.log('Per-store names also work: asc-metadata, play-metadata, asc-screenshots, play-screenshots, play-graphics, asc-creative, asc-pages, asc-page-test, asc-page-results.');
|
|
67
|
+
console.log('Per-store names also work: asc-metadata, play-metadata, asc-screenshots, play-screenshots, play-graphics, asc-creative, asc-pages, asc-page-test, asc-page-results, asc-retention.');
|
|
66
68
|
console.log('page-results only reads; it needs no --execute except to create the report request.');
|
|
67
69
|
console.log('\n--config <file> accepts TS, JS, MJS or JSON. Paths resolve beside that file.');
|
|
68
70
|
console.log('--locale <locale,...> selects store locale codes. --annotate records executed changes in Sprid (opt-in).');
|
|
@@ -162,6 +164,19 @@ async function main() {
|
|
|
162
164
|
return;
|
|
163
165
|
}
|
|
164
166
|
|
|
167
|
+
if (pageCommand === 'retention') {
|
|
168
|
+
if (!config.appId && !config.ascAppId) throw new Error('Set appId or ascAppId for App Store commands.');
|
|
169
|
+
const submit = has('submit');
|
|
170
|
+
if (submit && !execute) console.log('--submit sends the messages to App Review together with --execute.');
|
|
171
|
+
const pushed = await pushRetentionMessages({ config, localeMap: localeMap('apple'), execute, submit });
|
|
172
|
+
const changed = pushed.filter(p => p.copy === 'created' || p.copy === 'updated' || p.review);
|
|
173
|
+
if (execute && has('annotate') && changed.length) {
|
|
174
|
+
annotated(await annotate({ kind: 'listing', app: appSlugFromRepo(releasePath(config, '.')), areas: ['store'], meta: { command, retentionMessages: changed },
|
|
175
|
+
label: fit(`Retention messages ${pushed.some(p => p.review === 'submitted') ? 'sent to review' : 'updated'}: ${changed.map(p => p.name).join(', ')}`) }));
|
|
176
|
+
}
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
165
180
|
const needCopy = () => {
|
|
166
181
|
if (!config.storeCopy) throw new Error('release.config.ts needs `storeCopy` for metadata commands.');
|
|
167
182
|
return config.storeCopy;
|
package/src/config.ts
CHANGED
|
@@ -319,6 +319,16 @@ export interface AscCustomProductPage {
|
|
|
319
319
|
visible?: boolean;
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
+
/** A retention message (for the `retention` command). */
|
|
323
|
+
export interface AscRetentionMessage {
|
|
324
|
+
/** Reference name in App Store Connect, unique within the app. Never shown to subscribers. */
|
|
325
|
+
name: string;
|
|
326
|
+
/** Product ids of the auto-renewable subscriptions that show this message. A subscription holds one message. */
|
|
327
|
+
products: string[];
|
|
328
|
+
/** Header and body by copy-locale key. Every listing locale needs one. */
|
|
329
|
+
copy: Record<string, { header: string; body: string }>;
|
|
330
|
+
}
|
|
331
|
+
|
|
322
332
|
/** One treatment of a product page optimization test. */
|
|
323
333
|
export interface AscTestTreatment {
|
|
324
334
|
/** Name in App Store Connect and in the results. */
|
|
@@ -421,6 +431,8 @@ export interface AppReleaseConfig {
|
|
|
421
431
|
ascCustomProductPages?: AscCustomProductPage[];
|
|
422
432
|
/** The product page optimization test, for the `page-test` command. */
|
|
423
433
|
ascProductPageTest?: AscProductPageTest;
|
|
434
|
+
/** Messages shown when a subscriber starts to cancel, for the `retention` command. */
|
|
435
|
+
ascRetentionMessages?: AscRetentionMessage[];
|
|
424
436
|
/**
|
|
425
437
|
* Listing-locale maps for the metadata pushes (which locales the *listings*
|
|
426
438
|
* ship in — may be narrower than `locales`, which also drives release notes).
|