@meetreeve/capacitor-bridge
v0.1.1
Published
Reeve.Mobile substrate — Capacitor wrapper bridge for cross-product mobile apps. Provides useCapacitor() hook, safe-area helpers, native-aware paywall gate, splash bridge, deep-link router, bug-report widget, and Apple compliance pack.
Readme
@meetreeve/capacitor-bridge
Reeve.Mobile substrate — the Capacitor wrapper bridge every Reeve consumer mobile app imports. One package, six entrypoints, zero per-app reinvention.
Tracked in DEV-1387 under the Reeve substrate roadmap DEV-1376.
What it gives you
| Entrypoint | What |
|---|---|
| @meetreeve/capacitor-bridge/core | Platform detection (isNativePlatform, isIOS, …), safe-area inset reader, splash-screen dismiss. Framework-agnostic. |
| @meetreeve/capacitor-bridge/react | <CapacitorProvider>, useCapacitor(), useSafeArea(). |
| @meetreeve/capacitor-bridge/paywall | Native-aware paywall gate. Auto-routes to RevenueCat on iOS/Android and Stripe on web. Prevents Apple-review rejection from in-app Stripe Checkout. |
| @meetreeve/capacitor-bridge/deeplink | App-URL listener + handler chain for custom-scheme callbacks (Auth0) and universal links (email/iMessage/push). |
| @meetreeve/capacitor-bridge/bugreport | TestFlight bug-report submitter — POSTs payload + screenshot + environment to a consumer-configured endpoint. |
| @meetreeve/capacitor-bridge/compliance | Apple Privacy Manifest template + canonical Info.plist usage-description catalog (Node-only — used by the scaffold). |
Install
npm install @meetreeve/capacitor-bridge(Private package — pulled from the org's npm registry. Consumer apps in the MindFortressInc org get it via the standard @meetreeve/ workspace path.)
Quick start (React)
import { CapacitorProvider, useCapacitor } from "@meetreeve/capacitor-bridge/react";
function App() {
return (
<CapacitorProvider>
<YourApp />
</CapacitorProvider>
);
}
function YourApp() {
const { platform, isIOS } = useCapacitor();
// …
}Quick start (paywall gate)
import {
runPaywall,
registerNativePaywall,
registerWebPaywall,
shouldShowWebPaywall,
} from "@meetreeve/capacitor-bridge/paywall";
// At app boot — wire your platform-specific checkouts
registerNativePaywall(async (product) => {
// Reeve.Commerce DEV-1388 wires RevenueCat here
return purchaseViaRevenueCat(product);
});
registerWebPaywall(async (product) => {
// Existing Stripe Checkout redirect
window.location.href = await getStripeCheckoutUrl(product.webPriceId!);
return { status: "purchased", sourceChannel: "web_stripe" };
});
// In your paywall UI
if (shouldShowWebPaywall()) {
// render the Stripe button
}
const result = await runPaywall({ productId: "pro-monthly", webPriceId: "price_xxx" });Quick start (deep links)
import {
registerDeepLinkHandler,
startDeepLinkListener,
} from "@meetreeve/capacitor-bridge/deeplink";
registerDeepLinkHandler(async (link) => {
if (link.scheme.endsWith(".ios") && link.path === "/callback") {
await handleAuth0Callback(link.query);
return true;
}
return false;
});
startDeepLinkListener({
onUnhandled: (link) => router.push(link.path + (link.hash ? `#${link.hash}` : "")),
});Quick start (bug report)
import { configureBugReport, submitBugReport } from "@meetreeve/capacitor-bridge/bugreport";
configureBugReport({
endpoint: "https://api.meetfreya.com/me/bug-report",
headers: async () => ({ Authorization: `Bearer ${await getToken()}` }),
appVersion: "1.0.0",
buildNumber: "42",
});
await submitBugReport({ message: "Push notification opened wrong project", userIdentifier: "user-42" });Architecture notes
- Zero hard dependencies. Peers React and
@capacitor/coreare optional —core/works in any browser-like environment,react/only loads if React is present,paywall/deeplink/bugreportsimilarly degrade. - SSR-safe. Every entrypoint guards on
typeof window === "undefined"and returns sensible defaults (platform: "web", zero insets, no-op dismiss). - One-time install.
<CapacitorProvider>installs the safe-area CSS vars +data-platformattribute on mount. Idempotent.
Roadmap
| Substrate PR | What | Where it lives |
|---|---|---|
| PR 1 (this) | core + react + paywall + deeplink + bugreport + compliance pack | This package |
| PR 2 | create-reeve-mobile-app cookie-cutter | Sibling packages/create-reeve-mobile-app/ |
| PR 3 | reeve-mobile-ci reusable GitHub workflow | .github/workflows/reusable-ios-testflight.yml |
| PR 4 | Universal-links Vercel edge fn template | Bridge deeplink/ already covers the JS side; edge fn = separate folder |
| PR 5 (this) | Bug-report widget + compliance pack consolidated here | This package |
PR 1 and PR 5 actually land together in this single package — separating them into multiple commits inside one PR.
Consumers
- Freya iOS (DEV-1390) — first wedge
- AgentPik mobile (planned, post-Freya validation)
- Studio mobile (planned)
- AskClara mobile (planned, requires HIPAA-mode defaults)
- Reeve Platform v1 mobile (planned)
