create-disposabl-app 0.17.6 → 0.18.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.
Files changed (96) hide show
  1. package/README.md +4 -0
  2. package/dist/disposabl.js +42 -9
  3. package/dist/index.js +64 -18
  4. package/dist/templates/default/apps/mobile/README.md +40 -0
  5. package/dist/templates/default/apps/mobile/app.config.js +46 -2
  6. package/dist/templates/default/apps/mobile/package.json +7 -1
  7. package/dist/templates/default/apps/mobile/plugins/with-android-signing.js +23 -1
  8. package/dist/templates/default/apps/mobile/scripts/fresh-android.mjs +24 -0
  9. package/dist/templates/default/apps/mobile/scripts/play-aab.mjs +176 -0
  10. package/dist/templates/default/apps/mobile/scripts/verify-play-aab.mjs +77 -0
  11. package/dist/templates/default/bun.lock +12 -3
  12. package/dist/templates/default/bunfig.toml +1 -0
  13. package/dist/templates/default/package.json +6 -2
  14. package/dist/templates/default/packages/backend/convex/files/guard.ts +2 -0
  15. package/dist/templates/default/packages/backend/convex/http.ts +11 -1
  16. package/dist/templates/default/packages/backend/convex/schema.ts +10 -0
  17. package/dist/templates/default/packages/backend/convex/telemetry.ts +12 -16
  18. package/dist/templates/default/packages/cli/telemetry.ts +40 -3
  19. package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +2 -0
  20. package/dist/templates/default/packages/disposabl-kit/client/components/account-deletion.tsx +111 -0
  21. package/dist/templates/default/packages/disposabl-kit/client/components/consent-identity.tsx +50 -0
  22. package/dist/templates/default/packages/disposabl-kit/client/components/legal-page.tsx +12 -1
  23. package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry-lease.ts +200 -0
  24. package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry.ts +8 -1
  25. package/dist/templates/default/packages/disposabl-kit/client/routes/consent.tsx +23 -1
  26. package/dist/templates/default/packages/disposabl-kit/client/routes/legal/delete-account.tsx +6 -1
  27. package/dist/templates/default/packages/disposabl-kit/client/routes/legal/support.tsx +33 -0
  28. package/dist/templates/default/packages/disposabl-kit/client/routes/pricing.tsx +13 -0
  29. package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +19 -2
  30. package/dist/templates/default/packages/disposabl-kit/client/vite.config.ts +1 -0
  31. package/dist/templates/default/packages/disposabl-kit/legal/README.md +1 -1
  32. package/dist/templates/default/packages/disposabl-kit/legal/config.ts +32 -4
  33. package/dist/templates/default/packages/disposabl-kit/legal/index.ts +2 -2
  34. package/dist/templates/default/packages/disposabl-kit/legal/publisher.ts +6 -0
  35. package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +13 -9
  36. package/dist/templates/default/packages/disposabl-kit/mobile/billing/paywall.ts +28 -4
  37. package/dist/templates/default/packages/disposabl-kit/mobile/billing/policy.ts +31 -14
  38. package/dist/templates/default/packages/disposabl-kit/mobile/billing/web-checkout.ts +45 -34
  39. package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-links.tsx +14 -0
  40. package/dist/templates/default/packages/disposabl-kit/mobile/expo-plugin.cjs +3 -0
  41. package/dist/templates/default/packages/disposabl-kit/mobile/index.ts +4 -0
  42. package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +55 -8
  43. package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +147 -124
  44. package/dist/templates/default/packages/disposabl-kit/server/billing-handoff.ts +113 -95
  45. package/dist/templates/default/packages/disposabl-kit/server/files-functions.ts +70 -54
  46. package/dist/templates/default/packages/disposabl-kit/server/http.ts +49 -21
  47. package/dist/templates/default/packages/disposabl-kit/server/lib/platform-spec.ts +25 -1
  48. package/dist/templates/default/packages/disposabl-kit/server/lib/telemetry.ts +375 -69
  49. package/dist/templates/default/packages/sdk/README.md +2 -0
  50. package/dist/templates/default/packages/sdk/src/analytics.ts +7 -2
  51. package/dist/templates/default/packages/skill/SKILL.md +4 -2
  52. package/dist/templates/default/packages/skill/references/store-submissions.md +25 -0
  53. package/dist/templates/default/packages/tests/README.md +28 -1
  54. package/dist/templates/default/packages/tests/account-deletion-ui.test.ts +21 -0
  55. package/dist/templates/default/packages/tests/auth-email-setup.test.ts +45 -0
  56. package/dist/templates/default/packages/tests/components/account-deletion.test.mjs +82 -0
  57. package/dist/templates/default/packages/tests/components/consent-identity.test.mjs +175 -0
  58. package/dist/templates/default/packages/tests/components/mobile-deletion-link.test.mjs +40 -0
  59. package/dist/templates/default/packages/tests/components/mobile-theme.test.mjs +56 -3
  60. package/dist/templates/default/packages/tests/components/pricing-identity.test.mjs +113 -0
  61. package/dist/templates/default/packages/tests/components/support-page.test.mjs +36 -0
  62. package/dist/templates/default/packages/tests/consent-identity.test.ts +13 -0
  63. package/dist/templates/default/packages/tests/desktop-macos-release.test.ts +153 -145
  64. package/dist/templates/default/packages/tests/flows/legal.e2e.ts +40 -3
  65. package/dist/templates/default/packages/tests/helpers/auth-email-setup/probe.test.mjs +44 -0
  66. package/dist/templates/default/packages/tests/helpers/mobile-simulator/preflight.py +80 -0
  67. package/dist/templates/default/packages/tests/helpers/mobile-simulator/test_preflight.py +57 -0
  68. package/dist/templates/default/packages/tests/mobile-android-e2e-network.test.ts +81 -1
  69. package/dist/templates/default/packages/tests/mobile-android-signing.test.ts +52 -0
  70. package/dist/templates/default/packages/tests/mobile-deletion-link.test.ts +21 -0
  71. package/dist/templates/default/packages/tests/mobile-ios-reachability-pin.test.ts +84 -0
  72. package/dist/templates/default/packages/tests/mobile-simulator-preflight.test.ts +16 -0
  73. package/dist/templates/default/packages/tests/native-billing.test.ts +288 -0
  74. package/dist/templates/default/packages/tests/pricing-identity.test.ts +13 -0
  75. package/dist/templates/default/packages/tests/sdk-analytics.test.ts +28 -2
  76. package/dist/templates/default/packages/tests/support-page.test.ts +13 -0
  77. package/dist/templates/default/packages/tests/telemetry.test.ts +389 -18
  78. package/dist/templates/default/packages/tests/ui-telemetry-lease.test.ts +346 -0
  79. package/dist/templates/default/patches/convex-mcp-account-erasure-alpha7.patch +466 -0
  80. package/dist/templates/default/vendor/README.md +61 -1
  81. package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.1.patch +890 -0
  82. package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.1.tgz +0 -0
  83. package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.2.patch +1060 -0
  84. package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.2.tgz +0 -0
  85. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.4.tgz +0 -0
  86. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.5.tgz +0 -0
  87. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.6.tgz +0 -0
  88. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.7.tgz +0 -0
  89. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.8.tgz +0 -0
  90. package/dist/templates/default/vendor/convex-auth-core-erasure-disposabl.6.patch +115 -0
  91. package/dist/templates/default/vendor/convex-auth-identity-cutoff-disposabl.7.patch +442 -0
  92. package/dist/templates/default/vendor/convex-auth-identity-erasure-disposabl.8.md +11 -0
  93. package/dist/templates/default/vendor/convex-auth-identity-erasure-disposabl.8.patch +78 -0
  94. package/dist/templates/default/vendor/convex-auth-marker-disposabl.4.patch +169 -0
  95. package/dist/templates/default/vendor/convex-auth-marker-password-disposabl.5.patch +126 -0
  96. package/package.json +1 -1
@@ -0,0 +1,176 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { readFileSync, realpathSync } from "node:fs";
3
+ import { dirname, join, resolve, sep } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { fingerprint, verifyBundle } from "./verify-play-aab.mjs";
6
+ import { freshAndroid } from "./fresh-android.mjs";
7
+
8
+ const mobile = realpathSync(
9
+ resolve(dirname(fileURLToPath(import.meta.url)), ".."),
10
+ );
11
+ const env = process.env;
12
+ function required(name) {
13
+ if (!env[name]) throw new Error(`Missing ${name}`);
14
+ return env[name];
15
+ }
16
+ function run(command, args, options = {}) {
17
+ return execFileSync(command, args, {
18
+ cwd: mobile,
19
+ encoding: "utf8",
20
+ ...options,
21
+ });
22
+ }
23
+ const packageId = required("PLAY_PACKAGE_ID");
24
+ if (!/^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(packageId))
25
+ throw new Error("Invalid Play package ID");
26
+ const expectedCert = required("PLAY_UPLOAD_CERT_SHA256")
27
+ .replaceAll(":", "")
28
+ .toUpperCase();
29
+ if (!/^[0-9A-F]{64}$/.test(expectedCert))
30
+ throw new Error("Invalid upload certificate SHA256");
31
+ const version = required("DISPOSABL_ANDROID_VERSION_CODE");
32
+ const previous = required("PLAY_PREVIOUS_VERSION_CODE");
33
+ if (
34
+ !/^[1-9]\d*$/.test(version) ||
35
+ !/^(0|[1-9]\d*)$/.test(previous) ||
36
+ Number(version) > 2100000000 ||
37
+ BigInt(version) <= BigInt(previous)
38
+ )
39
+ throw new Error(
40
+ "Version code must be greater than the verified Play version code",
41
+ );
42
+ for (const key of [
43
+ "ANDROID_KEYSTORE_PATH",
44
+ "ANDROID_KEYSTORE_PASSWORD",
45
+ "ANDROID_KEY_ALIAS",
46
+ "ANDROID_KEY_PASSWORD",
47
+ ])
48
+ required(key);
49
+ if (env.EXPO_PUBLIC_E2E === "true")
50
+ throw new Error("E2E builds cannot be uploaded to Play");
51
+ for (const key of ["EXPO_PUBLIC_CONVEX_URL", "EXPO_PUBLIC_CONVEX_SITE_URL"]) {
52
+ const url = new URL(required(key));
53
+ if (
54
+ url.protocol !== "https:" ||
55
+ ["localhost", "127.0.0.1", "10.0.2.2", "[::1]"].includes(url.hostname)
56
+ )
57
+ throw new Error(`${key} must be a non-loopback HTTPS URL`);
58
+ }
59
+ env.BUNDLETOOL_JAR = realpathSync(required("BUNDLETOOL_JAR"));
60
+ env.ANDROID_KEYSTORE_PATH = realpathSync(env.ANDROID_KEYSTORE_PATH);
61
+ for (const key of ["BUNDLETOOL_JAR", "ANDROID_KEYSTORE_PATH"])
62
+ if (env[key].startsWith(`${mobile}${sep}android${sep}`))
63
+ throw new Error(`Keep ${key} outside the generated Android project`);
64
+ env.DISPOSABL_MOBILE_CHANNEL = "production";
65
+ env.DISPOSABL_ANDROID_CHANNEL = "production";
66
+ env.EXPO_NO_DOTENV = "1";
67
+ env.EXPO_NO_TELEMETRY = "1";
68
+ env.DO_NOT_TRACK = "1";
69
+ const keyInfo = run(
70
+ "keytool",
71
+ [
72
+ "-list",
73
+ "-v",
74
+ "-keystore",
75
+ env.ANDROID_KEYSTORE_PATH,
76
+ "-storepass:env",
77
+ "ANDROID_KEYSTORE_PASSWORD",
78
+ "-alias",
79
+ env.ANDROID_KEY_ALIAS,
80
+ ],
81
+ { env: { ...env, LANG: "C", LC_ALL: "C" } },
82
+ );
83
+ if (fingerprint(keyInfo) !== expectedCert)
84
+ throw new Error(
85
+ "Keystore certificate does not match verified Play upload certificate",
86
+ );
87
+ const config = JSON.parse(
88
+ run("bun", ["x", "--no-install", "expo", "config", "--json"]),
89
+ );
90
+ if (
91
+ config.android?.package !== packageId ||
92
+ String(config.android?.versionCode) !== version
93
+ )
94
+ throw new Error(
95
+ "Expo package or version does not match verified Play identity",
96
+ );
97
+ const architectures = config.extra?.disposablAndroidArchitectures;
98
+ if (
99
+ !Array.isArray(architectures) ||
100
+ !architectures.length ||
101
+ architectures.some(
102
+ (x) => !["arm64-v8a", "x86_64", "armeabi-v7a", "x86"].includes(x),
103
+ ) ||
104
+ new Set(architectures).size !== architectures.length
105
+ )
106
+ throw new Error("Invalid configured Android architectures");
107
+ freshAndroid(mobile, () =>
108
+ run(
109
+ "bun",
110
+ [
111
+ "x",
112
+ "--no-install",
113
+ "expo",
114
+ "prebuild",
115
+ "--platform",
116
+ "android",
117
+ "--no-install",
118
+ ],
119
+ {
120
+ stdio: "inherit",
121
+ },
122
+ ),
123
+ );
124
+ const gradle = readFileSync(join(mobile, "android/app/build.gradle"), "utf8");
125
+ if (
126
+ !gradle.includes(`applicationId '${packageId}'`) ||
127
+ !gradle.includes(`versionCode ${version}\n`)
128
+ )
129
+ throw new Error(
130
+ "Fresh Android project does not match verified Play identity",
131
+ );
132
+ run(
133
+ "./gradlew",
134
+ [
135
+ ":app:createBundleReleaseJsAndAssets",
136
+ "--rerun",
137
+ ":app:bundleRelease",
138
+ `-PreactNativeArchitectures=${architectures.join(",")}`,
139
+ ],
140
+ { cwd: join(mobile, "android"), stdio: "inherit" },
141
+ );
142
+ const bundle = join(
143
+ mobile,
144
+ "android/app/build/outputs/bundle/release/app-release.aab",
145
+ );
146
+ const bundledConfig = JSON.parse(
147
+ run("unzip", ["-p", bundle, "base/assets/app.config"]),
148
+ );
149
+ for (const [label, built, expected] of [
150
+ ["package", bundledConfig.android?.package, config.android?.package],
151
+ ["scheme", bundledConfig.scheme, config.scheme],
152
+ ["updates", bundledConfig.updates?.enabled, config.updates?.enabled],
153
+ [
154
+ "payments",
155
+ bundledConfig.extra?.disposablAndroidPayments,
156
+ config.extra?.disposablAndroidPayments,
157
+ ],
158
+ [
159
+ "architectures",
160
+ bundledConfig.extra?.disposablAndroidArchitectures,
161
+ architectures,
162
+ ],
163
+ ]) {
164
+ if (JSON.stringify(built) !== JSON.stringify(expected))
165
+ throw new Error(`Bundled Expo ${label} does not match production config`);
166
+ }
167
+ const verified = verifyBundle({
168
+ bundle,
169
+ packageId,
170
+ version,
171
+ architectures,
172
+ expectedCert,
173
+ bundletool: required("BUNDLETOOL_JAR"),
174
+ production: true,
175
+ });
176
+ console.log(JSON.stringify(verified, null, 2));
@@ -0,0 +1,77 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { createHash } from "node:crypto";
3
+ import { readFileSync } from "node:fs";
4
+
5
+ export function fingerprint(text) {
6
+ const matches = [...text.matchAll(/SHA256:\s*([0-9A-F:]{95})/gi)];
7
+ if (matches.length !== 1)
8
+ throw new Error("Expected exactly one SHA256 certificate fingerprint");
9
+ return matches[0][1].replaceAll(":", "").toUpperCase();
10
+ }
11
+
12
+ export function verifyBundle({
13
+ bundle,
14
+ packageId,
15
+ version,
16
+ architectures,
17
+ expectedCert,
18
+ bundletool,
19
+ production = false,
20
+ }) {
21
+ const run = (command, args) =>
22
+ execFileSync(command, args, {
23
+ encoding: "utf8",
24
+ env: { ...process.env, LANG: "C", LC_ALL: "C" },
25
+ maxBuffer: 8 * 1024 * 1024,
26
+ });
27
+ const entries = run("unzip", ["-Z1", bundle]).split("\n");
28
+ const actual = [
29
+ ...new Set(
30
+ entries
31
+ .map((x) => /^base\/lib\/([^/]+)\/.+\.so$/.exec(x)?.[1])
32
+ .filter(Boolean),
33
+ ),
34
+ ].sort();
35
+ if (JSON.stringify(actual) !== JSON.stringify([...architectures].sort()))
36
+ throw new Error(`Bundle ABI mismatch: ${actual.join(",")}`);
37
+ run("java", ["-jar", bundletool, "validate", `--bundle=${bundle}`]);
38
+ const manifest = run("java", [
39
+ "-jar",
40
+ bundletool,
41
+ "dump",
42
+ "manifest",
43
+ `--bundle=${bundle}`,
44
+ ]);
45
+ if (production && manifest.includes("e2e_network_security_config"))
46
+ throw new Error("Bundle contains E2E network configuration");
47
+ const targetSdk = Number(
48
+ /\bandroid:targetSdkVersion="(\d+)"/.exec(manifest)?.[1],
49
+ );
50
+ if (production && (!Number.isInteger(targetSdk) || targetSdk < 36))
51
+ throw new Error("Play requires Android target SDK 36 or higher");
52
+ const manifestPackage = /\bpackage="([^"]+)"/.exec(manifest)?.[1];
53
+ const manifestVersion = /\bandroid:versionCode="(\d+)"/.exec(manifest)?.[1];
54
+ if (manifestPackage !== packageId || manifestVersion !== version)
55
+ throw new Error("Bundle manifest package or version mismatch");
56
+ const verified = run("jarsigner", ["-verify", bundle]);
57
+ if (
58
+ !verified.includes("jar verified.") ||
59
+ verified.includes("unsigned entries")
60
+ )
61
+ throw new Error("Bundle signature verification failed");
62
+ if (
63
+ fingerprint(run("keytool", ["-printcert", "-jarfile", bundle])) !==
64
+ expectedCert
65
+ )
66
+ throw new Error(
67
+ "Bundle signer does not match verified Play upload certificate",
68
+ );
69
+ return {
70
+ bundle,
71
+ packageId,
72
+ versionCode: Number(version),
73
+ architectures: actual,
74
+ uploadCertificateSha256: expectedCert,
75
+ sha256: createHash("sha256").update(readFileSync(bundle)).digest("hex"),
76
+ };
77
+ }
@@ -73,6 +73,7 @@
73
73
  "@expo/vector-icons": "^15.0.2",
74
74
  "convex": "catalog:",
75
75
  "expo": "~58.0.23",
76
+ "expo-build-properties": "~58.0.11",
76
77
  "expo-clipboard": "~58.0.4",
77
78
  "expo-constants": "~58.0.15",
78
79
  "expo-dev-client": "~58.0.18",
@@ -284,19 +285,23 @@
284
285
  },
285
286
  },
286
287
  "patchedDependencies": {
287
- "expo-modules-core@58.0.30": "patches/expo-modules-core@58.0.30.patch",
288
288
  "react-native-css@3.1.0-rc.1": "patches/react-native-css@3.1.0-rc.1.patch",
289
+ "expo-modules-core@58.0.30": "patches/expo-modules-core@58.0.30.patch",
290
+ "@convex-dev/mcp@0.1.0-alpha.7": "patches/convex-mcp-account-erasure-alpha7.patch",
289
291
  "@convex-dev/static-hosting@0.2.1": "patches/@convex-dev%2Fstatic-hosting@0.2.1.patch",
290
292
  },
291
293
  "overrides": {
292
294
  "lightningcss": "1.30.1",
293
295
  },
294
296
  "catalog": {
295
- "@convex-dev/auth": "file:vendor/convex-auth-437831bd-disposabl.3.tgz",
297
+ "@convex-dev/auth": "file:vendor/convex-auth-040d8e36-disposabl.2.tgz",
296
298
  "@convex-dev/mcp": "0.1.0-alpha.7",
297
299
  "@convex-dev/static-hosting": "0.2.1",
300
+ "@posthog/react-native-plugin": "2.13.0",
298
301
  "convex": "^1.49.0",
299
302
  "lucide-react": "^1.70.0",
303
+ "posthog-js": "1.447.3",
304
+ "posthog-react-native": "4.85.3",
300
305
  "react": "19.3.0",
301
306
  "react-dom": "19.3.0",
302
307
  },
@@ -475,7 +480,7 @@
475
480
 
476
481
  "@colors/colors": ["@colors/colors@1.5.0", "", {}, "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="],
477
482
 
478
- "@convex-dev/auth": ["@convex-dev/auth@vendor/convex-auth-437831bd-disposabl.3.tgz", { "dependencies": { "@babel/code-frame": "^7.29.7", "@convex-dev/batch-worker": "^0.3.2", "@convex-dev/rate-limiter": "^0.3.2", "@simplewebauthn/browser": "^14.0.0", "@simplewebauthn/server": "^14.0.0", "argon2id-wasm": "0.0.0-alpha.2", "chalk": "^5.6.2", "commander": "^14.0.2", "cookie": "1.1.1", "jose": "^5.2.2" }, "peerDependencies": { "@convex-dev/resend": "^0.2.8", "convex": "^1.48.0", "next": "^16.0.0", "react": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@convex-dev/resend", "next", "react"], "hasInstallScript": true, "bin": { "@convex-dev/auth": "./dist/cli/init.js" } }, "sha512-ILtdtp/jnXthIDBCuUJ0Xwb/HFVuwbigdKgpBNYux39s0jjkKk50RPpxFivP9S6IsWd6Wl4uzQFe4dQGmCaavA=="],
483
+ "@convex-dev/auth": ["@convex-dev/auth@vendor/convex-auth-040d8e36-disposabl.2.tgz", { "dependencies": { "@babel/code-frame": "^7.29.7", "@convex-dev/batch-worker": "^0.3.2", "@convex-dev/rate-limiter": "^0.3.2", "@simplewebauthn/browser": "^14.0.0", "@simplewebauthn/server": "^14.0.0", "argon2id-wasm": "0.0.0-alpha.2", "chalk": "^5.6.2", "commander": "^14.0.2", "cookie": "1.1.1", "jose": "^5.2.2" }, "peerDependencies": { "@convex-dev/resend": "^0.2.8", "convex": "^1.48.0", "next": "^16.0.0", "react": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@convex-dev/resend", "next", "react"], "hasInstallScript": true, "bin": { "@convex-dev/auth": "./dist/cli/init.js" } }, "sha512-AU0g9BpnIfZRIN0PCO617/A20Rf9zBeWISVM06LDUybblZ8m3TcSK5Wv9C+ZFxVBdWA7VQi7kbr1nbv2vg7/3A=="],
479
484
 
480
485
  "@convex-dev/batch-worker": ["@convex-dev/batch-worker@0.3.6", "", { "dependencies": { "convex-helpers": "^0.1.127" }, "peerDependencies": { "convex": "^1.43.0" } }, "sha512-tR+9DaHR3jG3oqkIFX0ok/6944h7UHEQgT6HTmiuxU+lERYuYMsxA2IWwFD5yTFbCpO3YJhqXU4QdGY90sgUqQ=="],
481
486
 
@@ -2155,6 +2160,8 @@
2155
2160
 
2156
2161
  "expo-asset": ["expo-asset@58.0.20", "", { "dependencies": { "@expo/image-utils": "^0.12.6", "expo-constants": "~58.0.15" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-atirOtDsH0l+4zxnByf4WKc7Iw2k5e2bSNAkuu79d4SLOAjAROoDizeP0qNQSMyZNoHPArw7EwTpoc8LuWvg4Q=="],
2157
2162
 
2163
+ "expo-build-properties": ["expo-build-properties@58.0.12", "", { "dependencies": { "@expo/schema-utils": "^58.0.3", "resolve-from": "^5.0.0", "semver": "^7.7.4" }, "peerDependencies": { "expo": "*" } }, "sha512-Wrs1X1iz0kigrBBDs3qILxvXmANccvbsjpR937KqX0Qq7ON6ISk2uJyfz7Tb7/GFhDuJ6MAfW0jR+oryYdOhcg=="],
2164
+
2158
2165
  "expo-clipboard": ["expo-clipboard@58.0.4", "", { "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-b2eEJMwdWXLTrmrkg/otsmL2OV6s9D90tytSNBsY87UswrWf6JwxcB2OaWegyUWD9XnvtBVNeVK7lej0zZh+5A=="],
2159
2166
 
2160
2167
  "expo-constants": ["expo-constants@58.0.15", "", { "dependencies": { "@expo/env": "~2.5.4", "@expo/require-utils": "^58.0.5" }, "peerDependencies": { "expo": "*", "react-native": "*" } }, "sha512-uokwzsYdjM/ZTEvQJCANhP4eJ4XGGR6keJy/Ac9HntLsQART8o+Y8nTVAXdMaRv6T5wuzJOliJmKUYJlDlamdg=="],
@@ -4165,6 +4172,8 @@
4165
4172
 
4166
4173
  "execa/signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="],
4167
4174
 
4175
+ "expo-build-properties/semver": ["semver@7.8.6", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw=="],
4176
+
4168
4177
  "expo-modules-autolinking/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
4169
4178
 
4170
4179
  "expo-modules-autolinking/commander": ["commander@7.2.0", "", {}, "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="],
@@ -12,4 +12,5 @@ ignorePatterns = [
12
12
  "**/routeTree.gen.ts",
13
13
  "**/convex/_generated/**",
14
14
  "**/.agents/**",
15
+ "**/.claude/skills/**",
15
16
  ]
@@ -29,15 +29,19 @@
29
29
  "packages/*"
30
30
  ],
31
31
  "catalog": {
32
- "@convex-dev/auth": "file:vendor/convex-auth-437831bd-disposabl.3.tgz",
32
+ "@convex-dev/auth": "file:vendor/convex-auth-040d8e36-disposabl.2.tgz",
33
33
  "convex": "^1.49.0",
34
34
  "lucide-react": "^1.70.0",
35
35
  "react": "19.3.0",
36
36
  "react-dom": "19.3.0",
37
37
  "@convex-dev/mcp": "0.1.0-alpha.7",
38
- "@convex-dev/static-hosting": "0.2.1"
38
+ "@convex-dev/static-hosting": "0.2.1",
39
+ "posthog-js": "1.447.3",
40
+ "posthog-react-native": "4.85.3",
41
+ "@posthog/react-native-plugin": "2.13.0"
39
42
  },
40
43
  "patchedDependencies": {
44
+ "@convex-dev/mcp@0.1.0-alpha.7": "patches/convex-mcp-account-erasure-alpha7.patch",
41
45
  "@convex-dev/static-hosting@0.2.1": "patches/@convex-dev%2Fstatic-hosting@0.2.1.patch",
42
46
  "react-native-css@3.1.0-rc.1": "patches/react-native-css@3.1.0-rc.1.patch",
43
47
  "expo-modules-core@58.0.30": "patches/expo-modules-core@58.0.30.patch"
@@ -0,0 +1,2 @@
1
+ // Starter file writes use the default authenticated owner check.
2
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { webhook as revenueCatWebhook } from "@disposabl/disposabl-kit/server/revenuecat-functions";
2
2
  import { desktopUpdate } from "./desktopUpdates";
3
- import { page, options as telemetryOptions } from "./telemetry";
3
+ import { page, bootstrap, options as telemetryOptions } from "./telemetry";
4
4
  import createHttpRouter from "@disposabl/disposabl-kit/server/http";
5
5
 
6
6
  const http = createHttpRouter();
@@ -10,6 +10,16 @@ http.route({
10
10
  handler: revenueCatWebhook,
11
11
  });
12
12
  http.route({ path: "/telemetry/page", method: "POST", handler: page });
13
+ http.route({
14
+ path: "/telemetry/bootstrap",
15
+ method: "POST",
16
+ handler: bootstrap,
17
+ });
18
+ http.route({
19
+ path: "/telemetry/bootstrap",
20
+ method: "OPTIONS",
21
+ handler: telemetryOptions,
22
+ });
13
23
  http.route({
14
24
  path: "/telemetry/page",
15
25
  method: "OPTIONS",
@@ -19,6 +19,16 @@ export default defineSchema({
19
19
  hash: v.string(),
20
20
  userId: v.optional(v.string()),
21
21
  expiresAt: v.number(),
22
+ link: v.optional(
23
+ v.object({
24
+ anonymous: v.string(),
25
+ distinct: v.string(),
26
+ eventId: v.string(),
27
+ createdAt: v.number(),
28
+ attempts: v.number(),
29
+ retryAfter: v.number(),
30
+ }),
31
+ ),
22
32
  }).index("by_hash", ["hash"]),
23
33
  billingHandoffs: defineTable({
24
34
  hash: v.string(),
@@ -1,24 +1,22 @@
1
1
  import { v } from "convex/values";
2
- import { makeFunctionReference } from "convex/server";
3
2
  import { httpAction, internalAction } from "./_generated/server";
4
3
  import { getSessionUserId } from "@disposabl/disposabl-kit/server/lib/functions";
5
4
  import {
6
5
  captureTelemetry,
7
- hashTelemetryIdentity,
6
+ claimTelemetryClient,
8
7
  telemetryEnabled,
8
+ bootstrapTelemetry,
9
9
  } from "@disposabl/disposabl-kit/server/lib/telemetry";
10
10
 
11
11
  export {
12
12
  claimIdentity,
13
13
  expireIdentity,
14
+ getLink,
15
+ deliverLink,
16
+ finishLink,
17
+ beginLink,
14
18
  } from "@disposabl/disposabl-kit/server/lib/telemetry";
15
19
 
16
- const claimIdentityRef = makeFunctionReference<
17
- "mutation",
18
- { hash?: string; newHash: string; userId?: string },
19
- boolean | null
20
- >("telemetry:claimIdentity");
21
-
22
20
  const pageNames = [
23
21
  "home",
24
22
  "dashboard",
@@ -70,6 +68,9 @@ const headers = {
70
68
  export const options = httpAction(
71
69
  async () => new Response(null, { status: 204, headers }),
72
70
  );
71
+ export const bootstrap = httpAction((ctx, request) =>
72
+ bootstrapTelemetry(ctx, request, getSessionUserId),
73
+ );
73
74
  const anonymousIdPattern =
74
75
  /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
75
76
  export const page = httpAction(async (ctx, request) => {
@@ -95,14 +96,9 @@ export const page = httpAction(async (ctx, request) => {
95
96
  return new Response(null, { status: 401, headers });
96
97
  const existingId =
97
98
  "anonymousId" in body ? (body.anonymousId as string) : undefined;
98
- const issuedId = crypto.randomUUID();
99
- const accepted = await ctx.runMutation(claimIdentityRef, {
100
- ...(existingId ? { hash: await hashTelemetryIdentity(existingId) } : {}),
101
- newHash: await hashTelemetryIdentity(issuedId),
102
- ...(userId ? { userId } : {}),
103
- });
104
- if (accepted === null) return new Response(null, { status: 429, headers });
105
- const anonymousId = accepted && existingId ? existingId : issuedId;
99
+ const identity = await claimTelemetryClient(ctx, existingId, userId);
100
+ if (!identity) return new Response(null, { status: 429, headers });
101
+ const { anonymousId } = identity;
106
102
  await captureTelemetry(
107
103
  body.platform === "web" ? "page_view" : "screen_view",
108
104
  { page: body.page as (typeof pageNames)[number] },
@@ -1,6 +1,6 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
2
  import { realpathSync } from "node:fs";
3
- import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
3
+ import { mkdir, open, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
  import { lock } from "proper-lockfile";
@@ -126,6 +126,23 @@ async function send(
126
126
  return response.ok;
127
127
  }
128
128
 
129
+ // A local marker counts an execution attempt, not installation or delivery.
130
+ // Exclusive creation deduplicates concurrent invocations without storing inputs.
131
+ async function firstExecution(path: string, product: Product, version: string) {
132
+ try {
133
+ const directory = join(dirname(path), "activations");
134
+ await mkdir(directory, { recursive: true, mode: 0o700 });
135
+ const name = createHash("sha256")
136
+ .update(`${product}:${version}`)
137
+ .digest("hex");
138
+ const file = await open(join(directory, name), "wx", 0o600);
139
+ await file.close();
140
+ return true;
141
+ } catch {
142
+ return false;
143
+ }
144
+ }
145
+
129
146
  export async function capture(
130
147
  version: string,
131
148
  product: Product,
@@ -152,11 +169,15 @@ export async function capture(
152
169
  "other",
153
170
  "create",
154
171
  ];
155
- await send(config, "cli_command", current.userId ?? current.anonymousId, {
172
+ const distinctId = current.userId ?? current.anonymousId;
173
+ const activation =
174
+ outcome === "started" && (await firstExecution(path, product, version));
175
+ const properties = {
156
176
  product,
157
177
  command: allowed.includes(command) ? command : "other",
158
178
  outcome,
159
179
  version,
180
+ ...(activation ? { first_execution: true } : {}),
160
181
  invocation:
161
182
  process.env.npm_command === "exec"
162
183
  ? "npx"
@@ -167,7 +188,23 @@ export async function capture(
167
188
  ? process.platform
168
189
  : "other",
169
190
  ...(!current.userId ? { $process_person_profile: false } : {}),
170
- });
191
+ };
192
+ const pending = [send(config, "cli_command", distinctId, properties)];
193
+ if (outcome === "failure") {
194
+ // Never pass the thrown error: messages, stacks and paths may contain
195
+ // credentials or user content. Group this coarse, synthetic exception by
196
+ // the allowlisted product and command only.
197
+ pending.push(
198
+ send(config, "$exception", distinctId, {
199
+ ...properties,
200
+ $exception_list: [
201
+ { type: "CommandFailure", value: "Command failed" },
202
+ ],
203
+ $exception_fingerprint: `disposabl-${product}-${properties.command}`,
204
+ }),
205
+ );
206
+ }
207
+ await Promise.allSettled(pending);
171
208
  } catch {
172
209
  /* analytics must not affect the command */
173
210
  }
@@ -40,6 +40,8 @@ Generated apps include RevenueCat and the native billing example only when payme
40
40
 
41
41
  The account screen presents a RevenueCat paywall for the configured monthly subscription and supports restore. Its current offering must contain exactly that one monthly product; mixed or unverified products are unavailable. Use Autumn's managed RevenueCat integration as the sole sync path, with the same authenticated user ID as RevenueCat `appUserID` and Autumn `customer_id`. Request beta access, connect a RevenueCat project and V2 read-only key in Autumn, map store-level subscription products to `credits_monthly`, and configure separate test and live webhooks using Autumn's provided URL and authorization. Block duplicate web/native subscriptions based on the provider customer state. Mobile purchases use RevenueCat, never Autumn attach. Await Autumn webhook synchronization before treating the Autumn balance as available.
42
42
 
43
+ Optionally set the public build-time variable `EXPO_PUBLIC_REVENUECAT_OFFERING_ID` to select a dedicated monthly-only RevenueCat offering on both platforms. When omitted or blank, the SDK's current offering remains in use. An explicitly selected offering must exist and contain exactly the configured monthly product with a P1M period; a missing or mixed offering makes monthly purchase and the US website monthly handoff unavailable. The complete offering and its paywall must be configured safely, since the app does not filter paywall buttons. Selecting an identifier bypasses RevenueCat's current-offering targeting; use platform-specific products in the selected offering as configured in RevenueCat. Rebuild the app after changing this variable.
44
+
43
45
  Set public build-time variables `EXPO_PUBLIC_REVENUECAT_IOS_API_KEY` and `EXPO_PUBLIC_REVENUECAT_ANDROID_API_KEY`, plus `EXPO_PUBLIC_REVENUECAT_IOS_MONTHLY_PRODUCT` and `EXPO_PUBLIC_REVENUECAT_ANDROID_MONTHLY_PRODUCT` to the exact store product identifiers. Configure each monthly product to match `pricing.monthly.price` in `payments/config.ts`, with no unverified offers, and map it to the Autumn monthly plan whose included credits come from `creditQuantity("monthly")`. The defaults are $5 and 750 credits per cycle. The app displays the store's localized price. Build a new native binary after adding the SDK; Expo Go is insufficient. Android uses `singleTop` when payments is selected so external bank verification can return to the purchase.
44
46
 
45
47
  Only set backend `REVENUECAT_SYNC_ENABLED=true` after configuring and verifying the matching Autumn environment's managed integration. Without it, the app still reads shared credits but does not offer native purchases. Payments disabled means no billing component or SDK initialization. The SDK uses custom user IDs only and serializes account switching with purchase operations. Sign-out clears UI ownership without creating a RevenueCat anonymous ID. Configure RevenueCat restore behavior deliberately so a restore does not transfer another account's purchases unexpectedly.
@@ -0,0 +1,111 @@
1
+ import { useConvexAuth } from "convex/react";
2
+ import { useState } from "react";
3
+ import { authenticationEnabled } from "../../features";
4
+
5
+ // The backend owner must map only confirmed server states to this interface.
6
+ export type DeletionState =
7
+ "unavailable" | "idle" | "pending" | "failed" | "completed";
8
+
9
+ export function AccountDeletion() {
10
+ return authenticationEnabled ? <AuthenticatedDeletion /> : null;
11
+ }
12
+
13
+ function AuthenticatedDeletion() {
14
+ const { isAuthenticated, isLoading } = useConvexAuth();
15
+ if (isLoading)
16
+ return (
17
+ <p className="mt-8" role="status">
18
+ Loading account...
19
+ </p>
20
+ );
21
+ if (!isAuthenticated)
22
+ return (
23
+ <section className="mt-8">
24
+ <p role="status">Account deletion requests are not available yet.</p>
25
+ <p>Sign in to manage your account deletion request.</p>
26
+ <a
27
+ className="underline"
28
+ href="/login?returnTo=%2Flegal%2Fdelete-account"
29
+ >
30
+ Sign in
31
+ </a>
32
+ </section>
33
+ );
34
+ // No request or status endpoint is connected until the backend contract is available.
35
+ return <DeletionPanel state="unavailable" />;
36
+ }
37
+
38
+ export function DeletionPanel({
39
+ state,
40
+ onRequest,
41
+ }: {
42
+ state: DeletionState;
43
+ onRequest?: () => void;
44
+ }) {
45
+ const [confirming, setConfirming] = useState(false);
46
+ if (state === "unavailable")
47
+ return (
48
+ <p className="mt-8" role="status">
49
+ Account deletion requests are not available yet.
50
+ </p>
51
+ );
52
+ if (state === "pending")
53
+ return (
54
+ <p className="mt-8" role="status">
55
+ Your deletion request is pending. Your account has not yet been deleted.
56
+ </p>
57
+ );
58
+ if (state === "failed")
59
+ return (
60
+ <p className="mt-8" role="alert">
61
+ We could not confirm your deletion request. Check its status before
62
+ trying again.
63
+ </p>
64
+ );
65
+ if (state === "completed")
66
+ return (
67
+ <p className="mt-8" role="status">
68
+ Your account deletion has been completed.
69
+ </p>
70
+ );
71
+ return (
72
+ <section className="mt-8" aria-labelledby="deletion-heading">
73
+ <h2 id="deletion-heading" className="text-xl font-semibold">
74
+ Delete your account
75
+ </h2>
76
+ {confirming ? (
77
+ <>
78
+ <p className="mt-3">
79
+ Request deletion of your account and associated data?
80
+ </p>
81
+ <div className="mt-3 flex gap-4">
82
+ <button
83
+ type="button"
84
+ disabled={!onRequest}
85
+ onClick={onRequest}
86
+ className="underline"
87
+ >
88
+ Confirm deletion request
89
+ </button>
90
+ <button
91
+ type="button"
92
+ onClick={() => setConfirming(false)}
93
+ className="underline"
94
+ >
95
+ Cancel
96
+ </button>
97
+ </div>
98
+ </>
99
+ ) : (
100
+ <button
101
+ type="button"
102
+ disabled={!onRequest}
103
+ onClick={() => setConfirming(true)}
104
+ className="mt-3 underline"
105
+ >
106
+ Request account deletion
107
+ </button>
108
+ )}
109
+ </section>
110
+ );
111
+ }