create-disposabl-app 0.17.6 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) 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/app.json +2 -1
  7. package/dist/templates/default/apps/mobile/package.json +7 -1
  8. package/dist/templates/default/apps/mobile/plugins/with-android-signing.js +23 -1
  9. package/dist/templates/default/apps/mobile/scripts/fresh-android.mjs +24 -0
  10. package/dist/templates/default/apps/mobile/scripts/play-aab.mjs +176 -0
  11. package/dist/templates/default/apps/mobile/scripts/verify-play-aab.mjs +77 -0
  12. package/dist/templates/default/bun.lock +12 -3
  13. package/dist/templates/default/bunfig.toml +1 -0
  14. package/dist/templates/default/package.json +6 -2
  15. package/dist/templates/default/packages/backend/convex/files/guard.ts +2 -0
  16. package/dist/templates/default/packages/backend/convex/http.ts +11 -1
  17. package/dist/templates/default/packages/backend/convex/schema.ts +10 -0
  18. package/dist/templates/default/packages/backend/convex/telemetry.ts +12 -16
  19. package/dist/templates/default/packages/cli/telemetry.ts +40 -3
  20. package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +2 -0
  21. package/dist/templates/default/packages/disposabl-kit/client/components/account-deletion.tsx +111 -0
  22. package/dist/templates/default/packages/disposabl-kit/client/components/consent-identity.tsx +50 -0
  23. package/dist/templates/default/packages/disposabl-kit/client/components/legal-page.tsx +12 -1
  24. package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry-lease.ts +200 -0
  25. package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry.ts +8 -1
  26. package/dist/templates/default/packages/disposabl-kit/client/routes/consent.tsx +23 -1
  27. package/dist/templates/default/packages/disposabl-kit/client/routes/legal/delete-account.tsx +6 -1
  28. package/dist/templates/default/packages/disposabl-kit/client/routes/legal/support.tsx +33 -0
  29. package/dist/templates/default/packages/disposabl-kit/client/routes/pricing.tsx +13 -0
  30. package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +19 -2
  31. package/dist/templates/default/packages/disposabl-kit/client/vite.config.ts +1 -0
  32. package/dist/templates/default/packages/disposabl-kit/legal/README.md +1 -1
  33. package/dist/templates/default/packages/disposabl-kit/legal/config.ts +32 -4
  34. package/dist/templates/default/packages/disposabl-kit/legal/index.ts +2 -2
  35. package/dist/templates/default/packages/disposabl-kit/legal/publisher.ts +6 -0
  36. package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +13 -9
  37. package/dist/templates/default/packages/disposabl-kit/mobile/billing/paywall.ts +28 -4
  38. package/dist/templates/default/packages/disposabl-kit/mobile/billing/policy.ts +31 -14
  39. package/dist/templates/default/packages/disposabl-kit/mobile/billing/web-checkout.ts +45 -34
  40. package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-links.tsx +14 -0
  41. package/dist/templates/default/packages/disposabl-kit/mobile/expo-plugin.cjs +3 -0
  42. package/dist/templates/default/packages/disposabl-kit/mobile/index.ts +4 -0
  43. package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +55 -8
  44. package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +147 -124
  45. package/dist/templates/default/packages/disposabl-kit/server/billing-handoff.ts +113 -95
  46. package/dist/templates/default/packages/disposabl-kit/server/files-functions.ts +70 -54
  47. package/dist/templates/default/packages/disposabl-kit/server/http.ts +49 -21
  48. package/dist/templates/default/packages/disposabl-kit/server/lib/platform-spec.ts +25 -1
  49. package/dist/templates/default/packages/disposabl-kit/server/lib/telemetry.ts +375 -69
  50. package/dist/templates/default/packages/sdk/README.md +2 -0
  51. package/dist/templates/default/packages/sdk/src/analytics.ts +7 -2
  52. package/dist/templates/default/packages/skill/SKILL.md +4 -2
  53. package/dist/templates/default/packages/skill/references/store-submissions.md +25 -0
  54. package/dist/templates/default/packages/tests/README.md +28 -1
  55. package/dist/templates/default/packages/tests/account-deletion-ui.test.ts +21 -0
  56. package/dist/templates/default/packages/tests/auth-email-setup.test.ts +45 -0
  57. package/dist/templates/default/packages/tests/components/account-deletion.test.mjs +82 -0
  58. package/dist/templates/default/packages/tests/components/consent-identity.test.mjs +175 -0
  59. package/dist/templates/default/packages/tests/components/mobile-deletion-link.test.mjs +40 -0
  60. package/dist/templates/default/packages/tests/components/mobile-theme.test.mjs +56 -3
  61. package/dist/templates/default/packages/tests/components/pricing-identity.test.mjs +113 -0
  62. package/dist/templates/default/packages/tests/components/support-page.test.mjs +36 -0
  63. package/dist/templates/default/packages/tests/consent-identity.test.ts +13 -0
  64. package/dist/templates/default/packages/tests/desktop-macos-release.test.ts +153 -145
  65. package/dist/templates/default/packages/tests/flows/legal.e2e.ts +40 -3
  66. package/dist/templates/default/packages/tests/helpers/auth-email-setup/probe.test.mjs +44 -0
  67. package/dist/templates/default/packages/tests/helpers/mobile-simulator/preflight.py +80 -0
  68. package/dist/templates/default/packages/tests/helpers/mobile-simulator/test_preflight.py +57 -0
  69. package/dist/templates/default/packages/tests/mobile-android-e2e-network.test.ts +81 -1
  70. package/dist/templates/default/packages/tests/mobile-android-signing.test.ts +52 -0
  71. package/dist/templates/default/packages/tests/mobile-deletion-link.test.ts +21 -0
  72. package/dist/templates/default/packages/tests/mobile-ios-reachability-pin.test.ts +84 -0
  73. package/dist/templates/default/packages/tests/mobile-simulator-preflight.test.ts +16 -0
  74. package/dist/templates/default/packages/tests/native-billing.test.ts +288 -0
  75. package/dist/templates/default/packages/tests/pricing-identity.test.ts +13 -0
  76. package/dist/templates/default/packages/tests/sdk-analytics.test.ts +28 -2
  77. package/dist/templates/default/packages/tests/support-page.test.ts +13 -0
  78. package/dist/templates/default/packages/tests/telemetry.test.ts +389 -18
  79. package/dist/templates/default/packages/tests/ui-telemetry-lease.test.ts +346 -0
  80. package/dist/templates/default/patches/convex-mcp-account-erasure-alpha7.patch +466 -0
  81. package/dist/templates/default/vendor/README.md +61 -1
  82. package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.1.patch +890 -0
  83. package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.1.tgz +0 -0
  84. package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.2.patch +1060 -0
  85. package/dist/templates/default/vendor/convex-auth-040d8e36-disposabl.2.tgz +0 -0
  86. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.4.tgz +0 -0
  87. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.5.tgz +0 -0
  88. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.6.tgz +0 -0
  89. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.7.tgz +0 -0
  90. package/dist/templates/default/vendor/convex-auth-437831bd-disposabl.8.tgz +0 -0
  91. package/dist/templates/default/vendor/convex-auth-core-erasure-disposabl.6.patch +115 -0
  92. package/dist/templates/default/vendor/convex-auth-identity-cutoff-disposabl.7.patch +442 -0
  93. package/dist/templates/default/vendor/convex-auth-identity-erasure-disposabl.8.md +11 -0
  94. package/dist/templates/default/vendor/convex-auth-identity-erasure-disposabl.8.patch +78 -0
  95. package/dist/templates/default/vendor/convex-auth-marker-disposabl.4.patch +169 -0
  96. package/dist/templates/default/vendor/convex-auth-marker-password-disposabl.5.patch +126 -0
  97. package/package.json +1 -1
@@ -0,0 +1,50 @@
1
+ import { useAuthToken } from "@convex-dev/auth/react";
2
+ import { ConvexHttpClient } from "convex/browser";
3
+ import { useConvex, useConvexAuth } from "convex/react";
4
+ import { useEffect, useState } from "react";
5
+ import { api } from "../../../backend/convex/_generated/api";
6
+
7
+ type Identity = { token: string; label: string };
8
+
9
+ /** A fresh HTTP query is bound to this token, avoiding cached data from another account. */
10
+ export function useConsentIdentity() {
11
+ const token = useAuthToken();
12
+ const { isAuthenticated, isLoading } = useConvexAuth();
13
+ const convex = useConvex();
14
+ const [result, setResult] = useState<
15
+ Identity | { token: string; label: null } | null
16
+ >(null);
17
+ useEffect(() => {
18
+ if (!token || !isAuthenticated || isLoading) return;
19
+ let active = true;
20
+ const client = new ConvexHttpClient(convex.url);
21
+ client.setAuth(token);
22
+ void Promise.all([
23
+ client.query(api.auth.account, {}),
24
+ client.query(api.users.index.current, {}),
25
+ ])
26
+ .then(([account, user]) => {
27
+ if (!active) return;
28
+ const label =
29
+ account && user
30
+ ? account.username?.trim() ||
31
+ account.email?.trim() ||
32
+ account.profile?.email?.trim() ||
33
+ account.profile?.name?.trim() ||
34
+ user.id
35
+ : null;
36
+ setResult({ token, label: label || null });
37
+ })
38
+ .catch(() => {
39
+ if (active) setResult({ token, label: null });
40
+ });
41
+ return () => {
42
+ active = false;
43
+ };
44
+ }, [token, isAuthenticated, isLoading, convex]);
45
+ if (!token || !isAuthenticated || isLoading || result?.token !== token)
46
+ return { state: "loading" as const, label: null };
47
+ return result.label
48
+ ? { state: "ready" as const, label: result.label }
49
+ : { state: "unavailable" as const, label: null };
50
+ }
@@ -1,4 +1,5 @@
1
1
  import { legalConfig, legalDocuments, legalIsDraft } from "../../legal";
2
+ import type { ReactNode } from "react";
2
3
 
3
4
  export function legalHead(slug?: string) {
4
5
  const document = legalDocuments.find((item) => item.slug === slug);
@@ -17,7 +18,13 @@ export function legalHead(slug?: string) {
17
18
  };
18
19
  }
19
20
 
20
- export function LegalPage({ slug }: { slug?: string }) {
21
+ export function LegalPage({
22
+ slug,
23
+ children,
24
+ }: {
25
+ slug?: string;
26
+ children?: ReactNode;
27
+ }) {
21
28
  const document = legalDocuments.find((item) => item.slug === slug);
22
29
  return (
23
30
  <main className="mx-auto max-w-3xl px-6 py-12">
@@ -75,6 +82,7 @@ export function LegalPage({ slug }: { slug?: string }) {
75
82
  ))}
76
83
  </nav>
77
84
  )}
85
+ {children}
78
86
  {(slug === "privacy-request" || slug === "delete-account") && (
79
87
  <section className="mt-9">
80
88
  <h2 className="text-xl font-semibold">Privacy contact</h2>
@@ -111,6 +119,9 @@ export function LegalFooter() {
111
119
  <a href="/legal" className="hover:underline">
112
120
  Legal & privacy
113
121
  </a>
122
+ <a href="/support" className="hover:underline">
123
+ Support
124
+ </a>
114
125
  </footer>
115
126
  );
116
127
  }
@@ -0,0 +1,200 @@
1
+ import { sessionId } from "../../lib/auth-session";
2
+
3
+ /** A short-lived server authorization for a client telemetry adapter. */
4
+ export type TelemetryLease = {
5
+ enabled: true;
6
+ projectToken: string;
7
+ host: string;
8
+ anonymousId: string;
9
+ distinctId: string;
10
+ identified: boolean;
11
+ expiresAt: number;
12
+ };
13
+
14
+ type Adapter = {
15
+ start: (lease: TelemetryLease) => void;
16
+ stop: () => void;
17
+ renew?: (lease: TelemetryLease) => void;
18
+ };
19
+
20
+ const uuid =
21
+ /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
22
+ function valid(value: unknown, now: number): value is TelemetryLease {
23
+ if (!value || typeof value !== "object") return false;
24
+ const v = value as Record<string, unknown>;
25
+ return (
26
+ v.enabled === true &&
27
+ typeof v.projectToken === "string" &&
28
+ v.projectToken.length > 0 &&
29
+ (v.host === "https://us.i.posthog.com" ||
30
+ v.host === "https://eu.i.posthog.com") &&
31
+ typeof v.anonymousId === "string" &&
32
+ uuid.test(v.anonymousId) &&
33
+ typeof v.distinctId === "string" &&
34
+ v.distinctId.length > 0 &&
35
+ v.distinctId.length <= 256 &&
36
+ typeof v.identified === "boolean" &&
37
+ typeof v.expiresAt === "number" &&
38
+ Number.isFinite(v.expiresAt) &&
39
+ v.expiresAt > now
40
+ );
41
+ }
42
+
43
+ /**
44
+ * Adapters must synchronously stop all capture and clear SDK identity in stop().
45
+ * Server-side revocation is observed on refresh; the local lease is capped at
46
+ * 30 seconds. A suspended process can delay timers until it resumes.
47
+ */
48
+ export function createTelemetryLeaseController(options: {
49
+ origin: string;
50
+ transport: typeof fetch;
51
+ adapter: Adapter;
52
+ now?: () => number;
53
+ }) {
54
+ const now = options.now ?? Date.now;
55
+ let generation = 0;
56
+ let enabled = false;
57
+ let failures = 0;
58
+ let token: string | null = null;
59
+ let anonymousId: string | undefined;
60
+ let controller: AbortController | undefined;
61
+ let refresh: ReturnType<typeof setTimeout> | undefined;
62
+ let expiry: ReturnType<typeof setTimeout> | undefined;
63
+ let active = false;
64
+ let activeLease: TelemetryLease | undefined;
65
+
66
+ function halt() {
67
+ generation++;
68
+ controller?.abort();
69
+ clearTimeout(refresh);
70
+ clearTimeout(expiry);
71
+ refresh = expiry = undefined;
72
+ activeLease = undefined;
73
+ if (active) {
74
+ active = false;
75
+ try {
76
+ options.adapter.stop();
77
+ } catch {
78
+ // Telemetry failures must not affect the application.
79
+ }
80
+ }
81
+ }
82
+
83
+ function stop() {
84
+ enabled = false;
85
+ halt();
86
+ }
87
+
88
+ function recover(retryable: boolean) {
89
+ halt();
90
+ if (!enabled || !retryable) return;
91
+ const epoch = generation;
92
+ const delay = Math.min(1_000 * 2 ** Math.min(failures++, 5), 30_000);
93
+ refresh = setTimeout(() => void acquire(epoch), delay);
94
+ }
95
+
96
+ async function acquire(epoch: number) {
97
+ if (!enabled || epoch !== generation) return;
98
+ controller = new AbortController();
99
+ let retryable = true;
100
+ const timeout = setTimeout(() => {
101
+ if (epoch === generation) recover(true);
102
+ }, 10_000);
103
+ try {
104
+ const response = await options.transport(
105
+ `${options.origin}/telemetry/bootstrap`,
106
+ {
107
+ method: "POST",
108
+ headers: {
109
+ "Content-Type": "text/plain",
110
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
111
+ },
112
+ body: JSON.stringify(anonymousId ? { anonymousId } : {}),
113
+ signal: controller.signal,
114
+ },
115
+ );
116
+ retryable = response.status === 429 || response.status >= 500;
117
+ if (!response.ok || response.status !== 200)
118
+ throw new Error("bootstrap unavailable");
119
+ let lease: unknown;
120
+ try {
121
+ lease = await response.json();
122
+ } catch (error) {
123
+ // A truncated transport is recoverable; malformed JSON is not a lease.
124
+ retryable = !(error instanceof SyntaxError);
125
+ throw error;
126
+ }
127
+ if (epoch !== generation) return;
128
+ const time = now();
129
+ if (
130
+ !valid(lease, time) ||
131
+ lease.expiresAt - time <= 5_000 ||
132
+ (lease.identified && !token)
133
+ )
134
+ throw new Error("invalid bootstrap");
135
+ // A delayed response must never extend local authorization past 30 seconds.
136
+ const remaining = Math.min(lease.expiresAt - time, 30_000);
137
+ const bounded = { ...lease, expiresAt: time + remaining };
138
+ const unchanged =
139
+ active &&
140
+ activeLease &&
141
+ activeLease.expiresAt > time &&
142
+ activeLease.projectToken === lease.projectToken &&
143
+ activeLease.host === lease.host &&
144
+ activeLease.distinctId === lease.distinctId &&
145
+ activeLease.anonymousId === lease.anonymousId &&
146
+ activeLease.identified === lease.identified;
147
+ if (unchanged && options.adapter.renew) {
148
+ options.adapter.renew(bounded);
149
+ } else {
150
+ if (active) options.adapter.stop();
151
+ active = true;
152
+ options.adapter.start(bounded);
153
+ }
154
+ failures = 0;
155
+ activeLease = bounded;
156
+ anonymousId = lease.anonymousId;
157
+ clearTimeout(refresh);
158
+ clearTimeout(expiry);
159
+ expiry = setTimeout(() => recover(true), remaining);
160
+ refresh = setTimeout(
161
+ () => void acquire(epoch),
162
+ Math.max(0, remaining - 5_000),
163
+ );
164
+ } catch {
165
+ if (epoch === generation) recover(retryable);
166
+ } finally {
167
+ clearTimeout(timeout);
168
+ }
169
+ }
170
+
171
+ return {
172
+ update(input: { enabled: boolean; token: string | null }) {
173
+ enabled = input.enabled && (!input.token || !!sessionId(input.token));
174
+ const changed = token !== input.token;
175
+ const sameSession =
176
+ token === input.token ||
177
+ (token !== null &&
178
+ input.token !== null &&
179
+ sessionId(token) !== null &&
180
+ sessionId(token) === sessionId(input.token));
181
+ if (input.enabled && sameSession && active) {
182
+ // Cancel the superseded request, but retain the original expiry fence.
183
+ generation++;
184
+ controller?.abort();
185
+ clearTimeout(refresh);
186
+ refresh = undefined;
187
+ } else halt();
188
+ if (
189
+ !input.enabled ||
190
+ (changed &&
191
+ token !== null &&
192
+ sessionId(token) !== sessionId(input.token))
193
+ )
194
+ anonymousId = undefined;
195
+ token = input.token;
196
+ if (enabled) void acquire(generation);
197
+ },
198
+ stop,
199
+ };
200
+ }
@@ -1,9 +1,16 @@
1
- import { useEffect, useRef } from "react";
1
+ import { createContext, useEffect, useRef, type ComponentType } from "react";
2
2
  import { sessionId } from "../../lib/auth-session";
3
3
  import { analyticsEnabled } from "../../features";
4
4
 
5
5
  import { createPageTelemetry } from "../../lib/telemetry";
6
6
 
7
+ // Product apps can replace the generic starter transport without duplicating it.
8
+ export const TelemetryOverrideContext = createContext<ComponentType<{
9
+ pathname: string;
10
+ token: string | null;
11
+ ready: boolean;
12
+ }> | null>(null);
13
+
7
14
  // A shared ID is safe only when its entire read/send/write transition is locked.
8
15
  // Without Web Locks, use a document-local identity rather than share stale state.
9
16
  let memory: string | null = null;
@@ -2,6 +2,7 @@ import { useState } from "react";
2
2
  import { createFileRoute, Navigate } from "@tanstack/react-router";
3
3
  import { useAction, useConvexAuth, useQuery } from "convex/react";
4
4
  import { api } from "../../../backend/convex/_generated/api";
5
+ import { useConsentIdentity } from "../components/consent-identity";
5
6
  import { Button } from "../components/ui/button";
6
7
 
7
8
  export const Route = createFileRoute("/_providers/consent")({
@@ -22,6 +23,7 @@ function ConsentPage() {
22
23
  );
23
24
  const authorize = useAction(api.mcp.authorize);
24
25
  const { isAuthenticated, isLoading } = useConvexAuth();
26
+ const identity = useConsentIdentity();
25
27
  const [pending, setPending] = useState(false);
26
28
  const [error, setError] = useState<string | null>(null);
27
29
  const [decision, setDecision] = useState<{
@@ -41,6 +43,11 @@ function ConsentPage() {
41
43
  const decide = async (approve: boolean) => {
42
44
  if (!requestId || pending || !request || request.status !== "pending")
43
45
  return;
46
+ if (
47
+ approve &&
48
+ (identity.state !== "ready" || !isAuthenticated || isLoading)
49
+ )
50
+ return;
44
51
  if (approve && request.kind === "device" && !deviceConfirmed) return;
45
52
  setPending(true);
46
53
  setError(null);
@@ -102,6 +109,19 @@ function ConsentPage() {
102
109
  <strong>{request.clientName || request.clientId}</strong> wants to
103
110
  connect to {request.serverName}. This name is provided by the agent.
104
111
  </p>
112
+ {isAuthenticated && (
113
+ <p aria-live="polite">
114
+ {identity.state === "ready" ? (
115
+ <>
116
+ Signed in as <strong>{identity.label}</strong>
117
+ </>
118
+ ) : identity.state === "loading" ? (
119
+ "Loading your account…"
120
+ ) : (
121
+ "Your account could not be loaded. Refresh and try again."
122
+ )}
123
+ </p>
124
+ )}
105
125
  <section className="space-y-2" aria-label="Requested permissions">
106
126
  <h2 className="font-medium">Requested access</h2>
107
127
  {request.scopes.length ? (
@@ -159,7 +179,9 @@ function ConsentPage() {
159
179
  </Button>
160
180
  <Button
161
181
  disabled={
162
- pending || (request.kind === "device" && !deviceConfirmed)
182
+ pending ||
183
+ identity.state !== "ready" ||
184
+ (request.kind === "device" && !deviceConfirmed)
163
185
  }
164
186
  onClick={() => decide(true)}
165
187
  >
@@ -1,7 +1,12 @@
1
1
  import { createFileRoute } from "@tanstack/react-router";
2
2
  import { LegalPage, legalHead } from "../../components/legal-page";
3
+ import { AccountDeletion } from "../../components/account-deletion";
3
4
 
4
5
  export const Route = createFileRoute("/_providers/legal/delete-account")({
5
6
  head: () => legalHead("delete-account"),
6
- component: () => <LegalPage slug="delete-account" />,
7
+ component: () => (
8
+ <LegalPage slug="delete-account">
9
+ <AccountDeletion />
10
+ </LegalPage>
11
+ ),
7
12
  });
@@ -0,0 +1,33 @@
1
+ import { createFileRoute } from "@tanstack/react-router";
2
+ import { legalConfig } from "../../../legal";
3
+
4
+ export const Route = createFileRoute("/_providers/support")({
5
+ head: () => ({ meta: [{ title: `Support | ${legalConfig.appName}` }] }),
6
+ component: Support,
7
+ });
8
+
9
+ function Support() {
10
+ return (
11
+ <main className="mx-auto max-w-3xl px-6 py-12">
12
+ <h1 className="text-4xl font-semibold">Support</h1>
13
+ {legalConfig.privacyEmail ? (
14
+ <p className="mt-6">
15
+ Contact{" "}
16
+ <a className="underline" href={`mailto:${legalConfig.privacyEmail}`}>
17
+ {legalConfig.privacyEmail}
18
+ </a>{" "}
19
+ for help.
20
+ </p>
21
+ ) : (
22
+ <p className="mt-6">
23
+ The publisher has not provided a support contact yet.
24
+ </p>
25
+ )}
26
+ <p className="mt-4">
27
+ <a className="underline" href="/legal">
28
+ Legal and privacy information
29
+ </a>
30
+ </p>
31
+ </main>
32
+ );
33
+ }
@@ -9,6 +9,7 @@ import {
9
9
  useState,
10
10
  } from "react";
11
11
  import { useAuthToken } from "@convex-dev/auth/react";
12
+ import { useConsentIdentity } from "../components/consent-identity";
12
13
  import { sessionId } from "../../lib/auth-session";
13
14
  import { paymentsEnabled } from "../../features";
14
15
  import {
@@ -99,6 +100,7 @@ function SubscriptionHelp() {
99
100
  );
100
101
  }
101
102
  function PurchasePage({ session }: { session: string | null }) {
103
+ const identity = useConsentIdentity();
102
104
  const [{ handoff, fromIos }] = useState(() =>
103
105
  typeof window === "undefined"
104
106
  ? handoffContext(null, "")
@@ -235,6 +237,17 @@ function PurchasePage({ session }: { session: string | null }) {
235
237
  </p>
236
238
  ) : (
237
239
  <>
240
+ <p aria-live="polite">
241
+ {identity.state === "ready" ? (
242
+ <>
243
+ Signed in as <strong>{identity.label}</strong>
244
+ </>
245
+ ) : identity.state === "loading" ? (
246
+ "Loading your account…"
247
+ ) : (
248
+ "Your account could not be loaded. Refresh and try again."
249
+ )}
250
+ </p>
238
251
  <p>
239
252
  Available credits:{" "}
240
253
  {balance === null ? "not yet available" : balance}{" "}
@@ -2,7 +2,7 @@ import { Logo } from "../components/logo";
2
2
  import { appName } from "../../lib/app-name";
3
3
  import { LegalFooter } from "../components/legal-page";
4
4
  import { LogOut } from "../components/ui/log-out";
5
- import { useState } from "react";
5
+ import { useContext, useState } from "react";
6
6
  import { ThemeProvider } from "../lib/theme";
7
7
  import {
8
8
  createFileRoute,
@@ -21,7 +21,7 @@ import {
21
21
  paymentsEnabled,
22
22
  docsEnabled,
23
23
  } from "../../features";
24
- import { usePageTelemetry } from "../lib/telemetry";
24
+ import { TelemetryOverrideContext, usePageTelemetry } from "../lib/telemetry";
25
25
  import { api } from "../../../backend/convex/_generated/api";
26
26
 
27
27
  export const Route = createFileRoute("/_providers")({
@@ -138,6 +138,23 @@ function PageTelemetry({
138
138
  const pathname = useRouterState({
139
139
  select: (state) => state.location.pathname,
140
140
  });
141
+ const Override = useContext(TelemetryOverrideContext);
142
+ return Override ? (
143
+ <Override pathname={pathname} token={token} ready={ready} />
144
+ ) : (
145
+ <DefaultPageTelemetry pathname={pathname} token={token} ready={ready} />
146
+ );
147
+ }
148
+
149
+ function DefaultPageTelemetry({
150
+ pathname,
151
+ token,
152
+ ready,
153
+ }: {
154
+ pathname: string;
155
+ token: string | null;
156
+ ready: boolean;
157
+ }) {
141
158
  usePageTelemetry(pathname, token, ready);
142
159
  return null;
143
160
  }
@@ -25,6 +25,7 @@ export const createRoutes = (enabled: boolean, includePricing = true) =>
25
25
  route("/legal/terms", kitRoute("legal/terms.tsx")),
26
26
  route("/legal/privacy-request", kitRoute("legal/privacy-request.tsx")),
27
27
  route("/legal/delete-account", kitRoute("legal/delete-account.tsx")),
28
+ route("/support", kitRoute("legal/support.tsx")),
28
29
  ...(enabled
29
30
  ? [
30
31
  route("/login", kitRoute("_auth-pages/login.tsx")),
@@ -2,6 +2,6 @@
2
2
 
3
3
  Every generated app includes public `/legal`, `/legal/privacy`, `/legal/terms`, `/legal/privacy-request`, and `/legal/delete-account` pages. They remain available when frontend authentication is disabled. The shared footer links to them.
4
4
 
5
- The text comes from the existing Disposabl legal draft. It is unfinished and displays a draft notice. Edit `config.ts` and the documents for your own operator, contact, audience, retention, transfers, and actual data practices. App names come from the generated root package name. Provider descriptions follow the selected features. Set `reviewed` only after reviewing the completed documents.
5
+ The text comes from the existing Disposabl legal draft. It is unfinished and displays a draft notice. Edit `config.ts` and the documents for your own operator, contact, audience, retention, transfers, and actual data practices. App names come from the generated root package name. Provider descriptions follow the selected features; product-specific providers are supplied by `publisher.ts` and reset to an empty list for generated apps. Review connected and optional services against the deployed configuration and actual data flows. Set `reviewed` only after reviewing the completed documents.
6
6
 
7
7
  Privacy and deletion pages provide contact instructions. They do not submit requests, delete accounts, or claim to issue deletion receipts. There is no new sign-in agreement or checkbox.
@@ -1,13 +1,19 @@
1
1
  import project from "../../../package.json";
2
- import { authenticationEnabled, analyticsEnabled } from "../features";
2
+ import {
3
+ authenticationEnabled,
4
+ analyticsEnabled,
5
+ paymentsEnabled,
6
+ } from "../features";
7
+ import config from "../../../disposabl.json";
8
+ import { publisher } from "./publisher";
3
9
 
4
10
  // Public draft details. Each app publisher must review these before launch.
5
11
  export const legalConfig = {
6
12
  appName: project.name === "disposabl-dev" ? "Disposabl" : project.name,
7
- operatorName: "",
13
+ operatorName: publisher.operatorName,
8
14
  operatorAddress: "",
9
15
  country: "",
10
- privacyEmail: "",
16
+ privacyEmail: publisher.privacyEmail,
11
17
  effectiveDate: "",
12
18
  reviewed: false,
13
19
  retention: "",
@@ -16,8 +22,11 @@ export const legalConfig = {
16
22
  providers: [
17
23
  {
18
24
  name: "Convex",
19
- purpose: "Application database, hosting, and account authentication",
25
+ purpose: authenticationEnabled
26
+ ? "Application database, hosting, and account authentication"
27
+ : "Application database and hosting",
20
28
  },
29
+ ...publisher.providers,
21
30
  ...(authenticationEnabled
22
31
  ? [
23
32
  {
@@ -35,6 +44,25 @@ export const legalConfig = {
35
44
  },
36
45
  ]
37
46
  : []),
47
+ ...(paymentsEnabled
48
+ ? [
49
+ {
50
+ name: "Autumn",
51
+ purpose: "Billing and credit balances when payments are configured",
52
+ },
53
+ ...(config.platforms.some(
54
+ (platform) => platform === "android" || platform === "ios",
55
+ )
56
+ ? [
57
+ {
58
+ name: "RevenueCat",
59
+ purpose:
60
+ "Mobile purchase and subscription information when payments are configured",
61
+ },
62
+ ]
63
+ : []),
64
+ ]
65
+ : []),
38
66
  ],
39
67
  };
40
68
 
@@ -25,12 +25,12 @@ export const legalDocuments: LegalDocument[] = [
25
25
  slug: "delete-account",
26
26
  title: "Delete your account",
27
27
  description:
28
- "Contact the publisher about deleting your account and associated information.",
28
+ "Learn how to request deletion of your account and associated information.",
29
29
  sections: [
30
30
  {
31
31
  title: "Request account deletion",
32
32
  paragraphs: [
33
- "Use the privacy contact below to request deletion. This page does not delete your account or create a deletion receipt. The publisher must confirm how your request will be handled.",
33
+ "Use the available request option or contact the publisher below. A request does not itself delete your account; the publisher must confirm how it will be handled.",
34
34
  "Clearing browser storage or uninstalling an app does not delete information held by the service. Some records may be retained where applicable law requires or permits it; ask the publisher about its retention policy.",
35
35
  "Account deletion does not itself cancel an app-store subscription. Manage subscriptions through the store where you purchased them.",
36
36
  ],
@@ -0,0 +1,6 @@
1
+ // Set these to the app publisher's details before launch.
2
+ export const publisher = {
3
+ operatorName: "",
4
+ privacyEmail: "",
5
+ providers: [] as { name: string; purpose: string }[],
6
+ };
@@ -5,7 +5,11 @@ import { AppState, Linking, Platform, Text, View } from "react-native";
5
5
  import type { PurchasesPackage } from "react-native-purchases";
6
6
  import { AuthButton, authClasses } from "../components/auth-ui";
7
7
  import { billingSession } from "./session";
8
- import { presentMonthlyPaywall, validMonthlyOffering } from "./paywall";
8
+ import {
9
+ monthlyOfferingId,
10
+ presentMonthlyPaywall,
11
+ selectMonthlyOffering,
12
+ } from "./paywall";
9
13
  import { creditQuantity, monthlyLabel } from "../../payments/config";
10
14
  import { paymentOptions, storeEligibility } from "./policy";
11
15
  import { useWebCheckout } from "./web-checkout";
@@ -80,16 +84,14 @@ export function AccountBilling({ customerId }: { customerId: string }) {
80
84
  nativeReady: result.nativeSubscriptionsEnabled,
81
85
  webCheckoutEnabled: result.mobileWebCheckoutEnabled,
82
86
  });
87
+ const offering = selectMonthlyOffering(
88
+ store.offerings,
89
+ productId,
90
+ monthlyOfferingId,
91
+ );
83
92
  if (latest())
84
93
  setMonthly(
85
- options.native &&
86
- store.offerings.current &&
87
- validMonthlyOffering(
88
- store.offerings.current.availablePackages,
89
- productId,
90
- )
91
- ? (store.offerings.current.availablePackages[0] ?? null)
92
- : null,
94
+ options.native ? (offering?.availablePackages[0] ?? null) : null,
93
95
  );
94
96
  } else setMonthly(null);
95
97
  if (latest()) setRefreshError("");
@@ -171,6 +173,8 @@ export function AccountBilling({ customerId }: { customerId: string }) {
171
173
  () => getSnapshot({}),
172
174
  () => current(version),
173
175
  productId,
176
+ undefined,
177
+ monthlyOfferingId,
174
178
  );
175
179
  },
176
180
  );