@superwall/cli 1.7.0 → 2.1.0
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 +192 -52
- package/dist/{setup-Bxj22rYi.js → apple-CSzNTGHM.js} +82 -76
- package/dist/auth.d.ts +4 -19
- package/dist/auth.js +4 -2
- package/dist/{actions-B7ym3oVS.js → billing-C3Q8DBU2.js} +98 -28
- package/dist/{bind-YrJvuRF9.js → bind-BumHTi9O.js} +38 -33
- package/dist/{build-DLoCW5Ri.js → build-Bpviiclc.js} +20 -26
- package/dist/client-BL0f_yGf.js +176 -0
- package/dist/{asc-Bf7zBbyS.js → client-BZ1UbpXz.js} +16 -15
- package/dist/config-BO1Y87kV.js +105 -0
- package/dist/create-BSfvpWoD.js +19 -0
- package/dist/{create-pkANt1Gs.js → create-BUcVG4Ab.js} +195 -169
- package/dist/{notification-url-DuKF2659.js → create-CfK3PeKA.js} +235 -539
- package/dist/doctor-BWqIYcMn.js +83 -0
- package/dist/{drivers-Qx9LxmRN.js → drivers-CPhdPkW5.js} +185 -172
- package/dist/entry.d.ts +0 -5
- package/dist/entry.js +28072 -1134
- package/dist/environment-eBXjELoN.js +58 -0
- package/dist/{existing-AVEfZu2A.js → existing-BltvQiX5.js} +12 -6
- package/dist/held-CPve03KJ.js +16 -0
- package/dist/held-DgnTFMl3.js +1112 -0
- package/dist/input-vi0bou04.js +42 -0
- package/dist/{integrate-brmhPG-S.js → integrate-BRsqoe01.js} +277 -254
- package/dist/log-NVhVe_oe.js +62 -0
- package/dist/login-BCEH5q0U.js +53 -0
- package/dist/login-BPOONe7n.js +16 -0
- package/dist/{login-Do4wFuLv.js → login-BbTIrCFT.js} +118 -55
- package/dist/lookup-rr1AkCJA.js +71 -0
- package/dist/migrate-C9X2Vz81.js +274 -0
- package/dist/notification-url-CV86qiKP.js +100 -0
- package/dist/{open-studio-DOw-6ydc.js → open-CcpXotHG.js} +34 -43
- package/dist/org-BQQDo7wm.js +35 -0
- package/dist/output-Ggzq5_-t.js +122 -0
- package/dist/paths-CRlU72cq.js +29 -0
- package/dist/playbook-DVMXN7fh.js +53 -0
- package/dist/{asc-products-9JXtDxI4.js → products-DH_fK9tY.js} +6 -6
- package/dist/promote-Da8xctzy.js +91 -0
- package/dist/push-BV-grvQg.js +22 -0
- package/dist/push-D6R9icWN.js +495 -0
- package/dist/registry-BYVD-_h6.js +10385 -0
- package/dist/{reports-CfJqoava.js → reports-D_qbl7_u.js} +7 -6
- package/dist/{resources-Bf9O1JNM.js → resources-DLON3-61.js} +162 -55
- package/dist/{run-DsVZ5snL.js → run-Co-BwhOg.js} +16 -22
- package/dist/scan-B88OlWOt.js +4 -0
- package/dist/{scan-zKsddO72.js → scan-CKuk-_6W.js} +48 -37
- package/dist/scope-DV22_Ufm.js +198 -0
- package/dist/screenshot-file-tVBfUEIi.js +16 -0
- package/dist/{selection-CxZoX4NT.js → selection-C2_KbLuo.js} +100 -51
- package/dist/server-C4f6ccUr.js +22 -0
- package/dist/{dev-DmB3XqaJ.js → server-D0d2oP-5.js} +86 -94
- package/dist/session-B-Uz0cQ7.js +40 -0
- package/dist/session-BuvArt1j.js +6 -0
- package/dist/session-C4rbE3VS.js +796 -0
- package/dist/skills/animate-onboarding/SKILL.md +467 -0
- package/dist/skills/animate-onboarding/references/engine.md +494 -0
- package/dist/skills/animate-onboarding/references/framework/Question.tsx +71 -0
- package/dist/skills/animate-onboarding/references/framework/README.md +40 -0
- package/dist/skills/animate-onboarding/references/framework/answers.ts +19 -0
- package/dist/skills/animate-onboarding/references/framework/flow.ts +80 -0
- package/dist/skills/animate-onboarding/references/framework/handoffs.ts +869 -0
- package/dist/skills/animate-onboarding/references/framework/layout.tsx +113 -0
- package/dist/skills/animate-onboarding/references/framework/motion.css +559 -0
- package/dist/skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
- package/dist/skills/animate-onboarding/references/handoffs.md +375 -0
- package/dist/skills/animate-onboarding/references/imageReady.ts +92 -0
- package/dist/skills/animate-onboarding/references/morphFrame.ts +356 -0
- package/dist/skills/animate-onboarding/references/performance.md +41 -0
- package/dist/skills/animate-onboarding/references/web-runtime/README.md +17 -0
- package/dist/skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
- package/dist/skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
- package/dist/skills/index.json +37 -0
- package/dist/skills/mobile-design/SKILL.md +447 -0
- package/dist/skills/mobile-design/references/responsive.md +162 -0
- package/dist/skills/onboarding-questions/SKILL.md +231 -0
- package/dist/skills/onboarding-questions/references/arpu-questions.md +139 -0
- package/dist/skills/onboarding-questions/references/craft.md +142 -0
- package/dist/skills/onboarding-questions/references/example-reflective.md +117 -0
- package/dist/skills/superwall/SKILL.md +82 -9
- package/dist/skills/superwall/references/api.md +153 -37
- package/dist/skills/superwall/references/apple-setup.md +316 -0
- package/dist/skills/superwall/references/asc.md +74 -38
- package/dist/skills/superwall/references/data-analytics.md +55 -21
- package/dist/skills/superwall/workflows/dashboard/playbook.md +3 -3
- package/dist/skills/superwall/workflows/dashboard/setup.md +8 -8
- package/dist/skills/superwall/workflows/migrate/adapty.md +6 -6
- package/dist/skills/superwall/workflows/migrate/playbook.md +4 -4
- package/dist/skills/superwall/workflows/migrate/qonversion.md +5 -5
- package/dist/skills/superwall/workflows/migrate/revenuecat.md +6 -6
- package/dist/skills/superwall/workflows/placements/android.md +2 -2
- package/dist/skills/superwall/workflows/placements/expo.md +2 -2
- package/dist/skills/superwall/workflows/placements/flutter.md +2 -2
- package/dist/skills/superwall/workflows/placements/ios.md +2 -2
- package/dist/skills/superwall/workflows/placements/playbook.md +2 -2
- package/dist/skills/superwall/workflows/placements/react-native.md +2 -2
- package/dist/skills/superwall/workflows/placements/strategy.md +2 -2
- package/dist/skills/superwall/workflows/review/playbook.md +1 -1
- package/dist/skills/superwall-editor/SKILL.md +61 -0
- package/dist/skills/superwall-editor/references/cli.md +135 -0
- package/dist/skills/superwall-editor/references/design.md +51 -0
- package/dist/skills/superwall-editor/references/native-elements.md +171 -0
- package/dist/skills/superwall-editor/references/workflow.md +65 -0
- package/dist/skills/superwall-editor/scripts/sw-editor.sh +662 -0
- package/dist/skills/superwall-framework/SKILL.md +85 -31
- package/dist/skills/superwall-framework/references/cli.md +58 -27
- package/dist/skills/superwall-framework/references/examples.md +4 -3
- package/dist/skills/superwall-framework/references/layout.md +64 -9
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +1 -1
- package/dist/skills/superwall-framework/references/onboarding-state.md +245 -0
- package/dist/skills/wwdc/SKILL.md +22 -0
- package/dist/skills/wwdc/references/docs.md +52 -0
- package/dist/skills/wwdc/scripts/wwdc.sh +266 -0
- package/dist/skills-CLGJuMnF.js +14 -0
- package/dist/{skills-DPzlnfCK.js → skills-CZcpnEnG.js} +100 -122
- package/dist/{spawn-DSoTXy_j.js → spawn-DmmmHIP-.js} +14 -12
- package/dist/spinner-C2U6QBJ9.js +294 -0
- package/dist/storage-6h9vyiAz.js +31 -0
- package/dist/storage-CerJ5KLP.d.ts +16 -0
- package/dist/storekit-CK9JmM2D.js +16 -0
- package/dist/storekit-CinJra3V.js +47 -0
- package/dist/telemetry-DKyDhURo.js +56 -0
- package/dist/theme-DUsCh-Vd.js +25 -0
- package/dist/timing-BVxPrYq3.js +5 -0
- package/dist/{token-C0it-Xh7.js → token-DaxQgQkv.js} +6 -38
- package/dist/tools-skills/animate-onboarding/SKILL.md +467 -0
- package/dist/tools-skills/animate-onboarding/references/engine.md +494 -0
- package/dist/tools-skills/animate-onboarding/references/framework/Question.tsx +71 -0
- package/dist/tools-skills/animate-onboarding/references/framework/README.md +40 -0
- package/dist/tools-skills/animate-onboarding/references/framework/answers.ts +19 -0
- package/dist/tools-skills/animate-onboarding/references/framework/flow.ts +80 -0
- package/dist/tools-skills/animate-onboarding/references/framework/handoffs.ts +869 -0
- package/dist/tools-skills/animate-onboarding/references/framework/layout.tsx +113 -0
- package/dist/tools-skills/animate-onboarding/references/framework/motion.css +559 -0
- package/dist/tools-skills/animate-onboarding/references/framework/useStoryRouter.ts +48 -0
- package/dist/tools-skills/animate-onboarding/references/handoffs.md +375 -0
- package/dist/tools-skills/animate-onboarding/references/imageReady.ts +92 -0
- package/dist/tools-skills/animate-onboarding/references/morphFrame.ts +356 -0
- package/dist/tools-skills/animate-onboarding/references/performance.md +41 -0
- package/dist/tools-skills/animate-onboarding/references/web-runtime/README.md +17 -0
- package/dist/tools-skills/animate-onboarding/references/web-runtime/handoffs.ts +858 -0
- package/dist/tools-skills/animate-onboarding/references/web-runtime/story-motion.css +301 -0
- package/dist/tools-skills/mobile-design/SKILL.md +447 -0
- package/dist/tools-skills/mobile-design/references/responsive.md +162 -0
- package/dist/tools-skills/onboarding-questions/SKILL.md +231 -0
- package/dist/tools-skills/onboarding-questions/references/arpu-questions.md +139 -0
- package/dist/tools-skills/onboarding-questions/references/craft.md +142 -0
- package/dist/tools-skills/onboarding-questions/references/example-reflective.md +117 -0
- package/dist/tools-skills/superwall/SKILL.md +263 -0
- package/dist/tools-skills/superwall/references/api.md +303 -0
- package/dist/tools-skills/superwall/references/asa.md +166 -0
- package/dist/tools-skills/superwall/references/asc.md +95 -0
- package/dist/tools-skills/superwall/references/dashboard-links.md +57 -0
- package/dist/tools-skills/superwall/references/data-analytics.md +896 -0
- package/dist/tools-skills/superwall/references/docs.md +51 -0
- package/dist/tools-skills/superwall/references/sdk-integration.md +104 -0
- package/dist/tools-skills/superwall/references/sdk-source.md +18 -0
- package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +76 -0
- package/dist/tools-skills/superwall/workflows/dashboard/setup.md +100 -0
- package/dist/tools-skills/superwall/workflows/integrate/android.md +292 -0
- package/dist/tools-skills/superwall/workflows/integrate/expo.md +272 -0
- package/dist/tools-skills/superwall/workflows/integrate/flutter.md +285 -0
- package/dist/tools-skills/superwall/workflows/integrate/ios.md +314 -0
- package/dist/tools-skills/superwall/workflows/integrate/playbook.md +83 -0
- package/dist/tools-skills/superwall/workflows/integrate/react-native.md +246 -0
- package/dist/tools-skills/superwall/workflows/migrate/adapty.md +229 -0
- package/dist/tools-skills/superwall/workflows/migrate/playbook.md +78 -0
- package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +227 -0
- package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +414 -0
- package/dist/tools-skills/superwall/workflows/placements/android.md +175 -0
- package/dist/tools-skills/superwall/workflows/placements/expo.md +161 -0
- package/dist/tools-skills/superwall/workflows/placements/flutter.md +139 -0
- package/dist/tools-skills/superwall/workflows/placements/ios.md +165 -0
- package/dist/tools-skills/superwall/workflows/placements/playbook.md +69 -0
- package/dist/tools-skills/superwall/workflows/placements/react-native.md +145 -0
- package/dist/tools-skills/superwall/workflows/placements/strategy.md +222 -0
- package/dist/tools-skills/superwall/workflows/review/android.md +120 -0
- package/dist/tools-skills/superwall/workflows/review/expo.md +100 -0
- package/dist/tools-skills/superwall/workflows/review/flutter.md +99 -0
- package/dist/tools-skills/superwall/workflows/review/ios.md +108 -0
- package/dist/tools-skills/superwall/workflows/review/playbook.md +70 -0
- package/dist/tools-skills/superwall/workflows/review/react-native.md +100 -0
- package/dist/tools-skills/superwall-editor/SKILL.md +113 -0
- package/dist/tools-skills/superwall-editor/references/cli.md +135 -0
- package/dist/tools-skills/superwall-editor/references/design.md +51 -0
- package/dist/tools-skills/superwall-editor/references/native-elements.md +171 -0
- package/dist/tools-skills/superwall-editor/references/workflow.md +65 -0
- package/dist/tools-skills/superwall-editor/scripts/sw-editor.sh +662 -0
- package/dist/tools-skills/wwdc/SKILL.md +22 -0
- package/dist/tools-skills/wwdc/references/docs.md +52 -0
- package/dist/tools-skills/wwdc/scripts/wwdc.sh +266 -0
- package/dist/tools.d.ts +96 -0
- package/dist/tools.js +11360 -0
- package/dist/ui-D_qf3Gvw.js +53 -0
- package/dist/upgrade-DPo0a4Es.js +117 -0
- package/dist/upgrade-ffseQDMx.js +7 -0
- package/package.json +10 -5
- package/dist/api-CZzirVMj.js +0 -151
- package/dist/api-output-aJNw7Syy.js +0 -20
- package/dist/app-DH6U8yuI.js +0 -190
- package/dist/asa-C-sQzPPn.js +0 -1194
- package/dist/asc-1ZBJ6DwS.js +0 -778
- package/dist/auth-YRhlV3DE.js +0 -140
- package/dist/billing-CCYHdApx.js +0 -80
- package/dist/bundle-id-CKxl_026.js +0 -121
- package/dist/command-CMIz81Da.js +0 -301
- package/dist/dev-DZy6pOnB.js +0 -22
- package/dist/doctor-H-hf-Yww.js +0 -88
- package/dist/feedback-CKf-rpBW.js +0 -152
- package/dist/hosted-CXe9TrWx.js +0 -32
- package/dist/migrate-C9ERDR6y.js +0 -284
- package/dist/org-sj7uyvp-.js +0 -40
- package/dist/output-C4o2gJ1K.js +0 -146
- package/dist/params-l3CrvRtR.js +0 -51
- package/dist/pipeline-BqzqZhX1.js +0 -977
- package/dist/print-skill-ZojRSybs.js +0 -74
- package/dist/promote-BG8X4Nv_.js +0 -88
- package/dist/publish-sxLh-G4G.js +0 -35
- package/dist/push-bQ6Vxtg8.js +0 -35
- package/dist/query-_FbybaH-.js +0 -53
- package/dist/resource-CGIwSd29.js +0 -323
- package/dist/revenue-provider-ebsRINY8.js +0 -100
- package/dist/scope-BvzD-kO4.js +0 -223
- package/dist/skills-D_R-lEsK.js +0 -64
- package/dist/spinner-TWa0hia6.js +0 -18
- package/dist/storekit-Cj9Cpjcz.js +0 -29
- package/dist/telemetry-DeA1mvnT.js +0 -169
- package/dist/ui-Dy0b-9L8.js +0 -27738
- package/dist/update-B2fWIc4q.js +0 -59
- package/dist/upgrade-BmzkTKrh.js +0 -72
- /package/dist/{devtools-8EgLo86w.js → devtools-pBl_vt03.js} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { l as readJson, r as formatJson, u as state } from "./output-Ggzq5_-t.js";
|
|
2
|
+
import { n as API_HOST_OVERRIDE, t as API_HOST } from "./environment-eBXjELoN.js";
|
|
3
|
+
|
|
4
|
+
//#region src/core/account/storage.ts
|
|
5
|
+
const sessionOrgName = (session) => {
|
|
6
|
+
return session?.authMethod === "api_key" ? session.orgName : void 0;
|
|
7
|
+
};
|
|
8
|
+
const FILE = "auth.json";
|
|
9
|
+
function writeSession(session) {
|
|
10
|
+
state().write(FILE, `${formatJson(session)}\n`);
|
|
11
|
+
}
|
|
12
|
+
function readSession() {
|
|
13
|
+
return readJson(state(), FILE) ?? null;
|
|
14
|
+
}
|
|
15
|
+
function removeSession() {
|
|
16
|
+
state().remove(FILE);
|
|
17
|
+
}
|
|
18
|
+
function resolveApiHost(session) {
|
|
19
|
+
return API_HOST_OVERRIDE() ?? session.host ?? API_HOST();
|
|
20
|
+
}
|
|
21
|
+
function serializeSession(session) {
|
|
22
|
+
return {
|
|
23
|
+
authenticated: true,
|
|
24
|
+
user: { email: session.userEmail ?? null },
|
|
25
|
+
credential: { type: session.apiKey ? "api_key" : session.accessToken ? "oauth" : "unknown" },
|
|
26
|
+
host: resolveApiHost(session)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { sessionOrgName as a, serializeSession as i, removeSession as n, writeSession as o, resolveApiHost as r, readSession as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/core/account/storage.d.ts
|
|
2
|
+
interface Session {
|
|
3
|
+
authMethod?: "oauth" | "api_key";
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
orgName?: string;
|
|
6
|
+
userEmail?: string;
|
|
7
|
+
host: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
accessToken?: string;
|
|
10
|
+
refreshToken?: string;
|
|
11
|
+
accessTokenExpiresAt?: number;
|
|
12
|
+
tokenEndpoint?: string;
|
|
13
|
+
oauthClientId?: string;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Session as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "./token-DaxQgQkv.js";
|
|
2
|
+
import "./output-Ggzq5_-t.js";
|
|
3
|
+
import "./environment-eBXjELoN.js";
|
|
4
|
+
import "./storage-6h9vyiAz.js";
|
|
5
|
+
import "./client-BL0f_yGf.js";
|
|
6
|
+
import "./config-BO1Y87kV.js";
|
|
7
|
+
import "./spinner-C2U6QBJ9.js";
|
|
8
|
+
import "./ui-D_qf3Gvw.js";
|
|
9
|
+
import "./resources-DLON3-61.js";
|
|
10
|
+
import "./org-BQQDo7wm.js";
|
|
11
|
+
import "./lookup-rr1AkCJA.js";
|
|
12
|
+
import "./scope-DV22_Ufm.js";
|
|
13
|
+
import "./input-vi0bou04.js";
|
|
14
|
+
import { n as writeStoreKit, t as generateStoreKit } from "./storekit-CinJra3V.js";
|
|
15
|
+
|
|
16
|
+
export { generateStoreKit, writeStoreKit };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { r as formatJson } from "./output-Ggzq5_-t.js";
|
|
2
|
+
import { t as apiCall } from "./spinner-C2U6QBJ9.js";
|
|
3
|
+
import { m as listResource } from "./resources-DLON3-61.js";
|
|
4
|
+
import { a as pickScope } from "./scope-DV22_Ufm.js";
|
|
5
|
+
import { r as textOf } from "./input-vi0bou04.js";
|
|
6
|
+
import { writeFileSync } from "node:fs";
|
|
7
|
+
|
|
8
|
+
//#region src/core/main/storekit.ts
|
|
9
|
+
async function writeStoreKit(context, api, out) {
|
|
10
|
+
const scope = await pickScope(context, api, false);
|
|
11
|
+
const products = await apiCall(context, "Loading products", () => listResource(api, "products", scope));
|
|
12
|
+
const outFile = textOf(out) ?? "Superwall.storekit";
|
|
13
|
+
writeFileSync(outFile, `${formatJson(generateStoreKit(products))}\n`);
|
|
14
|
+
if (context.json) return context.output.data({
|
|
15
|
+
path: outFile,
|
|
16
|
+
products: products.length
|
|
17
|
+
});
|
|
18
|
+
context.ui.success(`Wrote \`${outFile}\` with ${products.length} product${products.length === 1 ? "" : "s"}`);
|
|
19
|
+
}
|
|
20
|
+
function generateStoreKit(products) {
|
|
21
|
+
return {
|
|
22
|
+
identifier: "SUPERWALL",
|
|
23
|
+
nonRenewingSubscriptions: [],
|
|
24
|
+
products: products.map((p) => String(p.identifier ?? p.product_identifier ?? p.name ?? "")).filter(Boolean).map((id, i) => ({
|
|
25
|
+
displayPrice: "9.99",
|
|
26
|
+
familyShareable: false,
|
|
27
|
+
internalID: String(1e3 + i),
|
|
28
|
+
localizations: [{
|
|
29
|
+
description: id,
|
|
30
|
+
displayName: id,
|
|
31
|
+
locale: "en_US"
|
|
32
|
+
}],
|
|
33
|
+
productID: id,
|
|
34
|
+
referenceName: id,
|
|
35
|
+
type: "NonConsumable"
|
|
36
|
+
})),
|
|
37
|
+
settings: { _applicationInternalID: "SUPERWALL" },
|
|
38
|
+
subscriptionGroups: [],
|
|
39
|
+
version: {
|
|
40
|
+
major: 3,
|
|
41
|
+
minor: 0
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { writeStoreKit as n, generateStoreKit as t };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { _ as VERSION, b as isNonInteractive, g as TELEMETRY_KEY, h as TELEMETRY_HOST } from "./environment-eBXjELoN.js";
|
|
2
|
+
import { h as writeTelemetryNoticeShown, l as telemetryNoticeShown, t as readAnonymousId } from "./config-BO1Y87kV.js";
|
|
3
|
+
|
|
4
|
+
//#region src/core/support/telemetry.ts
|
|
5
|
+
const tags = {};
|
|
6
|
+
const pending = [];
|
|
7
|
+
function updateTelemetryTags(next) {
|
|
8
|
+
Object.assign(tags, next);
|
|
9
|
+
}
|
|
10
|
+
function isTelemetryEnabled(env, key) {
|
|
11
|
+
return Boolean(key) && !env.DO_NOT_TRACK && !env.SUPERWALL_TELEMETRY_DISABLED && !env.NODE_TEST_CONTEXT;
|
|
12
|
+
}
|
|
13
|
+
function telemetryEnabled() {
|
|
14
|
+
return isTelemetryEnabled(process.env, TELEMETRY_KEY());
|
|
15
|
+
}
|
|
16
|
+
function buildEvent(event, props, distinctId) {
|
|
17
|
+
return {
|
|
18
|
+
api_key: TELEMETRY_KEY(),
|
|
19
|
+
event,
|
|
20
|
+
distinct_id: distinctId,
|
|
21
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22
|
+
properties: {
|
|
23
|
+
$process_person_profile: false,
|
|
24
|
+
cli_version: VERSION,
|
|
25
|
+
platform: process.platform,
|
|
26
|
+
ci: process.env.CI === "true",
|
|
27
|
+
interactive: !isNonInteractive(),
|
|
28
|
+
...tags,
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function track(event, props = {}) {
|
|
34
|
+
if (!telemetryEnabled()) return;
|
|
35
|
+
try {
|
|
36
|
+
const payload = buildEvent(event, props, readAnonymousId());
|
|
37
|
+
pending.push(fetch(`${TELEMETRY_HOST()}/capture/`, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: { "content-type": "application/json" },
|
|
40
|
+
body: JSON.stringify(payload),
|
|
41
|
+
signal: AbortSignal.timeout(1500)
|
|
42
|
+
}).catch(() => {}));
|
|
43
|
+
} catch {}
|
|
44
|
+
}
|
|
45
|
+
async function flushTelemetry(capMs = 2e3) {
|
|
46
|
+
if (pending.length === 0) return;
|
|
47
|
+
await Promise.race([Promise.allSettled(pending), new Promise((done) => setTimeout(done, capMs).unref())]);
|
|
48
|
+
}
|
|
49
|
+
function maybeShowTelemetryNotice(ui) {
|
|
50
|
+
if (!telemetryEnabled() || telemetryNoticeShown()) return;
|
|
51
|
+
writeTelemetryNoticeShown();
|
|
52
|
+
ui.info("The CLI collects anonymous usage data - no personal data, ever (see the README). Opt out with `SUPERWALL_TELEMETRY_DISABLED=1`.");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { updateTelemetryTags as i, maybeShowTelemetryNotice as n, track as r, flushTelemetry as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
|
|
3
|
+
//#region src/ui/theme.ts
|
|
4
|
+
const THEME = {
|
|
5
|
+
primary: "#74FFF1",
|
|
6
|
+
alert: "#E46671"
|
|
7
|
+
};
|
|
8
|
+
function hexToRgb(hex) {
|
|
9
|
+
const h = hex.replace("#", "");
|
|
10
|
+
const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
|
|
11
|
+
const n = parseInt(full, 16);
|
|
12
|
+
return [
|
|
13
|
+
n >> 16 & 255,
|
|
14
|
+
n >> 8 & 255,
|
|
15
|
+
n & 255
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
function fg(hex, text) {
|
|
19
|
+
if (!pc.isColorSupported) return text;
|
|
20
|
+
const [r, g, b] = hexToRgb(hex);
|
|
21
|
+
return `\x1b[38;2;${r};${g};${b}m${text}\x1b[39m`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { fg as n, THEME as t };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { o as writeSession, t as readSession } from "./storage-6h9vyiAz.js";
|
|
5
2
|
|
|
6
|
-
//#region src/core/
|
|
3
|
+
//#region src/core/account/errors.ts
|
|
7
4
|
var NotLoggedInError = class extends Error {
|
|
8
5
|
constructor() {
|
|
9
6
|
super("You aren't logged in. Run `superwall login` first.");
|
|
@@ -12,36 +9,7 @@ var NotLoggedInError = class extends Error {
|
|
|
12
9
|
};
|
|
13
10
|
|
|
14
11
|
//#endregion
|
|
15
|
-
//#region src/core/
|
|
16
|
-
function dir() {
|
|
17
|
-
return SUPERWALL_HOME() ?? join(homedir(), ".superwall");
|
|
18
|
-
}
|
|
19
|
-
function file() {
|
|
20
|
-
return join(dir(), "auth.json");
|
|
21
|
-
}
|
|
22
|
-
function saveSession(session) {
|
|
23
|
-
mkdirSync(dir(), {
|
|
24
|
-
recursive: true,
|
|
25
|
-
mode: 448
|
|
26
|
-
});
|
|
27
|
-
writeFileSync(file(), `${formatJson(session)}\n`, { mode: 384 });
|
|
28
|
-
}
|
|
29
|
-
function loadSession() {
|
|
30
|
-
try {
|
|
31
|
-
if (!existsSync(file())) return null;
|
|
32
|
-
return JSON.parse(readFileSync(file(), "utf8"));
|
|
33
|
-
} catch {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function clearSession() {
|
|
38
|
-
try {
|
|
39
|
-
rmSync(file(), { force: true });
|
|
40
|
-
} catch {}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/core/auth/token.ts
|
|
12
|
+
//#region src/core/account/token.ts
|
|
45
13
|
const EXPIRY_SKEW_MS = 6e4;
|
|
46
14
|
function accessTokenIsFresh(session) {
|
|
47
15
|
return session.accessTokenExpiresAt !== void 0 && session.accessTokenExpiresAt - EXPIRY_SKEW_MS > Date.now();
|
|
@@ -67,14 +35,14 @@ async function refreshAccessToken(session) {
|
|
|
67
35
|
refreshToken: d.refresh_token ?? session.refreshToken,
|
|
68
36
|
accessTokenExpiresAt: d.expires_in ? Date.now() + d.expires_in * 1e3 : void 0
|
|
69
37
|
};
|
|
70
|
-
|
|
38
|
+
writeSession(updated);
|
|
71
39
|
return updated;
|
|
72
40
|
} catch {
|
|
73
41
|
return null;
|
|
74
42
|
}
|
|
75
43
|
}
|
|
76
44
|
async function getOAuthAccessToken() {
|
|
77
|
-
const session =
|
|
45
|
+
const session = readSession();
|
|
78
46
|
if (!session?.accessToken || !session.refreshToken) return null;
|
|
79
47
|
if (accessTokenIsFresh(session)) return session.accessToken;
|
|
80
48
|
return (await refreshAccessToken(session))?.accessToken ?? null;
|
|
@@ -99,4 +67,4 @@ async function resolveAuthToken(session) {
|
|
|
99
67
|
}
|
|
100
68
|
|
|
101
69
|
//#endregion
|
|
102
|
-
export {
|
|
70
|
+
export { resolveAuthToken as n, NotLoggedInError as r, getOAuthAccessToken as t };
|