@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.
- package/README.md +47 -16
- package/dist/{apple-Dc5pOPms.js → apple-BE1GBJFP.js} +17 -19
- package/dist/{approve-BSbdmOez.js → approve-yRZmvkCj.js} +9 -11
- package/dist/{assets-C_RjojkK.js → assets-DTAgbWw0.js} +3 -3
- package/dist/auth.d.ts +11 -4
- package/dist/auth.js +4 -5
- package/dist/base-zc1wl_9b.js +82 -0
- package/dist/{billing-B6HK-F_a.js → billing-C1LV4-BN.js} +3 -3
- package/dist/{build-DK88pTMW.js → build-CQd-pf7O.js} +35 -16
- package/dist/{client-x08fpvay.js → config-DCqRQTJ4.js} +162 -15
- package/dist/create-CSHGZDfB.js +18 -0
- package/dist/{create-kpqEhqkk.js → create-Costu6UT.js} +9 -9
- package/dist/{create-B6-Dr3GZ.js → create-wlCp83IH.js} +41 -41
- package/dist/{doctor-DYbm8IKQ.js → doctor-Bd9ffg51.js} +50 -10
- package/dist/entry.js +45 -40
- package/dist/{environment-BFNzLLPN.js → environment-Dn7irhZr.js} +1 -1
- package/dist/{drivers-Dyi-y9Jn.js → existing-BQMB_2AG.js} +305 -8
- package/dist/framework-DW5fqjh4.js +65 -0
- package/dist/{source-BccdO4aL.js → git-Hf9Wc7Hp.js} +34 -92
- package/dist/{held-sKq3xrsT.js → held-D5wSX2Mf.js} +9 -9
- package/dist/held-Dmf5SR3p.js +15 -0
- package/dist/{install-DsIsif39.js → install-CxyqfKFe.js} +15 -17
- package/dist/{integrate-B8eA676b.js → integrate-MkyDDzI5.js} +33 -38
- package/dist/{login-BlpfYapG.js → login-B7IqDafm.js} +3 -3
- package/dist/{login-Blhxi20A.js → login-BMHDhxAx.js} +8 -9
- package/dist/login-Cp0-BgDZ.js +13 -0
- package/dist/{lookup-Dg55W9S7.js → lookup-DkcT4E-5.js} +28 -4
- package/dist/{migrate-DoRb9jmA.js → migrate-CdFoZipj.js} +66 -45
- package/dist/{notification-url-D82msWF5.js → notification-url-D6KKeXnk.js} +4 -4
- package/dist/{open-BAqLpTSI.js → open-COJE6ryI.js} +2 -2
- package/dist/{org-C4G7WjTV.js → org-BV8wwxwc.js} +4 -4
- package/dist/{organization-CmuQwcKN.js → organization-9R_1PJKk.js} +4 -4
- package/dist/{orgs-1OzwUtpT.js → orgs-ltP8H0Nl.js} +1 -2
- package/dist/{paths-gBbqgkS7.js → paths-Cb1RfjaX.js} +1 -1
- package/dist/{playbook-BKqlv77S.js → playbook-CVGolez9.js} +10 -14
- package/dist/{products-Cqq59DBQ.js → products-CJq_iXv5.js} +1 -1
- package/dist/{promote-D0i8A0CO.js → promote-B_HnFEbX.js} +27 -28
- package/dist/{pull-DgQ_UmGv.js → pull-DF4KYVcP.js} +72 -26
- package/dist/pull-JxiMyRwY.js +30 -0
- package/dist/{pull-CiIrJ5ik.js → pull-lYRULo4v.js} +33 -39
- package/dist/push-B5py7h5y.js +29 -0
- package/dist/{push-7N4XIVtg.js → push-BZN1Qpkq.js} +23 -12
- package/dist/{push-BWsXO7FN.js → push-BnllH2Rd.js} +8 -7
- package/dist/push-DHlUMkbf.js +21 -0
- package/dist/registry-BGEYCWyD.js +22 -0
- package/dist/{registry-aAR_8VOw.js → registry-CqePfigB.js} +1287 -902
- package/dist/{resolve-CcOpO_5s.js → resolve-B4bd3Qjl.js} +4 -4
- package/dist/{resources-DNwvf8rg.js → resources-BaURbSpY.js} +15 -2
- package/dist/{run-tVYJ3V5j.js → run-Bme4Egyl.js} +15 -17
- package/dist/{scan-dv0rrY4C.js → scan-DugxddUU.js} +1 -1
- package/dist/scan-J2DILUNE.js +4 -0
- package/dist/{scope-ehZ7L1nj.js → scope-Cg1AdAfO.js} +33 -3
- package/dist/{scope-BXoQo30_.js → scope-DDYLQeZw.js} +24 -18
- package/dist/screenshot-file-Dix2Qynm.js +127 -0
- package/dist/{sdk-DEfQttek.js → sdk-BFunw4Hc.js} +1 -1
- package/dist/{framework-JFLjmD5Y.js → selection-C439nEhn.js} +4 -54
- package/dist/{series-D2ZpZ8cx.js → series-B8NJK4yS.js} +1 -1
- package/dist/{server-CcZGdYjE.js → server-C_aMxzvS.js} +40 -18
- package/dist/server-Cif9w5lM.js +33 -0
- package/dist/{session-dHBtgSN0.js → session-B7frlXXQ.js} +1 -1
- package/dist/{base-83ZTv6up.js → session-CfG3gzko.js} +8 -83
- package/dist/session-DvaPyOuH.js +5 -0
- package/dist/{migration-BUedsREQ.js → setup-DQEasPhx.js} +290 -28
- package/dist/skills/index.json +5 -0
- package/dist/skills/superwall/SKILL.md +37 -10
- package/dist/skills/superwall/references/api.md +66 -21
- package/dist/skills/superwall/references/asa.md +109 -64
- package/dist/skills/superwall/references/dashboard-links.md +65 -28
- package/dist/skills/superwall/references/data-analytics.md +1 -1
- package/dist/skills/superwall/workflows/dashboard/setup.md +15 -5
- package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/skills/superwall-framework/SKILL.md +248 -36
- package/dist/skills/superwall-framework/references/cli.md +98 -7
- package/dist/skills/superwall-framework/references/examples.md +2 -2
- package/dist/skills/superwall-framework/references/layout.md +30 -2
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +5 -0
- package/dist/skills/superwall-framework/references/migrate-from-native.md +5 -0
- package/dist/skills/teleport/SKILL.md +154 -0
- package/dist/skills/teleport/references/experiments.md +328 -0
- package/dist/skills/teleport/references/setup.md +157 -0
- package/dist/{skills-Q7xB784d.js → skills-DnegE1A6.js} +139 -9
- package/dist/{skills-Bqz2l_bx.js → skills-MmF7IyTg.js} +8 -12
- package/dist/source-DQs6iLtC.js +82 -0
- package/dist/{source-push-CG948HrX.js → source-push-MbJjh4Ki.js} +38 -14
- package/dist/{spinner-IA6hV8nI.js → spinner-Dcr-Dqdi.js} +7 -5
- package/dist/{starter-BtUUQWhd.js → starter-BlJ_InZJ.js} +2 -2
- package/dist/{status-CB_MrFu5.js → status-DHRxg1ZA.js} +9 -11
- package/dist/{output-Ggzq5_-t.js → storage-DdIAHolY.js} +40 -1
- package/dist/storekit-De998QOt.js +203 -0
- package/dist/storekit-iBCWmeKn.js +15 -0
- package/dist/{bind-DcWIIPgk.js → theme-BrUrye-c.js} +29 -6
- package/dist/token-CKCBQ4I8.js +100 -0
- package/dist/tools-skills/animate-onboarding/SKILL.md +1 -1
- package/dist/tools-skills/mobile-design/SKILL.md +1 -1
- package/dist/tools-skills/onboarding-questions/SKILL.md +1 -1
- package/dist/tools-skills/superwall/SKILL.md +43 -17
- package/dist/tools-skills/superwall/references/api.md +74 -24
- package/dist/tools-skills/superwall/references/asa.md +109 -64
- package/dist/tools-skills/superwall/references/dashboard-links.md +65 -28
- package/dist/tools-skills/superwall/references/data-analytics.md +1 -1
- package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +4 -3
- package/dist/tools-skills/superwall/workflows/dashboard/setup.md +21 -8
- package/dist/tools-skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/tools-skills/superwall/workflows/migrate/adapty.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/playbook.md +2 -2
- package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +4 -3
- package/dist/tools-skills/superwall-editor/SKILL.md +2 -3
- package/dist/tools-skills/teleport/SKILL.md +154 -0
- package/dist/tools-skills/teleport/references/experiments.md +328 -0
- package/dist/tools-skills/teleport/references/setup.md +157 -0
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +1232 -746
- package/dist/{try-CS3jLyoP.js → try-C8QQbG0b.js} +17 -19
- package/dist/{lock-DgSx-p8Y.js → types-Dc9U_4kp.js} +86 -80
- package/dist/upgrade-CYFdpVpi.js +27 -0
- package/dist/upgrade-D0thxCA4.js +348 -0
- package/package.json +11 -3
- package/dist/config-CGcG7GOt.js +0 -113
- package/dist/create-Du8Fx7W5.js +0 -20
- package/dist/existing-WQ3pz94o.js +0 -97
- package/dist/held-DmOhszHR.js +0 -17
- package/dist/log-C0MDCfA2.js +0 -62
- package/dist/login-D9jfRO8w.js +0 -17
- package/dist/pull-CO5HlqBe.js +0 -36
- package/dist/push-BIhGDNpL.js +0 -30
- package/dist/push-BgqTddLA.js +0 -22
- package/dist/run-B-YoyB-a.js +0 -100
- package/dist/scan-BU41gcQY.js +0 -4
- package/dist/screenshot-file-XAS0Xy0e.js +0 -16
- package/dist/server-BemmM1FV.js +0 -29
- package/dist/session-4aITGsF1.js +0 -6
- package/dist/setup-m94dpT3t.js +0 -217
- package/dist/spawn-DmmmHIP-.js +0 -71
- package/dist/storage-pR0Wb0d9.js +0 -41
- package/dist/storekit-BMxyYAHj.js +0 -17
- package/dist/storekit-CQnwlpKV.js +0 -47
- package/dist/telemetry-DU56L7Cy.js +0 -56
- package/dist/theme-DUsCh-Vd.js +0 -25
- package/dist/token-BbUeExGJ.js +0 -70
- package/dist/upgrade-CKn88PZD.js +0 -206
- package/dist/upgrade-DfD3-ClG.js +0 -7
- /package/dist/{browser-Bp3yRKlU.js → browser-BVjaf98V.js} +0 -0
- /package/dist/{client-BJQXl62Q.js → client-BwYhzITp.js} +0 -0
- /package/dist/{design-lint-CiFc78aM.js → design-lint-mgO-2SGS.js} +0 -0
- /package/dist/{devtools-ByZ6XYnn.js → devtools-B6Vp6HMy.js} +0 -0
- /package/dist/{input-MDd67UIp.js → input-DOT_2Zvb.js} +0 -0
- /package/dist/{project-NoMtbMyl.js → project-BomArwSj.js} +0 -0
- /package/dist/{reports-HYVp169R.js → reports-hbxsd3Zo.js} +0 -0
- /package/dist/{storage-Bdz5AmqS.d.ts → storage-Bh3wT1Rn.d.ts} +0 -0
- /package/dist/{timing-Ca0TXY-A.js → timing-BKEEIBij.js} +0 -0
- /package/dist/{ui-D_qf3Gvw.js → ui-hFgji1e8.js} +0 -0
package/README.md
CHANGED
|
@@ -40,8 +40,18 @@ create its first app too. `BROWSER=none` stops the CLI from opening a browser
|
|
|
40
40
|
itself.
|
|
41
41
|
There are no organizations to pick: `superwall apps list` shows every app you
|
|
42
42
|
can open, grouped by organization, and commands take `--app <id|dashboard link>`.
|
|
43
|
-
Upgrade any time with `superwall upgrade
|
|
44
|
-
|
|
43
|
+
Upgrade any time with `superwall upgrade`. When a newer release is out, the CLI
|
|
44
|
+
says so on stderr after each command (and when `superwall dev` starts), with
|
|
45
|
+
the exact command to run: `superwall upgrade`, or the project's own bump such as
|
|
46
|
+
`cd superwall && pnpm add superwall@latest` when the project pins `superwall`.
|
|
47
|
+
A patch or minor gets one line; a major gets a warning that it may contain
|
|
48
|
+
breaking changes and a link to its release notes. A beta compares against the
|
|
49
|
+
newest beta (`superwall@next`). The check reads a once-a-day cache, so it never
|
|
50
|
+
slows a command, and stdout stays clean under `--json`. The studio
|
|
51
|
+
`superwall dev` opens shows the same update as a banner you can dismiss for
|
|
52
|
+
that version. Its Copy prompt button copies instructions for your coding agent:
|
|
53
|
+
read the release notes (for a major, list what will break first), run the
|
|
54
|
+
update command, then rebuild your paywalls.
|
|
45
55
|
|
|
46
56
|
## Set up your app
|
|
47
57
|
|
|
@@ -59,6 +69,10 @@ headless) to install and configure the SDK. Then it walks you through the
|
|
|
59
69
|
rest: products, campaigns, placements, paywalls, and verifying it all on a
|
|
60
70
|
real device.
|
|
61
71
|
|
|
72
|
+
With neither Claude Code nor Codex installed, it can run the bundled Superwall
|
|
73
|
+
Agent instead, which needs one more package:
|
|
74
|
+
`npm install @anthropic-ai/claude-agent-sdk@0.3.201`.
|
|
75
|
+
|
|
62
76
|
Prefer to drive the agent yourself? Add `--skill` to `integrate`, `migrate`,
|
|
63
77
|
or `review` and the CLI prints the full playbook for your project's framework
|
|
64
78
|
instead of running it — paste it into any agent.
|
|
@@ -95,6 +109,11 @@ you in, pick an app, or create one on the spot. `--yes` accepts the defaults;
|
|
|
95
109
|
specific Superwall app (the dashboard's **Copy Prompt** passes it) instead of
|
|
96
110
|
detecting or asking.
|
|
97
111
|
|
|
112
|
+
In a folder that is not inside a git repository yet, `create` also runs
|
|
113
|
+
`git init` and commits everything in that folder — your app included — as
|
|
114
|
+
"New superwall project". `--no-git` skips that step, so nothing is initialized,
|
|
115
|
+
staged or committed; a folder already under git is never touched either way.
|
|
116
|
+
|
|
98
117
|
### A project is a directory
|
|
99
118
|
|
|
100
119
|
```
|
|
@@ -239,6 +258,12 @@ landed stays pending, so `promote` still won't ship it. With no project,
|
|
|
239
258
|
`superwall pull --app <id> [dir]` creates `superwall/` from the app's source,
|
|
240
259
|
so you can work on an app's paywalls without its codebase or GitHub.
|
|
241
260
|
|
|
261
|
+
`pull` needs superwall 2.3.0 or later. Inside a project, the `superwall` your
|
|
262
|
+
project depends on is the one that runs, whichever copy you start (global,
|
|
263
|
+
`npx superwall@…`). When that copy is older, the CLI says so on stderr with the
|
|
264
|
+
command that updates it, such as `cd superwall && npm i superwall@latest`;
|
|
265
|
+
`superwall upgrade` and `superwall doctor` name it too.
|
|
266
|
+
|
|
242
267
|
A change to the shared design system (`DESIGN.md`, `design/`, `components/`)
|
|
243
268
|
reaches every paywall that imports it. `publish --existing --source` ships it:
|
|
244
269
|
`--existing` rebuilds only the paywalls already on Superwall and never creates
|
|
@@ -369,6 +394,7 @@ fails names the reference entry to read:
|
|
|
369
394
|
```bash
|
|
370
395
|
superwall get /v2/products
|
|
371
396
|
superwall post /v2/products -d name="Pro Monthly" -d price:=9.99
|
|
397
|
+
superwall put /v2/campaigns/123/audiences/456/weights -d 'weights:=[{"variant_id":"789","percentage":100}]'
|
|
372
398
|
superwall delete /v2/products/prod_123
|
|
373
399
|
```
|
|
374
400
|
|
|
@@ -574,23 +600,25 @@ and name the replacement.
|
|
|
574
600
|
|
|
575
601
|
## Apple Search Ads
|
|
576
602
|
|
|
577
|
-
The **entire** Apple Ads
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
`--
|
|
603
|
+
The **entire** Apple Ads Platform API (v1), proxied by Superwall — no client
|
|
604
|
+
secret, OAuth token, or account id to manage locally. It uses the credentials
|
|
605
|
+
you connect in the dashboard (app → Integrations → Apple Search Ads →
|
|
606
|
+
Advanced); the CLI finds the connected app on its own, or takes `--app <id>`.
|
|
607
|
+
Without `--ad-account-id`, requests go to the only ad account the key reaches; when it reaches several, pass `--ad-account-id`.
|
|
582
608
|
|
|
583
609
|
```bash
|
|
584
610
|
superwall asa campaigns list
|
|
585
|
-
superwall asa campaigns
|
|
611
|
+
superwall asa campaigns list --field status --op EQUALS --values ENABLED --all
|
|
612
|
+
superwall asa keywords list --adgroup 456 --order-by text:asc --limit 50
|
|
586
613
|
superwall asa keywords create --campaign 123 --adgroup 456 \
|
|
587
614
|
--text "grammar checker" --match-type EXACT --bid 1.25
|
|
588
615
|
superwall asa reports campaigns --start 2025-01-01 --end 2025-01-31 --group-by countryOrRegion
|
|
589
616
|
```
|
|
590
617
|
|
|
591
|
-
Every resource follows the same shape — `asa <resource> <action> [id]
|
|
592
|
-
|
|
593
|
-
|
|
618
|
+
Every resource follows the same shape — `asa <resource> <action> [id]` — and
|
|
619
|
+
lists are Apple queries: `--campaign` / `--adgroup` / `--adam-id` narrow them,
|
|
620
|
+
`--field --op --values` and `--order-by` add a filter and a sort, and `--query`
|
|
621
|
+
takes Apple's whole query request. The catalog is the documentation:
|
|
594
622
|
|
|
595
623
|
```bash
|
|
596
624
|
superwall asa docs # every endpoint, grouped
|
|
@@ -598,10 +626,13 @@ superwall asa docs keywords # one resource: usage, flags, Apple
|
|
|
598
626
|
superwall asa docs campaigns create # Apple's own page: fields, enums, examples
|
|
599
627
|
```
|
|
600
628
|
|
|
601
|
-
Writes take typed flags (money flags pick up the account's currency),
|
|
602
|
-
`-d key=value` for any other field, or `--body` for the whole payload
|
|
603
|
-
|
|
604
|
-
|
|
629
|
+
Writes take typed flags (money flags pick up the ad account's currency),
|
|
630
|
+
`-d key=value` for any other field, or `--body` for the whole payload; several
|
|
631
|
+
keyword ids or an array body go to Apple's bulk endpoints. Anything not covered
|
|
632
|
+
is `asa get|post|put|delete /path`, sent straight to Apple with your access
|
|
633
|
+
token and ad account context attached. A path without a version gets `/v1`;
|
|
634
|
+
one that starts with `/v1` or `/api/` is sent as written. Asset upload
|
|
635
|
+
(`POST /v1/assets/upload`) takes form data and isn't supported.
|
|
605
636
|
|
|
606
637
|
## For agents and scripts
|
|
607
638
|
|
|
@@ -664,7 +695,7 @@ packages/cli/
|
|
|
664
695
|
│ │ ├── paywalls/ create, dev, build, push, promote, publish, pull
|
|
665
696
|
│ │ ├── main/ bootstrap, apps, products, entitlements, campaigns, paywalls, users, webhooks, events, annotations
|
|
666
697
|
│ │ ├── analytics/ query
|
|
667
|
-
│ │ ├── api/ docs, get, post, patch, delete
|
|
698
|
+
│ │ ├── api/ docs, get, post, put, patch, delete
|
|
668
699
|
│ │ ├── app-store-connect/ setup/, keys/, notification-url/, store/ (apps, products, …), api/ (get, post, …, docs)
|
|
669
700
|
│ │ ├── apple-search-ads/ asa (the catalog), keys, api/ (get, post, put, delete, docs)
|
|
670
701
|
│ │ ├── account/ login, logout, whoami
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import "./token-
|
|
2
|
-
import {
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import "./
|
|
8
|
-
import
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
import "./
|
|
13
|
-
import "./
|
|
14
|
-
import "./
|
|
15
|
-
import "./
|
|
16
|
-
import "./
|
|
17
|
-
import "./
|
|
18
|
-
import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-D82msWF5.js";
|
|
19
|
-
import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-kpqEhqkk.js";
|
|
1
|
+
import "./token-CKCBQ4I8.js";
|
|
2
|
+
import { u as blocks } from "./storage-DdIAHolY.js";
|
|
3
|
+
import "./environment-Dn7irhZr.js";
|
|
4
|
+
import { y as ApiError } from "./config-DCqRQTJ4.js";
|
|
5
|
+
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-D5wSX2Mf.js";
|
|
6
|
+
import "./resources-BaURbSpY.js";
|
|
7
|
+
import "./orgs-ltP8H0Nl.js";
|
|
8
|
+
import "./ui-hFgji1e8.js";
|
|
9
|
+
import { t as apiCall } from "./spinner-Dcr-Dqdi.js";
|
|
10
|
+
import "./org-BV8wwxwc.js";
|
|
11
|
+
import "./lookup-DkcT4E-5.js";
|
|
12
|
+
import "./paths-Cb1RfjaX.js";
|
|
13
|
+
import "./scope-DDYLQeZw.js";
|
|
14
|
+
import "./client-BwYhzITp.js";
|
|
15
|
+
import "./timing-BKEEIBij.js";
|
|
16
|
+
import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-D6KKeXnk.js";
|
|
17
|
+
import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-Costu6UT.js";
|
|
20
18
|
|
|
21
19
|
//#region src/core/app-store-connect/setup/apple.ts
|
|
22
20
|
const STEPS = [
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import "./token-
|
|
2
|
-
import "./
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import { _ as approveVersion, d as resolveArtifact, f as roleCanApprove, i as installHints, l as pickVersion, n as awaitingInstall, s as notInstalledOf } from "./resolve-
|
|
9
|
-
import { t as ArtifactError } from "./project-
|
|
10
|
-
import "./lock-DgSx-p8Y.js";
|
|
11
|
-
import "./scope-ehZ7L1nj.js";
|
|
1
|
+
import "./token-CKCBQ4I8.js";
|
|
2
|
+
import "./storage-DdIAHolY.js";
|
|
3
|
+
import "./environment-Dn7irhZr.js";
|
|
4
|
+
import { y as ApiError } from "./config-DCqRQTJ4.js";
|
|
5
|
+
import "./orgs-ltP8H0Nl.js";
|
|
6
|
+
import "./types-Dc9U_4kp.js";
|
|
7
|
+
import "./scope-Cg1AdAfO.js";
|
|
8
|
+
import { _ as approveVersion, d as resolveArtifact, f as roleCanApprove, i as installHints, l as pickVersion, n as awaitingInstall, s as notInstalledOf } from "./resolve-B4bd3Qjl.js";
|
|
9
|
+
import { t as ArtifactError } from "./project-BomArwSj.js";
|
|
12
10
|
|
|
13
11
|
//#region src/core/artifacts/approve.ts
|
|
14
12
|
const SECTIONS = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as ASSET_HOST } from "./environment-
|
|
2
|
-
import {
|
|
3
|
-
import { S as pushPaywallAssets } from "./resources-
|
|
1
|
+
import { r as ASSET_HOST } from "./environment-Dn7irhZr.js";
|
|
2
|
+
import { y as ApiError } from "./config-DCqRQTJ4.js";
|
|
3
|
+
import { S as pushPaywallAssets } from "./resources-BaURbSpY.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,15 +1,22 @@
|
|
|
1
|
-
import { t as Session } from "./storage-
|
|
1
|
+
import { t as Session } from "./storage-Bh3wT1Rn.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/account/errors.d.ts
|
|
4
4
|
declare class NotLoggedInError extends Error {
|
|
5
5
|
constructor();
|
|
6
6
|
}
|
|
7
|
+
declare class LoginUnreachableError extends Error {
|
|
8
|
+
readonly timedOut: boolean;
|
|
9
|
+
constructor(endpoint: string, cause: unknown, timeoutMs?: number);
|
|
10
|
+
}
|
|
7
11
|
//#endregion
|
|
8
12
|
//#region src/core/account/token.d.ts
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
interface RefreshOptions {
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
}
|
|
16
|
+
declare function getOAuthAccessToken(options?: RefreshOptions): Promise<string | null>;
|
|
17
|
+
declare function resolveAuthToken(session: Session, options?: RefreshOptions): Promise<{
|
|
11
18
|
token: string;
|
|
12
19
|
session: Session;
|
|
13
20
|
}>;
|
|
14
21
|
//#endregion
|
|
15
|
-
export { NotLoggedInError, getOAuthAccessToken, resolveAuthToken };
|
|
22
|
+
export { LoginUnreachableError, NotLoggedInError, RefreshOptions, getOAuthAccessToken, resolveAuthToken };
|
package/dist/auth.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as resolveAuthToken, r as
|
|
2
|
-
import "./
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./storage-pR0Wb0d9.js";
|
|
1
|
+
import { i as NotLoggedInError, n as resolveAuthToken, r as LoginUnreachableError, t as getOAuthAccessToken } from "./token-CKCBQ4I8.js";
|
|
2
|
+
import "./storage-DdIAHolY.js";
|
|
3
|
+
import "./environment-Dn7irhZr.js";
|
|
5
4
|
|
|
6
|
-
export { NotLoggedInError, getOAuthAccessToken, resolveAuthToken };
|
|
5
|
+
export { LoginUnreachableError, NotLoggedInError, getOAuthAccessToken, resolveAuthToken };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { k as isRecord } from "./resources-BaURbSpY.js";
|
|
2
|
+
import { b as writeSources, d as parseSources, f as readLock } from "./types-Dc9U_4kp.js";
|
|
3
|
+
import { o as describePlatforms, s as platformFor } from "./session-CfG3gzko.js";
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
|
+
import * as path from "node:path";
|
|
6
|
+
|
|
7
|
+
//#region src/core/paywalls/binding/targets.ts
|
|
8
|
+
var TargetError = class extends Error {};
|
|
9
|
+
const surfaceKey = (surface) => `${surface.kind}/${surface.id}`;
|
|
10
|
+
const targetLabel = (target, multi) => multi ? `${target.surface.id} · ${target.platform}` : target.surface.id;
|
|
11
|
+
function wantedPlatforms(surfaces, declared) {
|
|
12
|
+
const wanted = /* @__PURE__ */ new Set();
|
|
13
|
+
for (const surface of surfaces) for (const platform of declared[surfaceKey(surface)] ?? []) wanted.add(platform);
|
|
14
|
+
return [...wanted];
|
|
15
|
+
}
|
|
16
|
+
function parsePlatformFlags(value) {
|
|
17
|
+
return (Array.isArray(value) ? value : value === void 0 ? [] : [value]).flatMap((entry) => typeof entry === "string" ? entry.split(",") : []).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
18
|
+
}
|
|
19
|
+
function planTargets(input) {
|
|
20
|
+
const { surfaces, declared, apps } = input;
|
|
21
|
+
const known = Object.keys(apps);
|
|
22
|
+
const only = (input.only ?? []).map((entry) => {
|
|
23
|
+
const platform = platformFor(apps, entry);
|
|
24
|
+
if (platform === void 0) throw new TargetError(`This project has no app for "${entry}" — its platforms are ${describePlatforms(apps) || "none"} (the keys under \`apps\` in superwall.lock). Declare it in a config.ts with \`platforms: [...]\` to bind one.`);
|
|
25
|
+
return platform;
|
|
26
|
+
});
|
|
27
|
+
const targets = [];
|
|
28
|
+
for (const surface of surfaces) {
|
|
29
|
+
const wanted = declared[surfaceKey(surface)];
|
|
30
|
+
let platforms;
|
|
31
|
+
if (wanted !== void 0) {
|
|
32
|
+
if (wanted.length === 0) throw new TargetError(`${surface.kind} \`${surface.id}\` declares \`platforms: []\` — list at least one, or remove the field.`);
|
|
33
|
+
for (const platform of wanted) if (!(platform in apps)) throw new TargetError(`${surface.kind} \`${surface.id}\` targets \`${platform}\`, which superwall.lock does not bind to an app.`);
|
|
34
|
+
platforms = [...new Set(wanted)];
|
|
35
|
+
} else if (known.length === 1 && known[0] !== void 0) platforms = [known[0]];
|
|
36
|
+
else if (known.length === 0) throw new TargetError("This project is not bound to an app yet — run `superwall push` to pick one.");
|
|
37
|
+
else throw new TargetError(`${surface.kind} \`${surface.id}\` doesn't say which platforms it's for, and this project pushes to several (${describePlatforms(apps)}). Add \`platforms: [...]\` to ${surface.kind}s/${surface.id}/config.ts.`);
|
|
38
|
+
for (const platform of platforms) {
|
|
39
|
+
if (only.length > 0 && !only.includes(platform)) continue;
|
|
40
|
+
const applicationId = apps[platform];
|
|
41
|
+
if (applicationId === void 0) continue;
|
|
42
|
+
targets.push({
|
|
43
|
+
surface,
|
|
44
|
+
platform,
|
|
45
|
+
applicationId
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (targets.length === 0 && only.length > 0) throw new TargetError(`No paywall or funnel targets ${only.map((platform) => `\`${platform}\``).join(", ")}.`);
|
|
50
|
+
return targets;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/core/paywalls/source/base.ts
|
|
55
|
+
const LEGACY_FILE = path.join(".superwall", "source.json");
|
|
56
|
+
function readLegacyBases(superwallDir) {
|
|
57
|
+
const file = path.join(superwallDir, LEGACY_FILE);
|
|
58
|
+
if (!fs.existsSync(file)) return {};
|
|
59
|
+
let parsed;
|
|
60
|
+
try {
|
|
61
|
+
parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
62
|
+
} catch (error) {
|
|
63
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
64
|
+
throw new Error(`Can't read ${file} (${reason}) — fix or delete it, then push again.`);
|
|
65
|
+
}
|
|
66
|
+
if (!isRecord(parsed) || !isRecord(parsed.repos)) throw new Error(`${file} isn't a source sync record — fix or delete it, then push again.`);
|
|
67
|
+
return parseSources(parsed.repos);
|
|
68
|
+
}
|
|
69
|
+
function readSourceBase(superwallDir, repo) {
|
|
70
|
+
return readLock(superwallDir).sources?.[repo] ?? readLegacyBases(superwallDir)[repo];
|
|
71
|
+
}
|
|
72
|
+
function writeSourceBase(superwallDir, repo, commitSha) {
|
|
73
|
+
writeSources(superwallDir, {
|
|
74
|
+
...readLegacyBases(superwallDir),
|
|
75
|
+
...readLock(superwallDir).sources,
|
|
76
|
+
[repo]: commitSha
|
|
77
|
+
});
|
|
78
|
+
fs.rmSync(path.join(superwallDir, LEGACY_FILE), { force: true });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { surfaceKey as a, planTargets as i, writeSourceBase as n, targetLabel as o, parsePlatformFlags as r, wantedPlatforms as s, readSourceBase as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as Integration } from "./environment-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { h as Integration } from "./environment-Dn7irhZr.js";
|
|
2
|
+
import { d as readBundledSkill } from "./skills-DnegE1A6.js";
|
|
3
|
+
import { i as readPackageJson, r as allDeps } from "./scan-DugxddUU.js";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import fg from "fast-glob";
|
|
6
6
|
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import "./token-
|
|
2
|
-
import "./
|
|
3
|
-
import { x as VERSION } from "./environment-
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import { n as ui } from "./ui-
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
13
|
-
import { n as lintDesignTokens, t as formatTokenFinding } from "./design-lint-CiFc78aM.js";
|
|
1
|
+
import "./token-CKCBQ4I8.js";
|
|
2
|
+
import "./storage-DdIAHolY.js";
|
|
3
|
+
import { x as VERSION } from "./environment-Dn7irhZr.js";
|
|
4
|
+
import "./config-DCqRQTJ4.js";
|
|
5
|
+
import "./resources-BaURbSpY.js";
|
|
6
|
+
import "./orgs-ltP8H0Nl.js";
|
|
7
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
8
|
+
import { f as readLock, n as collectProjectDeclarations, r as writeProjectTypes } from "./types-Dc9U_4kp.js";
|
|
9
|
+
import { i as resolveFramework } from "./framework-DW5fqjh4.js";
|
|
10
|
+
import { a as resolveProjectDir, d as kb, h as took, i as requireProject, n as parseIds, s as selectSurfaces } from "./selection-C439nEhn.js";
|
|
11
|
+
import { t as assetBaseUrl } from "./assets-DTAgbWw0.js";
|
|
12
|
+
import { n as lintDesignTokens, t as formatTokenFinding } from "./design-lint-mgO-2SGS.js";
|
|
14
13
|
import * as fs from "node:fs";
|
|
15
14
|
import * as path from "node:path";
|
|
16
15
|
import pc from "picocolors";
|
|
@@ -26,6 +25,12 @@ function parseBuildPlatforms(values) {
|
|
|
26
25
|
for (const platform of platforms) if (!PLATFORMS.has(platform)) throw new Error(`Unknown platform "${platform}" — use ios, android or web.`);
|
|
27
26
|
return platforms.length === 0 ? [void 0] : platforms;
|
|
28
27
|
}
|
|
28
|
+
function unbuiltTeleportPages(surface, route) {
|
|
29
|
+
return `${surface.kind}/${surface.id} teleports from "${route}", but its teleport pages are pre-rendered per platform: run \`superwall build --id ${surface.id} --platform ios\` to build them.`;
|
|
30
|
+
}
|
|
31
|
+
function teleportPageFile(file, key) {
|
|
32
|
+
return path.join(path.dirname(file), "teleport", `${key}.html`);
|
|
33
|
+
}
|
|
29
34
|
function outputFile(out, surface, platform) {
|
|
30
35
|
return path.join(out, surface.kind, surface.id, ...platform ? [platform] : [], "index.html");
|
|
31
36
|
}
|
|
@@ -61,18 +66,32 @@ async function runBuildPipeline(context, options = {}) {
|
|
|
61
66
|
const file = outputFile(out, surface, platform);
|
|
62
67
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
63
68
|
fs.writeFileSync(file, built.html);
|
|
69
|
+
const pages = built.teleportPages ?? [];
|
|
70
|
+
fs.rmSync(path.join(path.dirname(file), "teleport"), {
|
|
71
|
+
recursive: true,
|
|
72
|
+
force: true
|
|
73
|
+
});
|
|
74
|
+
for (const page of pages) {
|
|
75
|
+
const pageFile = teleportPageFile(file, page.key);
|
|
76
|
+
fs.mkdirSync(path.dirname(pageFile), { recursive: true });
|
|
77
|
+
fs.writeFileSync(pageFile, page.html);
|
|
78
|
+
}
|
|
64
79
|
outcomes.push({
|
|
65
80
|
kind: surface.kind,
|
|
66
81
|
id: surface.id,
|
|
67
82
|
platform: platform ?? null,
|
|
68
83
|
file,
|
|
69
84
|
bytes: built.bytes,
|
|
70
|
-
snapshotId: built.snapshotId
|
|
85
|
+
snapshotId: built.snapshotId,
|
|
86
|
+
teleportPages: pages.map((page) => page.key)
|
|
71
87
|
});
|
|
88
|
+
const teleport = pages.length === 0 ? "" : ` · ${pages.length} teleport ${pages.length === 1 ? "page" : "pages"}`;
|
|
72
89
|
context.output.render({
|
|
73
90
|
kind: "step",
|
|
74
|
-
text: `${surface.kind}/${surface.id}${platform ? ` ${platform}` : ""} ${pc.dim(`${kb(built.bytes)} · ${built.snapshotId.slice(0, 8)}`)} → ${path.relative(process.cwd(), file)}`
|
|
91
|
+
text: `${surface.kind}/${surface.id}${platform ? ` ${platform}` : ""} ${pc.dim(`${kb(built.bytes)} · ${built.snapshotId.slice(0, 8)}${teleport}`)} → ${path.relative(process.cwd(), file)}`
|
|
75
92
|
});
|
|
93
|
+
for (const warning of built.warnings ?? []) ui.warn(warning);
|
|
94
|
+
if (platform === void 0 && built.teleportRoute !== void 0) ui.info(unbuiltTeleportPages(surface, built.teleportRoute));
|
|
76
95
|
}
|
|
77
96
|
context.output.render({
|
|
78
97
|
kind: "outro",
|
|
@@ -83,4 +102,4 @@ async function runBuildPipeline(context, options = {}) {
|
|
|
83
102
|
}
|
|
84
103
|
|
|
85
104
|
//#endregion
|
|
86
|
-
export { outputFile, parseBuildPlatforms, runBuildPipeline };
|
|
105
|
+
export { outputFile, parseBuildPlatforms, runBuildPipeline, teleportPageFile, unbuiltTeleportPages };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as NotLoggedInError, n as resolveAuthToken } from "./token-CKCBQ4I8.js";
|
|
2
|
+
import { a as resolveApiHost, f as formatJson, n as readSession, v as readJson, y as state } from "./storage-DdIAHolY.js";
|
|
3
|
+
import { b as USER_AGENT } from "./environment-Dn7irhZr.js";
|
|
4
4
|
|
|
5
5
|
//#region src/core/api/client.ts
|
|
6
6
|
const BODY_SNIPPET = 200;
|
|
@@ -77,11 +77,22 @@ const failureLabel = ({ code, message }) => {
|
|
|
77
77
|
if (code === void 0) return message;
|
|
78
78
|
return message === void 0 || message.includes(code) ? code : `${code}: ${message}`;
|
|
79
79
|
};
|
|
80
|
+
const isTimeout = (error) => error instanceof Error && error.name === "TimeoutError";
|
|
80
81
|
var ApiUnreachableError = class extends Error {
|
|
81
82
|
/** The connection opened and then dropped, so the API may or may not have got the request. */
|
|
82
83
|
dropped;
|
|
84
|
+
/** The API didn't answer before the deadline, so it may or may not have got the request. */
|
|
85
|
+
timedOut;
|
|
83
86
|
code;
|
|
84
|
-
constructor(host, cause) {
|
|
87
|
+
constructor(host, cause, deadline) {
|
|
88
|
+
if (deadline !== void 0) {
|
|
89
|
+
super(`The Superwall API at ${host} didn't answer within ${deadline.ms / 1e3}s.\n` + (deadline.write ? " The change may or may not have been applied. Check before sending it again." : " Try again."));
|
|
90
|
+
this.name = "ApiUnreachableError";
|
|
91
|
+
this.cause = cause;
|
|
92
|
+
this.dropped = false;
|
|
93
|
+
this.timedOut = true;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
85
96
|
const local = /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])/.test(host);
|
|
86
97
|
const failure = fetchFailureOf(cause);
|
|
87
98
|
const dropped = failure.code !== void 0 && DROPPED_CODES.has(failure.code) || DROPPED_MESSAGE.test(failure.message ?? "");
|
|
@@ -91,6 +102,7 @@ var ApiUnreachableError = class extends Error {
|
|
|
91
102
|
this.name = "ApiUnreachableError";
|
|
92
103
|
this.cause = cause;
|
|
93
104
|
this.dropped = dropped;
|
|
105
|
+
this.timedOut = false;
|
|
94
106
|
if (failure.code !== void 0) this.code = failure.code;
|
|
95
107
|
}
|
|
96
108
|
};
|
|
@@ -104,6 +116,8 @@ const RETRYABLE = new Set([
|
|
|
104
116
|
]);
|
|
105
117
|
const DROPPED_ATTEMPTS = 3;
|
|
106
118
|
const DROPPED_BACKOFF_MS = 250;
|
|
119
|
+
const REQUEST_TIMEOUT_MS = 6e4;
|
|
120
|
+
const TEXT_TIMEOUT_MS = 3e5;
|
|
107
121
|
async function parseApiError(request, res) {
|
|
108
122
|
const text = await res.text().catch(() => "");
|
|
109
123
|
return new ApiError(request, res.status, text);
|
|
@@ -114,14 +128,29 @@ function retryDelay(res, retry) {
|
|
|
114
128
|
if (Number.isFinite(after) && after >= 0 && res.headers.has("retry-after")) return after * 1e3;
|
|
115
129
|
return 400 * 2 ** retry;
|
|
116
130
|
}
|
|
117
|
-
const createSuperwallApi = (initial, { userAgent = USER_AGENT() } = {}) => {
|
|
131
|
+
const createSuperwallApi = (initial, { userAgent = USER_AGENT(), timeoutMs = REQUEST_TIMEOUT_MS, textTimeoutMs = TEXT_TIMEOUT_MS } = {}) => {
|
|
118
132
|
let session = initial;
|
|
119
133
|
const host = () => resolveApiHost(session);
|
|
120
|
-
const send = async (url, init) => {
|
|
134
|
+
const send = async (url, init, ms = timeoutMs) => {
|
|
135
|
+
try {
|
|
136
|
+
return await fetch(url, {
|
|
137
|
+
...init,
|
|
138
|
+
signal: AbortSignal.timeout(ms)
|
|
139
|
+
});
|
|
140
|
+
} catch (error) {
|
|
141
|
+
if (!isTimeout(error)) throw new ApiUnreachableError(host(), error);
|
|
142
|
+
throw new ApiUnreachableError(host(), error, {
|
|
143
|
+
ms,
|
|
144
|
+
write: init.method !== "GET"
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const read$1 = async (body, deadline) => {
|
|
121
149
|
try {
|
|
122
|
-
return await
|
|
150
|
+
return await body();
|
|
123
151
|
} catch (error) {
|
|
124
|
-
throw new ApiUnreachableError(host(), error);
|
|
152
|
+
if (isTimeout(error)) throw new ApiUnreachableError(host(), error, deadline);
|
|
153
|
+
throw error;
|
|
125
154
|
}
|
|
126
155
|
};
|
|
127
156
|
const authorized = async () => {
|
|
@@ -159,7 +188,10 @@ const createSuperwallApi = (initial, { userAgent = USER_AGENT() } = {}) => {
|
|
|
159
188
|
}
|
|
160
189
|
if (!res.ok) throw await parseApiError(`${method} ${path}`, res);
|
|
161
190
|
if (res.status === 204) return void 0;
|
|
162
|
-
return
|
|
191
|
+
return read$1(() => res.json(), {
|
|
192
|
+
ms: timeoutMs,
|
|
193
|
+
write: method !== "GET"
|
|
194
|
+
});
|
|
163
195
|
};
|
|
164
196
|
const api = {
|
|
165
197
|
org: {},
|
|
@@ -180,19 +212,22 @@ const createSuperwallApi = (initial, { userAgent = USER_AGENT() } = {}) => {
|
|
|
180
212
|
patch: (path, body, options) => request("PATCH", path, body, options),
|
|
181
213
|
del: (path, options) => request("DELETE", path, void 0, options),
|
|
182
214
|
async postText(path, body) {
|
|
183
|
-
const
|
|
184
|
-
const res = await send(`${host()}${path}`, {
|
|
215
|
+
const init = {
|
|
185
216
|
method: "POST",
|
|
186
217
|
headers: {
|
|
187
|
-
authorization: `Bearer ${
|
|
218
|
+
authorization: `Bearer ${await authorized()}`,
|
|
188
219
|
"user-agent": userAgent,
|
|
189
220
|
accept: "text/plain",
|
|
190
221
|
"content-type": "text/plain; charset=utf-8"
|
|
191
222
|
},
|
|
192
223
|
body
|
|
193
|
-
}
|
|
224
|
+
};
|
|
225
|
+
const res = await send(`${host()}${path}`, init, textTimeoutMs);
|
|
194
226
|
if (!res.ok) throw await parseApiError(`POST ${path}`, res);
|
|
195
|
-
return res.text()
|
|
227
|
+
return read$1(() => res.text(), {
|
|
228
|
+
ms: textTimeoutMs,
|
|
229
|
+
write: true
|
|
230
|
+
});
|
|
196
231
|
},
|
|
197
232
|
async list(path) {
|
|
198
233
|
const out = [];
|
|
@@ -227,4 +262,116 @@ function withQuery(path, qs) {
|
|
|
227
262
|
}
|
|
228
263
|
|
|
229
264
|
//#endregion
|
|
230
|
-
|
|
265
|
+
//#region src/core/state/config.ts
|
|
266
|
+
const FILE = "config.json";
|
|
267
|
+
function read() {
|
|
268
|
+
return readJson(state(), FILE) ?? {};
|
|
269
|
+
}
|
|
270
|
+
function write(config) {
|
|
271
|
+
state().write(FILE, `${formatJson(config)}\n`);
|
|
272
|
+
}
|
|
273
|
+
function readDefaultApp(projectId) {
|
|
274
|
+
return read().defaultApp?.[projectId];
|
|
275
|
+
}
|
|
276
|
+
function writeDefaultApp(projectId, applicationId) {
|
|
277
|
+
const config = read();
|
|
278
|
+
config.defaultApp = {
|
|
279
|
+
...config.defaultApp ?? {},
|
|
280
|
+
[projectId]: applicationId
|
|
281
|
+
};
|
|
282
|
+
write(config);
|
|
283
|
+
}
|
|
284
|
+
function readOpenedOrgs() {
|
|
285
|
+
return read().openedOrgs ?? [];
|
|
286
|
+
}
|
|
287
|
+
function writeOpenedOrgs(ids) {
|
|
288
|
+
const config = read();
|
|
289
|
+
const next = [...new Set(ids)];
|
|
290
|
+
if (next.join() === (config.openedOrgs ?? []).join()) return;
|
|
291
|
+
config.openedOrgs = next;
|
|
292
|
+
write(config);
|
|
293
|
+
}
|
|
294
|
+
function readSkillsSync() {
|
|
295
|
+
return read().skillsSync;
|
|
296
|
+
}
|
|
297
|
+
function writeSkillsSync(sync) {
|
|
298
|
+
const config = read();
|
|
299
|
+
config.skillsSync = sync;
|
|
300
|
+
write(config);
|
|
301
|
+
}
|
|
302
|
+
function readAnonymousId() {
|
|
303
|
+
const config = read();
|
|
304
|
+
if (config.telemetry?.anonymousId) return config.telemetry.anonymousId;
|
|
305
|
+
const anonymousId = crypto.randomUUID();
|
|
306
|
+
config.telemetry = {
|
|
307
|
+
...config.telemetry,
|
|
308
|
+
anonymousId
|
|
309
|
+
};
|
|
310
|
+
write(config);
|
|
311
|
+
return anonymousId;
|
|
312
|
+
}
|
|
313
|
+
function readOnboardedOrg() {
|
|
314
|
+
return read().onboarded?.org;
|
|
315
|
+
}
|
|
316
|
+
function writeOnboardedOrg(org) {
|
|
317
|
+
const config = read();
|
|
318
|
+
config.onboarded = {
|
|
319
|
+
...config.onboarded,
|
|
320
|
+
org
|
|
321
|
+
};
|
|
322
|
+
write(config);
|
|
323
|
+
}
|
|
324
|
+
function readOnboardedApp(appPath) {
|
|
325
|
+
return read().onboarded?.apps?.[appPath];
|
|
326
|
+
}
|
|
327
|
+
function writeOnboardedApp(appPath, app) {
|
|
328
|
+
const config = read();
|
|
329
|
+
config.onboarded = {
|
|
330
|
+
...config.onboarded,
|
|
331
|
+
apps: {
|
|
332
|
+
...config.onboarded?.apps,
|
|
333
|
+
[appPath]: app
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
write(config);
|
|
337
|
+
}
|
|
338
|
+
function readUpdateCheck(tag = "latest") {
|
|
339
|
+
const config = read();
|
|
340
|
+
return tag === "next" ? config.updateCheckNext : config.updateCheck;
|
|
341
|
+
}
|
|
342
|
+
function writeUpdateCheck(check) {
|
|
343
|
+
const config = read();
|
|
344
|
+
if (check.tag === "next") config.updateCheckNext = check;
|
|
345
|
+
else config.updateCheck = check;
|
|
346
|
+
write(config);
|
|
347
|
+
}
|
|
348
|
+
function readAutoUpdate() {
|
|
349
|
+
return read().autoUpdate;
|
|
350
|
+
}
|
|
351
|
+
function writeAutoUpdate(update) {
|
|
352
|
+
const config = read();
|
|
353
|
+
config.autoUpdate = update;
|
|
354
|
+
write(config);
|
|
355
|
+
}
|
|
356
|
+
function readOnboardingIdempotencyKey() {
|
|
357
|
+
const config = read();
|
|
358
|
+
if (config.onboardingIdempotencyKey) return config.onboardingIdempotencyKey;
|
|
359
|
+
const key = crypto.randomUUID();
|
|
360
|
+
config.onboardingIdempotencyKey = key;
|
|
361
|
+
write(config);
|
|
362
|
+
return key;
|
|
363
|
+
}
|
|
364
|
+
function telemetryNoticeShown() {
|
|
365
|
+
return Boolean(read().telemetry?.noticeShown);
|
|
366
|
+
}
|
|
367
|
+
function writeTelemetryNoticeShown() {
|
|
368
|
+
const config = read();
|
|
369
|
+
config.telemetry = {
|
|
370
|
+
...config.telemetry,
|
|
371
|
+
noticeShown: true
|
|
372
|
+
};
|
|
373
|
+
write(config);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
//#endregion
|
|
377
|
+
export { withQuery as C, superwallApi as S, writeTelemetryNoticeShown as _, readOnboardedOrg as a, ApiUnreachableError as b, readSkillsSync as c, writeAutoUpdate as d, writeDefaultApp as f, writeSkillsSync as g, writeOpenedOrgs as h, readOnboardedApp as i, readUpdateCheck as l, writeOnboardedOrg as m, readAutoUpdate as n, readOnboardingIdempotencyKey as o, writeOnboardedApp as p, readDefaultApp as r, readOpenedOrgs as s, readAnonymousId as t, telemetryNoticeShown as u, writeUpdateCheck as v, createSuperwallApi as x, ApiError as y };
|