RevenueCat Capacitor IAP; keep Stripe on web (#100) (#102)
Deploy Beta / unit-tests (push) Successful in 12s
Unit Tests / test (push) Successful in 11s
Deploy Beta / deploy-beta (push) Failing after 2m20s

## Summary
- Native Capacitor: RevenueCat purchase/restore (`@revenuecat/purchases-capacitor`)
- Web: Stripe checkout/portal unchanged
- Billing history shows store rows (`provider` / `revenuecat_store`)
- RC `logIn`/`logOut` on auth lifecycle; appUserID = user pk

Closes #100. Depends on backend [chat_backend#68](ai_ml_operations/chat_backend#68) / monetization PR.

## Test plan
- [x] Unit tests: BillingSection, revenueCat, finance helpers, SignIn/Up, AuthCallback, Header2, DeleteAccount (38 OK)
- [ ] Fill `REACT_APP_REVENUECAT_*` keys in `.env.mobile`
- [ ] Align RC offerings/products with plan slugs
- [ ] `npm run build:mobile` + `cap sync`; sandbox purchase on Android/iOS
- [ ] Confirm web Stripe checkout/portal still work
- [ ] After RC webhook, Account → Billing history shows store invoiceReviewed-on: #102
This commit was merged in pull request #102.
This commit is contained in:
2026-08-04 03:43:10 -07:00
parent 3858b97104
commit ce86f56d37
28 changed files with 799 additions and 62 deletions
+13
View File
@@ -3,3 +3,16 @@
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
// Capacitor plugin ships ESM; Jest cannot parse it when AccountContext
// (or pages that import it) pull in utils/revenueCat. Stub globally.
jest.mock('@revenuecat/purchases-capacitor', () => ({
Purchases: {
configure: jest.fn(() => Promise.resolve()),
logIn: jest.fn(() => Promise.resolve({ customerInfo: {} })),
logOut: jest.fn(() => Promise.resolve({ customerInfo: {} })),
getOfferings: jest.fn(() => Promise.resolve({ current: null, all: {} })),
purchasePackage: jest.fn(() => Promise.resolve({ customerInfo: {} })),
restorePurchases: jest.fn(() => Promise.resolve({ customerInfo: {} })),
},
}));