Skip to content

Enhance Paddle integration and improve social auth visibility#3527

Merged
Baalmart merged 2 commits into
stagingfrom
OAuth-upgrades
May 22, 2026
Merged

Enhance Paddle integration and improve social auth visibility#3527
Baalmart merged 2 commits into
stagingfrom
OAuth-upgrades

Conversation

@OchiengPaul442

@OchiengPaul442 OchiengPaul442 commented May 22, 2026

Copy link
Copy Markdown
Contributor

Status of maturity (all need to be checked before merging):

  • I've tested this locally
  • I consider this code done

Screenshots (optional)

Summary by CodeRabbit

  • Bug Fixes
    • Social authentication buttons now display only in staging and development environments, preventing unintended exposure in production.
    • Improved payment provider environment initialization for better configuration flexibility.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@OchiengPaul442 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 50 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 88930f1a-e49b-48b5-a3fe-9612d9f10ad2

📥 Commits

Reviewing files that changed from the base of the PR and between b572f1f and 537cc6e.

📒 Files selected for processing (3)
  • src/platform/src/shared/components/auth/SocialAuthSection.tsx
  • src/platform/src/shared/lib/paddle.ts
  • src/platform/src/shared/providers/paddle-provider.tsx
📝 Walkthrough

Walkthrough

This PR restricts social auth button visibility to staging and local test environments, and refactors how Paddle payment SDK environment configuration is initialized. The Paddle changes improve flexibility by removing hardcoded environment mapping and allowing the SDK itself to manage configuration.

Changes

Environment-based Configuration Updates

Layer / File(s) Summary
Social auth hostname-based visibility
src/platform/src/shared/components/auth/SocialAuthSection.tsx
A new LOCAL_TEST_HOSTNAMES allowlist and shouldShowSocialAuth(hostname) predicate evaluate the current hostname in a useEffect, storing the result in isStagingDomain state. The component returns null when isStagingDomain is false, preventing social auth buttons from rendering outside staging/local environments.
Paddle environment helper refactor
src/platform/src/shared/lib/paddle.ts
getPaddleEnvironment() return type expands from 'sandbox' | undefined to string | undefined, now returning the trimmed NEXT_PUBLIC_PAYMENT_ENVIRONMENT value directly instead of conditionally mapping only the literal 'sandbox'.
Paddle provider initialization refactor
src/platform/src/shared/providers/paddle-provider.tsx
initializePaddle casts window.Paddle to access an optional Environment.set method, calling it before paddle.Initialize when available and paddleEnvironment is present. The inline environment parameter is removed from paddle.Initialize.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • airqo-platform/AirQo-frontend#3501: Both PRs touch SocialAuthSection—the retrieved PR adds and wires it into auth flows, while this PR changes SocialAuthSection itself to only render on an allowlisted staging/local hostname.

Poem

🌐 Social auth stays home on staging's green shore,
While Paddle SDK builds bridges, the old way no more.
Environment whispers through conditional gates,
The feature finds balance at just the right states. 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: conditional social auth rendering based on hostname and Paddle environment configuration updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch OAuth-upgrades

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/platform/src/shared/components/auth/SocialAuthSection.tsx`:
- Around line 61-67: The current shouldShowSocialAuth function uses
normalizedHostname.includes('staging') which is too broad; update it to only
match explicit staging hostnames (e.g., exact "staging" or subdomains that start
with "staging.") instead of any hostname containing the substring. Modify
shouldShowSocialAuth to check (normalizedHostname === 'staging' ||
normalizedHostname.startsWith('staging.')) in addition to the existing
LOCAL_TEST_HOSTNAMES.has(normalizedHostname) check so only intended staging
hosts get social auth enabled.

In `@src/platform/src/shared/lib/paddle.ts`:
- Around line 7-8: getPaddleEnvironment currently returns any trimmed
NEXT_PUBLIC_PAYMENT_ENVIRONMENT and may pass invalid values into
Paddle.Environment.set; change getPaddleEnvironment to validate the trimmed
value and only return "sandbox" or "production" (exact match), otherwise return
undefined (so Paddle.Environment.set is not called with unsupported values).
Locate getPaddleEnvironment in src/shared/lib/paddle.ts, normalize and trim the
env var, compare against the allowed set ["sandbox","production"], and return
the matching string or undefined to enforce a fail-closed behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0bc99c92-f0fd-4e40-952e-d4ebb412d069

📥 Commits

Reviewing files that changed from the base of the PR and between f5d1fe6 and b572f1f.

📒 Files selected for processing (3)
  • src/platform/src/shared/components/auth/SocialAuthSection.tsx
  • src/platform/src/shared/lib/paddle.ts
  • src/platform/src/shared/providers/paddle-provider.tsx

Comment thread src/platform/src/shared/components/auth/SocialAuthSection.tsx
Comment thread src/platform/src/shared/lib/paddle.ts Outdated
@github-actions

Copy link
Copy Markdown
Contributor

New azure analytics_platform changes available for preview here

@github-actions

Copy link
Copy Markdown
Contributor

New azure analytics_platform changes available for preview here

@Baalmart
Baalmart merged commit 8782bcd into staging May 22, 2026
19 of 20 checks passed
@Baalmart
Baalmart deleted the OAuth-upgrades branch May 22, 2026 07:01
@Baalmart Baalmart mentioned this pull request May 22, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants