feat(settings): in-window PayPal subscribe via JS SDK (no redirect) + popup resize#26
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… resize Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reset paypalButtonRendered flag in the subscriptionState watcher whenever the state leaves trial/grace, and guard renderPaypalButton() on DOM emptiness so the button re-renders correctly after a subscribe → cancel cycle within a single page session. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Frontend half of the in-window PayPal flow (spec:
knowledge_base/specs/2026-06-03-paypal-in-window-subscribe-design.md). Replaces the full-page redirect with PayPal's JS SDK — the user never leaves the shard, and there is noreturn_url(removes the hash-route mangling bug class).profile.billing_enabledis true. Self-hosted/disabled shards show nothing and load no PayPal JS.src/lib/paypal-sdk.js): loadswww.paypal.com/sdk/jsonce, intent=subscription, with the public client id from the self-view. Unit-tested.createSubscriptioncallsPOST .../shards/self/subscribe(server-created, returnssubscription_id);onApprovetriggers a profile refresh + the existing interstitial/poll. Removed the old redirect +?sub=returnhandling. The SDK opens a real popup window (matches the desired UX).window.open(approval_url)(popup; SDK has no revise action — per spike), with a redirect fallback if the popup is blocked, and apopup.closedpoll to refresh.Depends on
freeshard-controller#286 (provides
billing_enabled/paypal_client_idon the self-view, andsubscription_idfrom subscribe/resize). Deploy that first.Verification
Unit: SDK loader spec + existing suite (14/14). Build compiles. The SDK flow itself requires live sandbox browser verification (cannot be unit-tested): subscribe, reactivate-from-grace, resize — all in-window. Spike already confirmed the SDK loads + approves in-window and that resize needs the popup.
Live-test watch items (flagged during implementation): SDK button re-render on trial↔grace transitions in one session (addressed by
fa3b70a— confirm); popup-blocker fallback on resize.Recommended reading order
src/lib/paypal-sdk.js(+tests/unit/paypal-sdk.spec.js) — the loadersrc/views/Settings.vue— gate, SDK button (renderPaypalButton),resizeShardpopupTracks #265.
🤖 Generated with Claude Code