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

@1st-flock/donations-embed-react

v1.2.7

Published

React wrapper around the <flock-donate> web component for 1st Flock donation embeds.

Readme

@1st-flock/donations-embed-react

React wrapper around the <flock-donate> web component shipped by @1st-flock/donations-embed. Idiomatic React props, typed event handlers, automatic custom-element registration. Works with React 18 and 19 (App Router / Pages Router / Vite / CRA).

npm version bundle size license

Install

npm install @1st-flock/donations-embed @1st-flock/donations-embed-react
# or
pnpm add @1st-flock/donations-embed @1st-flock/donations-embed-react
# or
yarn add @1st-flock/donations-embed @1st-flock/donations-embed-react

react, react-dom, and @1st-flock/donations-embed are peer dependencies. React 18 or 19 is supported.

Quickstart

import { FlockDonate } from "@1st-flock/donations-embed-react";

export function GivePage() {
  return (
    <FlockDonate
      publishableKey="pk_test_8xK2zQ9m2nP4rT5vX7yZ"
      mode="inline"
      onComplete={(detail) => {
        console.log("Donation complete:", detail.confirmationId);
      }}
    />
  );
}

Render the page, walk the donor flow, and pay with sandbox card 4111 1111 1111 1111, exp 10/29, CVV 123. The success screen shows a confirmation ID like don_8a1b9c4d. The donation appears in your 1st Flock hub within seconds, marked with a TEST badge — no real money moved.

Importing FlockDonate (or any other symbol from this package) auto-registers the underlying <flock-donate> custom element on window.customElements. There is no separate setup step.

Next.js (App Router)

The component touches window.customElements, which doesn't exist during server rendering. Mark the component or page that uses it as a client component:

"use client";

import { FlockDonate } from "@1st-flock/donations-embed-react";

export default function GivePage() {
  return (
    <FlockDonate
      publishableKey="pk_test_8xK2zQ9m2nP4rT5vX7yZ"
      mode="modal"
      triggerLabel="Give"
    />
  );
}

Configuration

Generate keys in the 1st Flock account portal under Donations Setup → Embed Keys (full guide). The wrapper accepts only a publishable key — secret keys are server-only and would be rejected by the underlying web component.

Test mode

Test-mode keys (pk_test_…) route every request to the sandbox cluster. No real money moves. Same code path as production, same webhook events fire. Donations show up in the hub with a TEST badge and never appear in the production ledger.

Props

The wrapper exposes every web-component attribute as a camelCase prop, plus typed event handlers.

| Prop | Type | Notes | | --- | --- | --- | | publishableKey (required) | string | pk_live_… or pk_test_…. | | mode | "inline" \| "modal" \| "drawer" | Render mode. Defaults to "inline". | | triggerLabel | string | Button text for mode="modal" / "drawer". Defaults to "Give". | | funds | string \| string[] \| null | Allowed fund IDs. Empty array hides the picker. | | defaultFund | string \| null | Pre-selected fund ID. | | frequency | string \| FlockDonateFrequency[] | Allowed frequencies. | | defaultFrequency | FlockDonateFrequency | Pre-selected frequency. Defaults to "one-time". | | coverFees | boolean | Show the cover-fees toggle. Defaults to true. | | recurring | boolean | Allow recurring frequencies. Defaults to true. | | theme | "modern" \| "minimal" \| "classic" \| "playful" | Built-in theme preset. Defaults to "modern". | | successMode | "inline" \| "redirect" \| "callback" | Post-donation behaviour. Defaults to "inline". | | successUrl | string \| null | Required when successMode="redirect". | | suggestedAmounts | string \| number[] \| null | Suggested amounts in dollars. | | minAmount | number | Minimum donation in dollars. Defaults to 1. | | maxAmount | number \| null | Maximum donation in dollars. | | language | string | BCP-47 tag. Defaults to "en". | | noAnalytics | boolean | Suppress every host event. |

Plus standard HTML props: className, id, style, and ref (the ref resolves to the underlying <flock-donate> HTMLElement so you can call el.open() / el.close() for modal / drawer modes).

The full attribute reference (including <flock-donate>'s underlying token catalogue and theme inheritance rules) lives at 1stflock.com/developers/donations-embed/.

Event handlers

| Prop | Underlying CustomEvent | When | | --- | --- | --- | | onOpened | flock-donation-opened | Donor opens the flow. | | onStep | flock-donation-step | Donor advances to the next step. | | onComplete | flock-donation-complete | The success screen renders. | | onFailed | flock-donation-failed | The flow fails (declined card, network error). | | onClosed | flock-donation-closed | Donor leaves the flow without completing. |

<FlockDonate
  publishableKey="pk_test_8xK2zQ9m2nP4rT5vX7yZ"
  mode="modal"
  funds={["general", "building", "missions"]}
  defaultFund="general"
  frequency={["one-time", "monthly", "annual"]}
  defaultFrequency="monthly"
  coverFees
  suggestedAmounts={[25, 50, 100, 500]}
  onOpened={(detail) => console.log("opened", detail)}
  onStep={(detail) => console.log("step", detail)}
  onComplete={(detail) => analytics.track("donation", detail)}
  onFailed={(detail) => console.error("failed", detail)}
  onClosed={(detail) => console.log("closed", detail)}
/>

Setting noAnalytics suppresses every event in the stream — useful when the host platform requires donor consent before any analytics events fire.

Common tasks

Switch render mode

<FlockDonate publishableKey="pk_test_…" mode="inline" />
<FlockDonate publishableKey="pk_test_…" mode="modal" triggerLabel="Give" />
<FlockDonate publishableKey="pk_test_…" mode="drawer" triggerLabel="Support us" />

Theme override

<FlockDonate
  publishableKey="pk_test_…"
  theme="minimal"
  style={{ "--flock-primary": "#0d9488", "--flock-radius": "8px" } as React.CSSProperties}
/>

Imperative open / close (modal / drawer)

import { useRef } from "react";
import { FlockDonate } from "@1st-flock/donations-embed-react";

function GiveButton() {
  const ref = useRef<HTMLElement>(null);
  return (
    <>
      <button onClick={() => ref.current?.dispatchEvent(new MouseEvent("click"))}>
        Open the flow
      </button>
      <FlockDonate
        ref={ref}
        publishableKey="pk_test_…"
        mode="modal"
      />
    </>
  );
}

Bundling notes

The wrapper is ESM-only. Modern bundlers (Vite, Next.js, esbuild, Webpack 5) handle ESM natively. CommonJS-only stacks should use the lower-level @1st-flock/donations-embed web component directly with their bundler's interop layer.

Full documentation

The full reference — theme tokens, integration recipes, webhook event taxonomy, and compliance summary — lives at 1stflock.com/developers/donations-embed/.

Vendor neutrality

This SDK never names the underlying payment processor, bank-link service, or any other third-party vendor in customer-facing strings. The underlying integrations are an implementation detail and may change without notice — your code never has to.

License

MIT — see LICENSE.

Reporting issues

File issues at gitlab.com/1st-flock/donations/-/issues with the label donations-embed-react.