Repository navigation
Content gate - #1265
Merged
Merged
Content gate#1265
Conversation
|
@assumptaamara Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
Adds a Content Gate panel to the creator dashboard where creators choose who
can view their key's gated content: no gate, holder required, subscriber
required, or a token-amount threshold.
What changed
src/types/contentGate.ts(new) —ContentGateTypeandContentGateConfig.src/utils/contentGate.utils.ts(new) — the four gate options and theircopy, gate-type alias resolution, and threshold parsing/validation.
src/services/contentGate.service.ts(new) — readsGET /keys/:keyId/gatewith a tolerant normaliser, and submits theset_gatecontract call.src/hooks/useContentGate.ts(new) —useContentGateConfig(loads thecurrent configuration on mount) and
useSetContentGateMutation(saves it andconfirms with a toast).
src/components/common/ContentGatePanel.tsx(new) — the panel: gate-typeselector, conditional threshold field, and the Save Gate button.
src/pages/CreatorDashboardPage.tsx— the Content Gate section in theSettings tab.
src/lib/queryKeys.ts— newcreators.gateConfigquery key.src/components/common/SubscriptionAccessGate.tsx— itsGateTypeis nowderived from the shared
ContentGateType, so the gate types are defined inone place. Type-only change; the holder-facing behaviour is unchanged.
Behaviour
appearing for the threshold gate.
what is live before changing it.
set_gatewith the gate type and the threshold (null for thegate types that do not use one) and confirms with a toast.
inline instead of being submitted.
Tests
Added coverage:
contentGate.utils.test.ts,contentGate.service.test.ts,ContentGatePanel.test.tsxanduseContentGate.test.tsx.Note for review
This reads a new endpoint,
GET /keys/:keyId/gate. A missing endpoint istreated as "no gate" rather than an error — the same way the badges endpoint is
handled — so the panel opens sensibly before the backend ships it.