mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-25 08:55:58 +03:00
[PR #373] [MERGED] Require authenticated user identity for billing APIs and remove localStorage fallback #681
Labels
No labels
AI Content Agents
AI Content Strategy
AI Content planning
AI Marketing Tools
AI SEO
AI personalization
AI writer
ALwrity Copi-lot
Alwrity web search
Anthropic
DeepSeek
Gemini AI
Integration
LLM
OnBoarding
OnBoarding
RAG knowledgebase Memory
bug
documentation
enhancement
good first issue
help wanted
invalid
openai
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ALwrity#681
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/AJaySi/ALwrity/pull/373
Author: @AJaySi
Created: 3/4/2026
Status: ✅ Merged
Merged: 3/5/2026
Merged by: @AJaySi
Base:
main← Head:codex/refactor-billingservice-to-use-authenticated-user📝 Commits (1)
5a7b9e6Refactor billing flows to require authenticated user IDs📊 Changes
7 files changed (+54 additions, -33 deletions)
View changed files
📝
frontend/src/components/billing/CompactBillingDashboard/hooks/useCompactBillingData.ts(+1 -1)📝
frontend/src/components/billing/CompactBillingDashboard/index.tsx(+1 -1)📝
frontend/src/components/billing/EnhancedBillingDashboard.tsx(+25 -9)📝
frontend/src/components/billing/SubscriptionRenewalHistory.tsx(+1 -1)📝
frontend/src/hooks/useOAuthTokenAlerts.ts(+3 -4)📝
frontend/src/pages/BillingPage.tsx(+11 -5)📝
frontend/src/services/billingService.ts(+12 -12)📄 Description
Motivation
localStorage.getItem('user_id')and remove the'demo-user'fallback so billing calls always use a canonical authenticated identity.userIdpropagation./me/*style routes or otherwise rely solely on the server-resolved identity from the auth token.Description
frontend/src/services/billingService.tsso all user-scoped methods require an explicituserIdparameter and no longer readlocalStorageor fall back to'demo-user'(examples:getDashboardData,getUsageStats,getUsageTrends,getUsageAlerts,getUserSubscription,getRenewalHistory).EnhancedBillingDashboardnow importsuseAuth, resolveseffectiveUserId(prop or clerkuserId), guards fetches when missing, and passeseffectiveUserIdto child components and billing calls.userId: changeduseCompactBillingDatahook signature andCompactBillingDashboard/SubscriptionRenewalHistoryprops to requireuserIdand updated call sites accordingly.useOAuthTokenAlertsto use the provided authenticateduserIdand skip polling when no authenticated identity is available (removedlocalStoragefallback).Testing
npm --prefix frontend run buildto validate compilation, but it failed in this environment due to missing dev dependencies (react-scripts: not found).userIdis passed through.Codex Task
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.