@spectral-finance/spectral-modal
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-beta-24 • Public • Published

Spectral Modal

Calculate your Spectral Score in simple steps

TRY OUT (DEMO)

How to install the SDK?

npm i @spectral-finance/spectral-modal

or

yarn add @spectral-finance/spectral-modal

How to use it?

1- Import SpectralProvider and wrap your app

Wrap the main app component with SpectralProvider and set your app's logo URL for the UI.

import { SpectralProvider } from "@spectral-finance/spectral-modal";

export const App = () => {
  return (
    <SpectralProvider logo="yourLogoImageURL" partnerId="yourPartnerId">
      <RouterOrHome />
    </SpectralProvider>
  );
};

2- Invoke Spectral score hook calculation

The useSpectral hook can be used anywhere inside the app context. Once the score is calculated it will be served within the score key provided by the hook.

import { SpectralProvider } from "@spectral-finance/spectral-modal";

export const Home = () => {
  const { start, score } = useSpectral();

  const [myScore, setMyScore] = useState();

  useEffect(() => {
    if (!score) {
      console.log("Score not calculated");

      return;
    }

    console.log(`Hooray! your score is ${score}`);

    setMyScore(score);
  }, [score]);

  return (
    <div>
      <button type="button" onClick={start}>
        Calculate Spectral Score
      </button>
    </div>
  );
};

Readme

Keywords

none

Package Sidebar

Install

npm i @spectral-finance/spectral-modal

Weekly Downloads

0

Version

0.0.1-beta-24

License

ISC

Unpacked Size

2.77 MB

Total Files

534

Last publish

Collaborators

  • luispectral
  • pedrovk