Commit Graph

39 Commits

Author SHA1 Message Date
Jeff Emmett 2d636f5f25 feat(rcart): send branded payment success email on completed payments
Sends an HTML email with payment details, rFlows CTA, and resource links
when a card/Transak payment completes. Fire-and-forget (never blocks response).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 12:53:58 -07:00
Jeff Emmett e614df1b54 feat(responsive): add mobile breakpoints (768px/480px) across all rApps
Payment pages (folk-payment-page, folk-payment-request, folk-group-buy-page)
had zero or minimal media queries — now stack headers, reduce padding, and
resize iframes for 375px viewports. Other rApp dashboards (rchoices, rwallet,
rnotes, rfiles, rinbox, rforum, rtasks, rvote) gain consistent 768px/480px
breakpoints: collapsing grids to 1-column, shrinking fonts and padding, and
stacking flex rows on mobile. Also adds folk-payments-dashboard to the flex
centering rule in cart.css.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 12:32:47 -07:00
Jeff Emmett ba5ce34620 feat(transak): pre-fill fiat amount and currency in widget
Pass fiatAmount, defaultFiatAmount, fiatCurrency, and defaultFiatCurrency
to the Transak widget URL so users see the transaction total immediately
without manual entry. Applied to both rcart payment sessions and rflows
onramp adapter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 12:12:31 -07:00
Jeff Emmett 357e0bb4c0 refactor(transak): split API keys by environment (staging/production)
Add getTransakApiKey() and getTransakWebhookSecret() helpers that
resolve TRANSAK_API_KEY_STAGING or TRANSAK_API_KEY_PRODUCTION based
on TRANSAK_ENV, with fallback to legacy TRANSAK_API_KEY. All consumers
(rcart, rflows, transak-onramp) now use the shared helpers instead of
reading env vars directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 12:06:33 -07:00
Jeff Emmett 2cb1ff092b feat(shell): redesign rApp info popup as centered modal with overlay
- Fix z-index (9000 → 10001) so popup renders above header and tab bar
- Center popup as a proper modal with blurred backdrop overlay
- Header now shows module emoji icon + name (fetched from API)
- Bigger, bolder CTA buttons with gradient fills and hover effects
- Tour/guide links auto-promoted to prominent purple-accent buttons
- Loading spinner animation, Escape key to dismiss, click-outside-to-close
- Mobile: slides up from bottom instead of top-right corner
- Also: rcart/rwallet subnav route support, rcart tour simplification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 11:24:41 -07:00
Jeff Emmett 7ec1434e64 feat(rcart): add payments dashboard for Payments subnav tab
New folk-payments-dashboard component shows payment requests in/out with
status badges, links to pay pages, and a create button. Resolves 404 on
the existing Payments outputPath.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 11:17:54 -07:00
Jeff Emmett c668d5700c fix(transak): derive referrerDomain from request hostname instead of hardcoding
Resolves T-INF-101 Access Denied when accessing payment links from
subdomains like demo.rspace.online. Adds extractRootDomain() helper
to shared/transak.ts, used by both rcart and rflows onramp adapters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 10:49:29 -07:00
Jeff Emmett 9091c988ff feat: add subnav outputPaths for rcart, rmeets, rwallet; CRM URL-path tabs
- rcart: add subscriptions outputPath
- rmeets: add rooms + recordings outputPaths
- rwallet: add wallets, tokens, transactions outputPaths
- folk-crm-view: read active tab from URL pathname instead of ?tab=
  query param (with backward compat fallback)
- rstack-app-switcher: rename rtasks category to "Work & Productivity"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 01:37:05 -07:00
Jeff Emmett 44dff1991f fix(rcart): recognize existing session without wallet + show username
checkExistingSession() required a derived wallet address to set
authenticated=true, causing a re-login prompt even with a valid session.
Now authenticates on valid session and derives wallet lazily at payment
generation time. Also extracts claims.username for display instead of
showing raw did:key identifiers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:25:26 -07:00
Jeff Emmett adb0d173d8 feat(shell): add module sub-nav bar + rCart UX polish + fix TS errors
- Add secondary pill navigation bar between tab-row and <main> showing
  each module's outputPaths + subPageInfos as navigable links with
  client-side active highlighting
- Rename rcart /buy/:id route to /group-buy/:id, add payments and
  group-buys outputPaths, rename products → catalog
- Add outputPaths (mailboxes) to rinbox module
- Polish group buy page: hero stat cards, fill-up liquid progress
  visual with tier markers, warm amber→green gradient, pledge avatars,
  green CTA button, price box, responsive improvements
- Fix centering for narrow rcart form pages (flex layout in cart.css)
- Fix TS error: add walletAddress to rstack-identity SessionState type
- Fix TS errors: add ambient type declarations for 3d-force-graph and
  three (dynamically imported in folk-graph-viewer)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 20:44:45 -07:00
Jeff Emmett 96b77278d4 fix(transak): use direct widget URL instead of broken gateway API
The Transak gateway session API consistently returns 401 despite valid
access tokens. Switch to direct URL construction (query params on
global.transak.com) which Transak still supports and is simpler.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 20:32:23 -07:00
Jeff Emmett 28dbb059eb fix: remove stray brace in folk-payment-request checkExistingSession
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 20:22:23 -07:00
Jeff Emmett 911713e9aa fix(rcart): use rstack-identity auth instead of separate passkey flow
folk-payment-request now triggers the rstack-identity auth modal
instead of its own passkey flow. This ensures the username displays
correctly in the identity badge and avoids duplicate session management.
Also checks both session sources for wallet address and access token.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 20:21:18 -07:00
Jeff Emmett 71b2acd47b feat(rcart): persist payment request ID in URL for reloadability
After generating a payment request, push ?id=<paymentId> into the URL.
On page load, if ?id= is present, fetch the payment from the API and
display the QR/share view directly. Reset clears the URL param.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 20:14:10 -07:00
Jeff Emmett cbf1ae0b2c feat(rcart): group buys tab + interactive what-if calculator
Add Group Buys tab to the shop nav with listing of all ongoing group buys,
showing progress bars, tier chips, and clickable cards that navigate to the
full group buy page. Add "What If" simulator to the group buy page with
slider-driven pledge projection, dynamic tier highlighting, and a commons
revenue calculator with adjustable share percentage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:30:10 -07:00
Jeff Emmett 8040c30756 feat(rcart,rcal): group buy page, multi-scale calendar demo, TS fixes
- Add folk-group-buy-page.ts: public shareable group buy component
  with tier progress, pledge panel, and demo mode
- Add vite build block for folk-group-buy-page
- Wire rSwag "Send to rCart" to navigate to /demo/rcart?tab=catalog
- Add multi-scale calendar demo events: planetary (equinoxes, Earth Day),
  continental (Europe Day, Mobility Week), country (Unity Day), region
  (Brandenburg festivals), and multi-continent (Tokyo, Nairobi, Bogota)
- Add season-scale and year-scale events for temporal zoom demo
- Fix pre-existing TS errors: add missing likelihood field to CalendarEvent
  creation in rcal/mod.ts and rschedule/mod.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:59:02 -07:00
Jeff Emmett 13f331d72c feat(rcart): catalog detail view, order queue, and group buy
- Add catalog-detail view with quantity selector and order queue
- Add group buy creation flow
- Add ?tab=catalog URL param support
- Expand catalog item schema with inventory fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:45:46 -07:00
Jeff Emmett 4212a651e1 fix(auth): exchange WebAuthn credential for server-signed JWT + rNetwork CRM cleanup
- Session manager now calls EncryptID /api/auth/start + /api/auth/complete
  to get a properly signed JWT instead of creating unsigned local tokens.
  This fixes 401 errors on /api/payments, /api/notifications, and other
  authenticated endpoints that verify tokens via EncryptID server.
- Token refresh calls /api/session/refresh instead of extending unsigned tokens
- Server generateSessionToken now includes authTime, jti, recoveryConfigured
- rNetwork: /crm route renders folk-crm-view instead of iframe
- rNetwork: ?view=app redirects 301 to /crm (backward compat)
- rNetwork: graph viewer always uses API (removed hardcoded demo data)
- docker-compose: pass through TWENTY_API_TOKEN from Infisical
- rcart: add catalog product images

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:13:19 -07:00
Jeff Emmett 4199a8c6e0 feat(rcart): add "Payer Decides" option for payment type and amount
- Add 'payer_choice' as third paymentType option on request form
- When set, the payment page shows a One-time / Recurring toggle for the payer
- Payer's choice sent to server via chosenPaymentType in status update
- Server uses chosenPaymentType to determine subscription reset behavior
- Combined with existing amountEditable, creators can now leave both
  amount and payment type fully up to the payer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:57:09 -07:00
Jeff Emmett 636fc133fe feat(rcart): add subscription/inventory/method-toggles to payment requests + fix 403
- Fix: add publicWrite to cartModule so payment routes aren't blocked
  by space-level write auth (routes have their own auth checks)
- Add paymentType field: 'single' (one-time) or 'subscription' (reusable QR)
- Add maxPayments inventory limit: QR codes auto-fill when limit reached
- Add paymentCount to track how many payments received
- Add enabledMethods: toggle card/wallet/encryptid per payment request
- Payment page only shows enabled tabs, shows inventory progress bar
- Subscriptions reset to 'pending' after each payment until filled
- New 'filled' status for inventory-limited payments that are full

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:35:11 -07:00
Jeff Emmett c049d7e8df feat(rcart): QR code payment requests with self-service generator
Add shareable QR payment system to rCart:
- PaymentRequestDoc schema with amountEditable support
- Payment API routes (create, list, get, update, QR SVG, Transak session)
- folk-payment-page: 3-tab payer view (Card/Wallet/EncryptID passkey)
- folk-payment-request: self-service QR generator with passkey auth
- Payments tab in folk-cart-shop for managing requests
- Extract Transak utils to shared/transak.ts (used by rFlows + rCart)

Routes: /:space/rcart/request (generator), /:space/rcart/pay/:id (payer)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:11:20 -07:00
Jeff Emmett 31b088543e feat: add ViewHistory for in-app back navigation, rename rWork to rTasks
Add shared ViewHistory<V> utility class that provides a proper navigation
stack for rApps with hierarchical views. Replaces hardcoded data-back
targets with stack-based back navigation across 10 rApps: rtrips, rmaps,
rtasks, rforum, rphotos, rvote, rnotes, rinbox, rschedule, rcart.

Rename rWork module to rTasks — directory, component (folk-tasks-board),
CSS, exports, domains, and all cross-module references updated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 14:04:13 -07:00
Jeff Emmett 72100c0922 feat: migrate hardcoded colors to --rs-* CSS variables across 18 modules
Replace structural UI colors with theme-aware CSS custom properties so
all rApp modules respond correctly to light/dark theme switching.

Covers: folk-social-post, folk-forum-dashboard, folk-video-player,
folk-video-chat, folk-thread-gallery, folk-campaign-manager,
folk-wallet-viewer, folk-vote-dashboard, folk-swag-designer,
folk-cart-shop, folk-workflow-block, folk-choices-dashboard,
folk-pubs-editor, folk-book-shelf, folk-flows-app, folk-analytics-view,
folk-campaign-planner, and flows.css canvas background.

Intentionally preserved: platform brand colors, chain colors,
data-viz/chart colors, video player black, call action buttons.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:34:13 -07:00
Jeff Emmett c8e95ed506 feat(rcart): add cart tab to browser extension + install banner in web UI
Extension gets Clipper/Cart mode tabs, space/cart picker with persistence,
JSON-LD product detection, "Add to rCart" context menu, and badge count.
Web UI shows a dismissible indigo banner prompting extension install when
not detected. Content script sets detection marker on rspace.online pages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 12:07:13 -07:00
Jeff Emmett 12d3e86e13 feat(rcart): merge group shopping into rCart module
Add shared shopping carts with URL product extraction, pooled funding,
and extension support alongside existing cosmolocal catalog/orders.

- Shopping cart schemas (ShoppingCartDoc, ShoppingCartIndexDoc)
- Server-side product extraction (JSON-LD, meta tags, Amazon/Shopify)
- 13 new API routes (cart CRUD, items, contributions, extension endpoints)
- 3-tab UI (Carts/Catalog/Orders) with cart detail, funding progress
- Local-first client subscriptions for real-time cart sync
- Updated landing page to reflect group shopping workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:21:38 -07:00
Jeff Emmett 4cc420d0f6 feat: wire offline-first Automerge sync to all 13 rSpace modules
Add shared RSpaceOfflineRuntime singleton that coordinates IndexedDB
persistence (EncryptedDocStore), WebSocket sync (DocSyncManager), and
in-memory Automerge docs (DocumentManager) for all module web components.

- Phase 0: runtime.ts singleton, shell integration, beforeunload flush
- Phase 1: rstack-offline-indicator status dot in shell header
- Phase 2: service worker stale-while-revalidate for API GETs + offline fallback
- Phase 3: storage-quota.ts with LRU eviction (30d) and quota warnings (70%)
- Phase 4: Tier 1 single-doc modules (rFlows, rCal, rBooks, rSplat)
- Phase 5: Tier 2 multi-doc modules (rNotes, rWork, rInbox, rVote, rTrips, rFiles)
  with doc-list-request/response wire protocol for document discovery
- Phase 6: Tier 3 special cases (rCart hybrid, rForum global doc, rSchedule)

Data now loads instantly from IndexedDB, syncs via WebSocket when online,
and remains browsable offline. rNotes migrated from inline Automerge WS
to shared runtime. All modules fall back to REST when runtime unavailable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 19:07:59 -08:00
Jeff Emmett a6008a4f2d refactor: complete rfunds → rflows rename across configs and references
Update docker-compose, vite config, Traefik labels, module imports,
and all cross-module references to use the new rflows naming.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 19:13:14 -08:00
Jeff Emmett 63ac2a268e perf: parallelize local-first init — batch IDB loads, cache crypto keys, preload sync states
Sequential document loading during init() was the main bottleneck: each cached
doc required a serial IDB read + key derivation + decryption + Automerge.load.
With N documents this meant N× single-doc latency instead of 1×.

Changes:
- Add loadMany() to EncryptedDocStore for parallel Promise.all() batch loading
- Cache derived space/doc CryptoKeys in DocCrypto (one derivation per session)
- Add preloadSyncStates() to DocSyncManager for parallel sync state loading
- Update all 11 module local-first-client init() methods to use batch APIs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 14:18:55 -08:00
Jeff Emmett 35a5a5f29a feat: workflow template, choice components, space settings, EncryptID vault, UI polish
- Pre-populated 4-node workflow template (trigger→action→condition→output) with blue arrows
- Add folk-choice-vote, folk-choice-rank, folk-choice-spider component libraries
- New rstack-space-settings component
- EncryptID encrypted vault schema and server endpoints
- Space management and community store enhancements
- Shell, landing, and module CSS refinements
- Tab bar, app switcher, identity, and MI component updates
- rNotes app improvements
- rFunds diagram adjustments

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 13:15:13 -08:00
Jeff Emmett 1635b08704 feat: add seed template data for rCart, rChoices, rFiles, rForum, rFunds, rInbox, rSplat
Each module now seeds starter content when a new space is created,
giving users something to interact with immediately rather than
an empty state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 22:49:21 -08:00
Jeff Emmett b6ddd4a833 fix: getApiBase() across all 16 rApp modules for subdomain routing
All modules had getApiBase() matching wrong module names (e.g. /vote
instead of /rvote) and requiring /{space}/ prefix in the URL path.
On subdomains like jeff.rspace.online, the browser URL is /rfunds/...
not /jeff/rfunds/..., so the regex never matched.

New pattern: /^(\/[^/]+)?\/rmodule/ handles both:
- Subdomain: /rfunds/... → base = /rfunds
- Direct: /demo/rfunds/... → base = /demo/rfunds

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 21:01:06 -08:00
Jeff Emmett 8900eb32b9 feat: Phase 4 — remove PostgreSQL from 11 modules, switch to Automerge
Replace all sql.unsafe() calls with Automerge document operations
across rfunds, rbooks, rsplat, rnotes, rwork, rvote, rcal, rfiles,
rcart, rtrips, and rinbox. Only rforum retains PG (Discourse provisioning).

Each module now uses _syncServer.getDoc/changeDoc/setDoc for all CRUD,
with ensureDoc() helpers for lazy document creation. Schema SQL files
archived to .sql.archived. Adds Automerge round-trip test suite (35 tests).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 15:48:01 -08:00
Jeff Emmett ef3d0ce447 feat: batch local-first migration for 10 modules (Phase 3)
Add Automerge schemas, lifecycle hooks (onInit, docSchemas), and
local-first client wrappers for all remaining PG modules:
rWork, rVote, rCal, rFiles, rCart, rBooks, rTrips, rInbox, rSplat, rFunds.

Each module now:
- Defines typed Automerge document schemas (schemas.ts)
- Registers docSchemas and onInit hook with SyncServer reference
- Moves initDB() from top-level to onInit for unified startup
- Has a client-side local-first wrapper (local-first-client.ts)

Dual-write route handlers will be wired incrementally per module
following the rNotes pattern established in Phase 2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 14:01:58 -08:00
Jeff Emmett b2ea5e04cf feat: unified space lifecycle & module scoping contract (Phase 0+1)
Extend RSpaceModule with scoping, lifecycle hooks (onInit, onSpaceCreate/Delete
with SpaceLifecycleContext, onSpaceEnable/Disable), and DocSchema support.
Add scoping to all 25 modules (8 space, 11 global-configurable, 6 global-fixed).
Consolidate 4 space creation endpoints into shared createSpace() function.
Add enabledModules enforcement middleware and module configuration API
(GET/PATCH /api/spaces/:slug/modules). Deprecation header on /api/communities.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 13:35:41 -08:00
Jeff Emmett 3808b51a64 feat: strip demo pages to show just the interactive component
Demo pages now render the same clean shell as regular spaces — just the
<folk-*> component full-page, no marketing wrapper (hero, feature cards,
CTA). Descriptions belong on landing pages, not demos.

- Remove demo branch from 7 module route handlers (rcal, rcart, rfunds,
  rnotes, rtrips, rtube, rvote)
- Delete 7 demo.ts files (~1200 lines of dead markup)
- Remove renderDemoShell() and DEMO_PAGE_CSS from server/shell.ts
- Remove demoPage field from RSpaceModule interface
- Rename top rApp dropdown item from "rSpace" to "rStack"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 15:03:46 -08:00
Jeff Emmett f7ecf50588 feat: upgrade 6 module demos to use real interactive components
Replace static HTML mockups and WebSocket skeleton demos with the actual
self-contained web components (with built-in demo data) for rcart, rtube,
rfunds, rnotes, rtrips, and rvote — matching the rcal demo pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 14:10:52 -08:00
Jeff Emmett 5408eb0376 feat: add outputPaths to module interface and browsable list pages
Add OutputPath type to RSpaceModule so each module declares what content
types it produces (e.g. notebooks, routes, campaigns). Auto-generate
browsable list pages at /:space/:moduleId/:path that render a card grid
inside the standard shell, fetching items from the module's API.

Declares outputPaths across 23 modules (rwallet/rinbox skipped).

Move campaign demo from standalone campaign-demo space to
/rsocials/campaign route with a dedicated timeline view and
/api/campaigns endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 13:55:29 -08:00
Jeff Emmett 75b148e772 Merge branch 'dev'
# Conflicts:
#	modules/rcal/mod.ts
#	modules/rfiles/mod.ts
#	modules/rforum/mod.ts
#	modules/rmaps/mod.ts
#	modules/rnetwork/mod.ts
#	modules/rswag/mod.ts
#	modules/rwork/mod.ts
#	shared/module.ts
2026-02-28 19:51:51 -08:00
Jeff Emmett 5613370817 refactor: rename module directories to match r-prefixed module IDs
All 22 module directories under modules/ now match their module IDs
(e.g. modules/cart → modules/rcart, modules/canvas → modules/rspace).
Updated all import paths, vite build config, HTML template asset refs,
docker-compose standalone commands, and .gitignore accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 19:49:26 -08:00