@superwall/cli 2.6.0-beta.2 → 2.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.
Files changed (152) hide show
  1. package/README.md +47 -16
  2. package/dist/{apple-Dc5pOPms.js → apple-BE1GBJFP.js} +17 -19
  3. package/dist/{approve-BSbdmOez.js → approve-yRZmvkCj.js} +9 -11
  4. package/dist/{assets-C_RjojkK.js → assets-DTAgbWw0.js} +3 -3
  5. package/dist/auth.d.ts +11 -4
  6. package/dist/auth.js +4 -5
  7. package/dist/base-zc1wl_9b.js +82 -0
  8. package/dist/{billing-B6HK-F_a.js → billing-C1LV4-BN.js} +3 -3
  9. package/dist/{build-DK88pTMW.js → build-CQd-pf7O.js} +35 -16
  10. package/dist/{client-x08fpvay.js → config-DCqRQTJ4.js} +162 -15
  11. package/dist/create-CSHGZDfB.js +18 -0
  12. package/dist/{create-kpqEhqkk.js → create-Costu6UT.js} +9 -9
  13. package/dist/{create-B6-Dr3GZ.js → create-wlCp83IH.js} +41 -41
  14. package/dist/{doctor-DYbm8IKQ.js → doctor-Bd9ffg51.js} +50 -10
  15. package/dist/entry.js +45 -40
  16. package/dist/{environment-BFNzLLPN.js → environment-Dn7irhZr.js} +1 -1
  17. package/dist/{drivers-Dyi-y9Jn.js → existing-BQMB_2AG.js} +305 -8
  18. package/dist/framework-DW5fqjh4.js +65 -0
  19. package/dist/{source-BccdO4aL.js → git-Hf9Wc7Hp.js} +34 -92
  20. package/dist/{held-sKq3xrsT.js → held-D5wSX2Mf.js} +9 -9
  21. package/dist/held-Dmf5SR3p.js +15 -0
  22. package/dist/{install-DsIsif39.js → install-CxyqfKFe.js} +15 -17
  23. package/dist/{integrate-B8eA676b.js → integrate-MkyDDzI5.js} +33 -38
  24. package/dist/{login-BlpfYapG.js → login-B7IqDafm.js} +3 -3
  25. package/dist/{login-Blhxi20A.js → login-BMHDhxAx.js} +8 -9
  26. package/dist/login-Cp0-BgDZ.js +13 -0
  27. package/dist/{lookup-Dg55W9S7.js → lookup-DkcT4E-5.js} +28 -4
  28. package/dist/{migrate-DoRb9jmA.js → migrate-CdFoZipj.js} +66 -45
  29. package/dist/{notification-url-D82msWF5.js → notification-url-D6KKeXnk.js} +4 -4
  30. package/dist/{open-BAqLpTSI.js → open-COJE6ryI.js} +2 -2
  31. package/dist/{org-C4G7WjTV.js → org-BV8wwxwc.js} +4 -4
  32. package/dist/{organization-CmuQwcKN.js → organization-9R_1PJKk.js} +4 -4
  33. package/dist/{orgs-1OzwUtpT.js → orgs-ltP8H0Nl.js} +1 -2
  34. package/dist/{paths-gBbqgkS7.js → paths-Cb1RfjaX.js} +1 -1
  35. package/dist/{playbook-BKqlv77S.js → playbook-CVGolez9.js} +10 -14
  36. package/dist/{products-Cqq59DBQ.js → products-CJq_iXv5.js} +1 -1
  37. package/dist/{promote-D0i8A0CO.js → promote-B_HnFEbX.js} +27 -28
  38. package/dist/{pull-DgQ_UmGv.js → pull-DF4KYVcP.js} +72 -26
  39. package/dist/pull-JxiMyRwY.js +30 -0
  40. package/dist/{pull-CiIrJ5ik.js → pull-lYRULo4v.js} +33 -39
  41. package/dist/push-B5py7h5y.js +29 -0
  42. package/dist/{push-7N4XIVtg.js → push-BZN1Qpkq.js} +23 -12
  43. package/dist/{push-BWsXO7FN.js → push-BnllH2Rd.js} +8 -7
  44. package/dist/push-DHlUMkbf.js +21 -0
  45. package/dist/registry-BGEYCWyD.js +22 -0
  46. package/dist/{registry-aAR_8VOw.js → registry-CqePfigB.js} +1287 -902
  47. package/dist/{resolve-CcOpO_5s.js → resolve-B4bd3Qjl.js} +4 -4
  48. package/dist/{resources-DNwvf8rg.js → resources-BaURbSpY.js} +15 -2
  49. package/dist/{run-tVYJ3V5j.js → run-Bme4Egyl.js} +15 -17
  50. package/dist/{scan-dv0rrY4C.js → scan-DugxddUU.js} +1 -1
  51. package/dist/scan-J2DILUNE.js +4 -0
  52. package/dist/{scope-ehZ7L1nj.js → scope-Cg1AdAfO.js} +33 -3
  53. package/dist/{scope-BXoQo30_.js → scope-DDYLQeZw.js} +24 -18
  54. package/dist/screenshot-file-Dix2Qynm.js +127 -0
  55. package/dist/{sdk-DEfQttek.js → sdk-BFunw4Hc.js} +1 -1
  56. package/dist/{framework-JFLjmD5Y.js → selection-C439nEhn.js} +4 -54
  57. package/dist/{series-D2ZpZ8cx.js → series-B8NJK4yS.js} +1 -1
  58. package/dist/{server-CcZGdYjE.js → server-C_aMxzvS.js} +40 -18
  59. package/dist/server-Cif9w5lM.js +33 -0
  60. package/dist/{session-dHBtgSN0.js → session-B7frlXXQ.js} +1 -1
  61. package/dist/{base-83ZTv6up.js → session-CfG3gzko.js} +8 -83
  62. package/dist/session-DvaPyOuH.js +5 -0
  63. package/dist/{migration-BUedsREQ.js → setup-DQEasPhx.js} +290 -28
  64. package/dist/skills/index.json +5 -0
  65. package/dist/skills/superwall/SKILL.md +37 -10
  66. package/dist/skills/superwall/references/api.md +66 -21
  67. package/dist/skills/superwall/references/asa.md +109 -64
  68. package/dist/skills/superwall/references/dashboard-links.md +65 -28
  69. package/dist/skills/superwall/references/data-analytics.md +1 -1
  70. package/dist/skills/superwall/workflows/dashboard/setup.md +15 -5
  71. package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
  72. package/dist/skills/superwall-framework/SKILL.md +248 -36
  73. package/dist/skills/superwall-framework/references/cli.md +98 -7
  74. package/dist/skills/superwall-framework/references/examples.md +2 -2
  75. package/dist/skills/superwall-framework/references/layout.md +30 -2
  76. package/dist/skills/superwall-framework/references/migrate-from-editor.md +5 -0
  77. package/dist/skills/superwall-framework/references/migrate-from-native.md +5 -0
  78. package/dist/skills/teleport/SKILL.md +154 -0
  79. package/dist/skills/teleport/references/experiments.md +328 -0
  80. package/dist/skills/teleport/references/setup.md +157 -0
  81. package/dist/{skills-Q7xB784d.js → skills-DnegE1A6.js} +139 -9
  82. package/dist/{skills-Bqz2l_bx.js → skills-MmF7IyTg.js} +8 -12
  83. package/dist/source-DQs6iLtC.js +82 -0
  84. package/dist/{source-push-CG948HrX.js → source-push-MbJjh4Ki.js} +38 -14
  85. package/dist/{spinner-IA6hV8nI.js → spinner-Dcr-Dqdi.js} +7 -5
  86. package/dist/{starter-BtUUQWhd.js → starter-BlJ_InZJ.js} +2 -2
  87. package/dist/{status-CB_MrFu5.js → status-DHRxg1ZA.js} +9 -11
  88. package/dist/{output-Ggzq5_-t.js → storage-DdIAHolY.js} +40 -1
  89. package/dist/storekit-De998QOt.js +203 -0
  90. package/dist/storekit-iBCWmeKn.js +15 -0
  91. package/dist/{bind-DcWIIPgk.js → theme-BrUrye-c.js} +29 -6
  92. package/dist/token-CKCBQ4I8.js +100 -0
  93. package/dist/tools-skills/animate-onboarding/SKILL.md +1 -1
  94. package/dist/tools-skills/mobile-design/SKILL.md +1 -1
  95. package/dist/tools-skills/onboarding-questions/SKILL.md +1 -1
  96. package/dist/tools-skills/superwall/SKILL.md +43 -17
  97. package/dist/tools-skills/superwall/references/api.md +74 -24
  98. package/dist/tools-skills/superwall/references/asa.md +109 -64
  99. package/dist/tools-skills/superwall/references/dashboard-links.md +65 -28
  100. package/dist/tools-skills/superwall/references/data-analytics.md +1 -1
  101. package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +4 -3
  102. package/dist/tools-skills/superwall/workflows/dashboard/setup.md +21 -8
  103. package/dist/tools-skills/superwall/workflows/integrate/flutter.md +9 -7
  104. package/dist/tools-skills/superwall/workflows/migrate/adapty.md +4 -3
  105. package/dist/tools-skills/superwall/workflows/migrate/playbook.md +2 -2
  106. package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +4 -3
  107. package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +4 -3
  108. package/dist/tools-skills/superwall-editor/SKILL.md +2 -3
  109. package/dist/tools-skills/teleport/SKILL.md +154 -0
  110. package/dist/tools-skills/teleport/references/experiments.md +328 -0
  111. package/dist/tools-skills/teleport/references/setup.md +157 -0
  112. package/dist/tools.d.ts +1 -1
  113. package/dist/tools.js +1232 -746
  114. package/dist/{try-CS3jLyoP.js → try-C8QQbG0b.js} +17 -19
  115. package/dist/{lock-DgSx-p8Y.js → types-Dc9U_4kp.js} +86 -80
  116. package/dist/upgrade-CYFdpVpi.js +27 -0
  117. package/dist/upgrade-D0thxCA4.js +348 -0
  118. package/package.json +11 -3
  119. package/dist/config-CGcG7GOt.js +0 -113
  120. package/dist/create-Du8Fx7W5.js +0 -20
  121. package/dist/existing-WQ3pz94o.js +0 -97
  122. package/dist/held-DmOhszHR.js +0 -17
  123. package/dist/log-C0MDCfA2.js +0 -62
  124. package/dist/login-D9jfRO8w.js +0 -17
  125. package/dist/pull-CO5HlqBe.js +0 -36
  126. package/dist/push-BIhGDNpL.js +0 -30
  127. package/dist/push-BgqTddLA.js +0 -22
  128. package/dist/run-B-YoyB-a.js +0 -100
  129. package/dist/scan-BU41gcQY.js +0 -4
  130. package/dist/screenshot-file-XAS0Xy0e.js +0 -16
  131. package/dist/server-BemmM1FV.js +0 -29
  132. package/dist/session-4aITGsF1.js +0 -6
  133. package/dist/setup-m94dpT3t.js +0 -217
  134. package/dist/spawn-DmmmHIP-.js +0 -71
  135. package/dist/storage-pR0Wb0d9.js +0 -41
  136. package/dist/storekit-BMxyYAHj.js +0 -17
  137. package/dist/storekit-CQnwlpKV.js +0 -47
  138. package/dist/telemetry-DU56L7Cy.js +0 -56
  139. package/dist/theme-DUsCh-Vd.js +0 -25
  140. package/dist/token-BbUeExGJ.js +0 -70
  141. package/dist/upgrade-CKn88PZD.js +0 -206
  142. package/dist/upgrade-DfD3-ClG.js +0 -7
  143. /package/dist/{browser-Bp3yRKlU.js → browser-BVjaf98V.js} +0 -0
  144. /package/dist/{client-BJQXl62Q.js → client-BwYhzITp.js} +0 -0
  145. /package/dist/{design-lint-CiFc78aM.js → design-lint-mgO-2SGS.js} +0 -0
  146. /package/dist/{devtools-ByZ6XYnn.js → devtools-B6Vp6HMy.js} +0 -0
  147. /package/dist/{input-MDd67UIp.js → input-DOT_2Zvb.js} +0 -0
  148. /package/dist/{project-NoMtbMyl.js → project-BomArwSj.js} +0 -0
  149. /package/dist/{reports-HYVp169R.js → reports-hbxsd3Zo.js} +0 -0
  150. /package/dist/{storage-Bdz5AmqS.d.ts → storage-Bh3wT1Rn.d.ts} +0 -0
  151. /package/dist/{timing-Ca0TXY-A.js → timing-BKEEIBij.js} +0 -0
  152. /package/dist/{ui-D_qf3Gvw.js → ui-hFgji1e8.js} +0 -0
@@ -1,23 +1,21 @@
1
- import { r as NotLoggedInError } from "./token-BbUeExGJ.js";
2
- import { a as stripAnsi, l as readJson, o as cache, r as formatJson, t as blocks } from "./output-Ggzq5_-t.js";
3
- import { o as AUTO_UPDATE_TARGET, s as CHANNEL, t as API_HOST, v as TELEMETRY_HOST, w as detectAgent, x as VERSION, y as TELEMETRY_KEY } from "./environment-BFNzLLPN.js";
4
- import { n as readSession } from "./storage-pR0Wb0d9.js";
5
- import { a as withQuery$1, n as ApiUnreachableError, t as ApiError } from "./client-x08fpvay.js";
6
- import { C as listKeySources, S as listBundleIdSuggestions, T as replaceRevenueProvider, _ as checkServerNotifications, b as importAppKey, c as resolveAscOrgApi, d as runAscDocs, f as parseParams, h as REVENUE_INTEGRATIONS, i as savedKey, l as resolveAscTeam, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, r as chooseKeyApp, t as upsertHeldKey, u as sendAscRequest, v as copyAppKey, w as removeAppKey, x as keyKind, y as findIntegrations } from "./held-sKq3xrsT.js";
7
- import { f as writeDefaultApp, i as readOnboardedApp, r as readDefaultApp, t as readAnonymousId } from "./config-CGcG7GOt.js";
8
- import { a as defineCommand, d as readInput, i as defineCatalog, r as UsageError, t as apiCall } from "./spinner-IA6hV8nI.js";
9
- import { n as fg, t as THEME } from "./theme-DUsCh-Vd.js";
10
- import { n as runWhoami } from "./session-dHBtgSN0.js";
11
- import { i as orgIdOf, t as listOrgGroups } from "./orgs-1OzwUtpT.js";
12
- import { M as textField, O as field, T as rowName, a as createEntitlement, c as createProject, h as listResource, i as createCampaign, j as parseJson, k as isRecord, m as listProjects, r as createApplication, s as createProduct, t as RESOURCES, u as isAppScoped, y as platformLabel } from "./resources-DNwvf8rg.js";
13
- import { n as orgForNewProject } from "./org-C4G7WjTV.js";
14
- import { i as parseDashboardUrl, n as findApplication, r as findProject, t as appNotFound } from "./lookup-Dg55W9S7.js";
15
- import { a as pickScope, i as pickProject, n as chooseApp, r as pickOrganization, t as boundOrganization } from "./scope-BXoQo30_.js";
16
- import { a as listAscConfigs, i as findAppNotificationUrl, o as removeAscConfig, t as ascProxy } from "./client-BJQXl62Q.js";
17
- import { i as listUnimportedAscProducts, n as findAscAppId, r as listAscApps, t as ascTypeDisplay } from "./products-Cqq59DBQ.js";
18
- import { n as readResourceFlags, r as textOf, t as fieldName } from "./input-MDd67UIp.js";
19
- import { a as runAscNotificationUrlSet, i as printServerNotifications, t as describeNotificationUrl } from "./notification-url-D82msWF5.js";
20
- import { t as platformForIntegration } from "./bind-DcWIIPgk.js";
1
+ import { i as NotLoggedInError } from "./token-CKCBQ4I8.js";
2
+ import { f as formatJson, h as cache, m as stripAnsi, n as readSession, u as blocks, v as readJson } from "./storage-DdIAHolY.js";
3
+ import { o as AUTO_UPDATE_TARGET, s as CHANNEL, t as API_HOST, v as TELEMETRY_HOST, w as detectAgent, x as VERSION, y as TELEMETRY_KEY } from "./environment-Dn7irhZr.js";
4
+ import { C as withQuery$1, b as ApiUnreachableError, f as writeDefaultApp, i as readOnboardedApp, r as readDefaultApp, t as readAnonymousId, y as ApiError } from "./config-DCqRQTJ4.js";
5
+ import { C as listKeySources, S as listBundleIdSuggestions, T as replaceRevenueProvider, _ as checkServerNotifications, b as importAppKey, c as resolveAscOrgApi, d as runAscDocs, f as parseParams, h as REVENUE_INTEGRATIONS, i as savedKey, l as resolveAscTeam, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, r as chooseKeyApp, t as upsertHeldKey, u as sendAscRequest, v as copyAppKey, w as removeAppKey, x as keyKind, y as findIntegrations } from "./held-D5wSX2Mf.js";
6
+ import { M as textField, O as field, T as rowName, a as createEntitlement, c as createProject, h as listResource, i as createCampaign, j as parseJson, k as isRecord, m as listProjects, r as createApplication, s as createProduct, t as RESOURCES, u as isAppScoped, y as platformLabel } from "./resources-BaURbSpY.js";
7
+ import { i as orgIdOf, t as listOrgGroups } from "./orgs-ltP8H0Nl.js";
8
+ import { a as defineCommand, d as readInput, i as defineCatalog, r as UsageError, t as apiCall } from "./spinner-Dcr-Dqdi.js";
9
+ import { n as orgForNewProject } from "./org-BV8wwxwc.js";
10
+ import { n as fg, r as platformForIntegration, t as THEME } from "./theme-BrUrye-c.js";
11
+ import { a as parseDashboardUrl, i as findProject, n as findApplication, t as appNotFound } from "./lookup-DkcT4E-5.js";
12
+ import { n as runWhoami } from "./session-B7frlXXQ.js";
13
+ import { a as pickScope, i as pickProject, n as chooseApp, r as pickOrganization, t as boundOrganization } from "./scope-DDYLQeZw.js";
14
+ import { a as listAscConfigs, i as findAppNotificationUrl, o as removeAscConfig, t as ascProxy } from "./client-BwYhzITp.js";
15
+ import { i as listUnimportedAscProducts, n as findAscAppId, r as listAscApps, t as ascTypeDisplay } from "./products-CJq_iXv5.js";
16
+ import { n as readResourceFlags, r as textOf, t as fieldName } from "./input-DOT_2Zvb.js";
17
+ import { t as timing } from "./timing-BKEEIBij.js";
18
+ import { a as runAscNotificationUrlSet, i as printServerNotifications, t as describeNotificationUrl } from "./notification-url-D6KKeXnk.js";
21
19
  import pc from "picocolors";
22
20
 
23
21
  //#region src/ui/help-layout.ts
@@ -144,7 +142,7 @@ const command = defineCommand({
144
142
  prompts: true,
145
143
  mcp: false,
146
144
  async run(ctx, input) {
147
- const { runLogin } = await import("./login-D9jfRO8w.js");
145
+ const { runLogin } = await import("./login-Cp0-BgDZ.js");
148
146
  return runLogin(ctx, input);
149
147
  }
150
148
  });
@@ -160,7 +158,7 @@ const command$1 = defineCommand({
160
158
  prompts: true,
161
159
  mcp: false,
162
160
  async run(ctx) {
163
- const { runLogout } = await import("./session-4aITGsF1.js");
161
+ const { runLogout } = await import("./session-DvaPyOuH.js");
164
162
  return runLogout(ctx);
165
163
  }
166
164
  });
@@ -279,9 +277,9 @@ async function runQuery(ctx, { args, flags }) {
279
277
  for (const [name, value$1] of parseUserParams(flags.param)) params.set(`param_${name}`, value$1);
280
278
  if (!ctx.json) ctx.ui.intro("Superwall query");
281
279
  if (ctx.target.app) for (const [name, value$1] of await appParams(ctx, ctx.target.app)) params.set(`param_${name}`, value$1);
282
- const query = params.toString();
280
+ const query$1 = params.toString();
283
281
  const output = await apiCall(ctx, "Querying ClickHouse", () => {
284
- return ctx.api.postText(`/v2/organizations/${encodeURIComponent(organizationId)}/query${query ? `?${query}` : ""}`, sql);
282
+ return ctx.api.postText(`/v2/organizations/${encodeURIComponent(organizationId)}/query${query$1 ? `?${query$1}` : ""}`, sql);
285
283
  });
286
284
  if (ctx.json) {
287
285
  let parsed;
@@ -380,12 +378,12 @@ function objectOf$1(schema) {
380
378
  if (found) return found;
381
379
  }
382
380
  }
383
- function fieldsOf(schema, depth = 0) {
381
+ function fieldsOf$1(schema, depth = 0) {
384
382
  const object = objectOf$1(schema);
385
383
  if (!object?.properties || depth >= MAX_DEPTH$1) return void 0;
386
384
  const required = new Set(object.required ?? []);
387
385
  return Object.entries(object.properties).map(([name, field$1]) => {
388
- const nested = fieldsOf(field$1, depth + 1);
386
+ const nested = fieldsOf$1(field$1, depth + 1);
389
387
  return {
390
388
  name,
391
389
  type: typeOf(field$1),
@@ -429,7 +427,7 @@ function deriveApiIndex(spec) {
429
427
  ...param.description ? { description: oneLine(param.description) } : {}
430
428
  };
431
429
  }),
432
- ...op$1.requestBody ? { body: fieldsOf(op$1.requestBody.content?.["application/json"]?.schema) ?? [] } : {},
430
+ ...op$1.requestBody ? { body: fieldsOf$1(op$1.requestBody.content?.["application/json"]?.schema) ?? [] } : {},
433
431
  returns: Object.keys(returned?.properties ?? {})
434
432
  });
435
433
  }
@@ -440,8 +438,15 @@ function deriveApiIndex(spec) {
440
438
  operations
441
439
  };
442
440
  }
443
- async function downloadApiIndex() {
444
- const res = await fetch(specUrl());
441
+ const DOWNLOAD_TIMEOUT_MS = 1e4;
442
+ async function downloadApiIndex(timeoutMs = DOWNLOAD_TIMEOUT_MS) {
443
+ let res;
444
+ try {
445
+ res = await fetch(specUrl(), { signal: AbortSignal.timeout(timeoutMs) });
446
+ } catch (error) {
447
+ if (!(error instanceof Error) || error.name !== "TimeoutError") throw error;
448
+ throw new Error(`The Superwall API reference at ${specUrl()} didn't answer within ${timeoutMs / 1e3}s.`, { cause: error });
449
+ }
445
450
  if (!res.ok) throw new Error(`Couldn't fetch the Superwall API reference (HTTP ${res.status}).`);
446
451
  return deriveApiIndex(await res.json());
447
452
  }
@@ -508,8 +513,8 @@ function score(op$1, terms) {
508
513
  }
509
514
  return total;
510
515
  }
511
- function searchOperations(index, query) {
512
- const terms = query.toLowerCase().split(/\s+/).filter(Boolean);
516
+ function searchOperations(index, query$1) {
517
+ const terms = query$1.toLowerCase().split(/\s+/).filter(Boolean);
513
518
  return index.operations.map((op$1) => ({
514
519
  op: op$1,
515
520
  score: score(op$1, terms)
@@ -526,21 +531,24 @@ function renderFields(fields, indent = " ") {
526
531
  return [`${indent}${field$1.name}${field$1.required ? "" : "?"}: ${field$1.type}${field$1.description ? ` — ${field$1.description}` : ""}`, ...renderFields(field$1.fields ?? [], `${indent} `)];
527
532
  });
528
533
  }
529
- function renderOperation(op$1) {
534
+ function renderOperation(op$1, commandFor) {
530
535
  const out = [`${op$1.method} ${op$1.path}`, `${op$1.summary} · ${op$1.group}${op$1.scope ? ` · needs ${op$1.scope}` : ""}`];
531
536
  if (op$1.description) out.push("", op$1.description);
532
537
  const path = op$1.params.filter((param) => param.in === "path");
533
- const query = op$1.params.filter((param) => param.in === "query");
538
+ const query$1 = op$1.params.filter((param) => param.in === "query");
534
539
  if (path.length) out.push("", "Path:", ...renderFields(path));
535
- if (query.length) out.push("", "Query:", ...renderFields(query));
540
+ if (query$1.length) out.push("", "Query:", ...renderFields(query$1));
536
541
  if (op$1.body) out.push("", "Body (JSON):", ...op$1.body.length ? renderFields(op$1.body) : [" (empty)"]);
537
542
  if (op$1.returns.length) out.push("", `Returns: ${op$1.returns.join(", ")}`);
538
- out.push("", `Call it: superwall ${op$1.method.toLowerCase()} ${op$1.path}${op$1.body?.length ? " -d field=value …" : ""}`);
543
+ const fields = op$1.body?.length ? " -d field=value …" : "";
544
+ const raw = `superwall ${op$1.method.toLowerCase()} ${op$1.path}${fields}`;
545
+ const command$83 = commandFor?.(op$1);
546
+ out.push("", ...command$83 ? [`Call it: ${command$83}${fields}`, `Or: ${raw}`] : [`Call it: ${raw}`]);
539
547
  return out.join("\n");
540
548
  }
541
- function renderApiDocs(index, query = "", method) {
549
+ function renderApiDocs(index, query$1 = "", method, commandFor) {
542
550
  const header = `Superwall API ${index.version} — ${index.operations.length} endpoints`;
543
- const q = query.trim();
551
+ const q = query$1.trim();
544
552
  if (!q) {
545
553
  const groups = /* @__PURE__ */ new Map();
546
554
  for (const op$1 of index.operations) groups.set(op$1.group, (groups.get(op$1.group) ?? 0) + 1);
@@ -554,16 +562,16 @@ function renderApiDocs(index, query = "", method) {
554
562
  ].join("\n");
555
563
  }
556
564
  const [first = "", ...rest] = q.split(/\s+/);
557
- if (/^(get|post|put|patch|delete)$/i.test(first) && rest[0]?.startsWith("/")) return renderApiDocs(index, rest.join(" "), first);
565
+ if (/^(get|post|put|patch|delete)$/i.test(first) && rest[0]?.startsWith("/")) return renderApiDocs(index, rest.join(" "), first, commandFor);
558
566
  if (q.startsWith("/")) {
559
567
  const ops = findOperations(index, q, method);
560
568
  if (ops.length === 0) return `${header}\n\nNo endpoint matches ${q}. Search instead: superwall api docs <words>.`;
561
- return ops.map(renderOperation).join("\n\n────────\n\n");
569
+ return ops.map((op$1) => renderOperation(op$1, commandFor)).join("\n\n────────\n\n");
562
570
  }
563
571
  const hits = searchOperations(index, q);
564
572
  if (hits.length === 0) return `${header}\n\nNothing matches "${q}". Run \`superwall api docs\` for every group.`;
565
573
  const [only] = hits;
566
- if (hits.length === 1 && only) return renderOperation(only);
574
+ if (hits.length === 1 && only) return renderOperation(only, commandFor);
567
575
  const shown = hits.slice(0, SEARCH_HITS);
568
576
  return [
569
577
  `${hits.length} endpoints match "${q}":`,
@@ -575,9 +583,9 @@ function renderApiDocs(index, query = "", method) {
575
583
  ].join("\n");
576
584
  }
577
585
  const METHOD = /^(get|post|put|patch|delete)$/i;
578
- function listMatchingOperations(index, query, method) {
579
- if (query.startsWith("/")) return findOperations(index, query, method);
580
- if (query) return searchOperations(index, query);
586
+ function listMatchingOperations(index, query$1, method) {
587
+ if (query$1.startsWith("/")) return findOperations(index, query$1, method);
588
+ if (query$1) return searchOperations(index, query$1);
581
589
  return index.operations;
582
590
  }
583
591
 
@@ -592,6 +600,7 @@ async function runApiRequest(ctx, api, request) {
592
600
  case "get": return api.get(withQuery$1(path, params));
593
601
  case "delete": return api.del(withQuery$1(path, params));
594
602
  case "post": return api.post(path, params);
603
+ case "put": return api.put(path, params);
595
604
  case "patch": return api.patch(path, params);
596
605
  }
597
606
  }).catch(async (error) => {
@@ -637,6 +646,26 @@ const command$4 = defineCommand({
637
646
  }
638
647
  });
639
648
 
649
+ //#endregion
650
+ //#region src/core/api/commands.ts
651
+ async function resolveCommandLookup() {
652
+ const { listGroups: listGroups$1 } = await import("./registry-BGEYCWyD.js");
653
+ const catalogs = listGroups$1().flatMap((group$1) => group$1.commands.flatMap((command$83) => command$83.kind === "catalog" && command$83.commandFor ? [command$83.commandFor] : []));
654
+ return (endpoint) => {
655
+ for (const commandFor of catalogs) {
656
+ const found = commandFor(endpoint);
657
+ if (found) return found;
658
+ }
659
+ };
660
+ }
661
+ function withCommand(op$1, lookup) {
662
+ const command$83 = lookup(op$1);
663
+ return command$83 ? {
664
+ ...op$1,
665
+ command: command$83
666
+ } : op$1;
667
+ }
668
+
640
669
  //#endregion
641
670
  //#region src/commands/api/docs.ts
642
671
  const command$5 = defineCommand({
@@ -657,14 +686,15 @@ const command$5 = defineCommand({
657
686
  mcp: "read",
658
687
  async run(ctx, { args, flags }) {
659
688
  const found = args.query.find((word) => METHOD.test(word));
660
- const query = args.query.filter((word) => word !== found).join(" ");
689
+ const query$1 = args.query.filter((word) => word !== found).join(" ");
661
690
  const method = found?.toUpperCase();
662
691
  const index = await apiCall(ctx, "Loading the API reference", () => resolveApiIndex({ refresh: flags.refresh }));
692
+ const lookup = await resolveCommandLookup();
663
693
  if (ctx.json) return ctx.output.data({
664
694
  version: index.version,
665
- operations: listMatchingOperations(index, query, method)
695
+ operations: listMatchingOperations(index, query$1, method).map((op$1) => withCommand(op$1, lookup))
666
696
  });
667
- ctx.output.text(renderApiDocs(index, query, method));
697
+ ctx.output.text(renderApiDocs(index, query$1, method, lookup));
668
698
  }
669
699
  });
670
700
 
@@ -744,8 +774,33 @@ const command$8 = defineCommand({
744
774
  });
745
775
 
746
776
  //#endregion
747
- //#region src/commands/app-store-connect/store/apps.ts
777
+ //#region src/commands/api/put.ts
748
778
  const command$9 = defineCommand({
779
+ name: "put",
780
+ summary: "Make PUT requests to the Superwall API",
781
+ details: "Executes an arbitrary Superwall PUT endpoint. Depending on the path, it replaces account configuration whole, such as an audience's traffic weights.",
782
+ args: { path: {
783
+ describe: "API path, e.g. /v2/products",
784
+ required: true
785
+ } },
786
+ flags: { d: data },
787
+ examples: [[`put /v2/campaigns/<id>/audiences/<audience_id>/weights -d 'weights:=[{"variant_id":"<variant_id>","percentage":100}]'`, "Replace an audience's traffic weights"]],
788
+ auth: "required",
789
+ json: true,
790
+ prompts: false,
791
+ mcp: "destructive",
792
+ run(ctx, { args, flags }) {
793
+ return runApiRequest(ctx, ctx.api, {
794
+ verb: "put",
795
+ path: args.path,
796
+ data: flags.d
797
+ });
798
+ }
799
+ });
800
+
801
+ //#endregion
802
+ //#region src/commands/app-store-connect/store/apps.ts
803
+ const command$10 = defineCommand({
749
804
  name: "asc apps",
750
805
  summary: "Your apps in App Store Connect: name, bundle ID and id",
751
806
  flags: {
@@ -934,6 +989,15 @@ function describeAppleError$1(error) {
934
989
  });
935
990
  return `App Store Connect refused ${error.request.replace(/^(\w+) \/v2\/organizations\/[^/]+\/app-store-connect\/proxy\/[^/]+/, "$1 ")} (${error.status}):\n${lines.join("\n")}`;
936
991
  }
992
+ var AscRequestError = class extends Error {
993
+ constructor(message, status) {
994
+ super(message);
995
+ this.status = status;
996
+ }
997
+ };
998
+ function statusOf(error) {
999
+ return error instanceof ApiError || error instanceof AscRequestError ? error.status : void 0;
1000
+ }
937
1001
  var AscSession = class {
938
1002
  planned = [];
939
1003
  created = [];
@@ -956,7 +1020,7 @@ var AscSession = class {
956
1020
  const described = describeAppleError$1(error);
957
1021
  const made = this.created.map((resource) => `${resource.type} ${resource.id}`).join(", ");
958
1022
  if (!described && !made) throw error;
959
- throw new Error([described ?? error.message, ...made ? [`Already created: ${made}.`] : []].join("\n"));
1023
+ throw new AscRequestError([described ?? error.message, ...made ? [`Already created: ${made}.`] : []].join("\n"), error.status);
960
1024
  }
961
1025
  }
962
1026
  async get(path) {
@@ -992,7 +1056,7 @@ var AscSession = class {
992
1056
  try {
993
1057
  return (await this.get(path))?.one ?? void 0;
994
1058
  } catch (error) {
995
- if (error instanceof ApiError && error.status === 404) return void 0;
1059
+ if (statusOf(error) === 404) return void 0;
996
1060
  throw error;
997
1061
  }
998
1062
  }
@@ -1063,23 +1127,23 @@ async function assertConfirmed(session, yes$1, what) {
1063
1127
  async function list(context, api, resource, flags) {
1064
1128
  const { json } = context;
1065
1129
  if (resource === "apps") {
1066
- const query$1 = flags.search;
1130
+ const query$2 = flags.search;
1067
1131
  let room = limitOf(flags.limit) ?? Number.POSITIVE_INFINITY;
1068
1132
  const groups = (await apiCall(context, "Loading projects", () => listOrgGroups(api))).map((group$1) => {
1069
- const projects = matchingProjects(group$1.projects, query$1).slice(0, room);
1133
+ const projects = matchingProjects(group$1.projects, query$2).slice(0, room);
1070
1134
  room -= projects.length;
1071
1135
  return {
1072
1136
  ...group$1,
1073
1137
  projects
1074
1138
  };
1075
- }).filter((group$1) => group$1.projects.length > 0 || !query$1 && room > 0);
1139
+ }).filter((group$1) => group$1.projects.length > 0 || !query$2 && room > 0);
1076
1140
  if (json) return context.output.data(groups.flatMap(({ projects,...organization }) => projects.map((project$1) => organization.id ? {
1077
1141
  ...project$1,
1078
1142
  organization
1079
1143
  } : project$1)));
1080
1144
  if (groups.flatMap((group$1) => group$1.projects).length === 0) return context.output.render(blocks.list({
1081
1145
  items: [],
1082
- empty: query$1 ? `No project or app matches "${query$1}".` : "No projects yet - run `superwall apps create --name <name> --platform ios`."
1146
+ empty: query$2 ? `No project or app matches "${query$2}".` : "No projects yet - run `superwall apps create --name <name> --platform ios`."
1083
1147
  }));
1084
1148
  for (const group$1 of groups) {
1085
1149
  const heading$1 = groups.length > 1 ? `\`${group$1.name ?? `Organization ${group$1.id}`}\`${group$1.member ? "" : " (not a member)"} · ${formatCount(group$1.projects.length, "project")}` : formatCount(group$1.projects.length, "project");
@@ -1097,13 +1161,13 @@ async function list(context, api, resource, flags) {
1097
1161
  }
1098
1162
  const scope = await pickScope(context, api, isAppScoped(resource));
1099
1163
  const all = await apiCall(context, `Loading ${resource}`, () => listResource(api, resource, scope));
1100
- const query = flags.search;
1101
- const matched = query ? all.filter((row) => rowMatches(row, query)) : all;
1164
+ const query$1 = flags.search;
1165
+ const matched = query$1 ? all.filter((row) => rowMatches(row, query$1)) : all;
1102
1166
  const limit = limitOf(flags.limit);
1103
1167
  if (json) return context.output.data(limit === void 0 ? matched : matched.slice(0, limit));
1104
1168
  const shown = matched.slice(0, limit ?? RICH_ROWS);
1105
1169
  const noun = resource.replace(/s$/, "");
1106
- const heading = query ? `${formatCount(matched.length, noun)} matching "${query}", of ${all.length}` : formatCount(all.length, noun);
1170
+ const heading = query$1 ? `${formatCount(matched.length, noun)} matching "${query$1}", of ${all.length}` : formatCount(all.length, noun);
1107
1171
  context.output.render(blocks.step(`${heading}${scopeLabel(resource, scope)}`), blocks.list({
1108
1172
  items: shown.map((row) => {
1109
1173
  const label = rowName(row);
@@ -1113,7 +1177,7 @@ async function list(context, api, resource, flags) {
1113
1177
  meta: [identifier && identifier !== label ? identifier : void 0, secondaryId(label, row.id)].filter(Boolean).join(" ") || void 0
1114
1178
  };
1115
1179
  }),
1116
- empty: query ? `No ${resource} match "${query}".` : `No ${resource} yet.`
1180
+ empty: query$1 ? `No ${resource} match "${query$1}".` : `No ${resource} yet.`
1117
1181
  }));
1118
1182
  if (matched.length > shown.length) context.ui.info(`…${matched.length - shown.length} more. Narrow with --search <text>, or pass --limit <n> or --json for all.`);
1119
1183
  }
@@ -1168,17 +1232,17 @@ const SEARCHED_FIELDS = [
1168
1232
  "description",
1169
1233
  "public_api_key"
1170
1234
  ];
1171
- function rowMatches(row, query) {
1172
- const needle = query.toLowerCase();
1235
+ function rowMatches(row, query$1) {
1236
+ const needle = query$1.toLowerCase();
1173
1237
  return Object.entries(row).some(([field$1, value$1]) => {
1174
1238
  return SEARCHED_FIELDS.includes(field$1) && (typeof value$1 === "string" || typeof value$1 === "number") && String(value$1).toLowerCase().includes(needle);
1175
1239
  });
1176
1240
  }
1177
- function matchingProjects(projects, query) {
1178
- if (!query) return projects;
1241
+ function matchingProjects(projects, query$1) {
1242
+ if (!query$1) return projects;
1179
1243
  return projects.flatMap((project$1) => {
1180
- if (rowMatches(project$1, query)) return [project$1];
1181
- const apps = (project$1.applications ?? []).filter((app$1) => rowMatches(app$1, query));
1244
+ if (rowMatches(project$1, query$1)) return [project$1];
1245
+ const apps = (project$1.applications ?? []).filter((app$1) => rowMatches(app$1, query$1));
1182
1246
  return apps.length ? [{
1183
1247
  ...project$1,
1184
1248
  applications: apps
@@ -1263,13 +1327,13 @@ function rowsOf(response) {
1263
1327
  return response === void 0 || response === null ? [] : [response];
1264
1328
  }
1265
1329
  function renderRows(ctx, rows, noun, flags) {
1266
- const query = flags.search;
1267
- const matched = query ? rows.filter((row) => rowMatches(row, query)) : rows;
1330
+ const query$1 = flags.search;
1331
+ const matched = query$1 ? rows.filter((row) => rowMatches(row, query$1)) : rows;
1268
1332
  const limit = limitOf(flags.limit);
1269
1333
  if (ctx.json) return ctx.output.data(matched.slice(0, limit));
1270
1334
  const shown = matched.slice(0, limit ?? RICH_ROWS);
1271
1335
  const count = `${matched.length} ${matched.length === 1 ? noun : `${noun}s`}`;
1272
- ctx.output.render(blocks.step(query ? `${count} matching "${query}", of ${rows.length}` : count), blocks.list({
1336
+ ctx.output.render(blocks.step(query$1 ? `${count} matching "${query$1}", of ${rows.length}` : count), blocks.list({
1273
1337
  items: shown.map((row) => {
1274
1338
  const label = labelOf(row);
1275
1339
  return {
@@ -1277,7 +1341,7 @@ function renderRows(ctx, rows, noun, flags) {
1277
1341
  meta: [row.identifier, row.id].filter((part) => part !== void 0 && part !== null && String(part) !== label).map(String).join(" ") || void 0
1278
1342
  };
1279
1343
  }),
1280
- empty: query ? `Nothing matches "${query}".` : `No ${noun}s yet.`
1344
+ empty: query$1 ? `Nothing matches "${query$1}".` : `No ${noun}s yet.`
1281
1345
  }));
1282
1346
  if (matched.length > shown.length) ctx.ui.info(`…${matched.length - shown.length} more. Narrow with --search, or pass --limit or --json.`);
1283
1347
  }
@@ -1466,21 +1530,21 @@ function parseFlag(key, flag$1, raw) {
1466
1530
  }
1467
1531
  return parseChoice(key, flag$1, text);
1468
1532
  }
1469
- function parseArg(command$82, arg, word) {
1533
+ function parseArg(command$83, arg, word) {
1470
1534
  if (word === void 0 || !arg.choices) return word;
1471
1535
  const found = arg.choices.find((choice) => choice.toLowerCase() === word.toLowerCase());
1472
- if (!found) throw new UsageError(`${command$82} takes <${arg.name}> as one of: ${arg.choices.join(", ")} (not "${word}").`);
1536
+ if (!found) throw new UsageError(`${command$83} takes <${arg.name}> as one of: ${arg.choices.join(", ")} (not "${word}").`);
1473
1537
  return found;
1474
1538
  }
1475
- function parseInput(command$82, operation, words, raw) {
1539
+ function parseInput(command$83, operation, words, raw) {
1476
1540
  const specs = operation.flags ?? {};
1477
- for (const key of Object.keys(raw)) if (!(key in specs) && !(key in COMMON_FLAGS)) throw new UsageError(`${command$82} has no --${kebab(key)}. Run superwall ${command$82} --help for its flags.`);
1541
+ for (const key of Object.keys(raw)) if (!(key in specs) && !(key in COMMON_FLAGS)) throw new UsageError(`${command$83} has no --${kebab(key)}. Run superwall ${command$83} --help for its flags.`);
1478
1542
  const flags = Object.fromEntries(Object.entries(specs).map(([key, flag$1]) => [key, parseFlag(key, flag$1, raw[key])]));
1479
- for (const [key, flag$1] of Object.entries(specs)) if (flag$1.required && flags[key] === void 0) throw new UsageError(`${command$82} needs --${kebab(key)}.`);
1543
+ for (const [key, flag$1] of Object.entries(specs)) if (flag$1.required && flags[key] === void 0) throw new UsageError(`${command$83} needs --${kebab(key)}.`);
1480
1544
  const specArgs = operation.args ?? [];
1481
- if (words.length > specArgs.length) throw new UsageError(`${command$82} doesn't take "${words.slice(specArgs.length).join(" ")}".`);
1482
- const args = Object.fromEntries(specArgs.map((arg, index) => [arg.name, parseArg(command$82, arg, words[index])]));
1483
- for (const arg of specArgs) if (arg.required && args[arg.name] === void 0) throw new UsageError(`${command$82} needs <${arg.name}>.`);
1545
+ if (words.length > specArgs.length) throw new UsageError(`${command$83} doesn't take "${words.slice(specArgs.length).join(" ")}".`);
1546
+ const args = Object.fromEntries(specArgs.map((arg, index) => [arg.name, parseArg(command$83, arg, words[index])]));
1547
+ for (const arg of specArgs) if (arg.required && args[arg.name] === void 0) throw new UsageError(`${command$83} needs <${arg.name}>.`);
1484
1548
  return {
1485
1549
  args,
1486
1550
  flags,
@@ -1746,7 +1810,7 @@ async function runAvailabilitySet(session, input) {
1746
1810
 
1747
1811
  //#endregion
1748
1812
  //#region src/commands/app-store-connect/store/availability.ts
1749
- const command$10 = defineAscResource({
1813
+ const command$11 = defineAscResource({
1750
1814
  name: "asc availability",
1751
1815
  summary: "Where a subscription or in-app purchase is sold",
1752
1816
  operations: [{
@@ -1896,8 +1960,8 @@ async function resolveVersionId(session, input) {
1896
1960
  return id$1;
1897
1961
  }
1898
1962
  async function findVersion(session, id$1, include = []) {
1899
- const query = [`fields[appStoreVersions]=${[VERSION_FIELDS, ...include].join(",")}`, ...include.length ? [`include=${include.join(",")}`] : []];
1900
- const document = await session.next(`/v1/appStoreVersions/${id$1}?${query.join("&")}`);
1963
+ const query$1 = [`fields[appStoreVersions]=${[VERSION_FIELDS, ...include].join(",")}`, ...include.length ? [`include=${include.join(",")}`] : []];
1964
+ const document = await session.next(`/v1/appStoreVersions/${id$1}?${query$1.join("&")}`);
1901
1965
  const version = document.one;
1902
1966
  if (!version) throw new Error(`No App Store version ${id$1}.`);
1903
1967
  return {
@@ -1920,9 +1984,9 @@ async function runVersionsList(session, input) {
1920
1984
  versionString: textOf$1(input, "versionString"),
1921
1985
  appVersionState: textOf$1(input, "appVersionState")
1922
1986
  });
1923
- const query = Object.entries(filters).map(([key, value$1]) => `filter[${key}]=${encodeURIComponent(String(value$1))}`);
1987
+ const query$1 = Object.entries(filters).map(([key, value$1]) => `filter[${key}]=${encodeURIComponent(String(value$1))}`);
1924
1988
  const rows = ((await session.list(`/v1/apps/${app$1}/appStoreVersions?${[
1925
- ...query,
1989
+ ...query$1,
1926
1990
  `fields[appStoreVersions]=${VERSION_FIELDS}`,
1927
1991
  "limit=200"
1928
1992
  ].join("&")}`))?.data ?? []).map(rowOfVersion);
@@ -2067,7 +2131,7 @@ async function runBuildsList(session, input) {
2067
2131
  processingState: textOf$1(input, "processingState"),
2068
2132
  "preReleaseVersion.platform": textOf$1(input, "platform")
2069
2133
  });
2070
- const query = [
2134
+ const query$1 = [
2071
2135
  `filter[app]=${app$1}`,
2072
2136
  ...Object.entries(filters).map(([key, value$1]) => `filter[${key}]=${encodeURIComponent(String(value$1))}`),
2073
2137
  "sort=-uploadedDate",
@@ -2076,7 +2140,7 @@ async function runBuildsList(session, input) {
2076
2140
  "fields[preReleaseVersions]=version,platform",
2077
2141
  `limit=${limit}`
2078
2142
  ];
2079
- const document = await session.next(`/v1/builds?${query.join("&")}`);
2143
+ const document = await session.next(`/v1/builds?${query$1.join("&")}`);
2080
2144
  const rows = document.data.map((build) => rowOf$2(build, document));
2081
2145
  return {
2082
2146
  rows: buildRows(rows),
@@ -2132,7 +2196,7 @@ async function runBuildsExpire(session, input) {
2132
2196
 
2133
2197
  //#endregion
2134
2198
  //#region src/commands/app-store-connect/release/builds.ts
2135
- const command$11 = defineAscResource({
2199
+ const command$12 = defineAscResource({
2136
2200
  name: "asc builds",
2137
2201
  summary: "The app's uploaded builds: list, inspect, attach to a version, expire",
2138
2202
  operations: [
@@ -2218,7 +2282,7 @@ const command$11 = defineAscResource({
2218
2282
 
2219
2283
  //#endregion
2220
2284
  //#region src/commands/app-store-connect/api/delete.ts
2221
- const command$12 = defineCommand({
2285
+ const command$13 = defineCommand({
2222
2286
  name: "asc delete",
2223
2287
  summary: "Any App Store Connect DELETE request, through the signed proxy",
2224
2288
  args: { path: {
@@ -2253,7 +2317,7 @@ const command$12 = defineCommand({
2253
2317
 
2254
2318
  //#endregion
2255
2319
  //#region src/commands/app-store-connect/api/docs.ts
2256
- const command$13 = defineCommand({
2320
+ const command$14 = defineCommand({
2257
2321
  name: "asc docs",
2258
2322
  summary: "Apple's exact request schema for an endpoint",
2259
2323
  details: `A path (/v1/…), optionally with a verb, shows that endpoint's schema; words search every
@@ -2290,7 +2354,7 @@ in the background; --refresh downloads it now.`,
2290
2354
 
2291
2355
  //#endregion
2292
2356
  //#region src/commands/app-store-connect/api/get.ts
2293
- const command$14 = defineCommand({
2357
+ const command$15 = defineCommand({
2294
2358
  name: "asc get",
2295
2359
  summary: "Any App Store Connect GET request, through the signed proxy",
2296
2360
  args: { path: {
@@ -2500,7 +2564,7 @@ async function resolveTerritoryPoints(session, base, territories) {
2500
2564
  const equalized = await listEqualizations(session, base.point);
2501
2565
  const points = /* @__PURE__ */ new Map();
2502
2566
  const skipped = [];
2503
- for (const territory of new Set([base.territory, ...territories])) {
2567
+ for (const territory of new Set(territories)) {
2504
2568
  const point = territory === base.territory ? base.point : equalized ? equalized.get(territory) : placeholder(`price-point-${territory}`);
2505
2569
  if (point) points.set(territory, point);
2506
2570
  else skipped.push(territory);
@@ -2714,20 +2778,24 @@ async function runPricesSet(session, input) {
2714
2778
  const PRICED = ["subscription", "iap"];
2715
2779
  const POLL_INTERVAL_MS = 1e3;
2716
2780
  const POLL_ATTEMPTS = 60;
2781
+ const COMMIT_ATTEMPTS = 3;
2782
+ const COMMIT_PAUSE_MS = 2e3;
2717
2783
  const SCREENSHOT = {
2718
2784
  subscription: {
2719
2785
  of: (id$1) => `/v1/subscriptions/${id$1}/appStoreReviewScreenshot`,
2720
2786
  path: "/v1/subscriptionAppStoreReviewScreenshots",
2721
2787
  type: "subscriptionAppStoreReviewScreenshots",
2722
2788
  owner: "subscription",
2723
- ownerType: "subscriptions"
2789
+ ownerType: "subscriptions",
2790
+ label: "subscription"
2724
2791
  },
2725
2792
  iap: {
2726
2793
  of: (id$1) => `/v2/inAppPurchases/${id$1}/appStoreReviewScreenshot`,
2727
2794
  path: "/v1/inAppPurchaseAppStoreReviewScreenshots",
2728
2795
  type: "inAppPurchaseAppStoreReviewScreenshots",
2729
2796
  owner: "inAppPurchaseV2",
2730
- ownerType: "inAppPurchases"
2797
+ ownerType: "inAppPurchases",
2798
+ label: "in-app purchase"
2731
2799
  }
2732
2800
  };
2733
2801
  function deliveryState(resource) {
@@ -2765,14 +2833,57 @@ async function resolveDeliveryState(session, path) {
2765
2833
  const errors = resource.attributes.assetDeliveryState;
2766
2834
  throw new Error(`Apple couldn't process the screenshot: ${JSON.stringify(isRecord(errors) ? errors.errors : errors)}`);
2767
2835
  }
2768
- await new Promise((done) => setTimeout(done, POLL_INTERVAL_MS));
2836
+ await timing.sleep(POLL_INTERVAL_MS);
2769
2837
  }
2770
2838
  return "PROCESSING";
2771
2839
  }
2840
+ async function readReservation(session, path) {
2841
+ try {
2842
+ const resource = await session.select(path);
2843
+ return resource ? { state: deliveryState(resource) } : "gone";
2844
+ } catch {
2845
+ return "unknown";
2846
+ }
2847
+ }
2848
+ function accepted(reservation) {
2849
+ return typeof reservation === "object" && reservation.state !== void 0 && reservation.state !== "AWAITING_UPLOAD";
2850
+ }
2851
+ async function commitUpload(session, path, body) {
2852
+ for (let attempt = 1;; attempt++) try {
2853
+ await session.send("patch", path, body);
2854
+ return;
2855
+ } catch (error) {
2856
+ const status = statusOf(error);
2857
+ if (status === void 0 || status < 500) throw error;
2858
+ const reservation = await readReservation(session, path);
2859
+ if (accepted(reservation)) return void 0;
2860
+ if (reservation === "gone" || attempt >= COMMIT_ATTEMPTS) return {
2861
+ failure: error,
2862
+ reservation,
2863
+ attempts: attempt
2864
+ };
2865
+ await timing.sleep(COMMIT_PAUSE_MS * attempt);
2866
+ }
2867
+ }
2868
+ async function failedCommitMessage(session, path, failure, label, replaced) {
2869
+ const id$1 = path.slice(path.lastIndexOf("/") + 1);
2870
+ const lines = [`Apple failed to commit the screenshot after its bytes were uploaded (${failure.attempts === 1 ? "1 attempt" : `${failure.attempts} attempts`}):`, ...failure.failure.message.split("\n").filter((line$1) => !line$1.startsWith("Already created:"))];
2871
+ if (failure.reservation === "gone") lines.push(`Apple no longer has the unfinished screenshot ${id$1}.`);
2872
+ else if (failure.reservation === "unknown") lines.push(`Couldn't read the unfinished screenshot ${id$1} to check its state, so it was left in place; it may stay in AWAITING_UPLOAD.`);
2873
+ else try {
2874
+ await session.send("delete", path);
2875
+ lines.push(`Deleted the unfinished screenshot ${id$1} so it doesn't stay in AWAITING_UPLOAD.`);
2876
+ } catch (error) {
2877
+ lines.push(`Couldn't delete the unfinished screenshot ${id$1}, so it stays in AWAITING_UPLOAD: ${error.message}`);
2878
+ }
2879
+ if (replaced) lines.push(`The earlier screenshot ${replaced} was deleted before the upload, so this ${label} has no review screenshot now.`);
2880
+ lines.push("This is an error on Apple's side. Try the upload again later.");
2881
+ return lines.join("\n");
2882
+ }
2772
2883
  async function runScreenshotsUpload(session, input) {
2773
2884
  const { kind, id: id$1 } = resolveTarget(input, PRICED);
2774
2885
  const spec = SCREENSHOT[kind];
2775
- const { readScreenshotFile } = await import("./screenshot-file-XAS0Xy0e.js");
2886
+ const { readScreenshotFile } = await import("./screenshot-file-Dix2Qynm.js");
2776
2887
  const file = readScreenshotFile(argOf(input, "file"));
2777
2888
  const existing = await selectScreenshot(session, kind, id$1);
2778
2889
  if (existing) await session.send("delete", `${spec.path}/${existing.id}`);
@@ -2786,7 +2897,7 @@ async function runScreenshotsUpload(session, input) {
2786
2897
  } }, "screenshot");
2787
2898
  if (!reserved) throw new Error("Apple reserved no upload for the screenshot.");
2788
2899
  await session.upload(uploadOperationsOf(reserved), file.bytes);
2789
- await session.send("patch", `${spec.path}/${reserved.id}`, { data: {
2900
+ const failed = await commitUpload(session, `${spec.path}/${reserved.id}`, { data: {
2790
2901
  type: spec.type,
2791
2902
  id: reserved.id,
2792
2903
  attributes: {
@@ -2794,6 +2905,7 @@ async function runScreenshotsUpload(session, input) {
2794
2905
  sourceFileChecksum: file.checksum
2795
2906
  }
2796
2907
  } });
2908
+ if (failed) throw new Error(await failedCommitMessage(session, `${spec.path}/${reserved.id}`, failed, spec.label, existing?.id));
2797
2909
  const state = await resolveDeliveryState(session, `${spec.path}/${reserved.id}`);
2798
2910
  return {
2799
2911
  value: {
@@ -2952,7 +3064,7 @@ async function runIapsDelete(session, input) {
2952
3064
 
2953
3065
  //#endregion
2954
3066
  //#region src/commands/app-store-connect/store/iaps.ts
2955
- const command$15 = defineAscResource({
3067
+ const command$16 = defineAscResource({
2956
3068
  name: "asc iaps",
2957
3069
  summary: "In-app purchases: consumables, non-consumables and non-renewing subscriptions",
2958
3070
  operations: [
@@ -3118,7 +3230,7 @@ const command$15 = defineAscResource({
3118
3230
 
3119
3231
  //#endregion
3120
3232
  //#region src/commands/app-store-connect/store/localizations.ts
3121
- const command$16 = defineAscResource({
3233
+ const command$17 = defineAscResource({
3122
3234
  name: "asc localizations",
3123
3235
  summary: "The App Store names and descriptions of a subscription, group or in-app purchase",
3124
3236
  details: `Each takes one of --subscription, --group or --iap. A localization belongs to a version
@@ -3316,7 +3428,7 @@ async function runMetadataAdd(session, input) {
3316
3428
 
3317
3429
  //#endregion
3318
3430
  //#region src/commands/app-store-connect/release/metadata.ts
3319
- const command$17 = defineAscResource({
3431
+ const command$18 = defineAscResource({
3320
3432
  name: "asc metadata",
3321
3433
  summary: "A version's App Store text per locale: What's New, description, keywords, URLs",
3322
3434
  operations: [
@@ -3385,7 +3497,7 @@ const command$17 = defineAscResource({
3385
3497
 
3386
3498
  //#endregion
3387
3499
  //#region src/commands/app-store-connect/keys/create.ts
3388
- const command$18 = defineCommand({
3500
+ const command$19 = defineCommand({
3389
3501
  name: "asc keys create",
3390
3502
  summary: "Create a key at Apple and save it, or save one you hold with --key-file",
3391
3503
  details: `Without --key-file it signs in to Apple, creates one key named "Superwall" on the team
@@ -3483,7 +3595,7 @@ A purchase_key is for the app's bundle ID; an app with none gets --bundle-id sav
3483
3595
  prompts: true,
3484
3596
  mcp: false,
3485
3597
  async run(ctx, input) {
3486
- const { runAscKeysCreate } = await import("./create-Du8Fx7W5.js");
3598
+ const { runAscKeysCreate } = await import("./create-CSHGZDfB.js");
3487
3599
  return runAscKeysCreate(ctx, input);
3488
3600
  }
3489
3601
  });
@@ -3680,7 +3792,7 @@ async function runAscKeysSources(ctx, { flags }) {
3680
3792
 
3681
3793
  //#endregion
3682
3794
  //#region src/commands/app-store-connect/keys/delete.ts
3683
- const command$19 = defineCommand({
3795
+ const command$20 = defineCommand({
3684
3796
  name: "asc keys delete",
3685
3797
  summary: "Remove the app's saved key; with a team id instead, your organization's",
3686
3798
  details: "Nothing is revoked at Apple.",
@@ -3713,7 +3825,7 @@ const command$19 = defineCommand({
3713
3825
 
3714
3826
  //#endregion
3715
3827
  //#region src/commands/app-store-connect/keys/import.ts
3716
- const command$20 = defineCommand({
3828
+ const command$21 = defineCommand({
3717
3829
  name: "asc keys import",
3718
3830
  summary: "Reuse a key your organization already has, once Apple confirms it here",
3719
3831
  details: `Without --from it tries every key your organization has and saves the first Apple
@@ -3765,7 +3877,7 @@ With --from, replaces the target app's saved key.`,
3765
3877
 
3766
3878
  //#endregion
3767
3879
  //#region src/commands/app-store-connect/keys/list.ts
3768
- const command$21 = defineCommand({
3880
+ const command$22 = defineCommand({
3769
3881
  name: "asc keys list",
3770
3882
  summary: "Which keys the app has; without --app, your organization's",
3771
3883
  details: "Key id and issuer id of each. Changes nothing.",
@@ -3792,7 +3904,7 @@ const command$21 = defineCommand({
3792
3904
 
3793
3905
  //#endregion
3794
3906
  //#region src/commands/app-store-connect/keys/sources.ts
3795
- const command$22 = defineCommand({
3907
+ const command$23 = defineCommand({
3796
3908
  name: "asc keys sources",
3797
3909
  summary: "Keys on your organization's other iOS apps that import could use",
3798
3910
  flags: {
@@ -3814,7 +3926,7 @@ const command$22 = defineCommand({
3814
3926
 
3815
3927
  //#endregion
3816
3928
  //#region src/commands/app-store-connect/keys/update.ts
3817
- const command$23 = defineCommand({
3929
+ const command$24 = defineCommand({
3818
3930
  name: "asc keys update",
3819
3931
  summary: "Replace your organization's key for an Apple team",
3820
3932
  details: `Refused unless Apple confirms the new key belongs to the same team.
@@ -3870,7 +3982,7 @@ With --app it saves the key you hold on that app instead, as asc keys create --k
3870
3982
  prompts: true,
3871
3983
  mcp: false,
3872
3984
  async run(ctx, { args, flags }) {
3873
- const { upsertHeldKey: upsertHeldKey$1 } = await import("./held-DmOhszHR.js");
3985
+ const { upsertHeldKey: upsertHeldKey$1 } = await import("./held-Dmf5SR3p.js");
3874
3986
  return upsertHeldKey$1(ctx, {
3875
3987
  action: "update",
3876
3988
  key: {
@@ -3892,7 +4004,7 @@ With --app it saves the key you hold on that app instead, as asc keys create --k
3892
4004
 
3893
4005
  //#endregion
3894
4006
  //#region src/commands/app-store-connect/notification-url/check.ts
3895
- const command$24 = defineCommand({
4007
+ const command$25 = defineCommand({
3896
4008
  name: "asc notification-url check",
3897
4009
  summary: "Ask Apple whose URL each environment has",
3898
4010
  details: `For production and sandbox: this_app, superwall_app (another Superwall app's), other
@@ -3924,7 +4036,7 @@ const command$24 = defineCommand({
3924
4036
 
3925
4037
  //#endregion
3926
4038
  //#region src/commands/app-store-connect/notification-url/set.ts
3927
- const command$25 = defineCommand({
4039
+ const command$26 = defineCommand({
3928
4040
  name: "asc notification-url set",
3929
4041
  summary: "Write this app's URL where Apple has none",
3930
4042
  details: `Never replaces another server's URL: a conflict is reported and left alone (exit 1).
@@ -4099,7 +4211,7 @@ async function runOffersDelete(session, input) {
4099
4211
 
4100
4212
  //#endregion
4101
4213
  //#region src/commands/app-store-connect/store/offers.ts
4102
- const command$26 = defineAscResource({
4214
+ const command$27 = defineAscResource({
4103
4215
  name: "asc offers",
4104
4216
  summary: "Introductory offers of a subscription: free trials and discounted first periods",
4105
4217
  details: `Apple keeps one introductory offer per territory. create writes it to every territory the
@@ -4121,7 +4233,7 @@ priced in --territory and equalized.`,
4121
4233
  {
4122
4234
  name: "create",
4123
4235
  summary: "Create an introductory offer in every territory",
4124
- details: "Creates introductory offers in the selected territories. New offers with overlapping dates overwrite existing introductory offers.",
4236
+ details: "Creates introductory offers in the selected territories only; --territory just sets the price that is equalized. Apple rejects an offer whose dates overlap an existing one in the same territory (409): end it with asc offers update or remove it with asc offers delete first.",
4125
4237
  flags: {
4126
4238
  subscription: {
4127
4239
  type: "string",
@@ -4217,7 +4329,7 @@ priced in --territory and equalized.`,
4217
4329
 
4218
4330
  //#endregion
4219
4331
  //#region src/commands/app-store-connect/api/patch.ts
4220
- const command$27 = defineCommand({
4332
+ const command$28 = defineCommand({
4221
4333
  name: "asc patch",
4222
4334
  summary: "Any App Store Connect PATCH request, its body checked against Apple's schema",
4223
4335
  details: `Each -d names an attribute or a relationship of the body; its type comes from Apple's
@@ -4266,7 +4378,7 @@ Executes an arbitrary App Store Connect PATCH through the signed proxy, with sch
4266
4378
 
4267
4379
  //#endregion
4268
4380
  //#region src/commands/app-store-connect/api/post.ts
4269
- const command$28 = defineCommand({
4381
+ const command$29 = defineCommand({
4270
4382
  name: "asc post",
4271
4383
  summary: "Any App Store Connect POST request, its body checked against Apple's schema",
4272
4384
  details: `Each -d names an attribute or a relationship of the body; its type comes from Apple's
@@ -4315,7 +4427,7 @@ Executes an arbitrary App Store Connect POST through the signed proxy, with sche
4315
4427
 
4316
4428
  //#endregion
4317
4429
  //#region src/commands/app-store-connect/store/prices.ts
4318
- const command$29 = defineAscResource({
4430
+ const command$30 = defineAscResource({
4319
4431
  name: "asc prices",
4320
4432
  summary: "Prices of a subscription or in-app purchase, and Apple's price points",
4321
4433
  details: `Each takes --subscription or --iap. set on a subscription prices it in --territory and
@@ -4406,7 +4518,7 @@ async function printAscProducts(ctx, app$1, team$1) {
4406
4518
 
4407
4519
  //#endregion
4408
4520
  //#region src/commands/app-store-connect/store/products.ts
4409
- const command$30 = defineCommand({
4521
+ const command$31 = defineCommand({
4410
4522
  name: "asc products",
4411
4523
  summary: "The products of one App Store app: subscriptions and in-app purchases",
4412
4524
  args: { id: {
@@ -4662,7 +4774,7 @@ async function runReleaseStatus(session, input) {
4662
4774
 
4663
4775
  //#endregion
4664
4776
  //#region src/commands/app-store-connect/release/release.ts
4665
- const command$31 = defineAscResource({
4777
+ const command$32 = defineAscResource({
4666
4778
  name: "asc release",
4667
4779
  summary: "Ship a version: submit it for review, release it, run its phased release, check where it is",
4668
4780
  details: `submit adds the version to the app's open review submission, or a new one, with any
@@ -4738,7 +4850,7 @@ release on before the version is released; pause, resume and complete steer it a
4738
4850
 
4739
4851
  //#endregion
4740
4852
  //#region src/commands/app-store-connect/store/screenshots.ts
4741
- const command$32 = defineAscResource({
4853
+ const command$33 = defineAscResource({
4742
4854
  name: "asc screenshots",
4743
4855
  summary: "The App Review screenshot of a subscription or in-app purchase",
4744
4856
  operations: [{
@@ -4761,7 +4873,7 @@ const command$32 = defineAscResource({
4761
4873
 
4762
4874
  //#endregion
4763
4875
  //#region src/commands/app-store-connect/store/submit.ts
4764
- const command$33 = defineCommand({
4876
+ const command$34 = defineCommand({
4765
4877
  name: "asc submit",
4766
4878
  summary: "Submit subscriptions, groups and in-app purchases for App Review",
4767
4879
  details: `Adds the latest version of each to the app's open review submission, or a new one,
@@ -4918,7 +5030,7 @@ async function runSubscriptionGroupsDelete(session, input) {
4918
5030
 
4919
5031
  //#endregion
4920
5032
  //#region src/commands/app-store-connect/store/subscription-groups.ts
4921
- const command$34 = defineAscResource({
5033
+ const command$35 = defineAscResource({
4922
5034
  name: "asc subscription-groups",
4923
5035
  summary: "Subscription groups of an App Store app, and their localizations",
4924
5036
  operations: [
@@ -5015,7 +5127,7 @@ const command$34 = defineAscResource({
5015
5127
 
5016
5128
  //#endregion
5017
5129
  //#region src/commands/app-store-connect/setup/apple.ts
5018
- const command$35 = defineCommand({
5130
+ const command$36 = defineCommand({
5019
5131
  name: "setup apple",
5020
5132
  summary: "One Apple sign-in: create the keys an app is missing, set its notification URL",
5021
5133
  details: `What it does
@@ -5122,7 +5234,7 @@ Exit codes
5122
5234
  prompts: true,
5123
5235
  mcp: false,
5124
5236
  async run(ctx, input) {
5125
- const { runSetupApple } = await import("./apple-Dc5pOPms.js");
5237
+ const { runSetupApple } = await import("./apple-BE1GBJFP.js");
5126
5238
  return runSetupApple(ctx, input);
5127
5239
  }
5128
5240
  });
@@ -5318,7 +5430,7 @@ async function runSubscriptionsDelete(session, input) {
5318
5430
 
5319
5431
  //#endregion
5320
5432
  //#region src/commands/app-store-connect/store/subscriptions.ts
5321
- const command$36 = defineAscResource({
5433
+ const command$37 = defineAscResource({
5322
5434
  name: "asc subscriptions",
5323
5435
  summary: "Auto-renewable subscriptions: list, inspect, create one ready for review, change, delete",
5324
5436
  details: `create runs every step Apple needs, in order: the subscription, its localization
@@ -5502,7 +5614,7 @@ state and what is still missing.`,
5502
5614
 
5503
5615
  //#endregion
5504
5616
  //#region src/commands/app-store-connect/release/versions.ts
5505
- const command$37 = defineAscResource({
5617
+ const command$38 = defineAscResource({
5506
5618
  name: "asc versions",
5507
5619
  summary: "App Store versions: list, inspect, create, change, delete",
5508
5620
  details: `A <version> is the version's id, or its version string (1.2.0) with --asc-app and,
@@ -5640,7 +5752,7 @@ off iOS, --platform. --earliest-release-date (2026-11-01T08:00:00-07:00) goes wi
5640
5752
 
5641
5753
  //#endregion
5642
5754
  //#region src/core/apple-search-ads/catalog.ts
5643
- const APPLE_DOCS_BASE = "https://developer.apple.com/documentation/apple_ads";
5755
+ const APPLE_DOCS_BASE = "https://developer.apple.com/documentation/apple-ads-platform-api";
5644
5756
  const flag = (flag$1, key, type, describe$1) => ({
5645
5757
  flag: flag$1,
5646
5758
  key,
@@ -5649,73 +5761,66 @@ const flag = (flag$1, key, type, describe$1) => ({
5649
5761
  });
5650
5762
  const NAME = flag("name", "name", "string", "Name");
5651
5763
  const STATUS = flag("status", "status", "string", "ENABLED or PAUSED");
5652
- const ADAM_ID = flag("adam-id", "adamId", "number", "App Store app id (adamId)");
5653
- const MATCH_TYPE = flag("match-type", "matchType", "string", "BROAD or EXACT");
5764
+ const START = flag("start", "startTime", "string", "Start (yyyy-MM-ddTHH:mm:ss.SSS, UTC)");
5765
+ const END = flag("end", "endTime", "string", "End (yyyy-MM-ddTHH:mm:ss.SSS, UTC)");
5766
+ const BID_STRATEGY = flag("bid-strategy", "bidStrategy.bidStrategyType", "string", "MANUAL_CPT, MAX_CONVERSIONS, ... (with --bid-goal)");
5767
+ const BID_GOAL = flag("bid-goal", "bidStrategy.bidStrategyGoal", "string", "TAP, INSTALL, ... (with --bid-strategy)");
5768
+ const MATCH_TYPE = flag("match-type", "matchType", "string", "EXACT, BROAD, PHRASE or CATEGORY");
5654
5769
  const TEXT = flag("text", "text", "string", "Keyword text");
5655
- const KEYWORD_STATUS = flag("status", "status", "string", "ACTIVE or PAUSED");
5656
- const START = flag("start", "startTime", "string", "Start (YYYY-MM-DD or ISO timestamp)");
5657
- const END = flag("end", "endTime", "string", "End (YYYY-MM-DD or ISO timestamp)");
5658
- const CAMPAIGN_FIELDS = [
5770
+ const BID = flag("bid", "bid", "money", "Keyword bid");
5771
+ const IN_CAMPAIGN = flag("campaign", "campaignId", "number", "Campaign id");
5772
+ const IN_ADGROUP = flag("adgroup", "adGroupId", "number", "Ad group id");
5773
+ const CAMPAIGN_UPDATE = [
5659
5774
  NAME,
5660
- ADAM_ID,
5661
- flag("countries", "countriesOrRegions", "list", "Comma-separated country codes"),
5662
- flag("budget", "budgetAmount", "money", "Lifetime budget"),
5663
- flag("daily-budget", "dailyBudgetAmount", "money", "Daily budget"),
5664
- flag("supply-sources", "supplySources", "list", "Comma-separated supply sources"),
5665
- flag("ad-channel-type", "adChannelType", "string", "SEARCH or DISPLAY"),
5666
- flag("billing-event", "billingEvent", "string", "TAPS or IMPRESSIONS"),
5775
+ flag("countries", "targeting.countryOrRegion.include", "list", "Comma-separated country or region codes"),
5776
+ flag("daily-budget", "dailyBudget.value", "money", "Daily budget"),
5777
+ flag("supply-sources", "targeting.supplySource.include", "list", "Comma-separated supply sources (APPSTORE, MAPS)"),
5778
+ flag("supply-placements", "targeting.supplyPlacement.include", "list", "Comma-separated placements (APPSTORE_SEARCH_RESULTS, APPSTORE_TODAY_TAB, ...)"),
5779
+ BID_STRATEGY,
5780
+ BID_GOAL,
5667
5781
  START,
5668
5782
  END,
5669
5783
  STATUS
5670
5784
  ];
5671
- const ADGROUP_FIELDS = [
5785
+ const ADGROUP_UPDATE = [
5672
5786
  NAME,
5673
- flag("default-bid", "defaultBidAmount", "money", "Default CPT bid"),
5674
- flag("cpa-goal", "cpaGoal", "money", "CPA goal"),
5787
+ flag("bid", "bidStrategy.bid", "money", "Default bid"),
5788
+ BID_STRATEGY,
5789
+ BID_GOAL,
5675
5790
  flag("search-match", "automatedKeywordsOptIn", "boolean", "Enable Search Match"),
5676
5791
  START,
5677
5792
  END,
5678
5793
  STATUS
5679
5794
  ];
5680
- const KEYWORD_FIELDS = [
5795
+ const KEYWORD_CREATE = [
5796
+ IN_ADGROUP,
5681
5797
  TEXT,
5682
5798
  MATCH_TYPE,
5683
- flag("bid", "bidAmount", "money", "Keyword bid"),
5684
- KEYWORD_STATUS
5799
+ BID,
5800
+ STATUS
5685
5801
  ];
5686
- const NEGATIVE_FIELDS = [
5802
+ const KEYWORD_UPDATE = [BID, STATUS];
5803
+ const NEGATIVE_CREATE = [
5804
+ IN_CAMPAIGN,
5805
+ IN_ADGROUP,
5687
5806
  TEXT,
5688
5807
  MATCH_TYPE,
5689
- KEYWORD_STATUS
5690
- ];
5691
- const AD_FIELDS = [
5692
- NAME,
5693
- flag("creative-id", "creativeId", "number", "Creative id"),
5694
5808
  STATUS
5695
5809
  ];
5696
- const REPORT_FLAGS = [
5697
- flag("start", "startTime", "string", "Report start (YYYY-MM-DD)"),
5698
- flag("end", "endTime", "string", "Report end (YYYY-MM-DD)"),
5699
- flag("granularity", "granularity", "string", "HOURLY, DAILY, WEEKLY, or MONTHLY"),
5700
- flag("group-by", "groupBy", "list", "Group rows by dimension (e.g. countryOrRegion)")
5701
- ];
5702
- const SELECTOR_QUERY = [
5703
- "selector",
5704
- "field",
5705
- "op",
5706
- "values",
5707
- "order-by",
5708
- "fields",
5709
- "limit",
5710
- "offset",
5711
- "all"
5712
- ];
5713
- const LIST_QUERY = [
5714
- "fields",
5715
- "limit",
5716
- "offset",
5717
- "all"
5810
+ const BUDGET_UPDATE = [
5811
+ NAME,
5812
+ START,
5813
+ END,
5814
+ flag("amount", "value", "money", "Total budget")
5718
5815
  ];
5816
+ const CAMPAIGN_SCOPE = {
5817
+ flag: "campaign",
5818
+ field: "campaignId"
5819
+ };
5820
+ const ADGROUP_SCOPE = {
5821
+ flag: "adgroup",
5822
+ field: "adGroupId"
5823
+ };
5719
5824
  const op = (group$1, action, effect, method, path, summary, doc, rest = {}) => ({
5720
5825
  group: group$1,
5721
5826
  action,
@@ -5726,264 +5831,376 @@ const op = (group$1, action, effect, method, path, summary, doc, rest = {}) => (
5726
5831
  ...rest,
5727
5832
  effect
5728
5833
  });
5729
- const list$1 = (group$1, path, summary, doc, rest = {}) => {
5730
- return op(group$1, "list", "read", "GET", path, summary, doc, {
5731
- paged: "query",
5732
- query: LIST_QUERY,
5834
+ const query = (group$1, path, summary, doc, rest = {}) => {
5835
+ return op(group$1, "list", "read", "POST", path, summary, doc, {
5836
+ body: "query",
5837
+ paged: true,
5838
+ details: "Queries with POST; changes nothing.",
5733
5839
  ...rest
5734
5840
  });
5735
5841
  };
5736
5842
  const byId = (group$1, path, summary, doc, rest = {}) => {
5737
5843
  return op(group$1, "get", "read", "GET", path, summary, doc, {
5738
5844
  positional: "id",
5739
- query: ["fields"],
5740
5845
  ...rest
5741
5846
  });
5742
5847
  };
5743
- const find = (group$1, path, summary, doc, rest = {}) => {
5744
- return op(group$1, "find", "read", "POST", path, summary, doc, {
5745
- body: "selector",
5746
- paged: "selector",
5747
- query: SELECTOR_QUERY,
5848
+ const remove = (group$1, path, summary, doc, rest = {}) => {
5849
+ return op(group$1, "delete", "destructive", "DELETE", path, summary, doc, {
5850
+ positional: "id",
5748
5851
  ...rest
5749
5852
  });
5750
5853
  };
5854
+ const appReport = (action, path, summary, doc, scoped) => {
5855
+ return op("reports", action, "read", "POST", `/reports/apps/${path}/query`, summary, doc, {
5856
+ body: "report",
5857
+ paged: true,
5858
+ zoned: true,
5859
+ filters: [{
5860
+ ...CAMPAIGN_SCOPE,
5861
+ text: true,
5862
+ required: scoped
5863
+ }, {
5864
+ ...ADGROUP_SCOPE,
5865
+ text: true
5866
+ }]
5867
+ });
5868
+ };
5869
+ const brandReport = (action, path, summary, doc, scoped) => {
5870
+ return op("brand-reports", action, "read", "POST", `/reports/business-brands/${path}/query`, summary, doc, {
5871
+ body: "report",
5872
+ paged: true,
5873
+ zoned: true,
5874
+ filters: [{
5875
+ ...CAMPAIGN_SCOPE,
5876
+ text: true,
5877
+ required: scoped
5878
+ }, {
5879
+ ...ADGROUP_SCOPE,
5880
+ text: true
5881
+ }]
5882
+ });
5883
+ };
5884
+ const PROMOTED_APP = {
5885
+ flag: "adam-id",
5886
+ field: "promotedObjectId",
5887
+ text: true,
5888
+ list: true
5889
+ };
5751
5890
  const ASA_OPERATIONS = [
5752
- list$1("campaigns", "/campaigns", "List campaigns", "get-all-campaigns"),
5753
- byId("campaigns", "/campaigns/{id}", "Get a campaign", "get-a-campaign"),
5754
- find("campaigns", "/campaigns/find", "Find campaigns with a selector", "find-campaigns"),
5755
- op("campaigns", "create", "destructive", "POST", "/campaigns", "Create a campaign", "create-a-campaign", {
5756
- details: "Creates a campaign with a budget and caller-selected status. ENABLED permits advertising once Apple’s serving requirements are met; this is not restricted to paused drafts.",
5891
+ query("campaigns", "/campaigns/query", "List campaigns", "post-campaigns-query"),
5892
+ byId("campaigns", "/campaigns/{id}", "Get a campaign", "get-campaigns-_id_"),
5893
+ op("campaigns", "create", "destructive", "POST", "/campaigns", "Create a campaign", "post-campaigns", {
5894
+ details: "Creates a campaign with a daily budget and caller-selected status. ENABLED permits advertising once Apple’s serving requirements are met; this is not restricted to paused drafts.",
5757
5895
  body: "object",
5758
- flags: CAMPAIGN_FIELDS
5896
+ flags: [
5897
+ NAME,
5898
+ flag("adam-id", "promotedObjectId", "string", "App Store app id (adamId) to promote"),
5899
+ flag("promoted-type", "promotedObjectType", "string", "APPSTORE_APP (default) or BUSINESS_BRAND"),
5900
+ flag("billing-event", "billingEvent", "string", "TAPS or IMPRESSIONS"),
5901
+ ...CAMPAIGN_UPDATE.slice(1)
5902
+ ],
5903
+ defaults: { promotedObjectType: "APPSTORE_APP" },
5904
+ account: "adAccountId"
5759
5905
  }),
5760
- op("campaigns", "update", "destructive", "PUT", "/campaigns/{id}", "Update a campaign", "update-a-campaign", {
5761
- details: "Overwrites campaign status, countries and daily/lifetime budgets; can enable spending or pause delivery.",
5906
+ op("campaigns", "update", "destructive", "PUT", "/campaigns/{id}", "Update a campaign", "put-campaigns-_id_", {
5907
+ details: "Overwrites campaign status, targeting, bid strategy and daily budget; can enable spending or pause delivery.",
5762
5908
  positional: "id",
5763
5909
  body: "object",
5764
- envelope: "campaign",
5765
- flags: CAMPAIGN_FIELDS
5910
+ flags: CAMPAIGN_UPDATE
5766
5911
  }),
5767
- op("campaigns", "delete", "destructive", "DELETE", "/campaigns/{id}", "Delete a campaign", "delete-a-campaign", { positional: "id" }),
5768
- list$1("adgroups", "/campaigns/{campaign}/adgroups", "List ad groups in a campaign", "get-all-ad-groups"),
5769
- byId("adgroups", "/campaigns/{campaign}/adgroups/{id}", "Get an ad group", "get-an-ad-group"),
5770
- find("adgroups", "/campaigns/{campaign}/adgroups/find", "Find ad groups in a campaign", "find-ad-groups"),
5771
- find("adgroups", "/adgroups/find", "Find ad groups across the org", "find-ad-groups-(org-level)"),
5772
- op("adgroups", "create", "destructive", "POST", "/campaigns/{campaign}/adgroups", "Create an ad group", "create-an-ad-group", {
5912
+ remove("campaigns", "/campaigns/{id}", "Delete a campaign", "delete-campaigns-_id_"),
5913
+ op("campaigns", "limited-reasons", "read", "GET", "/campaigns/{id}/legacy-app-limited-status-reason-details", "Why a legacy app campaign is limited", "get-campaigns-_id_-legacy-app-limited-status-reason-details", { positional: "id" }),
5914
+ query("adgroups", "/adgroups/query", "List ad groups", "post-adgroups-query", { filters: [CAMPAIGN_SCOPE] }),
5915
+ byId("adgroups", "/adgroups/{id}", "Get an ad group", "get-adgroups-_id_"),
5916
+ op("adgroups", "create", "destructive", "POST", "/adgroups", "Create an ad group", "post-adgroups", {
5773
5917
  details: "Creates a bid-bearing ad group. An enabled group in an eligible live campaign can begin serving and spending immediately.",
5774
5918
  body: "object",
5775
- flags: ADGROUP_FIELDS
5919
+ flags: [
5920
+ NAME,
5921
+ IN_CAMPAIGN,
5922
+ flag("pricing-model", "pricingModel", "string", "CPT, CPM or CPA (must match the campaign's billing event)"),
5923
+ ...ADGROUP_UPDATE.slice(1)
5924
+ ]
5776
5925
  }),
5777
- op("adgroups", "update", "destructive", "PUT", "/campaigns/{campaign}/adgroups/{id}", "Update an ad group", "update-an-ad-group", {
5778
- details: "Overwrites ad-group status, bids, CPA goal, dates and Search Match behavior.",
5926
+ op("adgroups", "update", "destructive", "PUT", "/adgroups/{id}", "Update an ad group", "put-adgroups-_id_", {
5927
+ details: "Overwrites ad-group status, bids, bid strategy, dates and Search Match behavior.",
5779
5928
  positional: "id",
5780
5929
  body: "object",
5781
- flags: ADGROUP_FIELDS
5930
+ flags: ADGROUP_UPDATE
5782
5931
  }),
5783
- op("adgroups", "delete", "destructive", "DELETE", "/campaigns/{campaign}/adgroups/{id}", "Delete an ad group", "delete-an-ad-group", { positional: "id" }),
5784
- list$1("keywords", "/campaigns/{campaign}/adgroups/{adgroup}/targetingkeywords", "List targeting keywords in an ad group", "get-all-targeting-keywords-in-an-ad-group"),
5785
- byId("keywords", "/campaigns/{campaign}/adgroups/{adgroup}/targetingkeywords/{id}", "Get a targeting keyword", "get-a-targeting-keyword-in-an-ad-group"),
5786
- find("keywords", "/campaigns/{campaign}/adgroups/targetingkeywords/find", "Find targeting keywords across a campaign", "find-targeting-keywords-in-a-campaign"),
5787
- op("keywords", "create", "destructive", "POST", "/campaigns/{campaign}/adgroups/{adgroup}/targetingkeywords/bulk", "Create targeting keywords (bulk)", "create-targeting-keywords", {
5788
- details: "Creates targeting keywords, which can be ACTIVE with bids in a live ad group and enable spending.",
5789
- body: "array",
5790
- flags: KEYWORD_FIELDS
5932
+ remove("adgroups", "/adgroups/{id}", "Delete an ad group", "delete-adgroups-_id_"),
5933
+ query("keywords", "/keywords/query", "List targeting keywords", "post-keywords-query", { filters: [CAMPAIGN_SCOPE, ADGROUP_SCOPE] }),
5934
+ byId("keywords", "/keywords/{id}", "Get a targeting keyword", "get-keywords-_id_"),
5935
+ op("keywords", "create", "destructive", "POST", "/keywords", "Create a targeting keyword", "post-keywords", {
5936
+ details: "Creates targeting keywords, which can be ENABLED with bids in a live ad group and enable spending.",
5937
+ body: "object",
5938
+ flags: KEYWORD_CREATE
5791
5939
  }),
5792
- op("keywords", "update", "destructive", "PUT", "/campaigns/{campaign}/adgroups/{adgroup}/targetingkeywords/bulk", "Update targeting keywords (bulk)", "update-targeting-keywords", {
5793
- details: "Bulk-overwrites targeting keyword status, match type or bids.",
5794
- positional: "id",
5795
- body: "array",
5796
- flags: KEYWORD_FIELDS
5940
+ op("keywords", "create", "destructive", "POST", "/keywords/bulk-create", "Create targeting keywords (bulk)", "post-keywords-bulk-create", {
5941
+ body: "bulk",
5942
+ flags: KEYWORD_CREATE
5943
+ }),
5944
+ op("keywords", "update", "destructive", "PUT", "/keywords/{id}", "Update a targeting keyword", "put-keywords-_id_", {
5945
+ details: "Overwrites targeting keyword status or bids.",
5946
+ positional: "ids",
5947
+ body: "object",
5948
+ flags: KEYWORD_UPDATE
5797
5949
  }),
5798
- op("keywords", "delete", "destructive", "DELETE", "/campaigns/{campaign}/adgroups/{adgroup}/targetingkeywords/{id}", "Delete a targeting keyword", "delete-a-targeting-keyword", { positional: "ids" }),
5799
- op("keywords", "delete", "destructive", "POST", "/campaigns/{campaign}/adgroups/{adgroup}/targetingkeywords/delete/bulk", "Delete targeting keywords (bulk)", "delete-targeting-keywords", {
5950
+ op("keywords", "update", "destructive", "POST", "/keywords/bulk-update", "Update targeting keywords (bulk)", "post-keywords-bulk-update", {
5800
5951
  positional: "ids",
5801
- body: "ids"
5952
+ body: "bulk",
5953
+ flags: KEYWORD_UPDATE
5802
5954
  }),
5803
- list$1("negative-keywords", "/campaigns/{campaign}/negativekeywords", "List campaign negative keywords", "get-all-campaign-negative-keywords"),
5804
- list$1("negative-keywords", "/campaigns/{campaign}/adgroups/{adgroup}/negativekeywords", "List ad group negative keywords", "get-all-ad-group-negative-keywords"),
5805
- byId("negative-keywords", "/campaigns/{campaign}/negativekeywords/{id}", "Get a campaign negative keyword", "get-a-campaign-negative-keyword"),
5806
- byId("negative-keywords", "/campaigns/{campaign}/adgroups/{adgroup}/negativekeywords/{id}", "Get an ad group negative keyword", "get-an-ad-group-negative-keyword"),
5807
- find("negative-keywords", "/campaigns/{campaign}/negativekeywords/find", "Find campaign negative keywords", "find-campaign-negative-keywords"),
5808
- find("negative-keywords", "/campaigns/{campaign}/adgroups/negativekeywords/find", "Find ad group negative keywords across a campaign", "find-ad-group-negative-keywords", { level: "adgroup" }),
5809
- op("negative-keywords", "create", "write", "POST", "/campaigns/{campaign}/negativekeywords/bulk", "Create campaign negative keywords (bulk)", "create-campaign-negative-keywords", {
5810
- body: "array",
5811
- flags: NEGATIVE_FIELDS
5955
+ remove("keywords", "/keywords/{id}", "Delete a targeting keyword", "delete-keywords-_id_", { positional: "ids" }),
5956
+ op("keywords", "delete", "destructive", "POST", "/keywords/bulk-delete", "Delete targeting keywords (bulk)", "post-keywords-bulk-delete", {
5957
+ positional: "ids",
5958
+ body: "bulk"
5812
5959
  }),
5813
- op("negative-keywords", "create", "write", "POST", "/campaigns/{campaign}/adgroups/{adgroup}/negativekeywords/bulk", "Create ad group negative keywords (bulk)", "create-ad-group-negative-keywords", {
5814
- body: "array",
5815
- flags: NEGATIVE_FIELDS
5960
+ query("negative-keywords", "/negative-keywords/query", "List negative keywords", "post-negative-keywords-query", { filters: [CAMPAIGN_SCOPE, ADGROUP_SCOPE] }),
5961
+ byId("negative-keywords", "/negative-keywords/{id}", "Get a negative keyword", "get-negative-keywords-_id_"),
5962
+ op("negative-keywords", "create", "write", "POST", "/negative-keywords", "Create a negative keyword", "post-negative-keywords", {
5963
+ details: "Creates a campaign negative keyword, or an ad group one with --adgroup.",
5964
+ body: "object",
5965
+ flags: NEGATIVE_CREATE
5816
5966
  }),
5817
- op("negative-keywords", "update", "destructive", "PUT", "/campaigns/{campaign}/negativekeywords/bulk", "Update campaign negative keywords (bulk)", "update-campaign-negative-keywords", {
5818
- details: "Bulk-overwrites negative keyword configuration and can change which traffic is excluded.",
5819
- positional: "id",
5820
- body: "array",
5821
- flags: NEGATIVE_FIELDS
5967
+ op("negative-keywords", "create", "write", "POST", "/negative-keywords/bulk-create", "Create negative keywords (bulk)", "post-negative-keywords-bulk-create", {
5968
+ body: "bulk",
5969
+ flags: NEGATIVE_CREATE
5822
5970
  }),
5823
- op("negative-keywords", "update", "destructive", "PUT", "/campaigns/{campaign}/adgroups/{adgroup}/negativekeywords/bulk", "Update ad group negative keywords (bulk)", "update-ad-group-negative-keywords", {
5824
- details: "Bulk-overwrites negative keyword configuration and can change which traffic is excluded.",
5825
- positional: "id",
5826
- body: "array",
5827
- flags: NEGATIVE_FIELDS
5971
+ op("negative-keywords", "update", "destructive", "PUT", "/negative-keywords/{id}", "Update a negative keyword", "put-negative-keywords-_id_", {
5972
+ details: "Overwrites negative keyword status and can change which traffic is excluded.",
5973
+ positional: "ids",
5974
+ body: "object",
5975
+ flags: [STATUS]
5828
5976
  }),
5829
- op("negative-keywords", "delete", "destructive", "POST", "/campaigns/{campaign}/negativekeywords/delete/bulk", "Delete campaign negative keywords", "delete-campaign-negative-keywords", {
5977
+ op("negative-keywords", "update", "destructive", "POST", "/negative-keywords/bulk-update", "Update negative keywords (bulk)", "post-negative-keywords-bulk-update", {
5830
5978
  positional: "ids",
5831
- body: "ids"
5979
+ body: "bulk",
5980
+ flags: [STATUS]
5832
5981
  }),
5833
- op("negative-keywords", "delete", "destructive", "POST", "/campaigns/{campaign}/adgroups/{adgroup}/negativekeywords/delete/bulk", "Delete ad group negative keywords", "delete-ad-group-negative-keywords", {
5982
+ remove("negative-keywords", "/negative-keywords/{id}", "Delete a negative keyword", "delete-negative-keywords-_id_", { positional: "ids" }),
5983
+ op("negative-keywords", "delete", "destructive", "POST", "/negative-keywords/bulk-delete", "Delete negative keywords (bulk)", "post-negative-keywords-bulk-delete", {
5834
5984
  positional: "ids",
5835
- body: "ids"
5985
+ body: "bulk"
5836
5986
  }),
5837
- list$1("ads", "/campaigns/{campaign}/adgroups/{adgroup}/ads", "List ads in an ad group", "get-all-ads"),
5838
- byId("ads", "/campaigns/{campaign}/adgroups/{adgroup}/ads/{id}", "Get an ad", "get-an-ad"),
5839
- find("ads", "/campaigns/{campaign}/ads/find", "Find ads in a campaign", "find-ads"),
5840
- find("ads", "/ads/find", "Find ads across the org", "find-ads-(org-level)"),
5841
- op("ads", "create", "destructive", "POST", "/campaigns/{campaign}/adgroups/{adgroup}/ads", "Create an ad", "create-an-ad", {
5987
+ query("ads", "/ads/query", "List ads", "post-ads-query", { filters: [CAMPAIGN_SCOPE, ADGROUP_SCOPE] }),
5988
+ byId("ads", "/ads/{id}", "Get an ad", "get-ads-_id_"),
5989
+ op("ads", "create", "destructive", "POST", "/ads", "Create an ad", "post-ads", {
5842
5990
  details: "Creates an ad assigned to a creative. An ENABLED ad in an eligible live group can begin serving and spending immediately.",
5843
5991
  body: "object",
5844
- flags: AD_FIELDS
5992
+ flags: [
5993
+ IN_ADGROUP,
5994
+ flag("creative-id", "creativeId", "number", "Creative id"),
5995
+ NAME,
5996
+ STATUS
5997
+ ]
5845
5998
  }),
5846
- op("ads", "update", "destructive", "PUT", "/campaigns/{campaign}/adgroups/{adgroup}/ads/{id}", "Update an ad", "update-an-ad", {
5999
+ op("ads", "update", "destructive", "PUT", "/ads/{id}", "Update an ad", "put-ads-_id_", {
5847
6000
  details: "Overwrites ad status/name; pausing or enabling changes delivery.",
5848
6001
  positional: "id",
5849
6002
  body: "object",
5850
6003
  flags: [NAME, STATUS]
5851
6004
  }),
5852
- op("ads", "delete", "destructive", "DELETE", "/campaigns/{campaign}/adgroups/{adgroup}/ads/{id}", "Delete an ad", "delete-an-ad", { positional: "id" }),
5853
- list$1("creatives", "/creatives", "List creatives", "get-all-creatives"),
5854
- byId("creatives", "/creatives/{id}", "Get a creative", "get-a-creative", { query: ["fields", "include-deleted-assets"] }),
5855
- find("creatives", "/creatives/find", "Find creatives with a selector", "find-creatives"),
5856
- op("creatives", "create", "write", "POST", "/creatives", "Create a creative", "create-a-creative", {
6005
+ remove("ads", "/ads/{id}", "Delete an ad", "delete-ads-_id_"),
6006
+ query("creatives", "/creatives/query", "List creatives", "post-creatives-query"),
6007
+ byId("creatives", "/creatives/{id}", "Get a creative", "get-creatives-_id_"),
6008
+ op("creatives", "create", "write", "POST", "/creatives", "Create a creative", "post-creatives", {
5857
6009
  body: "object",
5858
6010
  flags: [
5859
- ADAM_ID,
5860
6011
  NAME,
5861
- flag("type", "type", "string", "CUSTOM_PRODUCT_PAGE or DEFAULT_PRODUCT_PAGE"),
5862
- flag("product-page-id", "productPageId", "string", "Custom product page id")
5863
- ]
5864
- }),
5865
- list$1("product-pages", "/apps/{adamId}/product-pages", "List an app's custom product pages", "get-product-pages", {
5866
- paged: void 0,
5867
- query: [
5868
- "adam-id",
5869
- "name",
5870
- "states"
5871
- ]
6012
+ flag("type", "creativeType", "string", "CUSTOM_PRODUCT_PAGE, DEFAULT_PRODUCT_PAGE, ..."),
6013
+ flag("adam-id", "destination.parameters.adamId", "string", "App Store app id (adamId)"),
6014
+ flag("product-page-id", "destination.parameters.productPageId", "string", "Custom product page id")
6015
+ ],
6016
+ defaults: {
6017
+ creativeSpec: {},
6018
+ destination: { destinationType: "APP_STORE_PRODUCT_PAGE" }
6019
+ }
5872
6020
  }),
5873
- byId("product-pages", "/apps/{adamId}/product-pages/{id}", "Get a product page", "get-product-pages-by-identifier", { query: ["adam-id"] }),
5874
- op("product-pages", "locales", "read", "GET", "/apps/{adamId}/product-pages/{id}/locale-details", "Get a product page's locales", "get-product-page-locales", {
6021
+ op("creatives", "update", "write", "PUT", "/creatives/{id}", "Update a creative", "put-creatives-_id_", {
6022
+ details: "Renames a creative or replaces its spec; a new spec sends it back to review.",
5875
6023
  positional: "id",
5876
- query: [
5877
- "adam-id",
5878
- "device-classes",
5879
- "language-codes",
5880
- "expand"
5881
- ]
5882
- }),
5883
- op("product-pages", "countries", "read", "GET", "/countries-or-regions", "List supported countries or regions", "get-supported-countries-or-regions", { query: ["countries"] }),
5884
- op("product-pages", "device-sizes", "read", "GET", "/creativeappmappings/devices", "List app preview device sizes", "get-app-preview-device-sizes"),
5885
- find("ad-rejections", "/product-page-reasons/find", "Find ad creative rejection reasons", "find-ad-creative-rejection-reasons"),
5886
- byId("ad-rejections", "/product-page-reasons/{id}", "Get an ad creative rejection reason", "gets-a-product-page-reason"),
5887
- find("ad-rejections", "/apps/{adamId}/assets/find", "Find an app's assets", "find-app-assets", {
5888
- action: "assets",
5889
- details: "Retrieves asset metadata with a selector using POST; does not modify assets or start a job.",
5890
- query: [...SELECTOR_QUERY, "adam-id"]
5891
- }),
5892
- op("reports", "campaigns", "read", "POST", "/reports/campaigns", "Campaign-level report", "get-campaign-level-reports", {
5893
- body: "report",
5894
- flags: REPORT_FLAGS
5895
- }),
5896
- op("reports", "adgroups", "read", "POST", "/reports/campaigns/{campaign}/adgroups", "Ad group-level report", "get-ad-group-level-reports", {
5897
- body: "report",
5898
- flags: REPORT_FLAGS
5899
- }),
5900
- op("reports", "keywords", "read", "POST", "/reports/campaigns/{campaign}/keywords", "Keyword-level report", "get-keyword-level-reports", {
5901
- body: "report",
5902
- flags: REPORT_FLAGS
5903
- }),
5904
- op("reports", "keywords", "read", "POST", "/reports/campaigns/{campaign}/adgroups/{adgroup}/keywords", "Keyword-level report within an ad group", "get-keyword-level-within-ad-group-reports", {
5905
- body: "report",
5906
- flags: REPORT_FLAGS
6024
+ body: "object",
6025
+ flags: [NAME]
5907
6026
  }),
5908
- op("reports", "searchterms", "read", "POST", "/reports/campaigns/{campaign}/searchterms", "Search term-level report", "get-search-term-level-reports", {
5909
- body: "report",
5910
- flags: REPORT_FLAGS
6027
+ remove("creatives", "/creatives/{id}", "Delete a creative", "delete-creatives-_id_"),
6028
+ query("assets", "/assets/query", "List assets", "query-assets", { filters: [{
6029
+ ...PROMOTED_APP,
6030
+ list: false
6031
+ }] }),
6032
+ byId("assets", "/assets/{id}", "Get an asset", "get-asset-by-id"),
6033
+ remove("assets", "/assets/{id}", "Delete an asset", "delete-asset-by-id"),
6034
+ query("product-pages", "/product-pages/query", "List an app's custom product pages", "query-product-pages", { filters: [{
6035
+ flag: "adam-id",
6036
+ field: "adamId",
6037
+ required: true
6038
+ }] }),
6039
+ byId("product-pages", "/product-pages/{id}", "Get a product page", "get-product-page-by-id"),
6040
+ query("product-pages", "/product-pages/locale-details/query", "Get a product page's locales", "query-product-page-locale-details", {
6041
+ action: "locales",
6042
+ positional: "id",
6043
+ filters: [{
6044
+ flag: "id",
6045
+ field: "productPageId",
6046
+ required: true,
6047
+ text: true
6048
+ }]
5911
6049
  }),
5912
- op("reports", "searchterms", "read", "POST", "/reports/campaigns/{campaign}/adgroups/{adgroup}/searchterms", "Search term-level report within an ad group", "get-search-term-level-within-ad-group-reports", {
6050
+ query("ad-rejections", "/rejection-reasons/apps/query", "List ad creative rejection reasons", "find-rejection-reasons", { filters: [{
6051
+ flag: "adam-id",
6052
+ field: "adamId"
6053
+ }] }),
6054
+ byId("ad-rejections", "/rejection-reasons/apps/{id}", "Get an ad creative rejection reason", "gets-rejection-reasons-by-id"),
6055
+ appReport("campaigns", "campaigns", "Campaign-level report", "get-app-campaign-reports", false),
6056
+ appReport("adgroups", "adgroups", "Ad group-level report", "get-app-ad-group-reports", true),
6057
+ appReport("keywords", "keywords", "Keyword-level report", "get-app-keyword-reports", true),
6058
+ appReport("searchterms", "searchterms", "Search term-level report", "get-app-search-term-reports", true),
6059
+ appReport("ads", "ads", "Ad-level report", "get-app-ad-reports", true),
6060
+ brandReport("campaigns", "campaigns", "Apple Maps campaign-level report", "get-brand-campaign-reports", false),
6061
+ brandReport("adgroups", "adgroups", "Apple Maps ad group-level report", "get-brand-ad-group-reports", true),
6062
+ brandReport("keywords", "keywords", "Apple Maps keyword-level report", "get-brand-keyword-reports", true),
6063
+ brandReport("searchterms", "searchterms", "Apple Maps search term-level report", "get-brand-search-term-reports", true),
6064
+ brandReport("ads", "ads", "Apple Maps ad-level report", "get-brand-ad-reports", true),
6065
+ op("insights", "impression-share", "read", "POST", "/insights/apps/impression-share/query", "App impression share", "query-app-impression-share-data", {
5913
6066
  body: "report",
5914
- flags: REPORT_FLAGS
6067
+ paged: true,
6068
+ filters: [{
6069
+ ...PROMOTED_APP,
6070
+ list: false
6071
+ }]
5915
6072
  }),
5916
- op("reports", "ads", "read", "POST", "/reports/campaigns/{campaign}/ads", "Ad-level report", "get-ad-level-reports", {
6073
+ op("insights", "search-term-popularity", "read", "POST", "/insights/apps/search-term-popularity/query", "Search term popularity", "query-app-search-term-popularity-data", {
5917
6074
  body: "report",
5918
- flags: REPORT_FLAGS
5919
- }),
5920
- list$1("impression-share", "/custom-reports", "List impression share reports", "get-all-impression-share-reports"),
5921
- byId("impression-share", "/custom-reports/{id}", "Get an impression share report", "get-a-single-impression-share-report"),
5922
- op("impression-share", "create", "write", "POST", "/custom-reports", "Request an impression share report", "impression-share-report", {
5923
- body: "object",
5924
- flags: [
5925
- NAME,
5926
- START,
5927
- END,
5928
- flag("granularity", "granularity", "string", "DAILY, WEEKLY, or MONTHLY"),
5929
- flag("dimensions", "dimensions", "list", "Comma-separated dimensions (appName, adamId, countryOrRegion, searchTerm)"),
5930
- flag("metrics", "metrics", "list", "Comma-separated metrics")
5931
- ]
6075
+ paged: true
5932
6076
  }),
5933
- op("apps", "search", "read", "GET", "/search/apps", "Search the App Store for apps", "search-for-ios-apps", {
6077
+ op("apps", "search", "read", "GET", "/search/apps", "Search the App Store for apps", "searches-for-a-list-of-apps", {
5934
6078
  positional: "query",
5935
- paged: "query",
6079
+ paged: true,
5936
6080
  query: [
5937
6081
  "owned",
6082
+ "store-fronts",
5938
6083
  "limit",
5939
6084
  "offset",
5940
6085
  "all"
5941
6086
  ]
5942
6087
  }),
5943
- find("apps", "/apps/{adamId}/eligibilities/find", "Find an app's eligibility records", "find-app-eligibility-records", {
6088
+ query("apps", "/eligibilities/apps/query", "Check an app's eligibility", "find-apps-eligibilities", {
5944
6089
  action: "eligibility",
5945
- details: "Retrieves app eligibility records using POST; does not change eligibility or start a job.",
6090
+ positional: "adam-id",
6091
+ filters: [{
6092
+ flag: "adam-id",
6093
+ field: "adamId",
6094
+ required: true
6095
+ }]
6096
+ }),
6097
+ op("apps", "get", "read", "GET", "/apps/{adamId}", "Get app details", "get-app-details-by-adam-id", { positional: "adam-id" }),
6098
+ query("apps", "/apps/{adamId}/locale-details/query", "Get an app's default product page locales", "query-default-product-page-locale-details-by-adam-id", {
6099
+ action: "localized",
5946
6100
  positional: "adam-id"
5947
6101
  }),
5948
- op("apps", "get", "read", "GET", "/apps/{adamId}", "Get app details", "get-app-details", { positional: "adam-id" }),
5949
- op("apps", "localized", "read", "GET", "/apps/{adamId}/locale-details", "Get localized app details", "get-localized-app-details", { positional: "adam-id" }),
5950
- op("geo", "search", "read", "GET", "/search/geo", "Search geolocations", "search-for-geolocations", {
6102
+ query("apps", "/metadata/apps/supported-languages/query", "List supported app languages", "query-supported-app-languages", { action: "languages" }),
6103
+ op("geo", "search", "read", "GET", "/search/geo", "Search geolocations", "searches-for-a-list-of-geo-locations", {
5951
6104
  positional: "query",
5952
- paged: "query",
6105
+ paged: true,
6106
+ pageSize: "pageSize",
6107
+ defaults: { supplySource: "APPSTORE" },
5953
6108
  query: [
6109
+ "supply-source",
5954
6110
  "country",
5955
6111
  "entity",
6112
+ "eligible",
5956
6113
  "limit",
5957
6114
  "offset",
5958
6115
  "all"
5959
6116
  ]
5960
6117
  }),
5961
- op("geo", "get", "read", "POST", "/search/geo", "Look up geolocations by id", "get-a-list-of-geo-locations", {
6118
+ op("geo", "get", "read", "POST", "/search/geo", "Look up geolocations by id", "gets-a-list-of-geo-locations", {
5962
6119
  details: "Retrieves geolocations by ID using POST; does not create locations or start a job.",
5963
6120
  positional: "ids",
5964
- body: "geo",
5965
- query: ["entity"]
6121
+ body: "geo"
5966
6122
  }),
5967
- list$1("budget-orders", "/budgetorders", "List budget orders", "get-all-budget-orders"),
5968
- byId("budget-orders", "/budgetorders/{id}", "Get a budget order", "get-a-budget-order"),
5969
- op("budget-orders", "create", "destructive", "POST", "/budgetorders", "Create a budget order", "create-a-budget-order", {
5970
- details: "Creates a financial budget order for the organization. Apple can return it ACTIVE; the request is not restricted to a draft allocation.",
5971
- body: "object"
6123
+ query("budget-orders", "/shared-budgets/query", "List budget orders", "post-shared-budgets-query"),
6124
+ byId("budget-orders", "/shared-budgets/{id}", "Get a budget order", "get-shared-budgets-_id_"),
6125
+ op("budget-orders", "create", "destructive", "POST", "/shared-budgets", "Create a budget order", "post-shared-budgets", {
6126
+ details: "Creates a financial budget order that ad accounts can draw from; it needs invoice details in --body or -d.",
6127
+ body: "object",
6128
+ flags: BUDGET_UPDATE,
6129
+ account: "adAccountIds"
5972
6130
  }),
5973
- op("budget-orders", "update", "destructive", "PUT", "/budgetorders/{id}", "Update a budget order", "update-a-budget-order", {
5974
- details: "Overwrites a financial budget order using an unrestricted request body.",
6131
+ op("budget-orders", "update", "destructive", "PUT", "/shared-budgets/{id}", "Update a budget order", "put-shared-budgets-_id_", {
6132
+ details: "Overwrites a financial budget order's amount, dates, accounts or invoice details.",
5975
6133
  positional: "id",
5976
- body: "object"
6134
+ body: "object",
6135
+ flags: BUDGET_UPDATE
5977
6136
  }),
5978
- op("acls", "list", "read", "GET", "/acls", "List the orgs this API user can access", "get-user-acl"),
5979
- op("me", "get", "read", "GET", "/me", "Show the calling API user", "get-me-details")
5980
- ];
5981
- const PLACEHOLDERS = [
5982
- "campaign",
5983
- "adgroup",
5984
- "adamId",
5985
- "id"
6137
+ remove("budget-orders", "/shared-budgets/{id}", "Delete a budget order", "delete-shared-budgets-_id_"),
6138
+ query("recommendations", "/recommendations/target-cpas/query", "Target CPA recommendations", "query-target-cpa-recommendations", {
6139
+ action: "target-cpas",
6140
+ filters: [PROMOTED_APP]
6141
+ }),
6142
+ op("recommendations", "apply-target-cpas", "destructive", "POST", "/recommendations/target-cpas/apply", "Apply target CPA recommendations", "apply-target-cpa-recommendations", {
6143
+ details: "Applies recommended target CPAs, which changes how ad groups bid and spend.",
6144
+ body: "array"
6145
+ }),
6146
+ op("recommendations", "dismiss-target-cpas", "write", "POST", "/recommendations/target-cpas/dismiss", "Dismiss target CPA recommendations", "dismiss-target-cpa-recommendations", { body: "array" }),
6147
+ query("recommendations", "/recommendations/daily-budgets/query", "Daily budget recommendations", "query-daily-budget-recommendations", {
6148
+ action: "daily-budgets",
6149
+ filters: [PROMOTED_APP]
6150
+ }),
6151
+ op("recommendations", "apply-daily-budgets", "destructive", "POST", "/recommendations/daily-budgets/apply", "Apply daily budget recommendations", "apply-daily-budget-recommendations", {
6152
+ details: "Applies recommended daily budgets, which changes how much campaigns can spend.",
6153
+ body: "array"
6154
+ }),
6155
+ op("recommendations", "dismiss-daily-budgets", "write", "POST", "/recommendations/daily-budgets/dismiss", "Dismiss daily budget recommendations", "dismiss-daily-budget-recommendations", { body: "array" }),
6156
+ query("suggestions", "/suggestions/keywords/query", "Keyword suggestions", "query-keyword-suggestions", {
6157
+ action: "keywords",
6158
+ filters: [PROMOTED_APP]
6159
+ }),
6160
+ query("suggestions", "/suggestions/phrases/query", "Phrase suggestions", "query-phrase-suggestions", {
6161
+ action: "phrases",
6162
+ filters: [PROMOTED_APP]
6163
+ }),
6164
+ query("suggestions", "/suggestions/categories/query", "Category suggestions", "query-category-suggestions", {
6165
+ action: "categories",
6166
+ filters: [PROMOTED_APP]
6167
+ }),
6168
+ query("suggestions", "/suggestions/target-cpas/query", "Target CPA suggestion", "query-target-cpa-suggestion", {
6169
+ action: "target-cpa",
6170
+ filters: [PROMOTED_APP]
6171
+ }),
6172
+ query("change-history", "/change-history/query", "List changes", "query-audit-summary-_-grouped-by-transaction"),
6173
+ byId("change-history", "/change-history/{id}", "Get a change's details", "get-change-details-by-detailid", {
6174
+ paged: true,
6175
+ query: [
6176
+ "limit",
6177
+ "offset",
6178
+ "all"
6179
+ ]
6180
+ }),
6181
+ query("brands", "/business-brands/query", "List Apple Maps brands", "query-brands"),
6182
+ byId("brands", "/business-brands/{id}", "Get an Apple Maps brand", "get-brand-by-id"),
6183
+ query("brands", "/business-categories/query", "List business categories", "query-categories", { action: "categories" }),
6184
+ op("brands", "category", "read", "GET", "/business-categories/{id}", "Get a business category", "get-category-by-id", { positional: "id" }),
6185
+ query("brands", "/rejection-reasons/business-brands/query", "List brand rejection reasons", "query-policy-assignments-(rejection-reasons)-for-external-consumers", { action: "rejections" }),
6186
+ byId("ad-accounts", "/ad-accounts/{id}", "Get an ad account", "get-ad-accounts-_id_"),
6187
+ op("ad-accounts", "create", "write", "POST", "/ad-accounts", "Create ad accounts", "post-ad-accounts", {
6188
+ details: "Creates ad accounts with their product features and advertiser delegations.",
6189
+ body: "object",
6190
+ flags: [NAME]
6191
+ }),
6192
+ op("ad-accounts", "update", "destructive", "PUT", "/ad-accounts/{id}", "Update an ad account", "put-ad-accounts-_id_", {
6193
+ details: "Overwrites an ad account's name, product features or delegations, which can change what it may advertise.",
6194
+ positional: "id",
6195
+ body: "object",
6196
+ flags: [NAME]
6197
+ }),
6198
+ op("ad-accounts", "resources", "read", "GET", "/advertiser-resources", "List advertiser resources", "get-advertiser-resources", { query: ["resource-type"] }),
6199
+ op("orgs", "get", "read", "GET", "/orgs/{id}", "Get an org", "get-orgs-_id_", { positional: "id" }),
6200
+ op("acls", "list", "read", "GET", "/acls", "List the ad accounts this API user can access", "get-user-acls"),
6201
+ op("me", "get", "read", "GET", "/me", "Show the calling API user", "get-current-user-details")
5986
6202
  ];
6203
+ const PLACEHOLDERS = ["adamId", "id"];
5987
6204
  function placeholdersOf(path) {
5988
6205
  return PLACEHOLDERS.filter((p) => path.includes(`{${p}}`));
5989
6206
  }
@@ -5996,24 +6213,25 @@ function asaActions(group$1) {
5996
6213
  function asaVariants(group$1, action) {
5997
6214
  return ASA_OPERATIONS.filter((o) => o.group === group$1 && o.action === action);
5998
6215
  }
6216
+ const filterFlag = (filter) => {
6217
+ return filter.flag === "id" ? "an id" : `--${filter.flag} <id>`;
6218
+ };
6219
+ function filterValue(filter, scope) {
6220
+ if (filter.flag === "campaign") return scope.campaign;
6221
+ if (filter.flag === "adgroup") return scope.adgroup;
6222
+ if (filter.flag === "adam-id") return scope.adamId;
6223
+ return scope.ids[0];
6224
+ }
5999
6225
  function selectVariant(variants, scope) {
6000
- const have = (p) => {
6001
- return p === "id" ? scope.ids.length === 1 : Boolean(scope[p]);
6002
- };
6003
- const leveled = variants.some((v) => v.level === "adgroup");
6004
- const pick = variants.filter((v) => !leveled || v.level === "adgroup" === Boolean(scope.adgroupLevel)).filter((v) => placeholdersOf(v.path).every(have)).sort((a, b) => placeholdersOf(b.path).length - placeholdersOf(a.path).length)[0];
6005
- if (pick) return pick;
6006
- const [simplest] = [...variants].sort((a, b) => placeholdersOf(a.path).length - placeholdersOf(b.path).length);
6007
- if (!simplest) throw new Error("No Apple Search Ads operation to choose from.");
6008
- const missing$1 = placeholdersOf(simplest.path).filter((p) => !have(p)).map((p) => {
6009
- if (p === "id") return "exactly one id";
6010
- if (p === "adamId") return "--adam-id <id>";
6011
- return `--${p} <id>`;
6012
- });
6013
- throw new Error(`asa ${simplest.group} ${simplest.action} needs ${missing$1.join(" and ")}.`);
6226
+ const bulk = scope.bulk === true || scope.ids.length > 1;
6227
+ const pick = variants.find((v) => v.body === "bulk" === bulk) ?? variants[0];
6228
+ if (!pick) throw new Error("No Apple Search Ads operation to choose from.");
6229
+ const missing$1 = [...placeholdersOf(pick.path).filter((p) => p === "id" ? scope.ids.length !== 1 : !scope.adamId).map((p) => p === "id" ? "exactly one id" : "--adam-id <id>"), ...(pick.filters ?? []).filter((f) => f.required && !filterValue(f, scope)).map(filterFlag)];
6230
+ if (missing$1.length) throw new Error(`asa ${pick.group} ${pick.action} needs ${missing$1.join(" and ")}.`);
6231
+ return pick;
6014
6232
  }
6015
6233
  function fillPath(path, scope) {
6016
- return path.replace("{campaign}", encodeURIComponent(scope.campaign ?? "")).replace("{adgroup}", encodeURIComponent(scope.adgroup ?? "")).replace("{adamId}", encodeURIComponent(scope.adamId ?? "")).replace("{id}", encodeURIComponent(scope.ids[0] ?? ""));
6234
+ return path.replace("{adamId}", encodeURIComponent(scope.adamId ?? "")).replace("{id}", encodeURIComponent(scope.ids[0] ?? ""));
6017
6235
  }
6018
6236
  function appleDocUrl(op$1) {
6019
6237
  return `${APPLE_DOCS_BASE}/${op$1.doc}`;
@@ -6065,10 +6283,10 @@ function formatAsaUsage(op$1) {
6065
6283
  if (op$1.positional === "ids") parts.push("<id[,id…]>");
6066
6284
  if (op$1.positional === "query") parts.push("<query>");
6067
6285
  if (op$1.positional === "adam-id") parts.push("<adam-id>");
6068
- for (const placeholder$1 of placeholdersOf(op$1.path)) {
6069
- if (placeholder$1 === "campaign") parts.push("--campaign <id>");
6070
- if (placeholder$1 === "adgroup") parts.push("--adgroup <id>");
6071
- if (placeholder$1 === "adamId" && op$1.positional !== "adam-id") parts.push("--adam-id <id>");
6286
+ if (placeholdersOf(op$1.path).includes("adamId") && op$1.positional !== "adam-id") parts.push("--adam-id <id>");
6287
+ for (const filter of op$1.filters ?? []) {
6288
+ if (filter.flag === "id" || filter.flag === "adam-id" && op$1.positional === "adam-id") continue;
6289
+ parts.push(filter.required ? `--${filter.flag} <id>` : `[--${filter.flag} <id>]`);
6072
6290
  }
6073
6291
  return parts.join(" ");
6074
6292
  }
@@ -6084,20 +6302,28 @@ function formatAsaFlags(op$1, variants) {
6084
6302
  return [`${cmd(`--${flag$1.flag}`)}${pc.dim(value$1)}`, flag$1.describe];
6085
6303
  });
6086
6304
  const add = (flag$1, text) => rows.push([cmd(flag$1), text]);
6087
- if (op$1.body === "object" || op$1.body === "array") {
6305
+ const bulk = variants.find((variant) => variant.body === "bulk");
6306
+ if (op$1.body === "object" || bulk?.flags) {
6088
6307
  add("-d key=value", "Another body field; key:=json for numbers and objects");
6089
- add("--body <json|@file|@->", "The whole request body");
6090
- }
6091
- if (op$1.body === "selector" || op$1.body === "report") add("--selector <json|@file|@->", "An Apple selector");
6092
- if (op$1.body === "selector") {
6093
- add("--field --op --values", "One condition, e.g. --field status --op EQUALS --values ENABLED");
6308
+ add("--body <json|@file|@->", bulk ? "The whole request body; an array goes to the bulk endpoint" : "The whole request body");
6309
+ } else if (bulk) add("--body <json|@file|@->", "Bulk items instead of ids, as Apple documents them");
6310
+ if (op$1.body === "array") add("--body <json|@file|@->", "The request body: an array, as Apple documents it");
6311
+ if (op$1.body === "query" || op$1.body === "report") {
6312
+ add("--query <json|@file|@->", "An Apple query request: filters, sorting, pagination");
6313
+ add("--field --op --values", "One filter, e.g. --field status --op EQUALS --values ENABLED");
6094
6314
  add("--order-by <field[:asc|desc]>", "Sort");
6095
6315
  }
6096
- if (op$1.body === "report") add("--time-zone <UTC|ORTZ>", "Report time zone (default UTC)");
6097
- if (op$1.body === "selector" || op$1.query?.includes("fields")) add("--fields <a,b>", "Only these fields");
6316
+ if (op$1.body === "report") {
6317
+ add("--start --end <YYYY-MM-DD>", "Report range");
6318
+ add("--granularity <HOURLY|DAILY|WEEKLY|MONTHLY>", "Rows per period (default DAILY)");
6319
+ add("--group-by <a,b>", "Group rows by dimension");
6320
+ add("--fields <a,b>", "Only these fields");
6321
+ if (op$1.zoned) add("--time-zone <UTC|ORTZ>", "Report time zone (default UTC)");
6322
+ }
6323
+ if (op$1.body === "geo") add("--entity <Country|AdminArea|Locality>", "What kind of place the ids are");
6098
6324
  if (op$1.paged) add("--limit <n> --offset <n> --all", "Paging; --all walks every page");
6099
- if (variants.some((variant) => variant.level === "adgroup")) add("--adgroup-level", "Ad group negatives instead of the campaign's");
6100
6325
  rows.push([cmd("--app <app>"), "The Superwall app whose Apple Search Ads account to use"]);
6326
+ rows.push([cmd("--ad-account-id <id>"), "The Apple Ads ad account (default: the only one the key reaches)"]);
6101
6327
  return rows;
6102
6328
  }
6103
6329
  function renderAsaHelp(words) {
@@ -6106,7 +6332,7 @@ function renderAsaHelp(words) {
6106
6332
  if (!group$1 || !groups.includes(group$1)) return renderAsaPage({
6107
6333
  path: "asa",
6108
6334
  usage: "<resource> <operation>",
6109
- summary: "The Apple Search Ads API through Superwall's proxy: no key or token handling",
6335
+ summary: "The Apple Ads Platform API (v1) through Superwall's proxy: no key or token handling",
6110
6336
  children: [
6111
6337
  ...groups.map((name) => ({
6112
6338
  path: `asa ${name}`,
@@ -6189,11 +6415,12 @@ function asaBase(api) {
6189
6415
  }
6190
6416
  function asaUpstreamPath(path) {
6191
6417
  if (!path.startsWith("/")) throw new Error(`Path must start with "/", e.g. /campaigns`);
6192
- return path.startsWith("/api/") ? path : `/api/v5${path}`;
6418
+ if (path.startsWith("/api/") || path === "/v1" || path.startsWith("/v1/") || path.startsWith("/v1?")) return path;
6419
+ return `/v1${path}`;
6193
6420
  }
6194
6421
  async function asaProxy(api, appId, method, asaPath, body, options = {}) {
6195
6422
  const path = `${asaBase(api)}/proxy/${appId}${asaUpstreamPath(asaPath)}`;
6196
- const request = options.orgId ? { headers: { "x-ap-context": `orgId=${options.orgId}` } } : {};
6423
+ const request = options.adAccountId ? { headers: { "x-ap-context": `adAccountId=${options.adAccountId}` } } : {};
6197
6424
  switch (method.toUpperCase()) {
6198
6425
  case "GET": return api.get(path, request);
6199
6426
  case "POST": return api.post(path, body ?? {}, request);
@@ -6257,6 +6484,25 @@ function numeric(value$1, label) {
6257
6484
  function idValue(id$1) {
6258
6485
  return /^\d+$/.test(id$1) ? Number(id$1) : id$1;
6259
6486
  }
6487
+ function assignField(target, path, value$1) {
6488
+ const [key = "", ...rest] = path.split(".");
6489
+ if (rest.length === 0) {
6490
+ target[key] = value$1;
6491
+ return;
6492
+ }
6493
+ const current = target[key];
6494
+ const child = isRecord(current) ? { ...current } : {};
6495
+ target[key] = child;
6496
+ assignField(child, rest.join("."), value$1);
6497
+ }
6498
+ function deepMerge(base, extra) {
6499
+ const out = { ...base };
6500
+ for (const [key, value$1] of Object.entries(extra)) {
6501
+ const current = out[key];
6502
+ out[key] = isRecord(current) && isRecord(value$1) ? deepMerge(current, value$1) : value$1;
6503
+ }
6504
+ return out;
6505
+ }
6260
6506
  async function convertFlag(f, value$1, currency) {
6261
6507
  switch (f.type) {
6262
6508
  case "string": return String(value$1);
@@ -6269,49 +6515,69 @@ async function convertFlag(f, value$1, currency) {
6269
6515
  };
6270
6516
  }
6271
6517
  }
6272
- function buildSelector(input) {
6273
- const base = given(input.selector) ? readJsonInput(input.selector, "--selector") : {};
6274
- if (!isRecord(base)) throw new Error("--selector must be a JSON object.");
6275
- const selector = { ...base };
6276
- if (input.field || input.op || input.values) {
6277
- if (!input.field || !input.op || !input.values) throw new Error("--field, --op and --values go together (e.g. --field status --op EQUALS --values ENABLED).");
6278
- const conditions = Array.isArray(selector.conditions) ? [...selector.conditions] : [];
6279
- conditions.push({
6280
- field: input.field,
6281
- operator: input.op.toUpperCase(),
6282
- values: splitList(input.values)
6283
- });
6284
- selector.conditions = conditions;
6285
- }
6518
+ function shorthandFilter(input) {
6519
+ if (!input.field && !input.op && input.values === void 0) return void 0;
6520
+ const operator = input.op?.toUpperCase();
6521
+ const valueless = operator === "IS_NULL" || operator === "IS_NOT_NULL";
6522
+ if (!input.field || !operator || !valueless && !input.values) throw new Error("--field, --op and --values go together (e.g. --field status --op EQUALS --values ENABLED).");
6523
+ if (valueless) return {
6524
+ field: input.field,
6525
+ operator
6526
+ };
6527
+ const values = splitList(input.values);
6528
+ const value$1 = [
6529
+ "IN",
6530
+ "NOT_IN",
6531
+ "CONTAINS_ANY",
6532
+ "NOT_CONTAINS_ANY",
6533
+ "CONTAINS_ALL",
6534
+ "NOT_CONTAINS_ALL",
6535
+ "BETWEEN"
6536
+ ].includes(operator) || values.length > 1 ? values : values[0];
6537
+ return {
6538
+ field: input.field,
6539
+ operator,
6540
+ value: value$1
6541
+ };
6542
+ }
6543
+ function buildQuery(input) {
6544
+ const base = given(input.query) ? readJsonInput(input.query, "--query") : {};
6545
+ if (!isRecord(base)) throw new Error("--query must be a JSON object.");
6546
+ const request = { ...base };
6547
+ const own = Array.isArray(base.filters) ? base.filters : [];
6548
+ const shorthand = shorthandFilter(input);
6549
+ const filters = [
6550
+ ...own,
6551
+ ...input.filters ?? [],
6552
+ ...shorthand ? [shorthand] : []
6553
+ ];
6554
+ if (filters.length) request.filters = filters;
6286
6555
  if (input.orderBy) {
6287
6556
  const [field$1, dir] = input.orderBy.split(":");
6288
- selector.orderBy = [{
6557
+ request.sorting = [{
6289
6558
  field: field$1,
6290
- sortOrder: (dir ?? "asc").toLowerCase().startsWith("desc") ? "DESCENDING" : "ASCENDING"
6559
+ order: (dir ?? "asc").toLowerCase().startsWith("desc") ? "DESC" : "ASC"
6291
6560
  }];
6292
6561
  }
6293
- if (input.fields) selector.fields = splitList(input.fields);
6294
- if (input.limit !== void 0 || input.offset !== void 0) selector.pagination = {
6562
+ if (input.fields) request.fields = splitList(input.fields);
6563
+ if (input.limit !== void 0 || input.offset !== void 0) request.pagination = {
6564
+ ...isRecord(base.pagination) ? base.pagination : {},
6295
6565
  offset: input.offset ?? 0,
6296
- limit: input.limit ?? 20
6566
+ pageSize: input.limit ?? 20
6297
6567
  };
6298
- return selector;
6568
+ return request;
6299
6569
  }
6300
6570
  function buildReport(input) {
6301
- if (!input.start || !input.end) throw new Error("Reports need --start and --end (YYYY-MM-DD).");
6302
- const report = {
6303
- startTime: input.start,
6304
- endTime: input.end,
6305
- timeZone: input.timeZone ?? "UTC",
6306
- returnRowTotals: true,
6307
- returnGrandTotals: true,
6308
- selector: given(input.selector) ? readJsonInput(input.selector, "--selector") : { orderBy: [{
6309
- field: "localSpend",
6310
- sortOrder: "DESCENDING"
6311
- }] }
6312
- };
6313
- if (input.granularity) report.granularity = input.granularity.toUpperCase();
6314
- else if (!input.searchTerms) report.granularity = "DAILY";
6571
+ const report = buildQuery(input);
6572
+ const range = isRecord(report.timeRange) ? { ...report.timeRange } : {};
6573
+ if (input.start) range.start = input.start;
6574
+ if (input.end) range.end = input.end;
6575
+ if (!range.start || !range.end) throw new Error("Reports need --start and --end (YYYY-MM-DD).");
6576
+ if (input.granularity) range.granularity = input.granularity.toUpperCase();
6577
+ else range.granularity ??= "DAILY";
6578
+ if (input.timeZone) range.timeZone = input.timeZone;
6579
+ else if (input.zoned) range.timeZone ??= "UTC";
6580
+ report.timeRange = range;
6315
6581
  if (input.groupBy) report.groupBy = splitList(input.groupBy);
6316
6582
  return report;
6317
6583
  }
@@ -6326,62 +6592,76 @@ function numberFlag(flags, name) {
6326
6592
  const v = flagValue(flags, name);
6327
6593
  return v === void 0 || v === null || v === "" ? void 0 : numeric(v, name);
6328
6594
  }
6329
- async function objectBody(op$1, flags, params, currency) {
6330
- const bodyInput = flagValue(flags, "body");
6331
- const base = given(bodyInput) ? readJsonInput(bodyInput, "--body") : {};
6332
- if (!isRecord(base)) throw new Error("--body must be a JSON object for this command.");
6333
- const body = { ...base };
6595
+ async function fieldsOf(op$1, flags, currency) {
6596
+ const data$1 = {};
6334
6597
  for (const f of op$1.flags ?? []) {
6335
6598
  const v = flagValue(flags, f.flag);
6336
6599
  if (v === void 0 || v === null || v === "") continue;
6337
- body[f.key] = await convertFlag(f, v, currency);
6600
+ assignField(data$1, f.key, await convertFlag(f, v, currency));
6338
6601
  }
6339
- Object.assign(body, params);
6340
- return body;
6602
+ return data$1;
6341
6603
  }
6342
- async function arrayBody(op$1, flags, params, ids, currency) {
6343
- const bodyInput = flagValue(flags, "body");
6344
- if (given(bodyInput)) {
6345
- const parsed = readJsonInput(bodyInput, "--body");
6346
- if (Array.isArray(parsed)) return parsed;
6347
- if (isRecord(parsed)) return [parsed];
6348
- throw new Error("--body must be a JSON array (or one object) for this command.");
6604
+ async function objectBody(op$1, flags, params, body, options) {
6605
+ if (body !== void 0 && !isRecord(body)) throw new Error("--body must be a JSON object for this command.");
6606
+ let out = deepMerge(op$1.defaults ?? {}, body ?? {});
6607
+ out = deepMerge(out, await fieldsOf(op$1, flags, options.account.currency));
6608
+ out = deepMerge(out, params);
6609
+ if (op$1.account && out[op$1.account] === void 0) {
6610
+ const id$1 = idValue(await options.account.id());
6611
+ out[op$1.account] = op$1.account === "adAccountIds" ? [id$1] : id$1;
6349
6612
  }
6350
- const item = await objectBody({
6351
- ...op$1,
6352
- envelope: void 0
6353
- }, flags, params, currency);
6354
- if (ids[0] !== void 0) item.id = idValue(ids[0]);
6355
- if (Object.keys(item).length === 0) {
6613
+ return out;
6614
+ }
6615
+ const bulkItem = (data$1, index) => {
6616
+ if (isRecord(data$1) && isRecord(data$1.data)) return {
6617
+ correlationId: index,
6618
+ ...data$1
6619
+ };
6620
+ return {
6621
+ correlationId: index,
6622
+ data: data$1
6623
+ };
6624
+ };
6625
+ async function bulkBody(op$1, flags, params, body, ids, currency) {
6626
+ if (isRecord(body) && Array.isArray(body.items)) return body;
6627
+ if (Array.isArray(body)) return { items: body.map(bulkItem) };
6628
+ if (body !== void 0 && !isRecord(body)) throw new Error("--body must be a JSON array (or one object) for this command.");
6629
+ const data$1 = deepMerge(deepMerge(body ?? {}, await fieldsOf(op$1, flags, currency)), params);
6630
+ if (Object.keys(data$1).length === 0) {
6356
6631
  const hint = (op$1.flags ?? []).map((f) => `--${f.flag}`).join(", ");
6357
6632
  throw new Error(`Nothing to send. Pass fields (${hint}) or --body '[...]'.`);
6358
6633
  }
6359
- return [item];
6634
+ if (ids.length) return { items: ids.map((id$1, index) => bulkItem({
6635
+ ...data$1,
6636
+ id: idValue(id$1)
6637
+ }, index)) };
6638
+ return { items: [bulkItem(data$1, 0)] };
6639
+ }
6640
+ function arrayBody(op$1, body) {
6641
+ if (Array.isArray(body)) return body;
6642
+ if (isRecord(body)) return [body];
6643
+ throw new Error(`asa ${op$1.group} ${op$1.action} needs --body '[...]', as Apple documents it.`);
6360
6644
  }
6361
6645
  const QUERY_NAMES = {
6362
- fields: "fields",
6363
6646
  limit: "limit",
6364
6647
  offset: "offset",
6365
- name: "name",
6366
- states: "states",
6648
+ owned: "returnOwnedApps",
6649
+ "store-fronts": "storeFronts",
6367
6650
  country: "countrycode",
6368
6651
  entity: "entity",
6369
- countries: "countriesOrRegions",
6370
- "device-classes": "deviceClasses",
6371
- "language-codes": "languageCodes",
6372
- expand: "expand",
6373
- owned: "returnOwnedApps",
6374
- "include-deleted-assets": "includeDeletedCreativeSetAssets"
6652
+ "supply-source": "supplySource",
6653
+ eligible: "eligible",
6654
+ "resource-type": "resourceType"
6375
6655
  };
6376
6656
  function queryFor(op$1, flags, positional) {
6377
6657
  const qs = new URLSearchParams();
6658
+ for (const [key, value$1] of Object.entries(op$1.defaults ?? {})) qs.set(key, String(value$1));
6378
6659
  if (op$1.positional === "query") {
6379
6660
  if (!positional) throw new Error(`asa ${op$1.group} ${op$1.action} needs a search query.`);
6380
6661
  qs.set("query", positional);
6381
6662
  }
6382
6663
  for (const name of op$1.query ?? []) {
6383
- if (name === "all" || name === "adam-id") continue;
6384
- const key = QUERY_NAMES[name];
6664
+ const key = name === "limit" ? op$1.pageSize ?? "limit" : QUERY_NAMES[name];
6385
6665
  if (!key) continue;
6386
6666
  const v = flagValue(flags, name);
6387
6667
  if (v === void 0 || v === null || v === "" || v === false) continue;
@@ -6389,29 +6669,42 @@ function queryFor(op$1, flags, positional) {
6389
6669
  }
6390
6670
  return qs;
6391
6671
  }
6672
+ function scopeFilters(op$1, scope) {
6673
+ return (op$1.filters ?? []).flatMap((filter) => {
6674
+ const value$1 = filterValue(filter, scope);
6675
+ if (!value$1) return [];
6676
+ const typed = filter.text ? value$1 : idValue(value$1);
6677
+ return [{
6678
+ field: filter.field,
6679
+ operator: "EQUALS",
6680
+ value: filter.list ? [typed] : typed
6681
+ }];
6682
+ });
6683
+ }
6392
6684
  async function collectPages(fetchPage, startOffset, limit) {
6393
6685
  const out = [];
6394
6686
  let offset = startOffset;
6395
6687
  for (let i = 0; i < MAX_PAGES; i++) {
6396
6688
  const page = await fetchPage(offset, limit);
6397
- const items = Array.isArray(page.data) ? page.data : [];
6689
+ const items = Array.isArray(page.result) ? page.result : [];
6398
6690
  out.push(...items);
6399
6691
  if (items.length === 0) break;
6400
6692
  offset += items.length;
6401
- const total = page.pagination?.totalResults;
6693
+ const total = page.pagination?.totalCount;
6402
6694
  if (typeof total === "number" && offset >= total) break;
6403
6695
  if (items.length < limit) break;
6404
6696
  }
6405
6697
  return {
6406
- data: out,
6698
+ result: out,
6407
6699
  pagination: {
6408
- totalResults: out.length,
6409
- startIndex: startOffset,
6410
- itemsPerPage: out.length
6700
+ offset: startOffset,
6701
+ pageSize: out.length,
6702
+ totalCount: out.length
6411
6703
  }
6412
6704
  };
6413
6705
  }
6414
- function resolveOperation(input) {
6706
+ const isBulkBody = (body) => Array.isArray(body) || isRecord(body) && Array.isArray(body.items);
6707
+ function resolveOperation(input, body) {
6415
6708
  const variants = asaVariants(input.group, input.action);
6416
6709
  if (variants.length === 0) {
6417
6710
  if (!asaGroups().includes(input.group)) throw new Error(`Unknown "asa ${input.group}". Use get|post|put|delete <path>, a raw path, docs, keys, or: ${asaGroups().join(" | ")}`);
@@ -6419,15 +6712,16 @@ function resolveOperation(input) {
6419
6712
  }
6420
6713
  const positional = variants[0]?.positional;
6421
6714
  const ids = positional === "id" || positional === "ids" ? splitList(input.positional) : [];
6715
+ const bulk = variants.some((v) => v.body === "bulk") && isBulkBody(body);
6422
6716
  const scope = {
6423
6717
  campaign: stringFlag(input.flags, "campaign"),
6424
6718
  adgroup: stringFlag(input.flags, "adgroup"),
6425
6719
  adamId: stringFlag(input.flags, "adam-id") ?? (positional === "adam-id" ? input.positional : void 0),
6426
6720
  ids,
6427
- adgroupLevel: input.flags.adgroupLevel === true
6721
+ bulk
6428
6722
  };
6429
- const needsId = variants.every((v) => placeholdersOf(v.path).includes("id") || v.body === "ids");
6430
- if ((positional === "id" || positional === "ids") && ids.length === 0 && needsId) throw new Error(`asa ${input.group} ${input.action} needs an id.`);
6723
+ const needsId = variants.every((v) => placeholdersOf(v.path).includes("id") || v.body === "bulk");
6724
+ if ((positional === "id" || positional === "ids") && ids.length === 0 && needsId && !bulk) throw new Error(`asa ${input.group} ${input.action} needs an id.`);
6431
6725
  if (positional === "adam-id" && !scope.adamId) throw new Error(`asa ${input.group} ${input.action} needs an App Store app id (adamId).`);
6432
6726
  return {
6433
6727
  op: selectVariant(variants, scope),
@@ -6435,113 +6729,103 @@ function resolveOperation(input) {
6435
6729
  };
6436
6730
  }
6437
6731
  async function runAsaOperation(api, appId, input, options) {
6438
- const { op: op$1, scope } = resolveOperation(input);
6439
- const path = fillPath(op$1.path, scope);
6440
6732
  const flags = input.flags;
6441
- const proxy = (method, p, body) => {
6442
- return asaProxy(api, appId, method, p, body, { orgId: options.orgId });
6733
+ const bodyInput = flagValue(flags, "body");
6734
+ const body = given(bodyInput) ? readJsonInput(bodyInput, "--body") : void 0;
6735
+ const { op: op$1, scope } = resolveOperation(input, body);
6736
+ const path = fillPath(op$1.path, scope);
6737
+ const proxy = (method, p, payload) => {
6738
+ return asaProxy(api, appId, method, p, payload, { adAccountId: options.adAccountId });
6443
6739
  };
6444
6740
  const all = flags.all === true;
6445
6741
  const limit = numberFlag(flags, "limit");
6446
6742
  const offset = numberFlag(flags, "offset") ?? 0;
6447
- if (op$1.body === "selector") {
6448
- const selector = buildSelector({
6449
- selector: flagValue(flags, "selector"),
6743
+ const send = async (payload) => ({
6744
+ op: op$1,
6745
+ path,
6746
+ response: await proxy(op$1.method, path, payload) ?? { result: null }
6747
+ });
6748
+ if (op$1.body === "query" || op$1.body === "report") {
6749
+ const query$1 = {
6750
+ query: flagValue(flags, "query"),
6450
6751
  field: stringFlag(flags, "field"),
6451
6752
  op: stringFlag(flags, "op"),
6452
6753
  values: stringFlag(flags, "values"),
6453
6754
  orderBy: stringFlag(flags, "order-by"),
6454
6755
  fields: stringFlag(flags, "fields"),
6455
6756
  limit,
6456
- offset: numberFlag(flags, "offset")
6457
- });
6458
- if (all) return {
6459
- op: op$1,
6460
- path,
6461
- response: await collectPages((pageOffset, pageLimit) => {
6462
- const pagination = {
6463
- offset: pageOffset,
6464
- limit: pageLimit
6465
- };
6466
- return proxy(op$1.method, path, {
6467
- ...selector,
6468
- pagination
6469
- });
6470
- }, offset, limit ?? DEFAULT_PAGE)
6757
+ offset: numberFlag(flags, "offset"),
6758
+ filters: scopeFilters(op$1, scope)
6471
6759
  };
6472
- return {
6473
- op: op$1,
6474
- path,
6475
- response: await proxy(op$1.method, path, selector)
6476
- };
6477
- }
6478
- if (op$1.body === "report") {
6479
- const report = buildReport({
6760
+ const request = op$1.body === "report" ? buildReport({
6761
+ ...query$1,
6480
6762
  start: stringFlag(flags, "start"),
6481
6763
  end: stringFlag(flags, "end"),
6482
6764
  granularity: stringFlag(flags, "granularity"),
6483
6765
  groupBy: stringFlag(flags, "group-by"),
6484
- selector: flagValue(flags, "selector"),
6485
6766
  timeZone: stringFlag(flags, "time-zone"),
6486
- searchTerms: op$1.action === "searchterms"
6487
- });
6767
+ zoned: op$1.zoned === true
6768
+ }) : buildQuery(query$1);
6769
+ if (!all) return send(request);
6488
6770
  return {
6489
6771
  op: op$1,
6490
6772
  path,
6491
- response: await proxy(op$1.method, path, report)
6773
+ response: await collectPages((pageOffset, pageSize) => {
6774
+ return proxy(op$1.method, path, {
6775
+ ...request,
6776
+ pagination: {
6777
+ offset: pageOffset,
6778
+ pageSize,
6779
+ fetchTotalCount: true
6780
+ }
6781
+ });
6782
+ }, offset, limit ?? DEFAULT_PAGE)
6492
6783
  };
6493
6784
  }
6494
- if (op$1.body === "ids") return {
6495
- op: op$1,
6496
- path,
6497
- response: await proxy(op$1.method, path, scope.ids.map(idValue))
6498
- };
6785
+ if (op$1.body === "bulk") {
6786
+ if (op$1.flags === void 0) {
6787
+ if (isBulkBody(body)) return send(await bulkBody(op$1, {}, {}, body, [], options.account.currency));
6788
+ return send({ items: scope.ids.map((id$1, index) => bulkItem({ id: idValue(id$1) }, index)) });
6789
+ }
6790
+ return send(await bulkBody(op$1, flags, input.params, body, scope.ids, options.account.currency));
6791
+ }
6792
+ if (op$1.body === "array") return send(arrayBody(op$1, body));
6499
6793
  if (op$1.body === "geo") {
6500
6794
  const entity = stringFlag(flags, "entity");
6501
6795
  if (!entity) throw new Error("asa geo get needs --entity <Country|AdminArea|Locality>.");
6502
- const body = scope.ids.map((id$1) => ({
6503
- id: id$1,
6504
- entity
6505
- }));
6506
- return {
6507
- op: op$1,
6508
- path,
6509
- response: await proxy(op$1.method, path, body)
6510
- };
6511
- }
6512
- if (op$1.body === "array") {
6513
- const body = await arrayBody(op$1, flags, input.params, scope.ids, options.currency);
6514
- return {
6515
- op: op$1,
6516
- path,
6517
- response: await proxy(op$1.method, path, body)
6796
+ const request = {
6797
+ geoRequest: scope.ids.map((id$1) => ({
6798
+ id: id$1,
6799
+ entity
6800
+ })),
6801
+ supplySource: stringFlag(flags, "supply-source") ?? "APPSTORE"
6518
6802
  };
6519
- }
6520
- if (op$1.body === "object") {
6521
- const body = await objectBody(op$1, flags, input.params, options.currency);
6522
- const payload = op$1.envelope ? { [op$1.envelope]: body } : body;
6523
- return {
6524
- op: op$1,
6525
- path,
6526
- response: await proxy(op$1.method, path, payload)
6803
+ if (limit !== void 0 || numberFlag(flags, "offset") !== void 0) request.pagination = {
6804
+ offset,
6805
+ pageSize: limit ?? 20
6527
6806
  };
6807
+ return send(request);
6528
6808
  }
6809
+ if (op$1.body === "object") return send(await objectBody(op$1, flags, input.params, body, options));
6529
6810
  if (op$1.method === "GET") {
6530
6811
  const qs = queryFor(op$1, flags, input.positional);
6531
6812
  for (const [key, value$1] of Object.entries(input.params)) {
6532
6813
  if (typeof value$1 === "object" && value$1 !== null) throw new Error(`Nested -d params aren't supported on GET (got "${key}").`);
6533
6814
  qs.set(key, String(value$1));
6534
6815
  }
6535
- if (op$1.paged === "query" && all) return {
6536
- op: op$1,
6537
- path,
6538
- response: await collectPages((pageOffset, pageLimit) => {
6539
- const page = new URLSearchParams(qs);
6540
- page.set("offset", String(pageOffset));
6541
- page.set("limit", String(pageLimit));
6542
- return proxy("GET", withQuery$1(path, page));
6543
- }, offset, limit ?? DEFAULT_PAGE)
6544
- };
6816
+ if (op$1.paged && all) {
6817
+ const sizeParam = op$1.pageSize ?? "limit";
6818
+ return {
6819
+ op: op$1,
6820
+ path,
6821
+ response: await collectPages((pageOffset, pageLimit) => {
6822
+ const page = new URLSearchParams(qs);
6823
+ page.set("offset", String(pageOffset));
6824
+ page.set(sizeParam, String(pageLimit));
6825
+ return proxy("GET", withQuery$1(path, page));
6826
+ }, offset, limit ?? DEFAULT_PAGE)
6827
+ };
6828
+ }
6545
6829
  return {
6546
6830
  op: op$1,
6547
6831
  path,
@@ -6551,26 +6835,49 @@ async function runAsaOperation(api, appId, input, options) {
6551
6835
  return {
6552
6836
  op: op$1,
6553
6837
  path,
6554
- response: await proxy(op$1.method, path) ?? { data: null }
6838
+ response: await proxy(op$1.method, path) ?? { result: null }
6555
6839
  };
6556
6840
  }
6557
- function currencyResolver(api, appId, explicit, orgId) {
6558
- let cached;
6559
- return () => {
6560
- if (explicit) return Promise.resolve(explicit.toUpperCase());
6561
- cached ??= (async () => {
6562
- const acls = await asaProxy(api, appId, "GET", "/acls");
6563
- const rows = Array.isArray(acls.data) ? acls.data.filter(isRecord) : [];
6564
- if (orgId) {
6565
- const match = rows.find((r) => String(r.orgId) === orgId && typeof r.currency === "string");
6566
- if (match) return String(match.currency).toUpperCase();
6567
- }
6568
- const currencies = [...new Set(rows.map((r) => r.currency).filter((c) => typeof c === "string"))];
6569
- const [only] = currencies;
6570
- if (currencies.length === 1 && only) return only.toUpperCase();
6571
- throw new Error(currencies.length === 0 ? "Couldn't determine the account currency from Apple Search Ads. Pass --currency (e.g. USD)." : `This API user spans several currencies (${currencies.join(", ")}). Pass --currency or --org-id.`);
6572
- })();
6573
- return cached;
6841
+ function aclAccounts(acls) {
6842
+ const result = acls && isRecord(acls.result) ? acls.result : {};
6843
+ return (Array.isArray(result.acls) ? result.acls.filter(isRecord) : []).map((r) => r.adAccount).filter(isRecord);
6844
+ }
6845
+ const currencyOf = (account) => {
6846
+ return account && typeof account.currency === "string" && account.currency ? account.currency.toUpperCase() : void 0;
6847
+ };
6848
+ function accountResolver(api, appId, explicitCurrency, adAccountId) {
6849
+ let accounts;
6850
+ let cachedCurrency;
6851
+ const choose = async (forCurrency) => {
6852
+ accounts ??= asaProxy(api, appId, "GET", "/acls").then(aclAccounts);
6853
+ const list$1 = await accounts;
6854
+ const account = adAccountId ? list$1.find((a) => String(a.id) === adAccountId) : list$1.length === 1 ? list$1[0] : void 0;
6855
+ if (account) return account;
6856
+ const ids = list$1.map((a) => String(a.id)).join(", ");
6857
+ if (adAccountId) {
6858
+ const reach = ids ? ` It reaches: ${ids}.` : "";
6859
+ const skip = forCurrency ? " Pass --currency (e.g. USD) to skip the lookup." : "";
6860
+ throw new Error(`This API user can't reach ad account ${adAccountId}.${reach}${skip}`);
6861
+ }
6862
+ if (!ids) throw new Error(`This API user can't reach any Apple Ads ad account.${forCurrency ? " Pass --currency (e.g. USD)." : ""}`);
6863
+ throw new Error(`This API user reaches several ad accounts (${ids}). Pass --ad-account-id${forCurrency ? " or --currency" : ""}.`);
6864
+ };
6865
+ return {
6866
+ id: async () => adAccountId ?? String((await choose(false)).id),
6867
+ currency: () => {
6868
+ if (explicitCurrency) return Promise.resolve(explicitCurrency.toUpperCase());
6869
+ cachedCurrency ??= (async () => {
6870
+ const account = await choose(true);
6871
+ const listed = currencyOf(account);
6872
+ if (listed) return listed;
6873
+ const id$1 = String(account.id);
6874
+ const detail = await asaProxy(api, appId, "GET", `/ad-accounts/${encodeURIComponent(id$1)}`, void 0, { adAccountId: id$1 });
6875
+ const currency = currencyOf(detail && isRecord(detail.result) ? detail.result : void 0);
6876
+ if (!currency) throw new Error(`Couldn't read ad account ${id$1}'s currency from Apple Ads. Pass --currency (e.g. USD).`);
6877
+ return currency;
6878
+ })();
6879
+ return cachedCurrency;
6880
+ }
6574
6881
  };
6575
6882
  }
6576
6883
 
@@ -6598,7 +6905,7 @@ function rowMeta(row) {
6598
6905
  const parts = [];
6599
6906
  for (const key of [
6600
6907
  "status",
6601
- "servingStatus",
6908
+ "displayStatus",
6602
6909
  "matchType",
6603
6910
  "state",
6604
6911
  "type",
@@ -6608,7 +6915,9 @@ function rowMeta(row) {
6608
6915
  const v = row[key];
6609
6916
  if (typeof v === "string" && v) parts.push(v);
6610
6917
  }
6611
- const bid = row.bidAmount ?? row.dailyBudgetAmount ?? row.defaultBidAmount;
6918
+ const budget = isRecord(row.dailyBudget) ? row.dailyBudget.value : void 0;
6919
+ const strategyBid = isRecord(row.bidStrategy) ? row.bidStrategy.bid : void 0;
6920
+ const bid = row.bid ?? strategyBid ?? budget;
6612
6921
  if (isRecord(bid) && bid.amount !== void 0) parts.push(`${String(bid.amount)} ${String(bid.currency ?? "")}`.trim());
6613
6922
  const id$1 = row.id ?? row.adamId ?? row.orgId;
6614
6923
  if (id$1 !== void 0) parts.push(String(id$1));
@@ -6616,11 +6925,11 @@ function rowMeta(row) {
6616
6925
  }
6617
6926
  function printResult(ctx, op$1, response) {
6618
6927
  if (ctx.json) return ctx.output.data(response);
6619
- const rows = Array.isArray(response.data) ? response.data.filter(isRecord) : void 0;
6620
- const listing = op$1.action === "list" || op$1.action === "find" || op$1.action === "search" || op$1.action === "assets";
6928
+ const rows = Array.isArray(response.result) ? response.result.filter(isRecord) : void 0;
6929
+ const listing = op$1.body === "query" || op$1.action === "search";
6621
6930
  if (!rows || !listing) return ctx.output.data(response);
6622
6931
  if (rows.length === 0) return ctx.ui.step(`No ${op$1.group} found`);
6623
- const total = response.pagination?.totalResults;
6932
+ const total = response.pagination?.totalCount;
6624
6933
  const count = typeof total === "number" && total > rows.length ? `${rows.length} of ${total}` : String(rows.length);
6625
6934
  ctx.ui.step(`${count} ${op$1.group}`);
6626
6935
  for (const row of rows) ctx.ui.info(`\`${rowLabel(row)}\` ${rowMeta(row)}`);
@@ -6633,14 +6942,26 @@ function describeAppleError(error, request) {
6633
6942
  const parsed = error.body ? parseJson(error.body) : void 0;
6634
6943
  if (!isRecord(parsed)) return void 0;
6635
6944
  if (parsed.error === "credentials_not_found" || parsed.error === "invalid_credentials") return /* @__PURE__ */ new Error(`${error.message}\n${CONNECT_HINT}`);
6636
- const apple = isRecord(parsed.error) && Array.isArray(parsed.error.errors) ? parsed.error.errors : void 0;
6637
- if (!apple || apple.length === 0) return void 0;
6638
- const lines = apple.filter(isRecord).map((e) => {
6945
+ const lines = appleErrorLines(parsed.error);
6946
+ if (lines.length === 0) return void 0;
6947
+ return /* @__PURE__ */ new Error(`Apple Search Ads rejected ${request} (${error.status}):\n${lines.join("\n")}`);
6948
+ }
6949
+ function appleErrorLines(error) {
6950
+ if (!isRecord(error)) return [];
6951
+ if (Array.isArray(error.errors)) return error.errors.filter(isRecord).map((e) => {
6639
6952
  const field$1 = typeof e.field === "string" && e.field ? `${e.field}: ` : "";
6640
6953
  const code = typeof e.messageCode === "string" && e.messageCode ? ` (${e.messageCode})` : "";
6641
6954
  return ` • ${field$1}${String(e.message ?? "")}${code}`;
6642
6955
  });
6643
- return /* @__PURE__ */ new Error(`Apple Search Ads rejected ${request} (${error.status}):\n${lines.join("\n")}`);
6956
+ if (typeof error.code !== "string") return [];
6957
+ const details = Array.isArray(error.details) ? error.details.filter(isRecord) : [];
6958
+ if (details.length === 0) return [` • ${String(error.message ?? error.code)} (${error.code})`];
6959
+ return details.map((d) => {
6960
+ const info = isRecord(d.info) ? d.info : {};
6961
+ const field$1 = typeof info.field === "string" && info.field ? `${info.field}: ` : "";
6962
+ const code = typeof d.code === "string" && d.code ? ` (${d.code})` : "";
6963
+ return ` • ${field$1}${String(d.message ?? error.message ?? "")}${code}`;
6964
+ });
6644
6965
  }
6645
6966
  async function withAppleErrors(request, work) {
6646
6967
  try {
@@ -6668,20 +6989,20 @@ async function resolveAsaApp(ctx, base) {
6668
6989
  };
6669
6990
  }
6670
6991
  async function runAsaRequest(ctx, base, request) {
6671
- const { verb, path, orgId } = request;
6992
+ const { verb, path, adAccountId } = request;
6672
6993
  const params = parseParams(request.data);
6673
6994
  if (!path.startsWith("/")) throw new Error(`Path must start with "/", e.g. /campaigns`);
6674
6995
  const { app: app$1, api } = await resolveAsaApp(ctx, base);
6675
6996
  const label = `${verb.toUpperCase()} ${path}`;
6676
6997
  return withAppleErrors(label, () => {
6677
6998
  return apiCall(ctx, label, () => {
6678
- if (verb === "get" || verb === "delete") return asaProxy(api, app$1.id, verb, withQuery$1(path, params), void 0, { orgId });
6999
+ if (verb === "get" || verb === "delete") return asaProxy(api, app$1.id, verb, withQuery$1(path, params), void 0, { adAccountId });
6679
7000
  const body = request.body ? readJsonInput(request.body, "--body") : params;
6680
7001
  const payload = isRecord(body) ? {
6681
7002
  ...body,
6682
7003
  ...params
6683
7004
  } : body;
6684
- return asaProxy(api, app$1.id, verb, path, payload, { orgId });
7005
+ return asaProxy(api, app$1.id, verb, path, payload, { adAccountId });
6685
7006
  });
6686
7007
  });
6687
7008
  }
@@ -6709,13 +7030,13 @@ async function runAsa(ctx, { words, flags }) {
6709
7030
  }
6710
7031
  if (extra.length) throw new Error(`\`superwall asa\` doesn't take "${extra.join(" ")}".`);
6711
7032
  const data$1 = listOf(flags.d);
6712
- const orgId = textField(flags, "orgId");
7033
+ const adAccountId = textField(flags, "adAccountId");
6713
7034
  if (target.startsWith("/")) return ctx.output.data(await runAsaRequest(ctx, ctx.api, {
6714
7035
  verb: "get",
6715
7036
  path: target,
6716
7037
  data: data$1,
6717
- orgId
6718
- }));
7038
+ adAccountId
7039
+ }) ?? { ok: true });
6719
7040
  const params = parseParams(data$1);
6720
7041
  if (!asaGroups().includes(target)) throw new Error(`asa has no "${target}". It takes: ${asaGroups().join(", ")}, docs, keys, get, post, put, delete, or a /path.\nRun superwall asa --help for what each does.`);
6721
7042
  const resolvedAction = action ?? (target === "me" ? "get" : "list");
@@ -6728,12 +7049,12 @@ async function runAsa(ctx, { words, flags }) {
6728
7049
  flags,
6729
7050
  params
6730
7051
  };
6731
- const currency = currencyResolver(api, asaApp.id, textField(flags, "currency"), orgId);
7052
+ const account = accountResolver(api, asaApp.id, textField(flags, "currency"), adAccountId);
6732
7053
  const label = `asa ${input.group} ${input.action}`;
6733
7054
  const result = await withAppleErrors(label, () => {
6734
7055
  return apiCall(ctx, label, () => runAsaOperation(api, asaApp.id, input, {
6735
- orgId,
6736
- currency
7056
+ adAccountId,
7057
+ account
6737
7058
  }));
6738
7059
  });
6739
7060
  printResult(ctx, result.op, result.response);
@@ -6771,7 +7092,7 @@ const POSITIONAL = {
6771
7092
  }
6772
7093
  }
6773
7094
  };
6774
- const PLACEHOLDER = {
7095
+ const SCOPE = {
6775
7096
  campaign: {
6776
7097
  name: "campaign",
6777
7098
  describe: "Campaign id"
@@ -6780,7 +7101,7 @@ const PLACEHOLDER = {
6780
7101
  name: "adgroup",
6781
7102
  describe: "Ad group id"
6782
7103
  },
6783
- adamId: {
7104
+ "adam-id": {
6784
7105
  name: "adam_id",
6785
7106
  describe: "App Store app id (adamId)"
6786
7107
  }
@@ -6808,34 +7129,19 @@ function schemaOfFlag$1(flag$1) {
6808
7129
  description: flag$1.describe
6809
7130
  };
6810
7131
  }
7132
+ const SUPPLY_SOURCE = {
7133
+ type: "string",
7134
+ enum: ["APPSTORE", "MAPS"],
7135
+ description: "Supply source (default APPSTORE)"
7136
+ };
6811
7137
  const QUERY = {
6812
- fields: {
6813
- type: "string",
6814
- description: "Comma-separated fields to return"
6815
- },
6816
- field: {
6817
- type: "string",
6818
- description: "Selector shorthand: field name (with op and values)"
6819
- },
6820
- op: {
6821
- type: "string",
6822
- description: "Selector shorthand: EQUALS, IN, CONTAINS, STARTSWITH, ..."
6823
- },
6824
- values: {
6825
- type: "string",
6826
- description: "Selector shorthand: comma-separated values"
6827
- },
6828
- "order-by": {
6829
- type: "string",
6830
- description: "Selector sort: field[:asc|desc]"
6831
- },
6832
- name: {
6833
- type: "string",
6834
- description: "Name to filter by"
7138
+ owned: {
7139
+ type: "boolean",
7140
+ description: "Only apps this account owns"
6835
7141
  },
6836
- states: {
7142
+ "store-fronts": {
6837
7143
  type: "string",
6838
- description: "Comma-separated states"
7144
+ description: "Comma-separated storefronts"
6839
7145
  },
6840
7146
  country: {
6841
7147
  type: "string",
@@ -6850,29 +7156,36 @@ const QUERY = {
6850
7156
  ],
6851
7157
  description: "What kind of place to search for"
6852
7158
  },
6853
- countries: {
6854
- type: "string",
6855
- description: "Comma-separated country codes"
7159
+ "supply-source": SUPPLY_SOURCE,
7160
+ eligible: {
7161
+ type: "boolean",
7162
+ description: "Only places that can be targeted"
6856
7163
  },
6857
- "device-classes": {
7164
+ "resource-type": {
6858
7165
  type: "string",
6859
- description: "Comma-separated device classes"
7166
+ description: "Advertiser resource type, e.g. CONTENT_PROVIDER"
7167
+ }
7168
+ };
7169
+ const QUERY_BODY = {
7170
+ query: {
7171
+ type: "object",
7172
+ description: "An Apple query request: filters, sorting, pagination"
6860
7173
  },
6861
- "language-codes": {
7174
+ field: {
6862
7175
  type: "string",
6863
- description: "Comma-separated language codes"
7176
+ description: "Filter shorthand: field name (with op and values)"
6864
7177
  },
6865
- expand: {
6866
- type: "boolean",
6867
- description: "Include nested versions"
7178
+ op: {
7179
+ type: "string",
7180
+ description: "Filter shorthand: EQUALS, IN, LIKE, STARTS_WITH, BETWEEN, ..."
6868
7181
  },
6869
- owned: {
6870
- type: "boolean",
6871
- description: "Only apps this org owns"
7182
+ values: {
7183
+ type: "string",
7184
+ description: "Filter shorthand: comma-separated values"
6872
7185
  },
6873
- "include-deleted-assets": {
6874
- type: "boolean",
6875
- description: "Include deleted assets"
7186
+ order_by: {
7187
+ type: "string",
7188
+ description: "Sort: field[:asc|desc]"
6876
7189
  }
6877
7190
  };
6878
7191
  const snake = (flag$1) => flag$1.replace(/-/g, "_");
@@ -6884,9 +7197,9 @@ function toolOf$1(group$1, action) {
6884
7197
  type: "string",
6885
7198
  description: "The Superwall app whose Apple Search Ads account to use, when several have it connected"
6886
7199
  },
6887
- org_id: {
7200
+ ad_account_id: {
6888
7201
  type: "string",
6889
- description: "Apple Search Ads org id, when the API user spans several"
7202
+ description: "Apple Ads ad account id, when the API user reaches several"
6890
7203
  }
6891
7204
  };
6892
7205
  const positionals = [];
@@ -6895,33 +7208,36 @@ function toolOf$1(group$1, action) {
6895
7208
  if (positional) {
6896
7209
  properties[positional.name] = positional.schema;
6897
7210
  positionals.push(positional.name);
6898
- if (variants.every((variant) => variant.positional === first?.positional)) required.push(positional.name);
6899
- }
6900
- for (const placeholder$1 of first ? placeholdersOf(first.path) : []) {
6901
- const named = PLACEHOLDER[placeholder$1];
6902
- if (named && variants.every((variant) => placeholdersOf(variant.path).includes(placeholder$1))) required.push(named.name);
7211
+ if (!variants.some((variant) => variant.body === "bulk") && variants.every((variant) => variant.positional === first?.positional)) required.push(positional.name);
6903
7212
  }
6904
7213
  for (const variant of variants) {
6905
- for (const placeholder$1 of placeholdersOf(variant.path)) {
6906
- const named = PLACEHOLDER[placeholder$1];
6907
- if (named && !properties[named.name]) properties[named.name] = {
7214
+ if (placeholdersOf(variant.path).includes("adamId") && variant.positional !== "adam-id") {
7215
+ properties.adam_id ??= {
7216
+ type: "string",
7217
+ description: "App Store app id (adamId)"
7218
+ };
7219
+ required.push("adam_id");
7220
+ }
7221
+ for (const filter of variant.filters ?? []) {
7222
+ const scope = SCOPE[filter.flag];
7223
+ if (!scope) continue;
7224
+ properties[scope.name] ??= {
6908
7225
  type: "string",
6909
- description: named.describe
7226
+ description: `${scope.describe}: only rows for it`
6910
7227
  };
7228
+ if (filter.required) required.push(scope.name);
6911
7229
  }
6912
7230
  for (const flag$1 of variant.flags ?? []) properties[snake(flag$1.flag)] ??= schemaOfFlag$1(flag$1);
6913
7231
  for (const name of variant.query ?? []) {
6914
7232
  const schema = QUERY[name];
6915
7233
  if (schema) properties[snake(name)] ??= schema;
6916
7234
  }
6917
- if (variant.body === "object" || variant.body === "array") properties.body = {
7235
+ if (variant.body === "object" || variant.body === "bulk" || variant.body === "array") properties.body = {
6918
7236
  type: ["object", "array"],
6919
7237
  description: "The whole request body, as Apple documents it"
6920
7238
  };
6921
- if (variant.body === "selector" || variant.body === "report") properties.selector = {
6922
- type: "object",
6923
- description: "An Apple selector: conditions, orderBy, pagination"
6924
- };
7239
+ if (variant.body === "array") required.push("body");
7240
+ if (variant.body === "query" || variant.body === "report") Object.assign(properties, QUERY_BODY);
6925
7241
  if (variant.body === "report") {
6926
7242
  properties.start = {
6927
7243
  type: "string",
@@ -6931,10 +7247,22 @@ function toolOf$1(group$1, action) {
6931
7247
  type: "string",
6932
7248
  description: "Last day, YYYY-MM-DD"
6933
7249
  };
6934
- properties.time_zone = {
7250
+ properties.granularity = {
7251
+ type: "string",
7252
+ description: "HOURLY, DAILY, WEEKLY or MONTHLY (default DAILY)"
7253
+ };
7254
+ properties.group_by = {
7255
+ type: "string",
7256
+ description: "Comma-separated dimensions, e.g. countryOrRegion"
7257
+ };
7258
+ properties.fields = {
7259
+ type: "string",
7260
+ description: "Comma-separated fields to return"
7261
+ };
7262
+ if (variant.zoned) properties.time_zone = {
6935
7263
  type: "string",
6936
7264
  enum: ["UTC", "ORTZ"],
6937
- description: "Report time zone"
7265
+ description: "Report time zone (default UTC)"
6938
7266
  };
6939
7267
  required.push("start", "end");
6940
7268
  }
@@ -6948,6 +7276,7 @@ function toolOf$1(group$1, action) {
6948
7276
  ],
6949
7277
  description: "What kind of place the ids are"
6950
7278
  };
7279
+ properties.supply_source = SUPPLY_SOURCE;
6951
7280
  required.push("entity");
6952
7281
  }
6953
7282
  if (variant.paged) {
@@ -6968,10 +7297,6 @@ function toolOf$1(group$1, action) {
6968
7297
  type: "string",
6969
7298
  description: "Currency for amounts"
6970
7299
  };
6971
- if (variant.level === "adgroup") properties.adgroup_level = {
6972
- type: "boolean",
6973
- description: "Ad group negative keywords instead of the campaign's"
6974
- };
6975
7300
  }
6976
7301
  const effect = variants.some((variant) => variant.effect === "destructive") ? "destructive" : variants.every((variant) => variant.effect === "read") ? "read" : "write";
6977
7302
  return {
@@ -6992,18 +7317,19 @@ async function listAsaTools() {
6992
7317
 
6993
7318
  //#endregion
6994
7319
  //#region src/commands/apple-search-ads/asa.ts
6995
- const command$38 = defineCatalog({
7320
+ const command$39 = defineCatalog({
6996
7321
  name: "asa",
6997
- summary: "The Apple Search Ads API through Superwall's proxy: no key or token handling",
7322
+ summary: "The Apple Ads Platform API (v1) through Superwall's proxy: no key or token handling",
7323
+ strictFlags: true,
6998
7324
  flags: {
6999
7325
  app: {
7000
7326
  ...app,
7001
7327
  describe: "Superwall app id or name (if several have Apple Search Ads connected)"
7002
7328
  },
7003
- orgId: {
7329
+ adAccountId: {
7004
7330
  type: "string",
7005
7331
  value: "id",
7006
- describe: "Apple Search Ads org id (X-AP-Context), if the API user spans several"
7332
+ describe: "Apple Ads ad account id (X-AP-Context), if the API user reaches several"
7007
7333
  },
7008
7334
  campaign: {
7009
7335
  type: "string",
@@ -7029,32 +7355,32 @@ const command$38 = defineCatalog({
7029
7355
  value: "json",
7030
7356
  describe: "Request body as JSON: inline, @file, or @- for stdin"
7031
7357
  },
7032
- selector: {
7358
+ query: {
7033
7359
  type: "string",
7034
7360
  value: "json",
7035
- describe: "Apple selector as JSON (find, reports): inline, @file, or @-"
7361
+ describe: "Apple query request as JSON (lists, reports): filters, sorting, pagination"
7036
7362
  },
7037
7363
  field: {
7038
7364
  type: "string",
7039
- describe: "Selector shorthand: field name (with --op and --values)"
7365
+ describe: "Filter shorthand: field name (with --op and --values)"
7040
7366
  },
7041
7367
  op: {
7042
7368
  type: "string",
7043
- describe: "Selector shorthand: EQUALS, IN, CONTAINS, STARTSWITH, ..."
7369
+ describe: "Filter shorthand: EQUALS, IN, LIKE, STARTS_WITH, BETWEEN, ..."
7044
7370
  },
7045
7371
  values: {
7046
7372
  type: "string",
7047
- describe: "Selector shorthand: comma-separated values"
7373
+ describe: "Filter shorthand: comma-separated values"
7048
7374
  },
7049
7375
  orderBy: {
7050
7376
  type: "string",
7051
7377
  value: "field[:asc|desc]",
7052
- describe: "Selector sort: field[:asc|desc]"
7378
+ describe: "Sort: field[:asc|desc]"
7053
7379
  },
7054
7380
  fields: {
7055
7381
  type: "string",
7056
7382
  value: "a,b",
7057
- describe: "Comma-separated fields to return (partial fetch)"
7383
+ describe: "Comma-separated fields to return (reports)"
7058
7384
  },
7059
7385
  limit: {
7060
7386
  type: "number",
@@ -7070,7 +7396,7 @@ const command$38 = defineCatalog({
7070
7396
  },
7071
7397
  currency: {
7072
7398
  type: "string",
7073
- describe: "Currency for money flags (defaults to the account's)"
7399
+ describe: "Currency for money flags (defaults to the ad account's)"
7074
7400
  },
7075
7401
  name: {
7076
7402
  type: "string",
@@ -7078,39 +7404,47 @@ const command$38 = defineCatalog({
7078
7404
  },
7079
7405
  status: {
7080
7406
  type: "string",
7081
- describe: "ENABLED, PAUSED (keywords: ACTIVE, PAUSED)"
7407
+ describe: "ENABLED or PAUSED"
7082
7408
  },
7083
7409
  countries: {
7084
7410
  type: "string",
7085
- describe: "Comma-separated country codes"
7086
- },
7087
- budget: {
7088
- type: "string",
7089
- describe: "Lifetime budget amount"
7411
+ describe: "Comma-separated country or region codes"
7090
7412
  },
7091
7413
  dailyBudget: {
7092
7414
  type: "string",
7093
7415
  describe: "Daily budget amount"
7094
7416
  },
7417
+ amount: {
7418
+ type: "string",
7419
+ describe: "Budget order amount"
7420
+ },
7095
7421
  supplySources: {
7096
7422
  type: "string",
7097
- describe: "Comma-separated supply sources"
7423
+ describe: "Comma-separated supply sources (APPSTORE, MAPS)"
7098
7424
  },
7099
- adChannelType: {
7425
+ supplyPlacements: {
7100
7426
  type: "string",
7101
- describe: "SEARCH or DISPLAY"
7427
+ describe: "Comma-separated placements"
7428
+ },
7429
+ promotedType: {
7430
+ type: "string",
7431
+ describe: "APPSTORE_APP (default) or BUSINESS_BRAND"
7102
7432
  },
7103
7433
  billingEvent: {
7104
7434
  type: "string",
7105
7435
  describe: "TAPS or IMPRESSIONS"
7106
7436
  },
7107
- defaultBid: {
7437
+ bidStrategy: {
7438
+ type: "string",
7439
+ describe: "Bid strategy type, e.g. MANUAL_CPT"
7440
+ },
7441
+ bidGoal: {
7108
7442
  type: "string",
7109
- describe: "Ad group default bid"
7443
+ describe: "Bid strategy goal, e.g. TAP"
7110
7444
  },
7111
- cpaGoal: {
7445
+ pricingModel: {
7112
7446
  type: "string",
7113
- describe: "Ad group CPA goal"
7447
+ describe: "Ad group pricing model: CPT, CPM or CPA"
7114
7448
  },
7115
7449
  searchMatch: {
7116
7450
  type: "boolean",
@@ -7122,11 +7456,11 @@ const command$38 = defineCatalog({
7122
7456
  },
7123
7457
  matchType: {
7124
7458
  type: "string",
7125
- describe: "BROAD or EXACT"
7459
+ describe: "EXACT, BROAD, PHRASE or CATEGORY"
7126
7460
  },
7127
7461
  bid: {
7128
7462
  type: "string",
7129
- describe: "Keyword bid amount"
7463
+ describe: "Bid amount"
7130
7464
  },
7131
7465
  creativeId: {
7132
7466
  type: "string",
@@ -7142,11 +7476,11 @@ const command$38 = defineCatalog({
7142
7476
  },
7143
7477
  start: {
7144
7478
  type: "string",
7145
- describe: "Start date (YYYY-MM-DD)"
7479
+ describe: "Start (reports: YYYY-MM-DD)"
7146
7480
  },
7147
7481
  end: {
7148
7482
  type: "string",
7149
- describe: "End date (YYYY-MM-DD)"
7483
+ describe: "End (reports: YYYY-MM-DD)"
7150
7484
  },
7151
7485
  granularity: {
7152
7486
  type: "string",
@@ -7154,23 +7488,19 @@ const command$38 = defineCatalog({
7154
7488
  },
7155
7489
  groupBy: {
7156
7490
  type: "string",
7157
- describe: "Report dimension (e.g. countryOrRegion)"
7491
+ describe: "Report dimensions (e.g. countryOrRegion)"
7158
7492
  },
7159
7493
  timeZone: {
7160
7494
  type: "string",
7161
7495
  describe: "Report time zone: UTC or ORTZ"
7162
7496
  },
7163
- dimensions: {
7164
- type: "string",
7165
- describe: "Impression share dimensions"
7166
- },
7167
- metrics: {
7168
- type: "string",
7169
- describe: "Impression share metrics"
7170
- },
7171
7497
  owned: {
7172
7498
  type: "boolean",
7173
- describe: "apps search: only apps this org owns"
7499
+ describe: "apps search: only apps this account owns"
7500
+ },
7501
+ storeFronts: {
7502
+ type: "string",
7503
+ describe: "apps search: comma-separated storefronts"
7174
7504
  },
7175
7505
  country: {
7176
7506
  type: "string",
@@ -7180,29 +7510,17 @@ const command$38 = defineCatalog({
7180
7510
  type: "string",
7181
7511
  describe: "geo: Country, AdminArea, or Locality"
7182
7512
  },
7183
- adgroupLevel: {
7184
- type: "boolean",
7185
- describe: "negative-keywords find: search ad group negatives"
7186
- },
7187
- states: {
7513
+ supplySource: {
7188
7514
  type: "string",
7189
- describe: "product-pages list: comma-separated states"
7515
+ describe: "geo: APPSTORE (default) or MAPS"
7190
7516
  },
7191
- deviceClasses: {
7192
- type: "string",
7193
- describe: "product-pages: comma-separated device classes"
7194
- },
7195
- languageCodes: {
7196
- type: "string",
7197
- describe: "product-pages: comma-separated language codes"
7198
- },
7199
- expand: {
7517
+ eligible: {
7200
7518
  type: "boolean",
7201
- describe: "product-pages: include nested versions"
7519
+ describe: "geo search: only targetable places"
7202
7520
  },
7203
- includeDeletedAssets: {
7204
- type: "boolean",
7205
- describe: "product-pages: include deleted assets"
7521
+ resourceType: {
7522
+ type: "string",
7523
+ describe: "ad-accounts resources: e.g. CONTENT_PROVIDER"
7206
7524
  }
7207
7525
  },
7208
7526
  operations: asaGroups,
@@ -7224,11 +7542,11 @@ const command$38 = defineCatalog({
7224
7542
 
7225
7543
  //#endregion
7226
7544
  //#region src/commands/apple-search-ads/api/delete.ts
7227
- const command$39 = defineCommand({
7545
+ const command$40 = defineCommand({
7228
7546
  name: "asa delete",
7229
7547
  summary: "Any DELETE request to the Apple Search Ads API",
7230
7548
  args: { path: {
7231
- describe: "Apple Search Ads API path, e.g. /campaigns (the /api/v5 prefix is added)",
7549
+ describe: "Apple Search Ads API path, e.g. /campaigns (the /v1 prefix is added)",
7232
7550
  required: true
7233
7551
  } },
7234
7552
  flags: {
@@ -7236,10 +7554,10 @@ const command$39 = defineCommand({
7236
7554
  ...app,
7237
7555
  describe: "Superwall app id or name (if several have Apple Search Ads connected)"
7238
7556
  },
7239
- orgId: {
7557
+ adAccountId: {
7240
7558
  type: "string",
7241
7559
  value: "id",
7242
- describe: "Apple Search Ads org id (X-AP-Context), if the API user spans several"
7560
+ describe: "Apple Ads ad account id (X-AP-Context), if the API user reaches several"
7243
7561
  },
7244
7562
  d: {
7245
7563
  ...data,
@@ -7256,7 +7574,7 @@ const command$39 = defineCommand({
7256
7574
  verb: "delete",
7257
7575
  path: args.path,
7258
7576
  data: flags.d,
7259
- orgId: flags.orgId
7577
+ adAccountId: flags.adAccountId
7260
7578
  });
7261
7579
  ctx.output.data(res ?? { ok: true });
7262
7580
  }
@@ -7264,7 +7582,7 @@ const command$39 = defineCommand({
7264
7582
 
7265
7583
  //#endregion
7266
7584
  //#region src/core/apple-search-ads/docs.ts
7267
- const APPLE_DOC_DATA_BASE = "https://developer.apple.com/tutorials/data/documentation/apple_ads";
7585
+ const APPLE_DOC_DATA_BASE = "https://developer.apple.com/tutorials/data/documentation/apple-ads-platform-api";
7268
7586
  async function downloadAppleDoc(url) {
7269
7587
  const res = await fetch(url, { headers: { accept: "application/json" } });
7270
7588
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
@@ -7277,10 +7595,10 @@ function usageOf$1(op$1) {
7277
7595
  if (op$1.positional === "ids") parts.push("<id[,id...]>");
7278
7596
  if (op$1.positional === "query") parts.push("<query>");
7279
7597
  if (op$1.positional === "adam-id") parts.push("<adam-id>");
7280
- for (const p of placeholdersOf(op$1.path)) {
7281
- if (p === "campaign") parts.push("--campaign <id>");
7282
- if (p === "adgroup") parts.push("--adgroup <id>");
7283
- if (p === "adamId" && op$1.positional !== "adam-id") parts.push("--adam-id <id>");
7598
+ if (placeholdersOf(op$1.path).includes("adamId") && op$1.positional !== "adam-id") parts.push("--adam-id <id>");
7599
+ for (const filter of op$1.filters ?? []) {
7600
+ if (filter.flag === "id" || filter.flag === "adam-id" && op$1.positional === "adam-id") continue;
7601
+ parts.push(filter.required ? `--${filter.flag} <id>` : `[--${filter.flag} <id>]`);
7284
7602
  }
7285
7603
  return parts.join(" ");
7286
7604
  }
@@ -7290,39 +7608,40 @@ function flagLines(op$1) {
7290
7608
  const value$1 = f.type === "boolean" ? "" : f.type === "money" ? " <amount>" : f.type === "list" ? " <a,b,c>" : f.type === "number" ? " <n>" : " <value>";
7291
7609
  lines.push(` --${f.flag}${value$1} ${f.describe} → \`${f.key}\``);
7292
7610
  }
7293
- if (op$1.body === "object" || op$1.body === "array") {
7611
+ if (op$1.body === "object" || op$1.body === "bulk") {
7294
7612
  lines.push(" -d key=value / key:=json Extra body fields (nesting via key[sub])");
7295
- lines.push(" --body <json|@file|@-> Full request body, sent as-is (merged under flags)");
7613
+ lines.push(" --body <json|@file|@-> Full request body (bulk: an array of items), merged under flags");
7296
7614
  }
7297
- if (op$1.body === "selector") {
7298
- lines.push(" --selector <json|@file|@-> Full Apple selector");
7299
- lines.push(" --field <f> --op <OP> --values <a,b> One-condition shorthand");
7615
+ if (op$1.body === "array") lines.push(" --body <json|@file|@-> The request body: an array, as Apple documents it");
7616
+ if (op$1.body === "query" || op$1.body === "report") {
7617
+ lines.push(" --query <json|@file|@-> Full Apple query request: filters, sorting, pagination");
7618
+ lines.push(" --field <f> --op <OP> --values <a,b> One-filter shorthand");
7300
7619
  lines.push(" --order-by <field[:asc|desc]> Sort");
7301
- lines.push(" --fields <a,b> Partial fetch");
7302
- lines.push(" --limit <n> --offset <n> --all Paging (--all walks every page)");
7303
7620
  }
7304
7621
  if (op$1.body === "report") {
7305
- lines.push(" --selector <json|@file|@-> Filter/sort rows (Apple selector)");
7306
- lines.push(" --time-zone <UTC|ORTZ> Report time zone (default UTC)");
7307
- }
7308
- if (op$1.body === "ids") lines.push(" ids Comma-separated ids in the positional");
7309
- if (op$1.body === "geo") lines.push(" --entity <Country|AdminArea|Locality> Entity type for each id");
7310
- if (op$1.query?.includes("all") && op$1.body !== "selector") lines.push(" --limit <n> --offset <n> --all Paging (--all walks every page)");
7311
- if (op$1.query?.includes("fields") && op$1.body !== "selector") lines.push(" --fields <a,b> Partial fetch");
7312
- if (op$1.query?.includes("owned")) lines.push(" --owned Only apps this org owns");
7622
+ lines.push(" --start <YYYY-MM-DD> --end <YYYY-MM-DD> Report range");
7623
+ lines.push(" --granularity <HOURLY|DAILY|WEEKLY|MONTHLY> Rows per period (default DAILY)");
7624
+ lines.push(" --group-by <a,b> Group rows by dimension");
7625
+ lines.push(" --fields <a,b> Only these fields");
7626
+ if (op$1.zoned) lines.push(" --time-zone <UTC|ORTZ> Report time zone (default UTC)");
7627
+ }
7628
+ if (op$1.body === "geo") {
7629
+ lines.push(" --entity <Country|AdminArea|Locality> Entity type for each id");
7630
+ lines.push(" --supply-source <APPSTORE|MAPS> Supply source (default APPSTORE)");
7631
+ }
7632
+ if (op$1.paged) lines.push(" --limit <n> --offset <n> --all Paging (--all walks every page)");
7633
+ if (op$1.query?.includes("owned")) lines.push(" --owned Only apps this account owns");
7634
+ if (op$1.query?.includes("store-fronts")) lines.push(" --store-fronts <a,b> Restrict to storefronts");
7313
7635
  if (op$1.query?.includes("country")) lines.push(" --country <CC> Restrict to a country code");
7314
- if (op$1.query?.includes("entity") && op$1.body !== "geo") lines.push(" --entity <Country|AdminArea|Locality>");
7315
- if (op$1.level === "adgroup") lines.push(" --adgroup-level Search ad group negatives instead of campaign negatives");
7316
- if (op$1.query?.includes("name")) lines.push(" --name <text> Filter by name");
7317
- if (op$1.query?.includes("states")) lines.push(" --states <a,b> Filter by state");
7318
- if (op$1.query?.includes("countries")) lines.push(" --countries <a,b> Restrict to country codes");
7319
- if (op$1.query?.includes("device-classes")) lines.push(" --device-classes <a,b> --language-codes <a,b> --expand");
7320
- if (op$1.query?.includes("include-deleted-assets")) lines.push(" --include-deleted-assets");
7636
+ if (op$1.query?.includes("entity")) lines.push(" --entity <Country|AdminArea|Locality>");
7637
+ if (op$1.query?.includes("supply-source")) lines.push(" --supply-source <APPSTORE|MAPS> Supply source (default APPSTORE)");
7638
+ if (op$1.query?.includes("eligible")) lines.push(" --eligible Only places that can be targeted");
7639
+ if (op$1.query?.includes("resource-type")) lines.push(" --resource-type <type> e.g. CONTENT_PROVIDER");
7321
7640
  return lines;
7322
7641
  }
7323
7642
  function renderAsaCatalog() {
7324
7643
  const lines = ["# Apple Search Ads — `superwall asa`", ""];
7325
- lines.push("Every Apple Ads Campaign Management API v5 endpoint, through Superwall's proxy.");
7644
+ lines.push("Every Apple Ads Platform API v1 endpoint, through Superwall's proxy.");
7326
7645
  lines.push("`superwall asa docs <group>` lists a group, `superwall asa docs <group> <action>` fetches Apple's page.");
7327
7646
  lines.push("");
7328
7647
  for (const group$1 of asaGroups()) {
@@ -7351,16 +7670,16 @@ function renderAsaGroup(group$1) {
7351
7670
  }
7352
7671
  return lines.join("\n").trimEnd();
7353
7672
  }
7354
- function searchAsaCatalog(query) {
7355
- const q = query.toLowerCase();
7673
+ function searchAsaCatalog(query$1) {
7674
+ const q = query$1.toLowerCase();
7356
7675
  return ASA_OPERATIONS.filter((o) => {
7357
7676
  return o.group.includes(q) || o.action.includes(q) || o.summary.toLowerCase().includes(q) || o.path.toLowerCase().includes(q);
7358
7677
  });
7359
7678
  }
7360
- function renderAsaSearch(query) {
7361
- const hits = searchAsaCatalog(query);
7362
- if (hits.length === 0) return `No Apple Search Ads endpoint matches "${query}". Run \`superwall asa docs\` for the catalog.`;
7363
- const lines = [`# Endpoints matching "${query}"`, ""];
7679
+ function renderAsaSearch(query$1) {
7680
+ const hits = searchAsaCatalog(query$1);
7681
+ if (hits.length === 0) return `No Apple Search Ads endpoint matches "${query$1}". Run \`superwall asa docs\` for the catalog.`;
7682
+ const lines = [`# Endpoints matching "${query$1}"`, ""];
7364
7683
  for (const v of hits) lines.push(`- \`${usageOf$1(v)}\` — ${v.summary} (${v.method} ${v.path})`);
7365
7684
  return lines.join("\n");
7366
7685
  }
@@ -7448,7 +7767,7 @@ function parameterLines(items, refs) {
7448
7767
  }
7449
7768
  return out;
7450
7769
  }
7451
- function renderAppleDoc(doc) {
7770
+ function renderAppleDoc(doc, body) {
7452
7771
  if (!isNode(doc)) return "";
7453
7772
  const refs = isNode(doc.references) ? doc.references : {};
7454
7773
  const metadata = isNode(doc.metadata) ? doc.metadata : {};
@@ -7475,6 +7794,7 @@ function renderAppleDoc(doc) {
7475
7794
  const typeLine = `${type ? `\`${type}\`` : ""}${desc ? ` — ${desc}` : ""}`.trim();
7476
7795
  if (typeLine) lines.push(typeLine);
7477
7796
  lines.push(...parameterLines(section$1.parameters, refs));
7797
+ if (body) lines.push("", body);
7478
7798
  break;
7479
7799
  }
7480
7800
  case "restResponses": {
@@ -7510,6 +7830,15 @@ function bodyTypeIdentifier(doc) {
7510
7830
  }
7511
7831
  }
7512
7832
  }
7833
+ async function bodyDocs(doc, fetchDoc) {
7834
+ const bodyType = bodyTypeIdentifier(doc);
7835
+ if (!bodyType) return void 0;
7836
+ try {
7837
+ return renderAppleDoc(await fetchDoc(`${APPLE_DOC_DATA_BASE}/${bodyType.toLowerCase()}.json`));
7838
+ } catch (error) {
7839
+ return `Couldn't fetch the \`${bodyType}\` object page (${describe(error)}) — see ${APPLE_DOCS_BASE}/${bodyType.toLowerCase()}.`;
7840
+ }
7841
+ }
7513
7842
  async function renderAsaOperationDocs(group$1, action, fetchDoc = downloadAppleDoc) {
7514
7843
  const variants = asaVariants(group$1, action);
7515
7844
  if (variants.length === 0) throw new Error(`Unknown "asa ${group$1} ${action}". Run \`superwall asa docs ${group$1}\` for its actions.`);
@@ -7522,14 +7851,7 @@ async function renderAsaOperationDocs(group$1, action, fetchDoc = downloadAppleD
7522
7851
  const url = `${APPLE_DOC_DATA_BASE}/${v.doc}.json`;
7523
7852
  try {
7524
7853
  const doc = await fetchDoc(url);
7525
- lines.push("", renderAppleDoc(doc));
7526
- const bodyType = bodyTypeIdentifier(doc);
7527
- if (bodyType) try {
7528
- const bodyDoc = await fetchDoc(`${APPLE_DOC_DATA_BASE}/${bodyType.toLowerCase()}.json`);
7529
- lines.push("", renderAppleDoc(bodyDoc));
7530
- } catch (error) {
7531
- lines.push("", `Couldn't fetch the \`${bodyType}\` object page (${describe(error)}) — see ${APPLE_DOCS_BASE}/${bodyType.toLowerCase()}.`);
7532
- }
7854
+ lines.push("", renderAppleDoc(doc, await bodyDocs(doc, fetchDoc)));
7533
7855
  } catch (error) {
7534
7856
  lines.push("", `Couldn't fetch Apple's page (${describe(error)}) — read it at ${appleDocUrl(v)}.`);
7535
7857
  }
@@ -7549,7 +7871,7 @@ async function renderDocs(ctx, resource, operation) {
7549
7871
 
7550
7872
  //#endregion
7551
7873
  //#region src/commands/apple-search-ads/api/docs.ts
7552
- const command$40 = defineCommand({
7874
+ const command$41 = defineCommand({
7553
7875
  name: "asa docs",
7554
7876
  summary: "Every endpoint, with Apple's own schema",
7555
7877
  args: {
@@ -7575,11 +7897,11 @@ const command$40 = defineCommand({
7575
7897
 
7576
7898
  //#endregion
7577
7899
  //#region src/commands/apple-search-ads/api/get.ts
7578
- const command$41 = defineCommand({
7900
+ const command$42 = defineCommand({
7579
7901
  name: "asa get",
7580
7902
  summary: "Any GET request to the Apple Search Ads API",
7581
7903
  args: { path: {
7582
- describe: "Apple Search Ads API path, e.g. /campaigns (the /api/v5 prefix is added)",
7904
+ describe: "Apple Search Ads API path, e.g. /campaigns (the /v1 prefix is added)",
7583
7905
  required: true
7584
7906
  } },
7585
7907
  flags: {
@@ -7587,10 +7909,10 @@ const command$41 = defineCommand({
7587
7909
  ...app,
7588
7910
  describe: "Superwall app id or name (if several have Apple Search Ads connected)"
7589
7911
  },
7590
- orgId: {
7912
+ adAccountId: {
7591
7913
  type: "string",
7592
7914
  value: "id",
7593
- describe: "Apple Search Ads org id (X-AP-Context), if the API user spans several"
7915
+ describe: "Apple Ads ad account id (X-AP-Context), if the API user reaches several"
7594
7916
  },
7595
7917
  d: {
7596
7918
  ...data,
@@ -7607,7 +7929,7 @@ const command$41 = defineCommand({
7607
7929
  verb: "get",
7608
7930
  path: args.path,
7609
7931
  data: flags.d,
7610
- orgId: flags.orgId
7932
+ adAccountId: flags.adAccountId
7611
7933
  });
7612
7934
  ctx.output.data(res ?? { ok: true });
7613
7935
  }
@@ -7615,7 +7937,7 @@ const command$41 = defineCommand({
7615
7937
 
7616
7938
  //#endregion
7617
7939
  //#region src/commands/apple-search-ads/keys.ts
7618
- const command$42 = defineCommand({
7940
+ const command$43 = defineCommand({
7619
7941
  name: "asa keys",
7620
7942
  summary: "Which apps have Apple Search Ads connected",
7621
7943
  details: CONNECT_HINT,
@@ -7632,12 +7954,12 @@ const command$42 = defineCommand({
7632
7954
 
7633
7955
  //#endregion
7634
7956
  //#region src/commands/apple-search-ads/api/post.ts
7635
- const command$43 = defineCommand({
7957
+ const command$44 = defineCommand({
7636
7958
  name: "asa post",
7637
7959
  summary: "Any POST request to the Apple Search Ads API",
7638
7960
  details: "Executes an arbitrary Apple Ads POST. It can bulk-delete resources, activate advertising or create financial budget orders; repeating a call may repeat its effects.",
7639
7961
  args: { path: {
7640
- describe: "Apple Search Ads API path, e.g. /campaigns (the /api/v5 prefix is added)",
7962
+ describe: "Apple Search Ads API path, e.g. /campaigns (the /v1 prefix is added)",
7641
7963
  required: true
7642
7964
  } },
7643
7965
  flags: {
@@ -7645,10 +7967,10 @@ const command$43 = defineCommand({
7645
7967
  ...app,
7646
7968
  describe: "Superwall app id or name (if several have Apple Search Ads connected)"
7647
7969
  },
7648
- orgId: {
7970
+ adAccountId: {
7649
7971
  type: "string",
7650
7972
  value: "id",
7651
- describe: "Apple Search Ads org id (X-AP-Context), if the API user spans several"
7973
+ describe: "Apple Ads ad account id (X-AP-Context), if the API user reaches several"
7652
7974
  },
7653
7975
  d: {
7654
7976
  ...data,
@@ -7660,7 +7982,7 @@ const command$43 = defineCommand({
7660
7982
  describe: "Request body as JSON: inline, @file, or @- for stdin; -d fields merge into it"
7661
7983
  }
7662
7984
  },
7663
- examples: [["asa post /campaigns/find --body '{\"conditions\":[]}'", "A raw selector query"]],
7985
+ examples: [["asa post /campaigns/query --body '{\"filters\":[]}'", "A raw query"]],
7664
7986
  auth: "required",
7665
7987
  json: true,
7666
7988
  prompts: false,
@@ -7670,7 +7992,7 @@ const command$43 = defineCommand({
7670
7992
  verb: "post",
7671
7993
  path: args.path,
7672
7994
  data: flags.d,
7673
- orgId: flags.orgId,
7995
+ adAccountId: flags.adAccountId,
7674
7996
  body: flags.body
7675
7997
  });
7676
7998
  ctx.output.data(res ?? { ok: true });
@@ -7679,12 +8001,12 @@ const command$43 = defineCommand({
7679
8001
 
7680
8002
  //#endregion
7681
8003
  //#region src/commands/apple-search-ads/api/put.ts
7682
- const command$44 = defineCommand({
8004
+ const command$45 = defineCommand({
7683
8005
  name: "asa put",
7684
8006
  summary: "Any PUT request to the Apple Search Ads API",
7685
8007
  details: "Executes an arbitrary Apple Ads PUT. It can overwrite bids, targeting, budgets and delivery status.",
7686
8008
  args: { path: {
7687
- describe: "Apple Search Ads API path, e.g. /campaigns (the /api/v5 prefix is added)",
8009
+ describe: "Apple Search Ads API path, e.g. /campaigns (the /v1 prefix is added)",
7688
8010
  required: true
7689
8011
  } },
7690
8012
  flags: {
@@ -7692,10 +8014,10 @@ const command$44 = defineCommand({
7692
8014
  ...app,
7693
8015
  describe: "Superwall app id or name (if several have Apple Search Ads connected)"
7694
8016
  },
7695
- orgId: {
8017
+ adAccountId: {
7696
8018
  type: "string",
7697
8019
  value: "id",
7698
- describe: "Apple Search Ads org id (X-AP-Context), if the API user spans several"
8020
+ describe: "Apple Ads ad account id (X-AP-Context), if the API user reaches several"
7699
8021
  },
7700
8022
  d: {
7701
8023
  ...data,
@@ -7717,7 +8039,7 @@ const command$44 = defineCommand({
7717
8039
  verb: "put",
7718
8040
  path: args.path,
7719
8041
  data: flags.d,
7720
- orgId: flags.orgId,
8042
+ adAccountId: flags.adAccountId,
7721
8043
  body: flags.body
7722
8044
  });
7723
8045
  ctx.output.data(res ?? { ok: true });
@@ -7726,7 +8048,7 @@ const command$44 = defineCommand({
7726
8048
 
7727
8049
  //#endregion
7728
8050
  //#region src/commands/paywalls/build.ts
7729
- const command$45 = defineCommand({
8051
+ const command$46 = defineCommand({
7730
8052
  name: "build",
7731
8053
  summary: "Build your paywalls into the snapshot documents a push would version, without pushing",
7732
8054
  args: { dir: { describe: "Project directory (default: cwd)" } },
@@ -7753,7 +8075,7 @@ const command$45 = defineCommand({
7753
8075
  prompts: true,
7754
8076
  mcp: false,
7755
8077
  async run(ctx, { args, flags }) {
7756
- const { runBuildPipeline } = await import("./build-DK88pTMW.js");
8078
+ const { runBuildPipeline } = await import("./build-CQd-pf7O.js");
7757
8079
  await runBuildPipeline({
7758
8080
  output: ctx.output,
7759
8081
  json: ctx.json
@@ -7768,7 +8090,7 @@ const command$45 = defineCommand({
7768
8090
 
7769
8091
  //#endregion
7770
8092
  //#region src/commands/paywalls/create.ts
7771
- const command$46 = defineCommand({
8093
+ const command$47 = defineCommand({
7772
8094
  name: "create",
7773
8095
  summary: "Set up paywalls in your app - creates a superwall/ directory inside it",
7774
8096
  args: { dir: { describe: "Your app's root (default: cwd) - paywalls land in superwall/ inside it" } },
@@ -7801,20 +8123,26 @@ const command$46 = defineCommand({
7801
8123
  type: "boolean",
7802
8124
  default: true,
7803
8125
  describe: "Connect a Superwall app when possible (--no-connect to skip)"
8126
+ },
8127
+ git: {
8128
+ type: "boolean",
8129
+ default: true,
8130
+ describe: "Create a git repository and commit the scaffold when the app is outside git (--no-git to skip)"
7804
8131
  }
7805
8132
  },
7806
8133
  examples: [
7807
8134
  ["create", "Set up superwall/ in the current app"],
7808
8135
  ["create --example with-rive", "Start from an example"],
7809
8136
  ["create --from 65920", "Rebuild dashboard paywall 65920 as code"],
7810
- ["create --app <app>", "Connect a specific Superwall app"]
8137
+ ["create --app <app>", "Connect a specific Superwall app"],
8138
+ ["create --no-git", "Scaffold without creating a git repository or commit"]
7811
8139
  ],
7812
8140
  auth: "none",
7813
8141
  json: false,
7814
8142
  prompts: true,
7815
8143
  mcp: false,
7816
8144
  async run(ctx, { args, flags }) {
7817
- const { runCreate } = await import("./create-B6-Dr3GZ.js");
8145
+ const { runCreate } = await import("./create-wlCp83IH.js");
7818
8146
  return runCreate(ctx, {
7819
8147
  dir: args.dir,
7820
8148
  ...flags
@@ -7824,7 +8152,7 @@ const command$46 = defineCommand({
7824
8152
 
7825
8153
  //#endregion
7826
8154
  //#region src/commands/paywalls/dev.ts
7827
- const command$47 = defineCommand({
8155
+ const command$48 = defineCommand({
7828
8156
  name: "dev",
7829
8157
  summary: "Host the studio: browse and preview your paywalls and funnels",
7830
8158
  args: { dir: {
@@ -7857,7 +8185,7 @@ const command$47 = defineCommand({
7857
8185
  prompts: true,
7858
8186
  mcp: false,
7859
8187
  async run(ctx, { args, flags }) {
7860
- const { runStudio } = await import("./server-BemmM1FV.js");
8188
+ const { runStudio } = await import("./server-Cif9w5lM.js");
7861
8189
  await runStudio({
7862
8190
  dirs: args.dir,
7863
8191
  port: flags.port,
@@ -7870,7 +8198,7 @@ const command$47 = defineCommand({
7870
8198
 
7871
8199
  //#endregion
7872
8200
  //#region src/commands/paywalls/promote.ts
7873
- const command$48 = defineCommand({
8201
+ const command$49 = defineCommand({
7874
8202
  name: "promote",
7875
8203
  summary: "Point production at a pushed version (the latest by default)",
7876
8204
  args: { dir: { describe: "Project directory (default: cwd)" } },
@@ -7897,14 +8225,14 @@ const command$48 = defineCommand({
7897
8225
  prompts: true,
7898
8226
  mcp: false,
7899
8227
  async run(ctx, input) {
7900
- const { runPromote } = await import("./promote-D0i8A0CO.js");
8228
+ const { runPromote } = await import("./promote-B_HnFEbX.js");
7901
8229
  return runPromote(ctx, input);
7902
8230
  }
7903
8231
  });
7904
8232
 
7905
8233
  //#endregion
7906
8234
  //#region src/commands/paywalls/publish.ts
7907
- const command$49 = defineCommand({
8235
+ const command$50 = defineCommand({
7908
8236
  name: "publish",
7909
8237
  summary: "Push and promote in one step - build, version, and ship to production",
7910
8238
  args: { dir: { describe: "Project directory (default: cwd)" } },
@@ -7953,14 +8281,14 @@ const command$49 = defineCommand({
7953
8281
  prompts: true,
7954
8282
  mcp: false,
7955
8283
  async run(ctx, input) {
7956
- const { runPush } = await import("./push-BIhGDNpL.js");
8284
+ const { runPush } = await import("./push-B5py7h5y.js");
7957
8285
  return runPush(ctx, input, true);
7958
8286
  }
7959
8287
  });
7960
8288
 
7961
8289
  //#endregion
7962
8290
  //#region src/commands/paywalls/pull.ts
7963
- const command$50 = defineCommand({
8291
+ const command$51 = defineCommand({
7964
8292
  name: "pull",
7965
8293
  summary: "Bring teammates' published source into this project, merged with your edits",
7966
8294
  args: { dir: { describe: "Project directory, or with --app the folder to create superwall/ in (default: cwd)" } },
@@ -7989,14 +8317,14 @@ const command$50 = defineCommand({
7989
8317
  prompts: true,
7990
8318
  mcp: false,
7991
8319
  async run(ctx, input) {
7992
- const { runPull } = await import("./pull-CO5HlqBe.js");
8320
+ const { runPull } = await import("./pull-JxiMyRwY.js");
7993
8321
  return runPull(ctx, input);
7994
8322
  }
7995
8323
  });
7996
8324
 
7997
8325
  //#endregion
7998
8326
  //#region src/commands/paywalls/push.ts
7999
- const command$51 = defineCommand({
8327
+ const command$52 = defineCommand({
8000
8328
  name: "push",
8001
8329
  summary: "Build and push your paywalls as immutable versions (production untouched)",
8002
8330
  args: { dir: { describe: "Project directory (default: cwd)" } },
@@ -8041,7 +8369,7 @@ const command$51 = defineCommand({
8041
8369
  prompts: true,
8042
8370
  mcp: false,
8043
8371
  async run(ctx, input) {
8044
- const { runPush } = await import("./push-BIhGDNpL.js");
8372
+ const { runPush } = await import("./push-B5py7h5y.js");
8045
8373
  return runPush(ctx, input, false);
8046
8374
  }
8047
8375
  });
@@ -8079,7 +8407,7 @@ function scopeParams(op$1) {
8079
8407
  return bound;
8080
8408
  }
8081
8409
  function scopeFields(op$1, spec) {
8082
- const query = (spec?.params ?? []).flatMap((param) => {
8410
+ const query$1 = (spec?.params ?? []).flatMap((param) => {
8083
8411
  const kind = SCOPE_PARAMS[param.name];
8084
8412
  return param.in === "query" && kind && (param.required || kind === "app") ? [{
8085
8413
  location: "query",
@@ -8088,7 +8416,7 @@ function scopeFields(op$1, spec) {
8088
8416
  type: param.type
8089
8417
  }] : [];
8090
8418
  });
8091
- if (op$1.method === "GET" || op$1.method === "DELETE") return query;
8419
+ if (op$1.method === "GET" || op$1.method === "DELETE") return query$1;
8092
8420
  const body = (spec?.body ?? []).flatMap((field$1) => {
8093
8421
  const kind = SCOPE_PARAMS[field$1.name];
8094
8422
  return kind && (field$1.required || op$1.method === "POST") ? [{
@@ -8098,7 +8426,7 @@ function scopeFields(op$1, spec) {
8098
8426
  type: field$1.type
8099
8427
  }] : [];
8100
8428
  });
8101
- return [...query, ...body];
8429
+ return [...query$1, ...body];
8102
8430
  }
8103
8431
  function argLabel(resource, param) {
8104
8432
  if (param === "app_user_id") return "<user>";
@@ -8113,6 +8441,22 @@ function usageOf(resource, op$1) {
8113
8441
  if (resource.appArg) return "<app>";
8114
8442
  return positionalParams(op$1).map((param) => argLabel(resource, param)).join(" ");
8115
8443
  }
8444
+ function resourceCommandFor(owner, endpoint) {
8445
+ for (const resource of [owner, ...owner.nested ?? []]) {
8446
+ const op$1 = resource.operations.find((candidate) => candidate.method === endpoint.method && candidate.path === endpoint.path);
8447
+ if (!op$1) continue;
8448
+ const usage = usageOf(owner, op$1);
8449
+ return [
8450
+ "superwall",
8451
+ ...owner === resource ? [owner.name, op$1.name] : [
8452
+ owner.name,
8453
+ resource.name,
8454
+ op$1.name
8455
+ ],
8456
+ ...usage ? [usage] : []
8457
+ ].join(" ");
8458
+ }
8459
+ }
8116
8460
 
8117
8461
  //#endregion
8118
8462
  //#region src/core/main/help.ts
@@ -8158,7 +8502,7 @@ function resourceHelp(resource) {
8158
8502
  })),
8159
8503
  {
8160
8504
  title: "Related",
8161
- lines: table((resource.related ?? []).map(([command$82, text]) => [`superwall ${command$82}`, pc.dim(text)]), ([left]) => left.length)
8505
+ lines: table((resource.related ?? []).map(([command$83, text]) => [`superwall ${command$83}`, pc.dim(text)]), ([left]) => left.length)
8162
8506
  },
8163
8507
  {
8164
8508
  title: "Examples",
@@ -8397,7 +8741,7 @@ async function create(context, api, resource, rawValue, value2, flags) {
8397
8741
  if (resource === "apps") return createApp(context, api, value$1, flags.fields);
8398
8742
  if (!value$1) throw new Error(resource === "campaigns" ? "Usage: superwall campaigns create --description \"<description>\" --placement <placement>" : `Usage: superwall ${resource} create --identifier <identifier>`);
8399
8743
  if (resource === "campaigns" && !value2) throw new Error("Usage: superwall campaigns create --description \"<description>\" --placement <placement> (campaigns need at least one placement)");
8400
- const scope = await pickScope(context, api, isAppScoped(resource) || resource === "products" && context.target.app !== void 0);
8744
+ const scope = await pickScope(context, api, isAppScoped(resource) || resource === "products" && context.target.app !== void 0, { customStores: resource === "products" });
8401
8745
  const grants = resource === "products" ? await resolveProductEntitlements(context, api, scope, entitlementValues(flags.fields)) : void 0;
8402
8746
  if (dryRun$1) {
8403
8747
  const { projectCount: _projects, appCount: _apps,...where } = scope;
@@ -8436,7 +8780,7 @@ async function createApp(context, api, nameArg, fields) {
8436
8780
  let name = nameArg;
8437
8781
  let platform = textOf(fields.platform);
8438
8782
  if (interactive && (!name || !platform)) {
8439
- const { scanProject } = await import("./scan-BU41gcQY.js");
8783
+ const { scanProject } = await import("./scan-J2DILUNE.js");
8440
8784
  const detected = (await scanProject(context.installDir).catch(() => null))?.apps[0];
8441
8785
  if (detected && !name && !platform) {
8442
8786
  ui.info(`Detected \`${detected.framework.name}\`` + (detected.details ? ` · \`${detected.details}\`` : ""));
@@ -8518,8 +8862,11 @@ function createOne(api, resource, scope, value$1, value2, fields, grants) {
8518
8862
  case "entitlements": return createEntitlement(api, scope, value$1, scope.boundApplicationId);
8519
8863
  case "products": {
8520
8864
  const applicationId = grants?.app ? String(grants.app.id) : scope.applicationId;
8865
+ const options = productOptions(fields);
8866
+ const store = options.store ?? (scope.appPlatform === "custom" ? "custom" : void 0);
8521
8867
  return createProduct(api, scope, value$1, {
8522
- ...productOptions(fields),
8868
+ ...options,
8869
+ ...store ? { store } : {},
8523
8870
  ...applicationId ? { applicationId } : {},
8524
8871
  ...grants?.ids.length ? { entitlements: grants.ids } : {}
8525
8872
  });
@@ -8528,13 +8875,47 @@ function createOne(api, resource, scope, value$1, value2, fields, grants) {
8528
8875
  default: throw new Error(`create is not supported for ${resource} yet.`);
8529
8876
  }
8530
8877
  }
8878
+ /**
8879
+ * The API takes a price as a whole number of the currency's smallest unit; `--price` is in major
8880
+ * units, so 9.99 USD is 999 and 1200 JPY (no minor unit) is 1200.
8881
+ */
8882
+ function minorUnits(price, currency) {
8883
+ const major = Number(price);
8884
+ if (price.trim() === "" || !Number.isFinite(major) || major < 0) throw new Error(`--price is an amount in ${currency}, such as 9.99, not "${price}".`);
8885
+ let digits;
8886
+ try {
8887
+ digits = new Intl.NumberFormat("en", {
8888
+ style: "currency",
8889
+ currency
8890
+ }).resolvedOptions().maximumFractionDigits ?? 2;
8891
+ } catch {
8892
+ throw new Error(`--currency is an ISO 4217 code, such as USD, not "${currency}".`);
8893
+ }
8894
+ const amount = major * 10 ** digits;
8895
+ const whole = Math.round(amount);
8896
+ if (Math.abs(amount - whole) > 1e-6) throw new Error(`--price ${price} has more decimals than ${currency} allows (${digits}).`);
8897
+ return whole;
8898
+ }
8899
+ const PRODUCT_STORES = [
8900
+ "app_store",
8901
+ "play_store",
8902
+ "custom"
8903
+ ];
8531
8904
  function productOptions(fields) {
8532
8905
  const options = {};
8533
8906
  if (fields.name) options.name = String(fields.name);
8534
- if (fields.price !== void 0) options.price = {
8535
- amount: Math.round(Number(fields.price) * 100),
8536
- currency: String(fields.currency ?? "USD").toUpperCase()
8537
- };
8907
+ if (fields.store !== void 0) {
8908
+ const store = String(fields.store);
8909
+ if (!PRODUCT_STORES.includes(store)) throw new Error(`--store is one of ${PRODUCT_STORES.join(", ")}, not "${store}".`);
8910
+ options.store = store;
8911
+ }
8912
+ if (fields.price !== void 0) {
8913
+ const currency = String(fields.currency ?? "USD").toUpperCase();
8914
+ options.price = {
8915
+ amount: minorUnits(String(fields.price), currency),
8916
+ currency
8917
+ };
8918
+ }
8538
8919
  if (fields.period) options.subscription = {
8539
8920
  period: String(fields.period),
8540
8921
  period_count: fields.periodCount !== void 0 ? Number(fields.periodCount) : 1,
@@ -8746,7 +9127,7 @@ async function runResource(ctx, resource, action, value$1, value2, flags) {
8746
9127
  if (action === "create") return create(ctx, ctx.api, resource, value$1, value2, flags);
8747
9128
  if (action === "use" && resource === "apps") return useApp(ctx, ctx.api, value$1);
8748
9129
  if (action === "storekit" && resource === "products") {
8749
- const { writeStoreKit } = await import("./storekit-BMxyYAHj.js");
9130
+ const { writeStoreKit } = await import("./storekit-iBCWmeKn.js");
8750
9131
  return writeStoreKit(ctx, ctx.api, flags.fields.out);
8751
9132
  }
8752
9133
  throw new Error(`Unknown action "${action}" for ${resource}.`);
@@ -8760,22 +9141,22 @@ async function runOperation(ctx, owner, resource, op$1, args, flags) {
8760
9141
  }
8761
9142
  const toFlag = (field$1) => `--${field$1.replace(/_/g, "-")}`;
8762
9143
  async function callOperation(context, owner, resource, op$1, ids, flags, merged = {}) {
8763
- const command$82 = `superwall ${owner === resource ? "" : `${owner.name} `}${resource.name} ${op$1.name}`;
9144
+ const command$83 = `superwall ${owner === resource ? "" : `${owner.name} `}${resource.name} ${op$1.name}`;
8764
9145
  const { method, path: template } = op$1;
8765
- if (!method || !template) throw new Error(`${command$82} has no API endpoint.`);
9146
+ if (!method || !template) throw new Error(`${command$83} has no API endpoint.`);
8766
9147
  const spec = await apiCall(context, "Loading the API reference", () => findSpec(op$1));
8767
9148
  const args = [...ids];
8768
9149
  const ctx = owner.appArg && args[0] && !context.target.app ? withApp(context, args.shift()) : context;
8769
9150
  const positional = positionalParams(op$1);
8770
- if (args.length < positional.length) throw new Error(`Usage: ${command$82} ${usageOf(owner, op$1)}\nRun \`${command$82} --help\` for its flags.`);
8771
- if (args.length > positional.length) throw new Error(`${command$82} takes ${positional.length || "no"} argument${positional.length === 1 ? "" : "s"}; got "${args.slice(positional.length).join(" ")}".`);
9151
+ if (args.length < positional.length) throw new Error(`Usage: ${command$83} ${usageOf(owner, op$1)}\nRun \`${command$83} --help\` for its flags.`);
9152
+ if (args.length > positional.length) throw new Error(`${command$83} takes ${positional.length || "no"} argument${positional.length === 1 ? "" : "s"}; got "${args.slice(positional.length).join(" ")}".`);
8772
9153
  const pathValues = /* @__PURE__ */ new Map();
8773
- const query = {};
9154
+ const query$1 = {};
8774
9155
  const queryNames = new Set(spec?.params.filter((param) => param.in === "query").map((param) => param.name));
8775
9156
  for (const [index, param] of positional.entries()) {
8776
9157
  const value$1 = args[index];
8777
9158
  if (value$1 === void 0) continue;
8778
- if (queryNames.has(param)) query[param] = value$1;
9159
+ if (queryNames.has(param)) query$1[param] = value$1;
8779
9160
  else pathValues.set(param, value$1);
8780
9161
  }
8781
9162
  const body = {};
@@ -8785,25 +9166,25 @@ async function callOperation(context, owner, resource, op$1, ids, flags, merged
8785
9166
  const field$1 = fieldName(flag$1);
8786
9167
  const queryParam = spec?.params.find((param) => param.in === "query" && param.name === field$1);
8787
9168
  const bodyField = bodyFields.get(field$1);
8788
- if (queryParam) query[field$1] = coerce(raw, queryParam.type);
9169
+ if (queryParam) query$1[field$1] = coerce(raw, queryParam.type);
8789
9170
  else if (bodyField) body[field$1] = coerce(raw, bodyField.type);
8790
- else if (!spec) (sendsBody ? body : query)[field$1] = raw;
8791
- else throw new Error(`${command$82} has no ${toFlag(field$1)}. \`${command$82} --help\` lists what it takes.`);
9171
+ else if (!spec) (sendsBody ? body : query$1)[field$1] = raw;
9172
+ else throw new Error(`${command$83} has no ${toFlag(field$1)}. \`${command$83} --help\` lists what it takes.`);
8792
9173
  }
8793
- Object.assign(sendsBody ? body : query, parseParams(flags.data));
8794
- await fillScope(ctx, op$1, spec, pathValues, query, body);
9174
+ Object.assign(sendsBody ? body : query$1, parseParams(flags.data));
9175
+ await fillScope(ctx, op$1, spec, pathValues, query$1, body);
8795
9176
  const missing$1 = (spec?.params ?? []).filter((param) => {
8796
- return param.in === "query" && param.required && query[param.name] === void 0;
9177
+ return param.in === "query" && param.required && query$1[param.name] === void 0;
8797
9178
  });
8798
9179
  if (missing$1.length > 0) {
8799
9180
  const needs = missing$1.map((param) => `${toFlag(param.name)} <${param.type.replace(/"/g, "").replace(/ \| /g, "|")}>`);
8800
- throw new Error(`${command$82} needs ${needs.join(" and ")}.`);
9181
+ throw new Error(`${command$83} needs ${needs.join(" and ")}.`);
8801
9182
  }
8802
9183
  const url = withQuery(template.replace(/\{([^}]+)\}/g, (_, param) => {
8803
9184
  const value$1 = pathValues.get(param);
8804
- if (value$1 === void 0) throw new Error(`${command$82} needs ${param}.`);
9185
+ if (value$1 === void 0) throw new Error(`${command$83} needs ${param}.`);
8805
9186
  return encodeURIComponent(value$1);
8806
- }), query);
9187
+ }), query$1);
8807
9188
  if (ctx.dryRun) return renderValue(ctx, {
8808
9189
  method,
8809
9190
  path: url,
@@ -8830,14 +9211,14 @@ async function callOperation(context, owner, resource, op$1, ids, flags, merged
8830
9211
  ...merged
8831
9212
  }, done);
8832
9213
  }
8833
- async function fillScope(ctx, op$1, spec, pathValues, query, body) {
9214
+ async function fillScope(ctx, op$1, spec, pathValues, query$1, body) {
8834
9215
  const wanted = /* @__PURE__ */ new Map();
8835
9216
  for (const [param, kind] of scopeParams(op$1)) if (!pathValues.has(param)) wanted.set(`path:${param}`, {
8836
9217
  kind,
8837
9218
  assign: (v) => pathValues.set(param, v)
8838
9219
  });
8839
9220
  for (const field$1 of scopeFields(op$1, spec)) {
8840
- const target = field$1.location === "query" ? query : body;
9221
+ const target = field$1.location === "query" ? query$1 : body;
8841
9222
  if (target[field$1.name] !== void 0) continue;
8842
9223
  const typed = (value$1) => field$1.location === "query" ? value$1 : coerce(value$1, field$1.type);
8843
9224
  wanted.set(`${field$1.location}:${field$1.name}`, {
@@ -8913,7 +9294,7 @@ async function dispatch(ctx, owner, words, flags) {
8913
9294
  const nested = rest[0] ? findNested(owner, rest[0]) : void 0;
8914
9295
  if (nested) rest = rest.slice(1);
8915
9296
  const resource = nested ?? owner;
8916
- const command$82 = nested ? `${owner.name} ${nested.name}` : owner.name;
9297
+ const command$83 = nested ? `${owner.name} ${nested.name}` : owner.name;
8917
9298
  if (rest[0] && /^(\d+|https?:\/\/.*)$/.test(rest[0]) && findOperation(resource, "get")) rest = ["get", ...rest];
8918
9299
  const [opName, ...args] = rest;
8919
9300
  if (!opName) {
@@ -8925,7 +9306,7 @@ async function dispatch(ctx, owner, words, flags) {
8925
9306
  if (!op$1) {
8926
9307
  const known = resource.operations.map((candidate) => candidate.name);
8927
9308
  const nestedNames = nested ? [] : (owner.nested ?? []).map((candidate) => candidate.name);
8928
- throw new UsageError(`${command$82} has no "${opName}". It takes: ${[...known, ...nestedNames].join(", ")}.\nRun superwall ${command$82} --help for what each does.`, command$82);
9309
+ throw new UsageError(`${command$83} has no "${opName}". It takes: ${[...known, ...nestedNames].join(", ")}.\nRun superwall ${command$83} --help for what each does.`, command$83);
8929
9310
  }
8930
9311
  await runOperation(ctx, owner, resource, op$1, args, flags);
8931
9312
  }
@@ -9113,13 +9494,14 @@ function defineResource(resource) {
9113
9494
  operations: () => [...resource.operations.map((operation) => operation.name), ...(resource.nested ?? []).map((nested) => `${nested.name} …`)],
9114
9495
  help: async (words) => renderResourceHelp(resource, words),
9115
9496
  tools: () => listResourceTools(resource, FLAGS),
9497
+ commandFor: (endpoint) => resourceCommandFor(resource, endpoint),
9116
9498
  run: (ctx, { words, flags }) => dispatch(ctx, resource, words, readResourceFlags(flags))
9117
9499
  });
9118
9500
  }
9119
9501
 
9120
9502
  //#endregion
9121
9503
  //#region src/commands/main/annotations.ts
9122
- const command$52 = defineResource({
9504
+ const command$53 = defineResource({
9123
9505
  name: "annotations",
9124
9506
  summary: "Releases, campaigns and incidents marked on an app's charts",
9125
9507
  operations: [
@@ -9169,7 +9551,7 @@ const command$52 = defineResource({
9169
9551
 
9170
9552
  //#endregion
9171
9553
  //#region src/commands/main/apps.ts
9172
- const command$53 = defineResource({
9554
+ const command$54 = defineResource({
9173
9555
  name: "apps",
9174
9556
  summary: "Every app you can open",
9175
9557
  appArg: true,
@@ -9422,7 +9804,7 @@ function renderAccountTree(tree) {
9422
9804
 
9423
9805
  //#endregion
9424
9806
  //#region src/commands/main/bootstrap.ts
9425
- const command$54 = defineCommand({
9807
+ const command$55 = defineCommand({
9426
9808
  name: "bootstrap",
9427
9809
  summary: "Everything at once: projects, apps, campaigns, products",
9428
9810
  details: "The complete account tree: organizations, projects, apps, campaigns and their placements,\npaywalls, products and entitlements.",
@@ -9455,7 +9837,7 @@ const command$54 = defineCommand({
9455
9837
 
9456
9838
  //#endregion
9457
9839
  //#region src/commands/main/campaigns.ts
9458
- const command$55 = defineResource({
9840
+ const command$56 = defineResource({
9459
9841
  name: "campaigns",
9460
9842
  summary: "Who sees which paywall, and when",
9461
9843
  operations: [
@@ -9680,7 +10062,7 @@ const command$55 = defineResource({
9680
10062
 
9681
10063
  //#endregion
9682
10064
  //#region src/commands/main/entitlements.ts
9683
- const command$56 = defineResource({
10065
+ const command$57 = defineResource({
9684
10066
  name: "entitlements",
9685
10067
  summary: "What a purchase unlocks",
9686
10068
  operations: [
@@ -9758,7 +10140,7 @@ const command$56 = defineResource({
9758
10140
 
9759
10141
  //#endregion
9760
10142
  //#region src/commands/main/events.ts
9761
- const command$57 = defineResource({
10143
+ const command$58 = defineResource({
9762
10144
  name: "events",
9763
10145
  summary: "Events sent to your webhooks",
9764
10146
  operations: [
@@ -9799,7 +10181,7 @@ const command$57 = defineResource({
9799
10181
 
9800
10182
  //#endregion
9801
10183
  //#region src/commands/main/paywalls.ts
9802
- const command$58 = defineResource({
10184
+ const command$59 = defineResource({
9803
10185
  name: "paywalls",
9804
10186
  summary: "Paywalls in the dashboard",
9805
10187
  operations: [
@@ -9869,7 +10251,7 @@ const command$58 = defineResource({
9869
10251
 
9870
10252
  //#endregion
9871
10253
  //#region src/commands/main/products.ts
9872
- const command$59 = defineResource({
10254
+ const command$60 = defineResource({
9873
10255
  name: "products",
9874
10256
  summary: "Products and their store prices",
9875
10257
  operations: [
@@ -9896,7 +10278,8 @@ const command$59 = defineResource({
9896
10278
  flags: [
9897
10279
  ["--identifier <id>", "The store product ID"],
9898
10280
  ["--name <name>", "Display name"],
9899
- ["--price <amount>", "Price in major units, e.g. 9.99"],
10281
+ ["--store <store>", "app_store | play_store | custom; custom without --app uses the project's default custom store"],
10282
+ ["--price <amount>", "Price in the currency's main unit, e.g. 9.99 (sent to the API as 999 cents)"],
9900
10283
  ["--currency <code>", "ISO currency, default USD"],
9901
10284
  ["--period <p>", "day | week | month | year"],
9902
10285
  ["--period-count <n>", "Periods per cycle, default 1"],
@@ -9939,13 +10322,14 @@ const command$59 = defineResource({
9939
10322
  examples: [
9940
10323
  ["products list --app <app>", "Products of an app's project"],
9941
10324
  ["products create --identifier <id> --price 9.99 --period month", "A monthly subscription"],
9942
- ["products create --identifier <id> --price 9.99 --period month --entitlement pro", "One that grants pro"]
10325
+ ["products create --identifier <id> --price 9.99 --period month --entitlement pro", "One that grants pro"],
10326
+ ["products create --identifier <id> --app <custom store> --price 9.99 --period month", "One in a custom store"]
9943
10327
  ]
9944
10328
  });
9945
10329
 
9946
10330
  //#endregion
9947
10331
  //#region src/commands/main/users.ts
9948
- const command$60 = defineResource({
10332
+ const command$61 = defineResource({
9949
10333
  name: "users",
9950
10334
  summary: "Your app's users: subscriptions, entitlements, attributes",
9951
10335
  operations: [
@@ -10016,7 +10400,7 @@ const command$60 = defineResource({
10016
10400
 
10017
10401
  //#endregion
10018
10402
  //#region src/commands/main/webhooks.ts
10019
- const command$61 = defineResource({
10403
+ const command$62 = defineResource({
10020
10404
  name: "webhooks",
10021
10405
  summary: "Endpoints that receive your events",
10022
10406
  operations: [
@@ -10090,7 +10474,7 @@ Overwrites destination, filters, headers and disabled state; can stop or redirec
10090
10474
 
10091
10475
  //#endregion
10092
10476
  //#region src/commands/support/doctor.ts
10093
- const command$62 = defineCommand({
10477
+ const command$63 = defineCommand({
10094
10478
  name: "doctor",
10095
10479
  summary: "Check the health of your Superwall integration",
10096
10480
  flags: { installDir },
@@ -10100,7 +10484,7 @@ const command$62 = defineCommand({
10100
10484
  prompts: true,
10101
10485
  mcp: false,
10102
10486
  async run(ctx) {
10103
- const { runDoctor } = await import("./doctor-DYbm8IKQ.js");
10487
+ const { runDoctor } = await import("./doctor-Bd9ffg51.js");
10104
10488
  return runDoctor(ctx);
10105
10489
  }
10106
10490
  });
@@ -10344,7 +10728,7 @@ async function runFeedback(ctx, { args, flags }) {
10344
10728
 
10345
10729
  //#endregion
10346
10730
  //#region src/commands/support/feedback.ts
10347
- const command$63 = defineCommand({
10731
+ const command$64 = defineCommand({
10348
10732
  name: "feedback",
10349
10733
  summary: "Report a bug or send feedback to the Superwall team",
10350
10734
  details: `Goes straight to the Superwall team, who read every report. Send one yourself, without asking first (Superwall's terms cover it), when you confirm a Superwall bug, a doc that is wrong or missing, or a capability the user needed that Superwall lacks; then tell the user in one line. Confirm it first: reproduce the bug, check the doc against what happens.
@@ -10416,7 +10800,7 @@ Sending cannot be undone; repeating the call sends a duplicate report.`,
10416
10800
 
10417
10801
  //#endregion
10418
10802
  //#region src/commands/support/skills.ts
10419
- const command$64 = defineCommand({
10803
+ const command$65 = defineCommand({
10420
10804
  name: "skills",
10421
10805
  summary: "Install or update the Superwall agent skills for your coding agents",
10422
10806
  flags: {
@@ -10445,14 +10829,14 @@ const command$64 = defineCommand({
10445
10829
  prompts: true,
10446
10830
  mcp: false,
10447
10831
  async run(ctx, input) {
10448
- const { runSkills } = await import("./skills-Bqz2l_bx.js");
10832
+ const { runSkills } = await import("./skills-MmF7IyTg.js");
10449
10833
  return runSkills(ctx, input);
10450
10834
  }
10451
10835
  });
10452
10836
 
10453
10837
  //#endregion
10454
10838
  //#region src/commands/support/upgrade.ts
10455
- const command$65 = defineCommand({
10839
+ const command$66 = defineCommand({
10456
10840
  name: "upgrade",
10457
10841
  summary: "Update the CLI and its agent skills to the latest version",
10458
10842
  examples: [["upgrade", "Install the latest version globally with npm, then its skills"]],
@@ -10461,14 +10845,14 @@ const command$65 = defineCommand({
10461
10845
  prompts: true,
10462
10846
  mcp: false,
10463
10847
  async run(ctx) {
10464
- const { runUpgrade } = await import("./upgrade-DfD3-ClG.js");
10848
+ const { runUpgrade } = await import("./upgrade-CYFdpVpi.js");
10465
10849
  return runUpgrade(ctx, AUTO_UPDATE_TARGET());
10466
10850
  }
10467
10851
  });
10468
10852
 
10469
10853
  //#endregion
10470
10854
  //#region src/commands/artifacts/approve.ts
10471
- const command$66 = defineCommand({
10855
+ const command$67 = defineCommand({
10472
10856
  name: "artifacts approve",
10473
10857
  summary: "Review what a version can do and make it live",
10474
10858
  details: "Admins only. Shows the version's manifest and how it differs from the live version, then asks. Without a terminal it needs --yes, and --accept-changes too when what the artifact can do changes.",
@@ -10501,7 +10885,7 @@ const command$66 = defineCommand({
10501
10885
  mcp: false,
10502
10886
  channel: "next",
10503
10887
  async run(ctx, { args, flags }) {
10504
- const { runArtifactApprove } = await import("./approve-BSbdmOez.js");
10888
+ const { runArtifactApprove } = await import("./approve-yRZmvkCj.js");
10505
10889
  await runArtifactApprove(ctx, {
10506
10890
  version: args.version,
10507
10891
  ...flags
@@ -10511,7 +10895,7 @@ const command$66 = defineCommand({
10511
10895
 
10512
10896
  //#endregion
10513
10897
  //#region src/commands/artifacts/create.ts
10514
- const command$67 = defineCommand({
10898
+ const command$68 = defineCommand({
10515
10899
  name: "artifacts create",
10516
10900
  summary: "Start an artifact: a mini-app that adds to the Superwall dashboard",
10517
10901
  args: { dir: { describe: "Where to put it (default: my-artifact)" } },
@@ -10527,7 +10911,7 @@ const command$67 = defineCommand({
10527
10911
  mcp: false,
10528
10912
  channel: "next",
10529
10913
  async run(ctx, { args, flags }) {
10530
- const { runArtifactCreate } = await import("./starter-BtUUQWhd.js");
10914
+ const { runArtifactCreate } = await import("./starter-BlJ_InZJ.js");
10531
10915
  await runArtifactCreate(ctx, {
10532
10916
  dir: args.dir,
10533
10917
  install: flags.install
@@ -10537,7 +10921,7 @@ const command$67 = defineCommand({
10537
10921
 
10538
10922
  //#endregion
10539
10923
  //#region src/commands/artifacts/dev.ts
10540
- const command$68 = defineCommand({
10924
+ const command$69 = defineCommand({
10541
10925
  name: "artifacts dev",
10542
10926
  summary: "Run an artifact on localhost against your real data, read-only",
10543
10927
  details: "Bundles the artifact the way the builder does, including its client.entry, and runs it in workerd. A local page plays the dashboard: it mounts pages and widgets, sends them context and theme over the bridge, and runs metrics and readouts. API calls go out with a short-lived, read-only token as you, limited to one organization and to the routes an artifact can read. It reads everything you can read in that organization, so only run code you trust. A staff account reaches only that organization too. Writes, outside hosts and raw sockets are refused. Every change rebuilds it.",
@@ -10611,7 +10995,7 @@ const command$68 = defineCommand({
10611
10995
  mcp: false,
10612
10996
  channel: "next",
10613
10997
  async run(ctx, { args, flags }) {
10614
- const { runArtifactDev } = await import("./run-tVYJ3V5j.js");
10998
+ const { runArtifactDev } = await import("./run-Bme4Egyl.js");
10615
10999
  await runArtifactDev(ctx, {
10616
11000
  dir: args.dir,
10617
11001
  ...flags
@@ -10621,7 +11005,7 @@ const command$68 = defineCommand({
10621
11005
 
10622
11006
  //#endregion
10623
11007
  //#region src/commands/artifacts/install.ts
10624
- const command$69 = defineCommand({
11008
+ const command$70 = defineCommand({
10625
11009
  name: "artifacts install",
10626
11010
  summary: "Choose where an entrypoint shows",
10627
11011
  details: "Admins only. Installs an entrypoint of the live version for the whole organization, or one app with --app. An app's row overrides the organization's there. Without an entrypoint, lists what's installed.",
@@ -10667,7 +11051,7 @@ const command$69 = defineCommand({
10667
11051
  mcp: false,
10668
11052
  channel: "next",
10669
11053
  async run(ctx, { args, flags }) {
10670
- const { runArtifactInstall } = await import("./install-DsIsif39.js");
11054
+ const { runArtifactInstall } = await import("./install-CxyqfKFe.js");
10671
11055
  await runArtifactInstall(ctx, {
10672
11056
  entrypoint: args.entrypoint,
10673
11057
  ...flags
@@ -10677,7 +11061,7 @@ const command$69 = defineCommand({
10677
11061
 
10678
11062
  //#endregion
10679
11063
  //#region src/commands/artifacts/list.ts
10680
- const command$70 = defineCommand({
11064
+ const command$71 = defineCommand({
10681
11065
  name: "artifacts list",
10682
11066
  summary: "List an organization's artifacts",
10683
11067
  flags: {
@@ -10695,14 +11079,14 @@ const command$70 = defineCommand({
10695
11079
  mcp: false,
10696
11080
  channel: "next",
10697
11081
  async run(ctx, { flags }) {
10698
- const { runArtifactList } = await import("./install-DsIsif39.js");
11082
+ const { runArtifactList } = await import("./install-CxyqfKFe.js");
10699
11083
  await runArtifactList(ctx, flags);
10700
11084
  }
10701
11085
  });
10702
11086
 
10703
11087
  //#endregion
10704
11088
  //#region src/commands/artifacts/logs.ts
10705
- const command$71 = defineCommand({
11089
+ const command$72 = defineCommand({
10706
11090
  name: "artifacts logs",
10707
11091
  summary: "Show a version's build log",
10708
11092
  details: "The last 128 KiB, once the build has finished. The latest version by default.",
@@ -10723,7 +11107,7 @@ const command$71 = defineCommand({
10723
11107
  mcp: false,
10724
11108
  channel: "next",
10725
11109
  async run(ctx, { args, flags }) {
10726
- const { runArtifactLogs } = await import("./status-CB_MrFu5.js");
11110
+ const { runArtifactLogs } = await import("./status-DHRxg1ZA.js");
10727
11111
  await runArtifactLogs(ctx, {
10728
11112
  version: args.version,
10729
11113
  ...flags
@@ -10733,7 +11117,7 @@ const command$71 = defineCommand({
10733
11117
 
10734
11118
  //#endregion
10735
11119
  //#region src/commands/artifacts/open.ts
10736
- const command$72 = defineCommand({
11120
+ const command$73 = defineCommand({
10737
11121
  name: "artifacts open",
10738
11122
  summary: "Open an artifact in the dashboard",
10739
11123
  args: { entrypoint: { describe: "An entrypoint to open inside an app, with --app" } },
@@ -10762,7 +11146,7 @@ const command$72 = defineCommand({
10762
11146
  mcp: false,
10763
11147
  channel: "next",
10764
11148
  async run(ctx, { args, flags }) {
10765
- const { runArtifactOpen } = await import("./install-DsIsif39.js");
11149
+ const { runArtifactOpen } = await import("./install-CxyqfKFe.js");
10766
11150
  await runArtifactOpen(ctx, {
10767
11151
  entrypoint: args.entrypoint,
10768
11152
  ...flags
@@ -10772,7 +11156,7 @@ const command$72 = defineCommand({
10772
11156
 
10773
11157
  //#endregion
10774
11158
  //#region src/commands/artifacts/pull.ts
10775
- const command$73 = defineCommand({
11159
+ const command$74 = defineCommand({
10776
11160
  name: "artifacts pull",
10777
11161
  summary: "Bring teammates' pushes into this project, merged with your edits",
10778
11162
  args: { dir: { describe: "The artifact project, or with --artifact an empty folder to fill (default: cwd)" } },
@@ -10799,7 +11183,7 @@ const command$73 = defineCommand({
10799
11183
  mcp: false,
10800
11184
  channel: "next",
10801
11185
  async run(ctx, { args, flags }) {
10802
- const { runArtifactPull } = await import("./pull-CiIrJ5ik.js");
11186
+ const { runArtifactPull } = await import("./pull-lYRULo4v.js");
10803
11187
  await runArtifactPull(ctx, {
10804
11188
  dir: args.dir,
10805
11189
  ...flags
@@ -10809,7 +11193,7 @@ const command$73 = defineCommand({
10809
11193
 
10810
11194
  //#endregion
10811
11195
  //#region src/commands/artifacts/push.ts
10812
- const command$74 = defineCommand({
11196
+ const command$75 = defineCommand({
10813
11197
  name: "artifacts push",
10814
11198
  summary: "Push this artifact's source and build it",
10815
11199
  details: "The first push creates the artifact from the manifest's name and records its id in superwall.artifact.json. Each push makes a version from the commit. Only you can see it until an admin approves it. When the source repo has commits this project doesn't, the push merges them, and your own copy runs them with your reads, so it asks first. Without a terminal it stops unless you pass --accept-merged-commits.",
@@ -10845,7 +11229,7 @@ const command$74 = defineCommand({
10845
11229
  mcp: false,
10846
11230
  channel: "next",
10847
11231
  async run(ctx, { args, flags }) {
10848
- const { runArtifactPush } = await import("./push-BgqTddLA.js");
11232
+ const { runArtifactPush } = await import("./push-DHlUMkbf.js");
10849
11233
  await runArtifactPush(ctx, {
10850
11234
  dir: args.dir,
10851
11235
  ...flags
@@ -10855,7 +11239,7 @@ const command$74 = defineCommand({
10855
11239
 
10856
11240
  //#endregion
10857
11241
  //#region src/commands/artifacts/share.ts
10858
- const command$75 = defineCommand({
11242
+ const command$76 = defineCommand({
10859
11243
  name: "artifacts share",
10860
11244
  summary: "Ask an admin to review a version",
10861
11245
  details: "The latest built version by default. Until an organization owner or admin approves it, only its author can see it. Nobody is told automatically, so it says who to ask.",
@@ -10876,7 +11260,7 @@ const command$75 = defineCommand({
10876
11260
  mcp: false,
10877
11261
  channel: "next",
10878
11262
  async run(ctx, { args, flags }) {
10879
- const { runArtifactShare } = await import("./status-CB_MrFu5.js");
11263
+ const { runArtifactShare } = await import("./status-DHRxg1ZA.js");
10880
11264
  await runArtifactShare(ctx, {
10881
11265
  version: args.version,
10882
11266
  ...flags
@@ -10886,7 +11270,7 @@ const command$75 = defineCommand({
10886
11270
 
10887
11271
  //#endregion
10888
11272
  //#region src/commands/artifacts/status.ts
10889
- const command$76 = defineCommand({
11273
+ const command$77 = defineCommand({
10890
11274
  name: "artifacts status",
10891
11275
  summary: "Show an artifact's state and its latest versions",
10892
11276
  flags: {
@@ -10909,14 +11293,14 @@ const command$76 = defineCommand({
10909
11293
  mcp: false,
10910
11294
  channel: "next",
10911
11295
  async run(ctx, { flags }) {
10912
- const { runArtifactStatus } = await import("./status-CB_MrFu5.js");
11296
+ const { runArtifactStatus } = await import("./status-DHRxg1ZA.js");
10913
11297
  await runArtifactStatus(ctx, flags);
10914
11298
  }
10915
11299
  });
10916
11300
 
10917
11301
  //#endregion
10918
11302
  //#region src/commands/artifacts/try.ts
10919
- const command$77 = defineCommand({
11303
+ const command$78 = defineCommand({
10920
11304
  name: "artifacts try",
10921
11305
  summary: "Upload a draft and run an entrypoint on the real runtime",
10922
11306
  details: "Nothing is saved: the draft runs as you, read-only and with no outside hosts, and only you can reach it for a day. A metric prints its series. A page, panel, tab, card or action opens in the dashboard. Readouts run with artifacts dev until the runtime takes them.",
@@ -11011,7 +11395,7 @@ const command$77 = defineCommand({
11011
11395
  mcp: false,
11012
11396
  channel: "next",
11013
11397
  async run(ctx, { args, flags }) {
11014
- const { runArtifactTry } = await import("./try-CS3jLyoP.js");
11398
+ const { runArtifactTry } = await import("./try-C8QQbG0b.js");
11015
11399
  await runArtifactTry(ctx, {
11016
11400
  entrypoint: args.entrypoint,
11017
11401
  ...flags
@@ -11021,7 +11405,7 @@ const command$77 = defineCommand({
11021
11405
 
11022
11406
  //#endregion
11023
11407
  //#region src/commands/artifacts/update.ts
11024
- const command$78 = defineCommand({
11408
+ const command$79 = defineCommand({
11025
11409
  name: "artifacts update",
11026
11410
  summary: "Refresh an artifact's vendored SDK from the public repo",
11027
11411
  args: { dir: { describe: "The artifact (default: cwd)" } },
@@ -11043,7 +11427,7 @@ const command$78 = defineCommand({
11043
11427
  mcp: false,
11044
11428
  channel: "next",
11045
11429
  async run(ctx, { args, flags }) {
11046
- const { runArtifactUpdate } = await import("./starter-BtUUQWhd.js");
11430
+ const { runArtifactUpdate } = await import("./starter-BlJ_InZJ.js");
11047
11431
  await runArtifactUpdate(ctx, {
11048
11432
  dir: args.dir,
11049
11433
  install: flags.install,
@@ -11054,7 +11438,7 @@ const command$78 = defineCommand({
11054
11438
 
11055
11439
  //#endregion
11056
11440
  //#region src/commands/workflows/integrate.ts
11057
- const command$79 = defineCommand({
11441
+ const command$80 = defineCommand({
11058
11442
  name: "integrate",
11059
11443
  summary: "Set up the SDK, placements, and dashboard in your app",
11060
11444
  flags: {
@@ -11086,8 +11470,8 @@ const command$79 = defineCommand({
11086
11470
  prompts: true,
11087
11471
  mcp: false,
11088
11472
  async run(ctx, { flags }) {
11089
- const { runIntegrate } = await import("./integrate-B8eA676b.js");
11090
- const { printPlaybook } = await import("./playbook-BKqlv77S.js");
11473
+ const { runIntegrate } = await import("./integrate-MkyDDzI5.js");
11474
+ const { printPlaybook } = await import("./playbook-CVGolez9.js");
11091
11475
  if (flags.skill) return printPlaybook(ctx.installDir, "integrate");
11092
11476
  await runIntegrate({
11093
11477
  ...ctx,
@@ -11099,7 +11483,7 @@ const command$79 = defineCommand({
11099
11483
 
11100
11484
  //#endregion
11101
11485
  //#region src/commands/workflows/migrate.ts
11102
- const command$80 = defineCommand({
11486
+ const command$81 = defineCommand({
11103
11487
  name: "migrate",
11104
11488
  summary: "Migrate from RevenueCat / Adapty / Qonversion, or rebuild a paywall or native screen as code",
11105
11489
  args: { paywall: { describe: "A dashboard paywall id: scaffold it as code (if not already) and rebuild its pages with your agent, or copy the prompt" } },
@@ -11133,8 +11517,8 @@ const command$80 = defineCommand({
11133
11517
  prompts: true,
11134
11518
  mcp: false,
11135
11519
  async run(ctx, { args, flags }) {
11136
- const { runPaywallMigration, runProviderMigration, runScreenMigration } = await import("./migrate-DoRb9jmA.js");
11137
- const { printPlaybook } = await import("./playbook-BKqlv77S.js");
11520
+ const { runPaywallMigration, runProviderMigration, runScreenMigration } = await import("./migrate-CdFoZipj.js");
11521
+ const { printPlaybook } = await import("./playbook-CVGolez9.js");
11138
11522
  if (flags.screen !== void 0) return runScreenMigration(ctx, {
11139
11523
  path: flags.screen,
11140
11524
  screenshot: flags.screenshot
@@ -11147,7 +11531,7 @@ const command$80 = defineCommand({
11147
11531
 
11148
11532
  //#endregion
11149
11533
  //#region src/commands/workflows/review.ts
11150
- const command$81 = defineCommand({
11534
+ const command$82 = defineCommand({
11151
11535
  name: "review",
11152
11536
  summary: "Review an existing Superwall setup end to end",
11153
11537
  flags: {
@@ -11168,8 +11552,8 @@ const command$81 = defineCommand({
11168
11552
  prompts: true,
11169
11553
  mcp: false,
11170
11554
  async run(ctx, { flags }) {
11171
- const { runReview } = await import("./integrate-B8eA676b.js");
11172
- const { printPlaybook } = await import("./playbook-BKqlv77S.js");
11555
+ const { runReview } = await import("./integrate-MkyDDzI5.js");
11556
+ const { printPlaybook } = await import("./playbook-CVGolez9.js");
11173
11557
  if (flags.skill) return printPlaybook(ctx.installDir, flags.fix ? "review-fix" : "review");
11174
11558
  await runReview(ctx, flags.fix);
11175
11559
  }
@@ -11183,9 +11567,9 @@ const GROUPS = [
11183
11567
  title: "Workflows",
11184
11568
  notes: ["Each takes --skill to print the playbook instead of running."],
11185
11569
  commands: [
11186
- command$79,
11187
- command$81,
11188
- command$80
11570
+ command$80,
11571
+ command$82,
11572
+ command$81
11189
11573
  ]
11190
11574
  },
11191
11575
  {
@@ -11193,13 +11577,13 @@ const GROUPS = [
11193
11577
  title: "Paywalls & funnels",
11194
11578
  notes: ["push and publish take -m <note> to record why, in the source commit.", "build, push, promote, publish and pull take --platform <p> when a project pushes to several platforms."],
11195
11579
  commands: [
11196
- command$46,
11197
11580
  command$47,
11198
- command$45,
11199
- command$51,
11200
11581
  command$48,
11582
+ command$46,
11583
+ command$52,
11201
11584
  command$49,
11202
- command$50
11585
+ command$50,
11586
+ command$51
11203
11587
  ]
11204
11588
  },
11205
11589
  {
@@ -11213,19 +11597,19 @@ const GROUPS = [
11213
11597
  details: "An artifact is a Worker with a superwall.json manifest. It holds no credential: it calls Superwall as whoever is viewing it."
11214
11598
  }],
11215
11599
  commands: [
11216
- command$67,
11217
11600
  command$68,
11218
- command$77,
11601
+ command$69,
11219
11602
  command$78,
11603
+ command$79,
11604
+ command$75,
11220
11605
  command$74,
11221
- command$73,
11606
+ command$77,
11607
+ command$72,
11222
11608
  command$76,
11223
- command$71,
11224
- command$75,
11225
- command$66,
11226
- command$69,
11609
+ command$67,
11227
11610
  command$70,
11228
- command$72
11611
+ command$71,
11612
+ command$73
11229
11613
  ]
11230
11614
  },
11231
11615
  {
@@ -11233,16 +11617,16 @@ const GROUPS = [
11233
11617
  title: "Commands",
11234
11618
  notes: ["superwall <command> --help lists its operations; <operation> --help, its flags."],
11235
11619
  commands: [
11236
- command$54,
11237
- command$53,
11238
- command$59,
11239
- command$56,
11240
11620
  command$55,
11241
- command$58,
11621
+ command$54,
11242
11622
  command$60,
11243
- command$61,
11244
11623
  command$57,
11245
- command$52
11624
+ command$56,
11625
+ command$59,
11626
+ command$61,
11627
+ command$62,
11628
+ command$58,
11629
+ command$53
11246
11630
  ]
11247
11631
  },
11248
11632
  {
@@ -11257,12 +11641,13 @@ const GROUPS = [
11257
11641
  topics: [{
11258
11642
  name: "api",
11259
11643
  summary: "The Superwall API reference",
11260
- details: "Search the reference for any endpoint, its parameters and body. get, post, patch and delete send any request to it."
11644
+ details: "Search the reference for any endpoint, its parameters and body. get, post, put, patch and delete send any request to it."
11261
11645
  }],
11262
11646
  commands: [
11263
11647
  command$5,
11264
11648
  command$6,
11265
11649
  command$8,
11650
+ command$9,
11266
11651
  command$7,
11267
11652
  command$4
11268
11653
  ]
@@ -11378,35 +11763,35 @@ proxy uses. No command prints a private key, and none revokes a key at Apple.`
11378
11763
  }
11379
11764
  ],
11380
11765
  commands: [
11381
- command$35,
11382
- command$21,
11383
- command$18,
11384
- command$23,
11385
- command$19,
11386
- command$20,
11766
+ command$36,
11387
11767
  command$22,
11768
+ command$19,
11388
11769
  command$24,
11770
+ command$20,
11771
+ command$21,
11772
+ command$23,
11389
11773
  command$25,
11390
- command$9,
11391
- command$30,
11392
- command$34,
11393
- command$36,
11394
- command$15,
11395
- command$16,
11396
- command$29,
11397
11774
  command$26,
11398
11775
  command$10,
11399
- command$32,
11400
- command$33,
11776
+ command$31,
11777
+ command$35,
11401
11778
  command$37,
11402
- command$11,
11779
+ command$16,
11403
11780
  command$17,
11404
- command$31,
11405
- command$14,
11406
- command$28,
11781
+ command$30,
11407
11782
  command$27,
11783
+ command$11,
11784
+ command$33,
11785
+ command$34,
11786
+ command$38,
11408
11787
  command$12,
11409
- command$13
11788
+ command$18,
11789
+ command$32,
11790
+ command$15,
11791
+ command$29,
11792
+ command$28,
11793
+ command$13,
11794
+ command$14
11410
11795
  ]
11411
11796
  },
11412
11797
  {
@@ -11421,13 +11806,13 @@ proxy uses. No command prints a private key, and none revokes a key at Apple.`
11421
11806
  "asa docs"
11422
11807
  ] },
11423
11808
  commands: [
11424
- command$38,
11425
- command$42,
11426
- command$41,
11809
+ command$39,
11427
11810
  command$43,
11811
+ command$42,
11428
11812
  command$44,
11429
- command$39,
11430
- command$40
11813
+ command$45,
11814
+ command$40,
11815
+ command$41
11431
11816
  ]
11432
11817
  },
11433
11818
  {
@@ -11443,10 +11828,10 @@ proxy uses. No command prints a private key, and none revokes a key at Apple.`
11443
11828
  id: "support",
11444
11829
  title: "Support & updates",
11445
11830
  commands: [
11446
- command$62,
11447
- command$64,
11831
+ command$63,
11448
11832
  command$65,
11449
- command$63
11833
+ command$66,
11834
+ command$64
11450
11835
  ]
11451
11836
  }
11452
11837
  ];
@@ -11456,9 +11841,9 @@ function visible(channel) {
11456
11841
  function listGroups() {
11457
11842
  return GROUPS.filter((group$1) => visible(group$1.channel)).map((group$1) => ({
11458
11843
  ...group$1,
11459
- commands: group$1.commands.filter((command$82) => visible(command$82.channel))
11844
+ commands: group$1.commands.filter((command$83) => visible(command$83.channel))
11460
11845
  }));
11461
11846
  }
11462
11847
 
11463
11848
  //#endregion
11464
- export { renderPage as a, exampleLines as i, cmd as n, detailLines as r, listGroups as t };
11849
+ export { exampleLines as a, detailLines as i, listGroups as n, renderPage as o, cmd as r, GROUPS as t };