diff --git a/mobile/src/account/plans.tsx b/mobile/src/account/plans.tsx
index c926952..ce74769 100644
--- a/mobile/src/account/plans.tsx
+++ b/mobile/src/account/plans.tsx
@@ -2,7 +2,7 @@ import { earlySupporterLabel, groupFeatures, savingsPct, type Cycle, type Plan }
import { POPULAR_PLAN } from "@notestack/shared/billing";
import * as WebBrowser from "expo-web-browser";
import type { ReactNode } from "react";
-import { StyleSheet, Text, View } from "react-native";
+import { Platform, StyleSheet, Text, View } from "react-native";
import { Pressable } from "@/ui/pressable";
import { Card, publicText } from "@/shell/public-page";
@@ -77,10 +77,33 @@ export function LegalLinks() {
);
}
+/**
+ * The subscription terms the stores ask to see wherever the plans are shown with prices (the upgrade sheet, the
+ * pricing page): automatic renewal, where it is charged and how to cancel, with the Terms and Privacy links.
+ */
+export function SubscriptionTerms() {
+ const ios = Platform.OS === "ios";
+ const open = (path: string) => void WebBrowser.openBrowserAsync(`https://notestack.ai${path}`, { controlsColor: colors.blue });
+ return (
+
+ Plans renew automatically at the price shown, monthly or yearly, until you cancel. Payment is charged to your{" "}
+ {ios ? "Apple ID" : "Google account"} at confirmation. Cancel at least 24 hours before the period ends in your{" "}
+ {ios ? "App Store account settings" : "Google Play subscriptions"}.{" "}
+ open("/terms")}>
+ Terms of Service
+ {" "}
+ ·{" "}
+ open("/privacy")}>
+ Privacy Policy
+
+
+ );
+}
+
/**
* One plan: its name, price and what it includes. `storePrice` is the App Store / Google Play price for this cycle
- * (localized, the whole period's). It is the only price the app shows for a paid plan: without it (signed out, or the
- * store's plans not loaded) the card has no price, since the stores don't allow pointing at other prices. `children`
+ * (localized, the whole period's). It is the only price the app shows for a paid plan: without it (the store's plans
+ * not loaded, or a build that cannot sell plans) the card has no price, since the stores don't allow pointing at other prices. `children`
* go under the features (the upgrade sheet's buttons). `introPrice` is an early supporter discount on the first payment
* (a store offer this person can get): it takes the price's place, with the usual one struck through beside it and
* the price it renews at spelled out, as the stores require.
@@ -165,6 +188,8 @@ export function PlanCard({
}
const styles = StyleSheet.create({
+ terms: { color: colors.text3, fontSize: 12.5, lineHeight: 18 },
+ termsLink: { color: colors.blue },
legal: { flexDirection: "row", gap: 8, marginTop: 6, paddingTop: 16, borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: colors.lineStrong },
legalItem: { flex: 1, flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 8 },
legalLink: { flexShrink: 1, color: colors.white, fontSize: 13.5, lineHeight: 20 },
diff --git a/mobile/src/account/purchases.ts b/mobile/src/account/purchases.ts
index 4c8d466..724ddf8 100644
--- a/mobile/src/account/purchases.ts
+++ b/mobile/src/account/purchases.ts
@@ -28,6 +28,16 @@ export async function identify(customerId: string): Promise {
customer = customerId;
}
+/**
+ * Read-only access for someone not signed in (the public Pricing page): RevenueCat set up as an anonymous user, which
+ * is enough to read the store's prices. Never touches an identified customer; when this person signs in, identify()
+ * logs the anonymous user in as their workspace.
+ */
+export async function ensureConfigured(): Promise {
+ if (!API_KEY || !purchasesReady || (await Purchases.isConfigured())) return;
+ Purchases.configure({ apiKey: API_KEY });
+}
+
/** Sign out: the next person on this phone starts as nobody, not as the last workspace. */
export function forgetCustomer() {
if (!customer) return;
diff --git a/mobile/src/account/store-prices.ts b/mobile/src/account/store-prices.ts
new file mode 100644
index 0000000..9a85ddf
--- /dev/null
+++ b/mobile/src/account/store-prices.ts
@@ -0,0 +1,54 @@
+import type { Cycle } from "@notestack/shared/content/marketing";
+import { useQuery } from "@tanstack/react-query";
+
+import {
+ ensureConfigured,
+ getIntroOffers,
+ getPackages,
+ identify,
+ isStorePlan,
+ type PlanIntroOffers,
+ type PlanPackages,
+ purchasesReady,
+} from "@/account/purchases";
+
+export type StorePrices = { plans: PlanPackages; intros: PlanIntroOffers };
+
+/**
+ * The plans for sale in this phone's store, with their localized prices and the early supporter offers this person
+ * can get. `customerId` is the signed-in workspace's RevenueCat customer (the upgrade sheet; undefined until the plan
+ * status has loaded); null reads them as an anonymous visitor (the public Pricing page). Off where the build cannot
+ * sell plans (no RevenueCat key: Expo web, a build without keys).
+ */
+export function useStorePrices(customerId: string | null | undefined) {
+ return useQuery({
+ queryKey: ["store", "packages", customerId ?? "anonymous"],
+ queryFn: async (): Promise => {
+ if (customerId) await identify(customerId);
+ else await ensureConfigured();
+ const plans = await getPackages();
+ // An early supporter discount that can't be read just leaves the usual prices
+ const intros: PlanIntroOffers = await getIntroOffers(plans).catch(() => ({}));
+ return { plans, intros };
+ },
+ enabled: purchasesReady && customerId !== undefined,
+ staleTime: 10 * 60_000,
+ });
+}
+
+/** The price to show for a plan and cycle: what it renews at (an intro offer is shown separately), else the store's. */
+export function priceFor(data: StorePrices | undefined, planId: string, cycle: Cycle): string | null {
+ if (!data || !isStorePlan(planId)) return null;
+ const key = `${planId}_${cycle}` as const;
+ return data.intros[key]?.renews ?? data.plans[key]?.product.priceString ?? null;
+}
+
+/**
+ * The early supporter price for a plan and cycle, when this phone's store account can get it (Google Play only lists
+ * offers the account is eligible for; on iOS the App Store is asked per Apple ID), else null. The card shows it in
+ * place of the price, with the usual price struck through and the renewal price spelled out.
+ */
+export function introFor(data: StorePrices | undefined, planId: string, cycle: Cycle): string | null {
+ if (!data || !isStorePlan(planId)) return null;
+ return data.intros[`${planId}_${cycle}`]?.price ?? null;
+}
diff --git a/mobile/src/account/upgrade.tsx b/mobile/src/account/upgrade.tsx
index a644f60..07439d2 100644
--- a/mobile/src/account/upgrade.tsx
+++ b/mobile/src/account/upgrade.tsx
@@ -3,20 +3,19 @@ import { api, PLAN_LIMIT_EVENT, type PlanLimitDetail } from "@notestack/shared/c
import { FALLBACK_PLANS, type Cycle, type Plan } from "@notestack/shared/content/marketing";
import type { BillingStatus } from "@notestack/shared/types";
import { useQuery, useQueryClient } from "@tanstack/react-query";
-import * as WebBrowser from "expo-web-browser";
import { createContext, useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from "react";
import { Platform, StyleSheet, Text, View } from "react-native";
import { planQuery } from "@/account/plan";
import { track } from "@/lib/analytics";
import { on } from "@/lib/platform";
-import { CycleToggle, defaultPlanTab, PlanCard, PlanTabs } from "@/account/plans";
-import { buy, getIntroOffers, getPackages, identify, type PlanIntroOffers, isStorePlan, manageSubscriptions, purchasesReady, restore } from "@/account/purchases";
+import { CycleToggle, defaultPlanTab, PlanCard, PlanTabs, SubscriptionTerms } from "@/account/plans";
+import { buy, identify, isStorePlan, manageSubscriptions, purchasesReady, restore } from "@/account/purchases";
+import { useStorePrices } from "@/account/store-prices";
import { colors } from "@/ui/theme";
import { ErrorText, Loading } from "@/ui";
import { PillButton, Sheet } from "@/ui/widgets";
-const SITE = "https://notestack.ai";
const STORE = Platform.OS === "ios" ? "the App Store" : "Google Play";
/** Where this app sells and manages plans: its phone's store. */
const HERE: BillingPlace = Platform.OS === "ios" ? "app_store" : "play_store";
@@ -92,18 +91,9 @@ function Paywall({ opening }: { opening: Opening }) {
const status = useQuery(planQuery);
const plansQuery = useQuery({ queryKey: ["plans"], queryFn: () => api<{ billing_enabled: boolean; plans: Plan[] }>("/api/billing/plans") });
const customerId = status.data?.store_customer_id;
- const packages = useQuery({
- queryKey: ["store", "packages", customerId],
- queryFn: async () => {
- await identify(customerId!);
- const plans = await getPackages();
- // An early supporter discount that can't be read just leaves the usual prices
- const intros: PlanIntroOffers = await getIntroOffers(plans).catch(() => ({}));
- return { plans, intros };
- },
- enabled: purchasesReady && Boolean(customerId),
- staleTime: 10 * 60_000,
- });
+ // Signed in, prices are read as this workspace's customer, never anonymously: a purchase must land on the workspace.
+ // No customer id yet (or none) keeps the query off.
+ const packages = useStorePrices(customerId || undefined);
const plans = plansQuery.data?.plans?.length ? plansQuery.data.plans : FALLBACK_PLANS;
const shownId = tab && plans.some((p) => p.id === tab) ? tab : defaultPlanTab(plans);
@@ -229,18 +219,7 @@ function Paywall({ opening }: { opening: Opening }) {
) : null}
{/* The subscription terms the stores ask to see wherever the plans are shown */}
-
- Plans renew automatically at the price shown, monthly or yearly, until you cancel. Payment is charged to your{" "}
- {Platform.OS === "ios" ? "Apple ID" : "Google account"} at confirmation. Cancel at least 24 hours before the
- period ends in your {Platform.OS === "ios" ? "App Store account settings" : "Google Play subscriptions"}.{" "}
- void WebBrowser.openBrowserAsync(`${SITE}/terms`, { controlsColor: colors.blue })}>
- Terms of Service
- {" "}
- ·{" "}
- void WebBrowser.openBrowserAsync(`${SITE}/privacy`, { controlsColor: colors.blue })}>
- Privacy Policy
-
-
+
);
}
@@ -272,6 +251,4 @@ const styles = StyleSheet.create({
notice: { color: colors.blue, fontSize: 15, fontWeight: "600" },
buy: { marginTop: 12, gap: 10, alignItems: "flex-start" },
row: { flexDirection: "row", flexWrap: "wrap", gap: 10 },
- terms: { color: colors.text3, fontSize: 12.5, lineHeight: 18 },
- link: { color: colors.blue },
});
diff --git a/mobile/src/app/(public)/pricing.tsx b/mobile/src/app/(public)/pricing.tsx
index 0c8850b..96e4598 100644
--- a/mobile/src/app/(public)/pricing.tsx
+++ b/mobile/src/app/(public)/pricing.tsx
@@ -5,14 +5,17 @@ import { router } from "expo-router";
import { useState } from "react";
import { StyleSheet, View } from "react-native";
-import { CycleToggle, defaultPlanTab, LegalLinks, PlanCard, PlanTabs } from "@/account/plans";
+import { CycleToggle, defaultPlanTab, LegalLinks, PlanCard, PlanTabs, SubscriptionTerms } from "@/account/plans";
+import { introFor, priceFor, useStorePrices } from "@/account/store-prices";
import { Eyebrow, PageTitle, PublicPage } from "@/shell/public-page";
import { Button } from "@/ui";
/**
- * The plans, as on the landing page's pricing section, for people not signed in: what each plan includes, then Start
- * free. No prices here: the app shows only the store's own prices, and those load in the upgrade sheet once signed in
- * (src/account/upgrade.tsx), where plans are bought with an in-app purchase.
+ * The plans, as on the landing page's pricing section, for people not signed in: what each plan includes, its price,
+ * then Start free. The prices are the store's own (App Store / Google Play, localized), read through RevenueCat as an
+ * anonymous visitor; the app shows no other prices. An early supporter offer this phone's store account can get is
+ * shown the same way as in the upgrade sheet (offer price, usual price struck through, then the renewal price). Plans are bought in the upgrade sheet once signed in
+ * (src/account/upgrade.tsx). Until the store answers, or where it can't (no RevenueCat key), the cards show no price.
*/
export default function Pricing() {
const [cycle, setCycle] = useState("annual");
@@ -24,6 +27,7 @@ export default function Pricing() {
});
const plans = data?.plans?.length ? data.plans : FALLBACK_PLANS;
const shownId = tab && plans.some((p) => p.id === tab) ? tab : defaultPlanTab(plans);
+ const prices = useStorePrices(null);
return (
@@ -36,18 +40,32 @@ export default function Pricing() {
{plans
.filter((plan) => plan.id === shownId)
.map((plan) => (
-
+
))}
-
+ {/* Prices are shown: so are the subscription terms the stores ask for beside them */}
+ {prices.data ? (
+
+
+
+ ) : (
+
+ )}
);
}
const styles = StyleSheet.create({
cta: { marginTop: 16 },
+ terms: { marginTop: 16 },
});