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
@@ -1,5 +1,8 @@
1
1
  import type Purchases from "react-native-purchases";
2
- import type { PurchasesOffering } from "react-native-purchases";
2
+ import type {
3
+ PurchasesOffering,
4
+ PurchasesOfferings,
5
+ } from "react-native-purchases";
3
6
 
4
7
  export type BillingSnapshot = {
5
8
  balance: number | null;
@@ -28,6 +31,26 @@ export function validMonthlyOffering(
28
31
  );
29
32
  }
30
33
 
34
+ // Expo inlines this public build-time value in the mobile bundle.
35
+ export const monthlyOfferingId = process.env.EXPO_PUBLIC_REVENUECAT_OFFERING_ID;
36
+
37
+ /** Validate the complete selected offering, never a filtered package list. */
38
+ export function selectMonthlyOffering(
39
+ offerings: PurchasesOfferings,
40
+ productId: string,
41
+ offeringId?: string,
42
+ ): PurchasesOffering | null {
43
+ const id = offeringId?.trim();
44
+ const offering = id
45
+ ? Object.hasOwn(offerings.all, id)
46
+ ? offerings.all[id]
47
+ : null
48
+ : offerings.current;
49
+ return offering && validMonthlyOffering(offering.availablePackages, productId)
50
+ ? offering
51
+ : null;
52
+ }
53
+
31
54
  /** Must run inside BillingSession.run so identity changes are serialized. */
32
55
  export async function presentMonthlyPaywall(
33
56
  sdk: Store,
@@ -38,6 +61,7 @@ export async function presentMonthlyPaywall(
38
61
  offering: PurchasesOffering,
39
62
  current: () => boolean,
40
63
  ) => Promise<Outcome> = showPaywall,
64
+ offeringId?: string,
41
65
  ): Promise<Outcome> {
42
66
  const check = () => {
43
67
  if (!current()) throw new Error("Account changed.");
@@ -56,10 +80,10 @@ export async function presentMonthlyPaywall(
56
80
  const info = await sdk.getCustomerInfo();
57
81
  check();
58
82
  if (info.activeSubscriptions.length) throw new Error("existing_subscription");
59
- const offering = (await sdk.getOfferings()).current;
83
+ const offerings = await sdk.getOfferings();
60
84
  check();
61
- if (!offering || !validMonthlyOffering(offering.availablePackages, productId))
62
- throw new Error("Store offering is unavailable.");
85
+ const offering = selectMonthlyOffering(offerings, productId, offeringId);
86
+ if (!offering) throw new Error("Store offering is unavailable.");
63
87
  const outcome = await present(offering, current);
64
88
  check();
65
89
  return outcome;
@@ -1,5 +1,5 @@
1
1
  import type Purchases from "react-native-purchases";
2
- import { validMonthlyOffering, type BillingSnapshot } from "./paywall";
2
+ import { selectMonthlyOffering, type BillingSnapshot } from "./paywall";
3
3
  import { loadTopup, matchingTopupRoute, type TopupSnapshot } from "./topup";
4
4
 
5
5
  export function paymentOptions(input: {
@@ -46,6 +46,7 @@ export async function preflightWebMonthly(
46
46
  BillingSnapshot & { mobileWebCheckoutEnabled: boolean; customerId: string }
47
47
  >,
48
48
  current: () => boolean,
49
+ offeringId?: string,
49
50
  ) {
50
51
  const check = () => {
51
52
  if (!current()) throw new Error("Account changed.");
@@ -53,26 +54,24 @@ export async function preflightWebMonthly(
53
54
  const latest = await snapshot();
54
55
  check();
55
56
  if (latest.customerId !== customerId) throw new Error("Account changed.");
56
- const eligibility = await storeEligibility(sdk, platform);
57
+ const offerings = await sdk.getOfferings();
58
+ check();
59
+ const offering = selectMonthlyOffering(offerings, productId, offeringId);
60
+ if (latest.hasMonthlyPlan !== false) throw new Error("existing_subscription");
61
+ const customer = await sdk.getCustomerInfo();
57
62
  check();
58
- const offering = (await sdk.getOfferings()).current;
63
+ if (customer.activeSubscriptions.length)
64
+ throw new Error("existing_subscription");
65
+ const eligibility = await storeEligibility(sdk, platform);
59
66
  check();
60
67
  const options = paymentOptions({
61
68
  platform,
62
69
  ...eligibility,
63
70
  paymentsEnabled: true,
64
71
  webCheckoutEnabled: latest.mobileWebCheckoutEnabled,
65
- nativeReady:
66
- latest.nativeSubscriptionsEnabled &&
67
- !!offering &&
68
- validMonthlyOffering(offering.availablePackages, productId),
72
+ nativeReady: latest.nativeSubscriptionsEnabled && !!offering,
69
73
  });
70
74
  if (!options.web) throw new Error("Website checkout is unavailable.");
71
- if (latest.hasMonthlyPlan !== false) throw new Error("existing_subscription");
72
- const customer = await sdk.getCustomerInfo();
73
- check();
74
- if (customer.activeSubscriptions.length)
75
- throw new Error("existing_subscription");
76
75
  }
77
76
 
78
77
  /** The matching route and real consumable must still exist at the moment of handoff. */
@@ -105,13 +104,13 @@ export async function preflightWebTopup(
105
104
  !matchingTopupRoute(latest, platform, app, productId)
106
105
  )
107
106
  throw new Error("Top-up unavailable.");
108
- const eligibility = await storeEligibility(sdk, platform);
109
- check();
110
107
  if ((await sdk.getAppUserID()) !== customerId)
111
108
  throw new Error("Account changed.");
112
109
  check();
113
110
  const product = await loadTopup(sdk, platform, productId!);
114
111
  check();
112
+ const eligibility = await storeEligibility(sdk, platform);
113
+ check();
115
114
  if (
116
115
  !paymentOptions({
117
116
  platform,
@@ -123,3 +122,21 @@ export async function preflightWebTopup(
123
122
  )
124
123
  throw new Error("Website checkout is unavailable.");
125
124
  }
125
+
126
+ /** Revalidate after creating the inert handoff, before returning its URL to the caller. */
127
+ export async function guardedWebHandoff<T>(
128
+ preflight: () => Promise<void>,
129
+ create: () => Promise<T>,
130
+ current: () => boolean,
131
+ ): Promise<T> {
132
+ const check = () => {
133
+ if (!current()) throw new Error("Account changed.");
134
+ };
135
+ await preflight();
136
+ check();
137
+ const result = await create();
138
+ check();
139
+ await preflight();
140
+ check();
141
+ return result;
142
+ }
@@ -5,12 +5,17 @@ import { useCallback, useEffect, useRef, useState } from "react";
5
5
  import { AppState, Linking, Platform } from "react-native";
6
6
  import { billingSession } from "./session";
7
7
  import {
8
+ guardedWebHandoff,
8
9
  paymentOptions,
9
10
  preflightWebMonthly,
10
11
  preflightWebTopup,
11
12
  storeEligibility,
12
13
  } from "./policy";
13
- import { validMonthlyOffering, type BillingSnapshot } from "./paywall";
14
+ import {
15
+ monthlyOfferingId,
16
+ selectMonthlyOffering,
17
+ type BillingSnapshot,
18
+ } from "./paywall";
14
19
  import { loadTopup, matchingTopupRoute, type TopupSnapshot } from "./topup";
15
20
 
16
21
  const topupApp = process.env.EXPO_PUBLIC_REVENUECAT_IOS_APP_ID;
@@ -54,9 +59,13 @@ export function useWebCheckout(
54
59
  key,
55
60
  async (sdk) => {
56
61
  const eligibility = await storeEligibility(sdk, Platform.OS);
57
- const offering = productId
58
- ? (await sdk.getOfferings().catch(() => null))?.current
62
+ const offerings = productId
63
+ ? await sdk.getOfferings().catch(() => null)
59
64
  : null;
65
+ const offering =
66
+ offerings && productId
67
+ ? selectMonthlyOffering(offerings, productId, monthlyOfferingId)
68
+ : null;
60
69
  const common = {
61
70
  platform: Platform.OS,
62
71
  ...eligibility,
@@ -78,11 +87,7 @@ export function useWebCheckout(
78
87
  ...eligibility,
79
88
  paymentsEnabled: true,
80
89
  webCheckoutEnabled: latest.mobileWebCheckoutEnabled,
81
- nativeReady:
82
- latest.nativeSubscriptionsEnabled &&
83
- !!offering &&
84
- !!productId &&
85
- validMonthlyOffering(offering.availablePackages, productId),
90
+ nativeReady: latest.nativeSubscriptionsEnabled && !!offering,
86
91
  }).web,
87
92
  };
88
93
  },
@@ -129,32 +134,38 @@ export function useWebCheckout(
129
134
  generation,
130
135
  key,
131
136
  async (sdk) => {
132
- if (purchase === "monthly")
133
- await preflightWebMonthly(
134
- sdk,
135
- Platform.OS,
136
- productId!,
137
- customerId,
138
- snapshot,
139
- current,
140
- );
141
- else
142
- await preflightWebTopup(
143
- sdk,
144
- Platform.OS,
145
- topupApp,
146
- topupProduct,
147
- customerId,
148
- snapshot,
149
- current,
150
- );
151
- if (!current()) throw new Error("Account changed.");
152
- const returnChannel =
153
- Constants.expoConfig?.extra?.billingReturnChannel;
154
- return handoff({
155
- purchase,
156
- ...(typeof returnChannel === "string" ? { returnChannel } : {}),
157
- });
137
+ const preflight = () =>
138
+ purchase === "monthly"
139
+ ? preflightWebMonthly(
140
+ sdk,
141
+ Platform.OS,
142
+ productId!,
143
+ customerId,
144
+ snapshot,
145
+ current,
146
+ monthlyOfferingId,
147
+ )
148
+ : preflightWebTopup(
149
+ sdk,
150
+ Platform.OS,
151
+ topupApp,
152
+ topupProduct,
153
+ customerId,
154
+ snapshot,
155
+ current,
156
+ );
157
+ return guardedWebHandoff(
158
+ preflight,
159
+ () => {
160
+ const returnChannel =
161
+ Constants.expoConfig?.extra?.billingReturnChannel;
162
+ return handoff({
163
+ purchase,
164
+ ...(typeof returnChannel === "string" ? { returnChannel } : {}),
165
+ });
166
+ },
167
+ current,
168
+ );
158
169
  },
159
170
  );
160
171
  const parsed = new URL(handoffResult.url);
@@ -1,6 +1,7 @@
1
1
  import { Alert } from "react-native";
2
2
  import { openBrowserAsync } from "expo-web-browser";
3
3
  import config from "../../../../disposabl.json";
4
+ import { authenticationEnabled } from "../../features";
4
5
  import {
5
6
  PreferenceRow,
6
7
  PreferenceSection,
@@ -27,6 +28,19 @@ export function SettingsLinks() {
27
28
  <PreferenceSection title="About">
28
29
  {site && (
29
30
  <>
31
+ {authenticationEnabled && (
32
+ <>
33
+ <PreferenceRow
34
+ icon={{
35
+ ios: "person.crop.circle.badge.minus",
36
+ android: "person_remove",
37
+ }}
38
+ label="Delete account"
39
+ onPress={() => void open(`${site}/legal/delete-account`)}
40
+ />
41
+ <PreferenceSeparator />
42
+ </>
43
+ )}
30
44
  <PreferenceRow
31
45
  icon={{ ios: "hand.raised", android: "privacy_tip" }}
32
46
  label="Privacy policy"
@@ -57,7 +57,10 @@ tasks.withType(com.facebook.react.tasks.BundleHermesCTask).configureEach {
57
57
  inputs.property("convexUrl", System.getenv("EXPO_PUBLIC_CONVEX_URL") ?: "")
58
58
  inputs.property("convexSiteUrl", System.getenv("EXPO_PUBLIC_CONVEX_SITE_URL") ?: "")
59
59
  inputs.property("revenuecatAndroidKey", System.getenv("EXPO_PUBLIC_REVENUECAT_ANDROID_API_KEY") ?: "")
60
+ inputs.property("revenuecatOfferingId", System.getenv("EXPO_PUBLIC_REVENUECAT_OFFERING_ID") ?: "")
60
61
  inputs.property("revenuecatAndroidMonthly", System.getenv("EXPO_PUBLIC_REVENUECAT_ANDROID_MONTHLY_PRODUCT") ?: "")
62
+ inputs.property("revenuecatAndroidAppId", System.getenv("EXPO_PUBLIC_REVENUECAT_ANDROID_APP_ID") ?: "")
63
+ inputs.property("revenuecatAndroidTopup", System.getenv("EXPO_PUBLIC_REVENUECAT_ANDROID_TOPUP_PRODUCT") ?: "")
61
64
  }
62
65
  `;
63
66
  if (mod.modResults.contents.includes(marker)) {
@@ -10,5 +10,9 @@ export { SettingsPage, ScreenCloseButton } from "./components/settings-page";
10
10
  export { LoginScreen } from "./screens/login";
11
11
  export { SignupScreen } from "./screens/signup";
12
12
  export { ChangePasswordScreen } from "./screens/change-password";
13
+ export {
14
+ useAccentColor,
15
+ useResolvedColorScheme,
16
+ } from "./design/theme-provider";
13
17
 
14
18
  export { ForgotPasswordScreen } from "./screens/forgot-password";
@@ -1,7 +1,13 @@
1
1
  import { ConvexAuthProvider, useAuthToken } from "@convex-dev/auth/react";
2
2
  import { ConvexProvider, ConvexReactClient, useConvexAuth } from "convex/react";
3
3
  import { Redirect, Stack, router, usePathname } from "expo-router";
4
- import { useEffect, useRef, useState, type ReactNode } from "react";
4
+ import {
5
+ useEffect,
6
+ useRef,
7
+ useState,
8
+ type ComponentType,
9
+ type ReactNode,
10
+ } from "react";
5
11
  import { ActivityIndicator, Pressable, Text, View } from "react-native";
6
12
  import { analyticsEnabled, authenticationEnabled } from "../features";
7
13
  import { authClasses } from "./components/auth-ui";
@@ -14,15 +20,33 @@ import { UpdatePrompt } from "./updates/update-prompt";
14
20
  import { ThemeProvider, useResolvedColorScheme } from "./design/theme-provider";
15
21
  import { useTheme } from "./design/use-theme";
16
22
 
17
- export function MobileLayout({ children }: { children?: ReactNode }) {
23
+ type TelemetryOverride = ComponentType<{
24
+ pathname: string;
25
+ token: string | null;
26
+ ready: boolean;
27
+ }>;
28
+
29
+ export function MobileLayout({
30
+ children,
31
+ telemetry,
32
+ }: {
33
+ children?: ReactNode;
34
+ telemetry?: TelemetryOverride;
35
+ }) {
18
36
  return (
19
37
  <ThemeProvider>
20
- <BackendLayout>{children}</BackendLayout>
38
+ <BackendLayout telemetry={telemetry}>{children}</BackendLayout>
21
39
  </ThemeProvider>
22
40
  );
23
41
  }
24
42
 
25
- function BackendLayout({ children }: { children?: ReactNode }) {
43
+ function BackendLayout({
44
+ children,
45
+ telemetry,
46
+ }: {
47
+ children?: ReactNode;
48
+ telemetry?: TelemetryOverride;
49
+ }) {
26
50
  const [client] = useState(() => {
27
51
  const url = process.env.EXPO_PUBLIC_CONVEX_URL;
28
52
  return url ? new ConvexReactClient(url) : null;
@@ -43,7 +67,7 @@ function BackendLayout({ children }: { children?: ReactNode }) {
43
67
  if (!authenticationEnabled) {
44
68
  return (
45
69
  <ConvexProvider client={client}>
46
- <ScreenTelemetry token={null} />
70
+ <ScreenTelemetry token={null} override={telemetry} />
47
71
  <UpdatePrompt>{children ?? <PublicLayout />}</UpdatePrompt>
48
72
  </ConvexProvider>
49
73
  );
@@ -51,7 +75,7 @@ function BackendLayout({ children }: { children?: ReactNode }) {
51
75
 
52
76
  return (
53
77
  <ConvexAuthProvider client={client} api={api.auth} storage={authStorage}>
54
- <AuthenticatedScreenTelemetry />
78
+ <AuthenticatedScreenTelemetry override={telemetry} />
55
79
  <UpdatePrompt>{children ?? <SessionRoutes />}</UpdatePrompt>
56
80
  </ConvexAuthProvider>
57
81
  );
@@ -207,25 +231,48 @@ const screenTelemetry = createPageTelemetry({
207
231
  setItem: SecureStore.setItemAsync,
208
232
  });
209
233
 
210
- function AuthenticatedScreenTelemetry() {
234
+ function AuthenticatedScreenTelemetry({
235
+ override,
236
+ }: {
237
+ override?: TelemetryOverride;
238
+ }) {
211
239
  const token = useAuthToken();
212
240
  const { isLoading, isAuthenticated } = useConvexAuth();
213
241
  return (
214
242
  <ScreenTelemetry
215
243
  token={token}
216
244
  ready={!isLoading && (!isAuthenticated || !!token)}
245
+ override={override}
217
246
  />
218
247
  );
219
248
  }
220
249
  function ScreenTelemetry({
221
250
  token,
222
251
  ready = true,
252
+ override: Override,
223
253
  }: {
224
254
  token: string | null;
225
255
  ready?: boolean;
256
+ override?: TelemetryOverride;
226
257
  }) {
227
- const lastView = useRef<string | null>(null);
228
258
  const pathname = usePathname();
259
+ return Override ? (
260
+ <Override pathname={pathname} token={token} ready={ready} />
261
+ ) : (
262
+ <DefaultScreenTelemetry pathname={pathname} token={token} ready={ready} />
263
+ );
264
+ }
265
+
266
+ function DefaultScreenTelemetry({
267
+ pathname,
268
+ token,
269
+ ready,
270
+ }: {
271
+ pathname: string;
272
+ token: string | null;
273
+ ready: boolean;
274
+ }) {
275
+ const lastView = useRef<string | null>(null);
229
276
  useEffect(() => {
230
277
  const origin = process.env.EXPO_PUBLIC_CONVEX_SITE_URL;
231
278
  if (