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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gofynd/fdk-store-gql

v0.0.112

Published

FPI Store bridging library

Downloads

232

Readme

FDK Store

Overview

The FDK Store is an NPM package that serves as a wrapper over the FDK Client Javascript SDK, providing users with a convenient interface to interact with the SDK's functionality. This package utilizes Redux Toolkit to manage the application state and automatically updates the store based on actions performed through the SDK.

The FDK Store exports a class that encapsulates the Redux store and exposes methods for interacting with the SDK and retrieving data from the store. It also includes a getters object that provides getter functions for different slices of the store.

Installation

To install the FDK Store package in your project, use the following command:

npm install github:@gofynd/fdk-store

Usage

Importing the Package

To import the FDK Store package into your project, use the following import statement:

import FDKStore from 'fdk-store';

Creating an Instance

To import the FDK Store package into your project, use the following import statement:

const fpiOptions = {
    applicationID,
    applicationToken,
    domain,
    storeInitialData,
  };

  const { client: fpi } = new FDKStore(fpiOptions);

Using FPI Client Instance

For theme developers, each route level theme page will be provided with fpi client instance. Theme developers can use this client to fetch and sync data with their redux stores.

Read Redux State

Get current State Snapshot

The fpi client exposes the standard redux store at fpi.store. Developers can use redux method fpi.store.getState() to the current snapshot of the state.

Subscribe to a slice of state

FDK Store uses Redux Toolkit to manage slices of state internally. Theme developers can leverage the useGlobalStore hook provided by the theme engine through a global package called fdk-core/utils. The useGlobalStore hook is similar to the standard useSelector hook provided by redux toolkit. Developers can use useGlobalStore and pass the required getters provided in fpi.getters to subscribe to state changes in a React Component.

Example
import React from 'react';
import { useGlobalStore } from 'fdk-core/utils';

function Home({ fpi }) {

  /**
   * Get PAGE data from store
   */
  const page = useGlobalStore(fpi.getters.PAGE) || {};

  /**
   * Rendering Logic Here
   */

  return (
    <p>Home Component</p>
  );
  
}

API Guide

Check docs for full API guide.