@superwall/cli 2.4.0 → 2.5.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 (111) hide show
  1. package/README.md +7 -0
  2. package/dist/{apple-Bx_fm5M-.js → apple-BSKxY7Gx.js} +16 -15
  3. package/dist/approve-DbwsYO4s.js +190 -0
  4. package/dist/{assets-W5yvyf0V.js → assets-CqpFg5mM.js} +3 -3
  5. package/dist/auth.d.ts +1 -1
  6. package/dist/auth.js +3 -3
  7. package/dist/{billing-C4lXR0xG.js → billing-BopwIhR3.js} +3 -3
  8. package/dist/{bind-82oTpHZ3.js → bind-DOF3o3FR.js} +4 -4
  9. package/dist/browser-Bp3yRKlU.js +36 -0
  10. package/dist/{build-7_8cBgBm.js → build-BF22vVdV.js} +11 -7
  11. package/dist/{client-ltxxHuxn.js → client-DHlsTaP1.js} +3 -3
  12. package/dist/{create-DEyveHS6.js → create-CboPfAlN.js} +39 -67
  13. package/dist/{create-Dk8U_B49.js → create-CiZzZrru.js} +8 -8
  14. package/dist/create-DAkNdEzt.js +20 -0
  15. package/dist/design-lint-CvgcSzVg.js +158 -0
  16. package/dist/{doctor-Df2GwS4K.js → doctor-BqZGaQE5.js} +6 -6
  17. package/dist/download-F8OtTJze.js +58 -0
  18. package/dist/{drivers-CTyYdBL7.js → drivers-DkboeR1c.js} +3 -3
  19. package/dist/entry.js +25 -24
  20. package/dist/{environment-djS0ik60.js → environment-FR3bcq0D.js} +5 -4
  21. package/dist/{existing-Das3PHGG.js → existing-C6TTT6c4.js} +2 -2
  22. package/dist/{session-CV0P8BjK.js → git-DqDPnldI.js} +109 -338
  23. package/dist/{held-B8EFWDEc.js → held-C2IjAyg6.js} +7 -7
  24. package/dist/held-KVcYIplR.js +17 -0
  25. package/dist/install-DoSYCwLL.js +109 -0
  26. package/dist/{integrate-Cz48dm_h.js → integrate-BSqd2wgI.js} +27 -25
  27. package/dist/login-BiwaQkXS.js +17 -0
  28. package/dist/{login-CiK5T4w8.js → login-C6FcBQZg.js} +8 -41
  29. package/dist/{login-girc324T.js → login-dRPPnGr7.js} +2 -1
  30. package/dist/{lookup-us5vu5od.js → lookup-D23dAOz6.js} +3 -2
  31. package/dist/{migrate-DaVwhdov.js → migrate-CDdUCTH3.js} +30 -25
  32. package/dist/{migration-cS6UGeUj.js → migration-r9plM7F6.js} +29 -11
  33. package/dist/{notification-url-Hg42tAbW.js → notification-url-rdnENCxt.js} +4 -4
  34. package/dist/{open-BIuOZ9ka.js → open-DVdE3HnK.js} +2 -2
  35. package/dist/{org-BrR4HGvl.js → org-DZ41muzA.js} +3 -2
  36. package/dist/organization-DIODPOwO.js +39 -0
  37. package/dist/orgs-BxlwcvTu.js +81 -0
  38. package/dist/{paths-CdwjySxK.js → paths-BaeoxDze.js} +1 -1
  39. package/dist/{playbook-BJ3opYIS.js → playbook-B-Pdonhg.js} +10 -10
  40. package/dist/{products-DH_fK9tY.js → products-Cqq59DBQ.js} +1 -1
  41. package/dist/project-DHU5wc3R.js +47 -0
  42. package/dist/{promote-BQO-1ScY.js → promote-Ca4URuHY.js} +24 -18
  43. package/dist/{pull-BhRswq6x.js → pull-CQcTZxW8.js} +9 -28
  44. package/dist/pull-DRMIxqR8.js +36 -0
  45. package/dist/pull-_qs90vGA.js +106 -0
  46. package/dist/{push-CR110qRh.js → push-BlZoIwIj.js} +122 -20
  47. package/dist/push-Cb4g_l1K.js +30 -0
  48. package/dist/push-DQE48h_M.js +290 -0
  49. package/dist/push-DZKsd6Dp.js +22 -0
  50. package/dist/{registry-DZsWoWqH.js → registry-FNG-uiIt.js} +712 -68
  51. package/dist/resolve-DGePiHgL.js +196 -0
  52. package/dist/{resources-BMspgZO1.js → resources-COOEvqqW.js} +3 -80
  53. package/dist/run-Czbb-sHR.js +1368 -0
  54. package/dist/{run-D4V6mq8_.js → run-DpYDOAw-.js} +2 -2
  55. package/dist/scan-2WqHGkjU.js +4 -0
  56. package/dist/{scan-CRexsHOE.js → scan-BZS2FZeU.js} +1 -1
  57. package/dist/{scope-Ct0_HoNq.js → scope-BJQ-KcQg.js} +5 -4
  58. package/dist/scope-t_SqFN6W.js +103 -0
  59. package/dist/sdk-CyttTnGf.js +71 -0
  60. package/dist/selection-CWfI4a0O.js +179 -0
  61. package/dist/series--Wp7TngJ.js +685 -0
  62. package/dist/{server-Dv1VwbNh.js → server-BmmOj7bh.js} +10 -8
  63. package/dist/server-BqLPwcy9.js +29 -0
  64. package/dist/session-BHBIGscL.js +6 -0
  65. package/dist/{session-UiPlLFn6.js → session-BpYpOgaY.js} +1 -1
  66. package/dist/session-DYdxTNZf.js +219 -0
  67. package/dist/{setup-UWLhQG3M.js → setup-DW50luOZ.js} +9 -8
  68. package/dist/skills/index.json +5 -0
  69. package/dist/skills/superwall/SKILL.md +48 -30
  70. package/dist/skills/superwall/references/api.md +3 -2
  71. package/dist/skills/superwall-editor/SKILL.md +7 -5
  72. package/dist/skills/superwall-framework/SKILL.md +7 -5
  73. package/dist/skills/superwall-workspaces/SKILL.md +314 -0
  74. package/dist/skills/superwall-workspaces/references/cli.md +174 -0
  75. package/dist/skills/superwall-workspaces/references/slots.md +103 -0
  76. package/dist/{skills-DzOvse9L.js → skills-Bbtq8V_D.js} +8 -8
  77. package/dist/{skills-CiWxt6vS.js → skills-Cm1j2d1W.js} +4 -4
  78. package/dist/{source-push-CX_k_yZD.js → source-push-B3c-VLfe.js} +43 -25
  79. package/dist/{spinner-1uuKKZMc.js → spinner-025_eqCX.js} +16 -4
  80. package/dist/starter-hcwocv_Z.js +190 -0
  81. package/dist/status-K1IGp6pe.js +142 -0
  82. package/dist/{storage-CrXGgIbS.js → storage-CUMgpcVH.js} +1 -1
  83. package/dist/{storekit-CptdG4RJ.js → storekit-Cb0TkToV.js} +4 -4
  84. package/dist/storekit-Dewj_5qg.js +17 -0
  85. package/dist/{telemetry-BqaPbM0k.js → telemetry-ekUQuhLJ.js} +1 -1
  86. package/dist/{token-zjjlkNDF.js → token-B2PduqrR.js} +1 -1
  87. package/dist/tools-skills/superwall/SKILL.md +49 -31
  88. package/dist/tools-skills/superwall/references/api.md +3 -2
  89. package/dist/tools-skills/superwall-editor/SKILL.md +7 -5
  90. package/dist/tools.d.ts +1 -1
  91. package/dist/tools.js +479 -34
  92. package/dist/try-BUnhITXS.js +120 -0
  93. package/dist/{selection-CgZJJ3FD.js → types-CB6O_wjy.js} +1 -178
  94. package/dist/{upgrade-BBnmcyY2.js → upgrade-CI7K1UZ-.js} +2 -2
  95. package/dist/{upgrade-AdyF7wXk.js → upgrade-DfZfDljd.js} +2 -2
  96. package/package.json +5 -3
  97. package/dist/create-CBCDWuyo.js +0 -19
  98. package/dist/held-BL4oizD6.js +0 -16
  99. package/dist/login-DdrOmi6m.js +0 -16
  100. package/dist/push-B3Onn_mL.js +0 -24
  101. package/dist/scan-DUQjxOZf.js +0 -4
  102. package/dist/server-Cv-Ug9JF.js +0 -24
  103. package/dist/session-BCQuMcQ0.js +0 -6
  104. package/dist/storekit-B675ZNiA.js +0 -16
  105. /package/dist/{client-BZ1UbpXz.js → client-BJQXl62Q.js} +0 -0
  106. /package/dist/{devtools-pBl_vt03.js → devtools-ByZ6XYnn.js} +0 -0
  107. /package/dist/{input-vi0bou04.js → input-MDd67UIp.js} +0 -0
  108. /package/dist/{reports-CwwKLUh0.js → reports-BZfxvenS.js} +0 -0
  109. /package/dist/{screenshot-file-tVBfUEIi.js → screenshot-file-XAS0Xy0e.js} +0 -0
  110. /package/dist/{storage-gRyQetN9.d.ts → storage-Bdz5AmqS.d.ts} +0 -0
  111. /package/dist/{timing-BVxPrYq3.js → timing-Ca0TXY-A.js} +0 -0
package/README.md CHANGED
@@ -239,6 +239,13 @@ landed stays pending, so `promote` still won't ship it. With no project,
239
239
  `superwall pull --app <id> [dir]` creates `superwall/` from the app's source,
240
240
  so you can work on an app's paywalls without its codebase or GitHub.
241
241
 
242
+ A change to the shared design system (`DESIGN.md`, `design/`, `components/`)
243
+ reaches every paywall that imports it. `publish --existing --source` ships it:
244
+ `--existing` rebuilds only the paywalls already on Superwall and never creates
245
+ one, and `--source` pushes the project source to every app, also those whose
246
+ paywalls built the same. Push and build warn when a paywall hard-codes a value
247
+ that `design/tokens.css` already holds, naming the token to use instead.
248
+
242
249
  The full reference — assets, localization, trials, transitions, web
243
250
  checkout, troubleshooting — lives at
244
251
  [superwall.com/docs/framework](https://superwall.com/docs/framework).
@@ -1,21 +1,22 @@
1
- import "./token-zjjlkNDF.js";
1
+ import "./token-B2PduqrR.js";
2
2
  import { t as blocks } from "./output-Ggzq5_-t.js";
3
- import "./environment-djS0ik60.js";
4
- import "./storage-CrXGgIbS.js";
5
- import { t as ApiError } from "./client-ltxxHuxn.js";
6
- import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-B8EFWDEc.js";
3
+ import "./environment-FR3bcq0D.js";
4
+ import "./storage-CUMgpcVH.js";
5
+ import { t as ApiError } from "./client-DHlsTaP1.js";
6
+ import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-C2IjAyg6.js";
7
7
  import "./config-CGcG7GOt.js";
8
- import { t as apiCall } from "./spinner-1uuKKZMc.js";
8
+ import { t as apiCall } from "./spinner-025_eqCX.js";
9
9
  import "./ui-D_qf3Gvw.js";
10
- import "./paths-CdwjySxK.js";
11
- import "./resources-BMspgZO1.js";
12
- import "./org-BrR4HGvl.js";
13
- import "./lookup-us5vu5od.js";
14
- import "./scope-Ct0_HoNq.js";
15
- import "./client-BZ1UbpXz.js";
16
- import "./timing-BVxPrYq3.js";
17
- import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-Hg42tAbW.js";
18
- import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-Dk8U_B49.js";
10
+ import "./paths-BaeoxDze.js";
11
+ import "./orgs-BxlwcvTu.js";
12
+ import "./resources-COOEvqqW.js";
13
+ import "./org-DZ41muzA.js";
14
+ import "./lookup-D23dAOz6.js";
15
+ import "./scope-BJQ-KcQg.js";
16
+ import "./client-BJQXl62Q.js";
17
+ import "./timing-Ca0TXY-A.js";
18
+ import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-rdnENCxt.js";
19
+ import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-CiZzZrru.js";
19
20
 
20
21
  //#region src/core/app-store-connect/setup/apple.ts
21
22
  const STEPS = [
@@ -0,0 +1,190 @@
1
+ import "./token-B2PduqrR.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-FR3bcq0D.js";
4
+ import "./storage-CUMgpcVH.js";
5
+ import { t as ApiError } from "./client-DHlsTaP1.js";
6
+ import "./config-CGcG7GOt.js";
7
+ import "./orgs-BxlwcvTu.js";
8
+ import "./types-CB6O_wjy.js";
9
+ import "./scope-t_SqFN6W.js";
10
+ import { h as approveVersion, l as resolveWorkspace, n as awaitingInstall, s as pickVersion, u as roleCanApprove } from "./resolve-DGePiHgL.js";
11
+ import { r as WorkspaceError } from "./project-DHU5wc3R.js";
12
+
13
+ //#region src/core/workspaces/approve.ts
14
+ const SECTIONS = [
15
+ ["scopes", "Scopes"],
16
+ ["backgroundScopes", "Background scopes"],
17
+ ["egress", "Outside hosts"],
18
+ ["secrets", "Secrets"],
19
+ ["entrypoints", "Entrypoints"],
20
+ ["crons", "Crons"],
21
+ ["events", "Events"],
22
+ ["storage", "Storage"],
23
+ ["compatibility", "Compatibility"]
24
+ ];
25
+ const quoted = (text) => JSON.stringify(text);
26
+ const secretLabel = (secret) => `${secret.name} to ${secret.host} (${quoted(secret.inject)})`;
27
+ const metricLabel = (metric) => {
28
+ const breakdowns = (metric.breakdowns ?? []).map((breakdown) => breakdown.key);
29
+ const filters = (metric.filters ?? []).map((filter) => `${filter.key} (${filter.values.map((option) => quoted(option.value)).join(", ")})`);
30
+ return [
31
+ metric.value_type ?? "number",
32
+ breakdowns.length > 0 ? `split by ${breakdowns.join(", ")}` : void 0,
33
+ filters.length > 0 ? `filtered by ${filters.join(", ")}` : void 0
34
+ ].filter(Boolean).join(", ");
35
+ };
36
+ const entrypointLabel = (entrypoint) => [
37
+ `${entrypoint.id}: ${entrypoint.slot}`,
38
+ entrypoint.path ? `at ${entrypoint.path}` : void 0,
39
+ quoted(entrypoint.title),
40
+ entrypoint.metric ? `metric: ${metricLabel(entrypoint.metric)}` : void 0
41
+ ].filter(Boolean).join(" ");
42
+ const emptySide = {
43
+ scopes: [],
44
+ backgroundScopes: [],
45
+ egress: [],
46
+ secrets: [],
47
+ entrypoints: [],
48
+ crons: [],
49
+ events: [],
50
+ storage: [],
51
+ compatibility: []
52
+ };
53
+ function sideOf(version, enforced) {
54
+ const manifest = version?.manifest;
55
+ if (!version || !manifest) return emptySide;
56
+ if (enforced && version.grant === null) return emptySide;
57
+ const grant = enforced ? version.grant : null;
58
+ const storage = manifest.storage ?? {};
59
+ return {
60
+ scopes: grant?.scopes ?? manifest.scopes,
61
+ backgroundScopes: grant?.background_scopes ?? manifest.background?.scopes ?? [],
62
+ egress: grant?.egress ?? manifest.egress ?? [],
63
+ secrets: (grant?.secret_bindings ?? manifest.secrets ?? []).map(secretLabel),
64
+ entrypoints: manifest.entrypoints.map(entrypointLabel),
65
+ crons: (manifest.crons ?? []).map((cron) => `${cron.name}: ${cron.schedule}`),
66
+ events: manifest.events ?? [],
67
+ storage: [storage.sql ? "sql" : void 0, storage.kv ? "kv" : void 0].filter((kind) => kind !== void 0),
68
+ compatibility: [...version.compatibility_date ? [`date ${version.compatibility_date}`] : [], ...(version.compatibility_flags ?? []).map((flag) => `flag ${flag}`)]
69
+ };
70
+ }
71
+ function diffSides(before, after) {
72
+ return SECTIONS.flatMap(([section, title]) => {
73
+ const [old, next] = [new Set(before[section]), new Set(after[section])];
74
+ const added = [...next].filter((item) => !old.has(item)).sort();
75
+ const removed = [...old].filter((item) => !next.has(item)).sort();
76
+ return added.length + removed.length > 0 ? [{
77
+ section,
78
+ title,
79
+ added,
80
+ removed
81
+ }] : [];
82
+ });
83
+ }
84
+ const manifestLines = (side) => SECTIONS.flatMap(([section, title]) => {
85
+ const items = side[section];
86
+ if (items.length === 0) return section === "scopes" || section === "egress" ? [`${title}: none`] : [];
87
+ return [`${title}:`, ...[...items].sort().map((item) => ` ${item}`)];
88
+ });
89
+ const diffLines = (diff) => diff.flatMap(({ title, added, removed }) => [
90
+ `${title}:`,
91
+ ...added.map((item) => ` + ${item}`),
92
+ ...removed.map((item) => ` - ${item}`)
93
+ ]);
94
+ function commitLine(message) {
95
+ const [subject = "", note] = message.split(/\n\n+/);
96
+ return subject.startsWith("push workspace/") && note && !note.startsWith("Superwall-") ? note : subject;
97
+ }
98
+ const ONLY_ADMINS = "Only organization owners and admins can approve workspace versions. Ask one of them to review this version.";
99
+ async function runWorkspaceApprove(ctx, input) {
100
+ const workspace = await resolveWorkspace(ctx, input);
101
+ const { version, versions } = await pickVersion(ctx, workspace, input.version, (candidate) => candidate.build_status === "SUCCEEDED" && candidate.id !== workspace.active_version_id);
102
+ if (version.build_status !== "SUCCEEDED" || version.manifest === null) throw new WorkspaceError(`Version ${version.id} is ${version.build_status.toLowerCase()}. Only a built version can be approved.`);
103
+ if (version.id === workspace.active_version_id && version.grant !== null) {
104
+ if (ctx.json) ctx.output.data({
105
+ approved: false,
106
+ reason: "already_active",
107
+ version_id: version.id
108
+ });
109
+ else ctx.ui.info(`Version ${version.id} is already live.`);
110
+ return;
111
+ }
112
+ const active = versions.find((candidate) => candidate.id === workspace.active_version_id);
113
+ const proposed = sideOf(version, false);
114
+ const diff = diffSides(sideOf(active, true), proposed);
115
+ const details = {
116
+ workspace_id: workspace.id,
117
+ version_id: version.id,
118
+ commit_sha: version.commit_sha,
119
+ active_version_id: active?.id ?? null,
120
+ manifest: version.manifest,
121
+ compatibility_date: version.compatibility_date ?? null,
122
+ compatibility_flags: version.compatibility_flags ?? [],
123
+ diff
124
+ };
125
+ if (!ctx.json) ctx.ui.report([
126
+ `${workspace.name}, version ${version.id} (${version.commit_sha.slice(0, 12)})`,
127
+ ...version.commit_message ? [commitLine(version.commit_message)] : [],
128
+ "",
129
+ "What it can do:",
130
+ ...manifestLines(proposed),
131
+ "",
132
+ active ? `Changes from the live version, ${active.id}:` : "Nothing is live yet, so all of this is new:",
133
+ ...diff.length === 0 ? [" Nothing it can do changes."] : diffLines(diff)
134
+ ].join("\n"));
135
+ const refuse = (reason, message) => {
136
+ if (ctx.json) ctx.output.data({
137
+ approved: false,
138
+ reason,
139
+ ...details
140
+ });
141
+ else ctx.ui.error(message);
142
+ ctx.fail();
143
+ };
144
+ if (!await roleCanApprove(ctx, workspace)) {
145
+ refuse("needs_admin", ONLY_ADMINS);
146
+ if (!ctx.json) ctx.ui.info("To ask for review, run `superwall workspaces share`.");
147
+ return;
148
+ }
149
+ const changes = diff.length > 0;
150
+ const accepted = !changes || input.acceptChanges;
151
+ if (ctx.interactive && !(input.yes && accepted)) {
152
+ if (!await ctx.ui.confirm({
153
+ message: changes ? `Approve version ${version.id}, with the changes above to what it can do?` : `Approve version ${version.id}?`,
154
+ initial: false
155
+ })) {
156
+ ctx.ui.outro("Nothing was approved.");
157
+ return;
158
+ }
159
+ } else if (!ctx.interactive) {
160
+ if (!input.yes) {
161
+ refuse("needs_yes", "Nothing was approved. Read the above, then pass --yes to approve it.");
162
+ return;
163
+ }
164
+ if (!accepted) {
165
+ refuse("needs_accept_changes", "Nothing was approved, because this changes what the workspace can do. Read the changes above, then pass --accept-changes too.");
166
+ return;
167
+ }
168
+ }
169
+ let approved;
170
+ try {
171
+ approved = await approveVersion(ctx.api, workspace.id, version.id);
172
+ } catch (error) {
173
+ if (!(error instanceof ApiError) || error.status !== 403) throw error;
174
+ refuse("forbidden", error.message);
175
+ return;
176
+ }
177
+ if (ctx.json) {
178
+ ctx.output.data({
179
+ approved: true,
180
+ ...details,
181
+ version: approved
182
+ });
183
+ return;
184
+ }
185
+ ctx.ui.success(await awaitingInstall(ctx.api, workspace.id, version.manifest) ? `Approved version ${version.id}. Nothing is installed yet, so only its author can see it until you choose where it shows.` : `Approved version ${version.id}. It's live for everyone it's installed for.`);
186
+ ctx.ui.info(`Choose where it shows with \`superwall workspaces install <entrypoint> --workspace ${workspace.id}\`.`);
187
+ }
188
+
189
+ //#endregion
190
+ export { diffSides, runWorkspaceApprove, sideOf };
@@ -1,6 +1,6 @@
1
- import { r as ASSET_HOST } from "./environment-djS0ik60.js";
2
- import { t as ApiError } from "./client-ltxxHuxn.js";
3
- import { S as pushPaywallAssets } from "./resources-BMspgZO1.js";
1
+ import { r as ASSET_HOST } from "./environment-FR3bcq0D.js";
2
+ import { t as ApiError } from "./client-DHlsTaP1.js";
3
+ import { S as pushPaywallAssets } from "./resources-COOEvqqW.js";
4
4
  import * as fs from "node:fs";
5
5
 
6
6
  //#region src/core/paywalls/assets.ts
package/dist/auth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Session } from "./storage-gRyQetN9.js";
1
+ import { t as Session } from "./storage-Bdz5AmqS.js";
2
2
 
3
3
  //#region src/core/account/errors.d.ts
4
4
  declare class NotLoggedInError extends Error {
package/dist/auth.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-zjjlkNDF.js";
1
+ import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-B2PduqrR.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-djS0ik60.js";
4
- import "./storage-CrXGgIbS.js";
3
+ import "./environment-FR3bcq0D.js";
4
+ import "./storage-CUMgpcVH.js";
5
5
 
6
6
  export { NotLoggedInError, getOAuthAccessToken, resolveAuthToken };
@@ -1,6 +1,6 @@
1
- import { m as Integration } from "./environment-djS0ik60.js";
2
- import { i as readPackageJson, r as allDeps } from "./scan-CRexsHOE.js";
3
- import { d as readBundledSkill } from "./skills-CiWxt6vS.js";
1
+ import { h as Integration } from "./environment-FR3bcq0D.js";
2
+ import { i as readPackageJson, r as allDeps } from "./scan-BZS2FZeU.js";
3
+ import { d as readBundledSkill } from "./skills-Cm1j2d1W.js";
4
4
  import { readFileSync } from "node:fs";
5
5
  import fg from "fast-glob";
6
6
 
@@ -1,8 +1,8 @@
1
- import { m as Integration } from "./environment-djS0ik60.js";
2
- import { n as withSpinner } from "./spinner-1uuKKZMc.js";
1
+ import { h as Integration } from "./environment-FR3bcq0D.js";
2
+ import { n as withSpinner } from "./spinner-025_eqCX.js";
3
3
  import { n as ui } from "./ui-D_qf3Gvw.js";
4
- import { c as createProject, m as listProjects, r as createApplication, y as platformLabel } from "./resources-BMspgZO1.js";
5
- import { n as orgForNewProject } from "./org-BrR4HGvl.js";
4
+ import { c as createProject, m as listProjects, r as createApplication, y as platformLabel } from "./resources-COOEvqqW.js";
5
+ import { n as orgForNewProject } from "./org-DZ41muzA.js";
6
6
 
7
7
  //#region src/core/account/bind.ts
8
8
  const NEW = "__new__";
@@ -0,0 +1,36 @@
1
+ import { spawn } from "node:child_process";
2
+
3
+ //#region src/core/account/browser.ts
4
+ const BROWSER_UNAVAILABLE = "Couldn't open a browser here. Open the URL above to approve the login.";
5
+ function hasDisplay(env, platform) {
6
+ if (platform !== "linux") return true;
7
+ return Boolean(env.DISPLAY || env.WAYLAND_DISPLAY || env.WSL_DISTRO_NAME);
8
+ }
9
+ function openBrowser(url, deps = {}) {
10
+ const platform = deps.platform ?? process.platform;
11
+ const env = deps.env ?? process.env;
12
+ if (env.BROWSER === "none" || !hasDisplay(env, platform)) return Promise.resolve(false);
13
+ const cmd = platform === "darwin" ? "open" : platform === "win32" ? "cmd" : "xdg-open";
14
+ const args = platform === "win32" ? [
15
+ "/c",
16
+ "start",
17
+ "",
18
+ url.replaceAll("&", "^&")
19
+ ] : [url];
20
+ return new Promise((resolve) => {
21
+ try {
22
+ const child = (deps.spawn ?? spawn)(cmd, args, {
23
+ stdio: "ignore",
24
+ detached: true
25
+ });
26
+ child.once("error", () => resolve(false));
27
+ child.once("spawn", () => resolve(true));
28
+ child.unref();
29
+ } catch {
30
+ resolve(false);
31
+ }
32
+ });
33
+ }
34
+
35
+ //#endregion
36
+ export { openBrowser as n, BROWSER_UNAVAILABLE as t };
@@ -1,13 +1,16 @@
1
- import "./token-zjjlkNDF.js";
1
+ import "./token-B2PduqrR.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import { b as VERSION } from "./environment-djS0ik60.js";
4
- import "./storage-CrXGgIbS.js";
5
- import "./client-ltxxHuxn.js";
3
+ import { x as VERSION } from "./environment-FR3bcq0D.js";
4
+ import "./storage-CUMgpcVH.js";
5
+ import "./client-DHlsTaP1.js";
6
6
  import "./config-CGcG7GOt.js";
7
7
  import { n as ui } from "./ui-D_qf3Gvw.js";
8
- import "./resources-BMspgZO1.js";
9
- import { t as assetBaseUrl } from "./assets-W5yvyf0V.js";
10
- import { a as resolveProjectDir, b as writeProjectTypes, d as kb, h as took, i as requireProject, k as readLock, n as parseIds, s as selectSurfaces, y as collectProjectDeclarations, z as resolveFramework } from "./selection-CgZJJ3FD.js";
8
+ import "./orgs-BxlwcvTu.js";
9
+ import "./resources-COOEvqqW.js";
10
+ import { t as assetBaseUrl } from "./assets-CqpFg5mM.js";
11
+ import { a as resolveProjectDir, d as kb, h as took, i as requireProject, n as parseIds, s as selectSurfaces, y as resolveFramework } from "./selection-CWfI4a0O.js";
12
+ import { n as lintDesignTokens, t as formatTokenFinding } from "./design-lint-CvgcSzVg.js";
13
+ import { f as readLock, n as collectProjectDeclarations, r as writeProjectTypes } from "./types-CB6O_wjy.js";
11
14
  import * as fs from "node:fs";
12
15
  import * as path from "node:path";
13
16
  import pc from "picocolors";
@@ -47,6 +50,7 @@ async function runBuildPipeline(context, options = {}) {
47
50
  text: `Superwall ${pc.dim(`v${VERSION}`)}`
48
51
  });
49
52
  for (const surface of surfaces) for (const problem of surface.diagnostics ?? []) ui.warn(problem);
53
+ for (const finding of lintDesignTokens(project, surfaces)) ui.warn(formatTokenFinding(finding));
50
54
  const outcomes = [];
51
55
  const at = Date.now();
52
56
  for (const surface of surfaces) for (const platform of platforms) {
@@ -1,6 +1,6 @@
1
- import { n as resolveAuthToken, r as NotLoggedInError } from "./token-zjjlkNDF.js";
2
- import { y as USER_AGENT } from "./environment-djS0ik60.js";
3
- import { a as resolveApiHost, n as readSession } from "./storage-CrXGgIbS.js";
1
+ import { n as resolveAuthToken, r as NotLoggedInError } from "./token-B2PduqrR.js";
2
+ import { b as USER_AGENT } from "./environment-FR3bcq0D.js";
3
+ import { a as resolveApiHost, n as readSession } from "./storage-CUMgpcVH.js";
4
4
 
5
5
  //#region src/core/api/client.ts
6
6
  const BODY_SNIPPET = 200;
@@ -1,84 +1,56 @@
1
- import "./token-zjjlkNDF.js";
1
+ import "./token-B2PduqrR.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-djS0ik60.js";
4
- import "./storage-CrXGgIbS.js";
5
- import "./client-ltxxHuxn.js";
3
+ import "./environment-FR3bcq0D.js";
4
+ import "./storage-CUMgpcVH.js";
5
+ import "./client-DHlsTaP1.js";
6
6
  import "./config-CGcG7GOt.js";
7
- import "./telemetry-BqaPbM0k.js";
7
+ import "./telemetry-ekUQuhLJ.js";
8
8
  import "./spawn-DmmmHIP-.js";
9
- import "./spinner-1uuKKZMc.js";
9
+ import "./spinner-025_eqCX.js";
10
10
  import "./ui-D_qf3Gvw.js";
11
11
  import "./theme-DUsCh-Vd.js";
12
12
  import "./log-C0MDCfA2.js";
13
- import "./scan-CRexsHOE.js";
14
- import "./existing-Das3PHGG.js";
15
- import "./paths-CdwjySxK.js";
16
- import { O as field } from "./resources-BMspgZO1.js";
17
- import "./org-BrR4HGvl.js";
18
- import "./lookup-us5vu5od.js";
19
- import "./bind-82oTpHZ3.js";
20
- import "./login-CiK5T4w8.js";
21
- import "./skills-CiWxt6vS.js";
22
- import "./assets-W5yvyf0V.js";
23
- import "./selection-CgZJJ3FD.js";
24
- import { n as requireApi, t as LoginRequiredError, u as projectPackageName } from "./session-CV0P8BjK.js";
25
- import "./source-push-CX_k_yZD.js";
26
- import "./login-girc324T.js";
27
- import "./run-D4V6mq8_.js";
28
- import "./drivers-CTyYdBL7.js";
29
- import { _ as slugOf, c as scaffoldFromPaywall, g as writeTemplate, h as writeSurfaceFiles, i as migrationFor, m as starterConfig, o as offerMigration, s as projectDirOf } from "./migration-cS6UGeUj.js";
30
- import "./server-Dv1VwbNh.js";
31
- import { i as startStudio, n as migrationNextSteps, t as askStudio } from "./open-BIuOZ9ka.js";
32
- import { a as devCommand, c as uniqueSurfaceId, i as detectPackageManager, n as connectApp, o as initGit, r as detectHostApp, s as installDependencies, t as alreadyAProject } from "./setup-UWLhQG3M.js";
33
- import { execFile } from "node:child_process";
13
+ import "./scan-BZS2FZeU.js";
14
+ import "./existing-C6TTT6c4.js";
15
+ import "./paths-BaeoxDze.js";
16
+ import "./orgs-BxlwcvTu.js";
17
+ import { O as field } from "./resources-COOEvqqW.js";
18
+ import "./org-DZ41muzA.js";
19
+ import "./lookup-D23dAOz6.js";
20
+ import "./bind-DOF3o3FR.js";
21
+ import "./login-C6FcBQZg.js";
22
+ import "./skills-Cm1j2d1W.js";
23
+ import "./browser-Bp3yRKlU.js";
24
+ import "./assets-CqpFg5mM.js";
25
+ import "./selection-CWfI4a0O.js";
26
+ import "./types-CB6O_wjy.js";
27
+ import { a as projectPackageName, n as requireApi, t as LoginRequiredError } from "./session-DYdxTNZf.js";
28
+ import "./source-push-B3c-VLfe.js";
29
+ import "./git-DqDPnldI.js";
30
+ import "./scope-t_SqFN6W.js";
31
+ import "./login-dRPPnGr7.js";
32
+ import "./run-DpYDOAw-.js";
33
+ import "./drivers-DkboeR1c.js";
34
+ import { _ as slugOf, c as scaffoldFromPaywall, g as writeTemplate, h as writeSurfaceFiles, i as migrationFor, m as starterConfig, o as offerMigration, s as projectDirOf } from "./migration-r9plM7F6.js";
35
+ import "./server-BmmOj7bh.js";
36
+ import { i as startStudio, n as migrationNextSteps, t as askStudio } from "./open-DVdE3HnK.js";
37
+ import { i as downloadRepoDir, n as PUBLIC_REPO, r as RepoDownloadError, t as PUBLIC_REF } from "./download-F8OtTJze.js";
38
+ import { a as devCommand, c as uniqueSurfaceId, i as detectPackageManager, n as connectApp, o as initGit, r as detectHostApp, s as installDependencies, t as alreadyAProject } from "./setup-DW50luOZ.js";
34
39
  import * as fs from "node:fs";
35
- import * as os$1 from "node:os";
36
40
  import * as path from "node:path";
37
41
  import pc from "picocolors";
38
- import { promisify } from "node:util";
39
- import { gunzipSync } from "node:zlib";
40
42
 
41
43
  //#region src/core/paywalls/project/examples.ts
42
- const run = promisify(execFile);
43
- const EXAMPLES_REPO = process.env.SUPERWALL_EXAMPLES_REPO ?? "superwall/superwall";
44
- const EXAMPLES_REF = process.env.SUPERWALL_EXAMPLES_REF ?? "main";
45
- var ExampleError = class extends Error {};
46
44
  async function listExamples(fetchImpl = fetch) {
47
- const response = await fetchImpl(`https://api.github.com/repos/${EXAMPLES_REPO}/contents/examples?ref=${EXAMPLES_REF}`);
48
- if (!response.ok) throw new ExampleError(`Could not list examples from github.com/${EXAMPLES_REPO} (HTTP ${response.status}).`);
45
+ const response = await fetchImpl(`https://api.github.com/repos/${PUBLIC_REPO}/contents/examples?ref=${PUBLIC_REF}`);
46
+ if (!response.ok) throw new RepoDownloadError(`Could not list examples from github.com/${PUBLIC_REPO} (HTTP ${response.status}).`);
49
47
  const entries = await response.json();
50
48
  return (Array.isArray(entries) ? entries : []).filter((entry) => field(entry, "type") === "dir").map((entry) => field(entry, "name")).filter((name) => typeof name === "string").sort();
51
49
  }
52
50
  async function downloadExample(name, target, fetchImpl = fetch) {
53
- if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new ExampleError(`\`${name}\` is not an example name.`);
54
- const response = await fetchImpl(`https://codeload.github.com/${EXAMPLES_REPO}/tar.gz/refs/heads/${EXAMPLES_REF}`);
55
- if (!response.ok) throw new ExampleError(`Could not download github.com/${EXAMPLES_REPO} (HTTP ${response.status}). Check your network, then try again.`);
56
- let archive;
57
- try {
58
- archive = gunzipSync(Buffer.from(await response.arrayBuffer()));
59
- } catch {
60
- throw new ExampleError(`The download of github.com/${EXAMPLES_REPO} was damaged. Try again.`);
61
- }
62
- const tarball = path.join(os$1.tmpdir(), `superwall-example-${process.pid}.tar`);
63
- fs.writeFileSync(tarball, archive);
64
- const prefix = `${EXAMPLES_REPO.split("/")[1]}-${EXAMPLES_REF.replace(/\//g, "-")}`;
65
- fs.mkdirSync(target, { recursive: true });
66
- try {
67
- await run("tar", [
68
- "-xf",
69
- tarball,
70
- "-C",
71
- target,
72
- "--strip-components",
73
- "3",
74
- `${prefix}/examples/${name}`
75
- ]);
76
- } catch {
77
- throw new ExampleError(`No example named \`${name}\` in github.com/${EXAMPLES_REPO} — run \`superwall create\` without --example to pick from the list.`);
78
- } finally {
79
- fs.rmSync(tarball, { force: true });
80
- }
81
- if (!fs.existsSync(path.join(target, "package.json"))) throw new ExampleError(`Example \`${name}\` did not contain a project.`);
51
+ if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new RepoDownloadError(`\`${name}\` is not an example name.`);
52
+ await downloadRepoDir(`examples/${name}`, target, `No example named \`${name}\` in github.com/${PUBLIC_REPO} — run \`superwall create\` without --example to pick from the list.`, fetchImpl);
53
+ if (!fs.existsSync(path.join(target, "package.json"))) throw new RepoDownloadError(`Example \`${name}\` did not contain a project.`);
82
54
  }
83
55
  function adoptExamplePackage(target, name) {
84
56
  const file = path.join(target, "package.json");
@@ -186,7 +158,7 @@ async function runCreate(ctx, options, deps = runtime) {
186
158
  }, {
187
159
  value: "example",
188
160
  label: "An example",
189
- hint: `github.com/${EXAMPLES_REPO}`
161
+ hint: `github.com/${PUBLIC_REPO}`
190
162
  }],
191
163
  initialValue: "minimal"
192
164
  });
@@ -208,7 +180,7 @@ async function runCreate(ctx, options, deps = runtime) {
208
180
  example = picked;
209
181
  } catch (error) {
210
182
  spin.stop("Could not fetch the example list");
211
- ui.warn(`${error instanceof ExampleError ? error.message : String(error)}\nStarting from minimal instead.`);
183
+ ui.warn(`${error instanceof RepoDownloadError ? error.message : String(error)}\nStarting from minimal instead.`);
212
184
  }
213
185
  }
214
186
  }
@@ -1,12 +1,12 @@
1
1
  import { r as formatJson, t as blocks } from "./output-Ggzq5_-t.js";
2
- import { S as appleCredentialsFromEnv, b as VERSION, f as ENV_APPLE_ID, p as ENV_APPLE_PASSWORD } from "./environment-djS0ik60.js";
3
- import { t as ApiError } from "./client-ltxxHuxn.js";
4
- import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-B8EFWDEc.js";
5
- import { t as apiCall } from "./spinner-1uuKKZMc.js";
6
- import { n as SUPERWALL_HOME } from "./paths-CdwjySxK.js";
7
- import { A as listField, M as textField, O as field, j as parseJson } from "./resources-BMspgZO1.js";
8
- import { c as replaceAppPurchaseKey, s as replaceAppAscKey } from "./client-BZ1UbpXz.js";
9
- import { t as timing } from "./timing-BVxPrYq3.js";
2
+ import { C as appleCredentialsFromEnv, m as ENV_APPLE_PASSWORD, p as ENV_APPLE_ID, x as VERSION } from "./environment-FR3bcq0D.js";
3
+ import { t as ApiError } from "./client-DHlsTaP1.js";
4
+ import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-C2IjAyg6.js";
5
+ import { t as apiCall } from "./spinner-025_eqCX.js";
6
+ import { n as SUPERWALL_HOME } from "./paths-BaeoxDze.js";
7
+ import { A as listField, M as textField, O as field, j as parseJson } from "./resources-COOEvqqW.js";
8
+ import { c as replaceAppPurchaseKey, s as replaceAppAscKey } from "./client-BJQXl62Q.js";
9
+ import { t as timing } from "./timing-Ca0TXY-A.js";
10
10
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
11
11
  import { join } from "node:path";
12
12
  import { createHash, pbkdf2Sync, randomBytes } from "node:crypto";
@@ -0,0 +1,20 @@
1
+ import "./token-B2PduqrR.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-FR3bcq0D.js";
4
+ import "./storage-CUMgpcVH.js";
5
+ import "./client-DHlsTaP1.js";
6
+ import "./held-C2IjAyg6.js";
7
+ import "./config-CGcG7GOt.js";
8
+ import "./spinner-025_eqCX.js";
9
+ import "./ui-D_qf3Gvw.js";
10
+ import "./paths-BaeoxDze.js";
11
+ import "./orgs-BxlwcvTu.js";
12
+ import "./resources-COOEvqqW.js";
13
+ import "./org-DZ41muzA.js";
14
+ import "./lookup-D23dAOz6.js";
15
+ import "./scope-BJQ-KcQg.js";
16
+ import "./client-BJQXl62Q.js";
17
+ import "./timing-Ca0TXY-A.js";
18
+ import { i as runAscKeysCreate, n as keyAccess, r as keyRole, t as createAndSaveKey } from "./create-CiZzZrru.js";
19
+
20
+ export { createAndSaveKey, keyAccess, keyRole, runAscKeysCreate };