@wbsuite/react-hooks 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +62 -0
  2. package/package.json +28 -1
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ ## Installing wbsuite react hooks library
2
+ 1. Install dependency in your proyect by running `npm i @wbsuite/react-hooks`
3
+
4
+ ## How to use
5
+ 1. Set up wbsuite by running the `useWBSuite` hook with the api key you were given.
6
+
7
+ ```
8
+ function App() {
9
+ useWBSuite({ apiKey: '<your-api-key>' });
10
+ return <></>
11
+ }
12
+ ```
13
+
14
+ 2. You're ready to start using the hooks you need. This library version contains:
15
+ - useStores -- lists available stores for your team
16
+ - useProducts -- lists products available for your team
17
+ - useCategories -- lists categories available for your team
18
+ - useRenting -- renting utils
19
+ - useDocuments -- document / images utils
20
+ - useContact -- create leads for your campaigns, use this for contacts or whatever you need.
21
+
22
+ ### useCategories
23
+ This hook is used to list, get or create categories. In order to use it consider:
24
+
25
+ ```
26
+ const { list: listCategories } = useCategories();
27
+
28
+ useEffect(() => {
29
+ listCategories().then(categoryList => {
30
+ // Do what you need with the categoryList
31
+ });
32
+ }, []);
33
+ ```
34
+
35
+ ### useProducts
36
+ This hook is used to list, get or create products. In order to use it consider:
37
+
38
+ ```
39
+ const { list: listProducts } = useProducts();
40
+
41
+ useEffect(() => {
42
+ /** filters needs to be an object with any valid property of the product schema.
43
+ * for example to get the products from a category you need to pass in an object like:
44
+ * { categories: <categoryId>[] }
45
+ *
46
+ * { categories: ['some-category-id', 'other-category-id'] }
47
+ *
48
+ * The categoryId can be retrieved from the useCategories hook explained above.
49
+ **/
50
+ listProducts(filters ?? {}).then(filteredProductList => {
51
+ // Do what you need with the filteredProductList
52
+ });
53
+ }, []);
54
+ ```
55
+
56
+ ## Permissions
57
+ Even if the hooks are available in the library the `apiKey` limits the permissions you have
58
+ access to.
59
+
60
+ Which means, that you won't be able to use all of our features unless you were given access to.
61
+
62
+ If, you find yourself in need of using a non-accessible util, please reach out to the provider.
package/package.json CHANGED
@@ -1 +1,28 @@
1
- {"name":"@wbsuite/react-hooks","version":"1.0.0","description":"","main":"cjs/index.js","module":"esm/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","lint":"npx eslint src/**","build":"npm run build:esm && npm run build:cjs","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir dist/react-hooks/cjs","pre-publish":"npm run lint && rm -rf dist && npm run build && cp package*.json dist/react-hooks"},"author":"faluma@webbuilders.com.ar","license":"ISC","devDependencies":{"@wb/types":"^2.0.0","eslint":"^8.57.0","typescript":"^5.3.3","typescript-eslint":"^7.0.2","@eslint/js":"^8.57.0"},"dependencies":{"axios":"^1.6.7"}}
1
+ {
2
+ "name": "@wbsuite/react-hooks",
3
+ "version": "1.0.2",
4
+ "description": "",
5
+ "main": "cjs/index.js",
6
+ "module": "esm/index.js",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "lint": "npx eslint src/**",
10
+ "build": "npm run build:esm && npm run build:cjs",
11
+ "build:esm": "tsc",
12
+ "build:cjs": "tsc --module commonjs --outDir dist/react-hooks/cjs",
13
+ "pre-publish": "npm run lint && rm -rf dist && npm run build && cp package*.json dist/react-hooks && cp README.md dist/react-hooks",
14
+ "publish-to-npm": "cd dist/react-hooks && npm publish --access public --registry=https://registry.npmjs.org/"
15
+ },
16
+ "author": "faluma@webbuilders.com.ar",
17
+ "license": "ISC",
18
+ "devDependencies": {
19
+ "@wb/types": "^2.0.0",
20
+ "eslint": "^8.57.0",
21
+ "typescript": "^5.3.3",
22
+ "typescript-eslint": "^7.0.2",
23
+ "@eslint/js": "^8.57.0"
24
+ },
25
+ "dependencies": {
26
+ "axios": "^1.6.7"
27
+ }
28
+ }