npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@core-sdk/feature-flags-react

v0.7.2

Published

Minimal React context + hooks for @core-sdk/feature-flags-sdk

Downloads

144

Readme

@core-sdk/feature-flags-react

@core-sdk/feature-flags-sdk içindeki FeatureFlagsClient örneğini React context ile uygulamaya yayar; bayrak sorgusu ve kimlik (identify) için hook tabanlı ince bir sarmalayıcı sağlar.

Kurulum

npm install @core-sdk/feature-flags-react react
  • Peer: react — gereksinim bu paketin package.jsonpeerDependencies içinde; npm install ile çözülür.
  • Bağımlılık: @core-sdk/feature-flags-sdk (dependencies; kurulumda indirilir).

Kural modeli sunucu ve çekirdek paketle uyumlu olmalıdır: koşullar OR, filtreler AND — ayrıntı için @core-sdk/feature-flags-core ve bayrak API dokümantasyonuna bakın.

Hızlı başlangıç

"use client";

import {
  FeatureFlagsClient,
  FeatureFlagsProvider,
  useFeatureFlagEnabled,
  useIdentify,
} from "@core-sdk/feature-flags-react";

const featureClient = new FeatureFlagsClient({
  baseUrl: "https://flag-api.example.com",
  apiKey: process.env.NEXT_PUBLIC_FEATURE_FLAGS_API_KEY ?? "",
  projectKey: "portal-web",
  includeBrowserInfo: true,
});

export function AppRoot({ children }: { children: React.ReactNode }) {
  return (
    <FeatureFlagsProvider client={featureClient} autoBootstrap>
      <IdentityBridge>{children}</IdentityBridge>
    </FeatureFlagsProvider>
  );
}

function IdentityBridge({ children }: { children: React.ReactNode }) {
  const { identify, reset } = useIdentify();
  // Oturum değişince: identify(id, traits) + featureClient.invalidate()
  // veya reset() + invalidate()
  return <>{children}</>;
}

function CheckoutGate() {
  const { enabled, loading } = useFeatureFlagEnabled("checkout_redesign");
  if (loading) return null;
  return enabled ? <div>New checkout</div> : <div>Legacy checkout</div>;
}

FeatureFlagsProvider props

| Prop | Açıklama | |------|-----------| | client | Paylaşılan FeatureFlagsClient (zorunlu). | | autoBootstrap | true ise mount sonrası bir kez client.bootstrap(); bootstrap bitene kadar (veya timeout) children opsiyonel olarak kilitlenir. | | bootstrapGateTimeoutMs | Geçit için üst süre (ms); varsayılan 10000. ≤ 0 ise sadece bootstrap tamamlanınca açılır. | | bootstrappingFallback | Geçit kapalıyken gösterilecek içerik (ör. spinner). |

Hook’lar

| Hook | Dönüş / davranış | |------|-------------------| | useFeatureFlagsClient() | Context’teki FeatureFlagsClient. Provider dışında kullanılırsa hata. | | useFeatureFlagEnabled(flagKey, context?) | { enabled, loading }. Önbellekte değer varsa peekServerEnabled ile gereksiz istek azaltılabilir. | | useIdentify() | { identify, reset } — SDK’daki identify / reset ile aynı örnek üzerinde. |

identify sonrası yenileme

identify bağlamı değiştirir; hook’ların yeni bağlamla tekrar hesaplanması için featureClient.invalidate() çağrısı önerilir (aksi halde eski önbellekli sonuç görülebilir).

Gizlilik ve includeBrowserInfo

Varsayılan true iken değerlendirme bağlamına tarayıcıdan alanlar eklenir. KVKK / deterministik test için istemciyi includeBrowserInfo: false ile oluşturabilirsiniz.

Lisans

Kuruluşunuzun lisans kuralları geçerlidir.