Skip to content

Content gate - #1265

Merged
Chucks1093 merged 4 commits into
accesslayerorg:devfrom
assumptaamara:contentGate
Oct 21, 2026
Merged

Chucks1093 merged 4 commits into
accesslayerorg:devfrom
assumptaamara:contentGate

Conversation

@assumptaamara

Copy link
Copy Markdown
Contributor

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) — ContentGateType and ContentGateConfig.
  • src/utils/contentGate.utils.ts (new) — the four gate options and their
    copy, gate-type alias resolution, and threshold parsing/validation.
  • src/services/contentGate.service.ts (new) — reads
    GET /keys/:keyId/gate with a tolerant normaliser, and submits the
    set_gate contract call.
  • src/hooks/useContentGate.ts (new) — useContentGateConfig (loads the
    current configuration on mount) and useSetContentGateMutation (saves it and
    confirms with a toast).
  • src/components/common/ContentGatePanel.tsx (new) — the panel: gate-type
    selector, conditional threshold field, and the Save Gate button.
  • src/pages/CreatorDashboardPage.tsx — the Content Gate section in the
    Settings tab.
  • src/lib/queryKeys.ts — new creators.gateConfig query key.
  • src/components/common/SubscriptionAccessGate.tsx — its GateType is now
    derived from the shared ContentGateType, so the gate types are defined in
    one place. Type-only change; the holder-facing behaviour is unchanged.

Behaviour

  • All four gate types render as radio cards, with the threshold field only
    appearing for the threshold gate.
  • The panel opens on the configuration stored for the key, so the creator sees
    what is live before changing it.
  • Saving submits set_gate with the gate type and the threshold (null for the
    gate types that do not use one) and confirms with a toast.
  • A threshold that is missing or not a whole number of tokens is rejected
    inline instead of being submitted.
  • A key with no stored configuration opens on "No Gate".

Tests

Added coverage: contentGate.utils.test.ts, contentGate.service.test.ts,
ContentGatePanel.test.tsx and useContentGate.test.tsx.

Note for review

This reads a new endpoint, GET /keys/:keyId/gate. A missing endpoint is
treated 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.

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit 9b89593 into accesslayerorg:dev Oct 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement key content gate configuration panel for creators

2 participants