1.0.29 • Published 4 months ago

@wbsuite/react-hooks v1.0.29

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

Installing wbsuite react hooks library

  1. Install dependency in your proyect by running npm i @wbsuite/react-hooks

How to use

  1. Set up wbsuite by running the useWBSuite hook with the api key you were given.
function App() {
  useWBSuite({ apiKey: '<your-api-key>' });
  return <></>
}
  1. You're ready to start using the hooks you need. This library version contains:
  • useStores -- lists available stores for your team
  • useProducts -- lists products available for your team
  • useCategories -- lists categories available for your team
  • useRenting -- renting utils
  • useDocuments -- document / images utils
  • useContact -- create leads for your campaigns, use this for contacts or whatever you need.

useCategories

This hook is used to list, get or create categories. In order to use it consider:

  const { list: listCategories } = useCategories();

  useEffect(() => {
    listCategories().then(categoryList => {
      // Do what you need with the categoryList
    });
  }, []);

useProducts

This hook is used to list, get or create products. In order to use it consider:

  const { list: listProducts } = useProducts();

  useEffect(() => {
    /** filters needs to be an object with any valid property of the product schema.
    * for example to get the products from a category you need to pass in an object like:
    * { categories: <categoryId>[] }
    *
    * { categories: ['some-category-id', 'other-category-id'] }
    *
    * The categoryId can be retrieved from the useCategories hook explained above.
    **/
    listProducts(filters ?? {}).then(filteredProductList => {
      // Do what you need with the filteredProductList
    });
  }, []);

Permissions

Even if the hooks are available in the library the apiKey limits the permissions you have access to.

Which means, that you won't be able to use all of our features unless you were given access to.

If, you find yourself in need of using a non-accessible util, please reach out to the provider.

1.0.26

4 months ago

1.0.25

4 months ago

1.0.24

4 months ago

1.0.29

4 months ago

1.0.27

4 months ago

1.0.19

4 months ago

1.0.18

4 months ago

1.0.17

4 months ago

1.0.16

5 months ago

1.0.22

4 months ago

1.0.21

4 months ago

1.0.20

4 months ago

1.0.23

4 months ago

1.0.15

5 months ago

1.0.14

5 months ago

1.0.11

6 months ago

1.0.10

5 months ago

1.0.13

5 months ago

1.0.12

5 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.5

11 months ago

1.0.6

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago