Skip to content

flysim-apps/flydonate-sdk

Repository files navigation

@flysim-apps/flydonate-sdk

Seamless FlyDonate overlay integration. Point it at a streamer's overlay feed URL and get live config, goals and donation alerts — no sockets to wire, no auth to manage (the token lives in the URL). Framework-agnostic core, plus a React hook and a Redux Toolkit slice.

yarn add @flysim-apps/flydonate-sdk

The feed URL comes from the streamer's FlyDonate dashboard (or, inside the FlyAround overlay, is auto-discovered from tower settings): https://flydonate.com/overlay/{token}.

Core (any framework)

import { FlyDonateClient } from '@flysim-apps/flydonate-sdk';

const client = new FlyDonateClient({ feedUrl: 'https://flydonate.com/overlay/ABC123' });
const off = client.on((e) => {
  if (e.type === 'config') console.log('goal + alert settings', e.config);
  if (e.type === 'goal') console.log('goal progress', e.goal);
  if (e.type === 'alert') console.log('new tip!', e.alert); // only alerts that arrive while connected
});
client.start();
// ...later
off();
client.stop();

The client primes on connect — it won't replay historical donations, only tips that land while it's running.

React

import { useFlyDonateFeed, formatSalutation } from '@flysim-apps/flydonate-sdk/react';

function Overlay({ feedUrl }: { feedUrl: string }) {
  const { config, goal, currentAlert } = useFlyDonateFeed(feedUrl);
  return (
    <>
      {goal && <GoalBar goal={goal} />}
      {currentAlert && config && <Alert text={formatSalutation(config, currentAlert)} alert={currentAlert} />}
    </>
  );
}

currentAlert surfaces one donation at a time for config.alertDurationMs, so you just animate it in/out. config carries the salutation template, animation, SFX + TTS settings and per-field visibility.

Redux Toolkit

import { flydonateReducer, connectFlyDonateFeed, selectFlyDonateGoal } from '@flysim-apps/flydonate-sdk/features';

// reducer under the `flydonate` key
const store = configureStore({ reducer: { flydonate: flydonateReducer /* … */ } });

const disconnect = connectFlyDonateFeed(store.dispatch, { feedUrl });
// selectors: selectFlyDonateConfig / selectFlyDonateGoal / selectFlyDonateAlerts

Entry points

Import What
@flysim-apps/flydonate-sdk FlyDonateClient, createFlyDonateClient, all types
@flysim-apps/flydonate-sdk/types DTOs only (OverlayConfig, Goal, DonationAlert, …)
@flysim-apps/flydonate-sdk/react useFlyDonateFeed hook
@flysim-apps/flydonate-sdk/features RTK slice + connectFlyDonateFeed

Zero runtime dependencies. React / Redux Toolkit are optional peers — only needed for the ./react / ./features entry points.

The feed contract

Published to GitHub Packages on a v*.*.* tag.

© FlyAround Simulations LLC · MIT

About

Seamless FlyDonate overlay integration

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors