@websolutespa/bom-mixer-hooks 0.0.2 → 0.2.0
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.
- package/CHANGELOG.md +19 -7
- package/dist/index.d.ts +3 -3
- package/dist/index.js +11 -11
- package/dist/index.mjs +4 -4
- package/package.json +32 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
# @websolutespa/bom-mixer-hooks
|
|
2
|
-
|
|
3
|
-
## 0.0
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- Added:
|
|
1
|
+
# @websolutespa/bom-mixer-hooks
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added: splat routes.
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Added: @websolutespa/bom-core.
|
|
14
|
+
|
|
15
|
+
## 0.0.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Added: first release.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { RefObject, Dispatch, SetStateAction, MutableRefObject, ComponentProps, useEffect } from 'react';
|
|
3
|
-
import { FetchRequestOptions, ISchema, IEquatable } from '@websolutespa/bom-
|
|
3
|
+
import { FetchRequestOptions, ISchema, IEquatable, ILayout, IPage } from '@websolutespa/bom-core';
|
|
4
4
|
import * as zustand_middleware from 'zustand/middleware';
|
|
5
5
|
import { StateStorage } from 'zustand/middleware';
|
|
6
6
|
import * as zustand from 'zustand';
|
|
7
|
-
import { ICartItem, ICartAddItem, IAddressOptions, ICheckoutPartial, IFeatureType,
|
|
7
|
+
import { ICartItem, ICartAddItem, IAddressOptions, ICheckoutPartial, IFeatureType, IUser } from '@websolutespa/bom-mixer-models';
|
|
8
8
|
import { NextRouter } from 'next/router';
|
|
9
9
|
|
|
10
10
|
declare function useApiFetch<T = any>(pathname: string, options?: FetchRequestOptions): [T | undefined, boolean, any, React$1.Dispatch<any>];
|
|
@@ -217,7 +217,7 @@ type UseFiltersResultType<T> = {
|
|
|
217
217
|
itemsWithOmittedKeys: (...keys: string[]) => T[];
|
|
218
218
|
};
|
|
219
219
|
|
|
220
|
-
declare const createGenericContext: <T>() => readonly [() => NonNullable<T>, React$1.Provider<T | undefined>];
|
|
220
|
+
declare const createGenericContext: <T>(defaultContext?: T | null) => readonly [() => NonNullable<T>, React$1.Provider<T | undefined>];
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
* @desc Made compatible with {GeolocationPositionError} and {PositionError} cause
|
package/dist/index.js
CHANGED
|
@@ -168,12 +168,12 @@ __export(src_exports, {
|
|
|
168
168
|
module.exports = __toCommonJS(src_exports);
|
|
169
169
|
|
|
170
170
|
// src/useApi/useApi.ts
|
|
171
|
-
var
|
|
171
|
+
var import_bom_mixer_store = require("@websolutespa/bom-mixer-store");
|
|
172
172
|
|
|
173
173
|
// src/useHttp/useHttp.ts
|
|
174
|
-
var
|
|
174
|
+
var import_bom_core = require("@websolutespa/bom-core");
|
|
175
175
|
var import_react = require("react");
|
|
176
|
-
function useHttpFetch(pathname, options = { method: "GET" }, service =
|
|
176
|
+
function useHttpFetch(pathname, options = { method: "GET" }, service = import_bom_core.httpFetch, serviceOptions) {
|
|
177
177
|
const [response, setResponse] = (0, import_react.useState)();
|
|
178
178
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
179
179
|
const [error, setError] = (0, import_react.useState)(null);
|
|
@@ -196,8 +196,8 @@ function useHttpFetch(pathname, options = { method: "GET" }, service = import_bo
|
|
|
196
196
|
|
|
197
197
|
// src/useGenericContext/useGenericContext.ts
|
|
198
198
|
var import_react2 = require("react");
|
|
199
|
-
var createGenericContext = () => {
|
|
200
|
-
const genericContext = (0, import_react2.createContext)(
|
|
199
|
+
var createGenericContext = (defaultContext = null) => {
|
|
200
|
+
const genericContext = (0, import_react2.createContext)(defaultContext);
|
|
201
201
|
const useGenericContext = () => {
|
|
202
202
|
const context = (0, import_react2.useContext)(genericContext);
|
|
203
203
|
if (!context) {
|
|
@@ -218,7 +218,7 @@ function LayoutProvider({ children, layout }) {
|
|
|
218
218
|
// src/useApi/useApi.ts
|
|
219
219
|
function useApiFetch(pathname, options = {}) {
|
|
220
220
|
const layout = useLayout();
|
|
221
|
-
return useHttpFetch(pathname, options,
|
|
221
|
+
return useHttpFetch(pathname, options, import_bom_mixer_store.apiFetch, layout);
|
|
222
222
|
}
|
|
223
223
|
function useApiGet(pathname, options = {}) {
|
|
224
224
|
return useApiFetch(pathname, __spreadProps(__spreadValues({}, options), { method: "GET" }));
|
|
@@ -239,19 +239,19 @@ function useApi() {
|
|
|
239
239
|
const layout = useLayout();
|
|
240
240
|
return {
|
|
241
241
|
get: (_0, ..._1) => __async(this, [_0, ..._1], function* (pathname, options = {}) {
|
|
242
|
-
return (0,
|
|
242
|
+
return (0, import_bom_mixer_store.apiGet)(pathname, options, layout);
|
|
243
243
|
}),
|
|
244
244
|
post: (_0, _1, ..._2) => __async(this, [_0, _1, ..._2], function* (pathname, payload, options = {}) {
|
|
245
|
-
return (0,
|
|
245
|
+
return (0, import_bom_mixer_store.apiPost)(pathname, payload, options, layout);
|
|
246
246
|
}),
|
|
247
247
|
put: (_0, _1, ..._2) => __async(this, [_0, _1, ..._2], function* (pathname, payload, options = {}) {
|
|
248
|
-
return (0,
|
|
248
|
+
return (0, import_bom_mixer_store.apiPut)(pathname, payload, options, layout);
|
|
249
249
|
}),
|
|
250
250
|
patch: (_0, _1, ..._2) => __async(this, [_0, _1, ..._2], function* (pathname, payload, options = {}) {
|
|
251
|
-
return (0,
|
|
251
|
+
return (0, import_bom_mixer_store.apiPatch)(pathname, payload, options, layout);
|
|
252
252
|
}),
|
|
253
253
|
delete: (_0, ..._1) => __async(this, [_0, ..._1], function* (pathname, options = {}) {
|
|
254
|
-
return (0,
|
|
254
|
+
return (0, import_bom_mixer_store.apiDelete)(pathname, options, layout);
|
|
255
255
|
})
|
|
256
256
|
};
|
|
257
257
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -51,10 +51,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
// src/useApi/useApi.ts
|
|
54
|
-
import { apiDelete, apiFetch, apiGet, apiPatch, apiPost, apiPut } from "@websolutespa/bom-mixer-
|
|
54
|
+
import { apiDelete, apiFetch, apiGet, apiPatch, apiPost, apiPut } from "@websolutespa/bom-mixer-store";
|
|
55
55
|
|
|
56
56
|
// src/useHttp/useHttp.ts
|
|
57
|
-
import { httpFetch } from "@websolutespa/bom-
|
|
57
|
+
import { httpFetch } from "@websolutespa/bom-core";
|
|
58
58
|
import { useEffect, useState } from "react";
|
|
59
59
|
function useHttpFetch(pathname, options = { method: "GET" }, service = httpFetch, serviceOptions) {
|
|
60
60
|
const [response, setResponse] = useState();
|
|
@@ -79,8 +79,8 @@ function useHttpFetch(pathname, options = { method: "GET" }, service = httpFetch
|
|
|
79
79
|
|
|
80
80
|
// src/useGenericContext/useGenericContext.ts
|
|
81
81
|
import { createContext, useContext } from "react";
|
|
82
|
-
var createGenericContext = () => {
|
|
83
|
-
const genericContext = createContext(
|
|
82
|
+
var createGenericContext = (defaultContext = null) => {
|
|
83
|
+
const genericContext = createContext(defaultContext);
|
|
84
84
|
const useGenericContext = () => {
|
|
85
85
|
const context = useContext(genericContext);
|
|
86
86
|
if (!context) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/bom-mixer-hooks",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Mixer Hooks module of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bom",
|
|
7
7
|
"mixer",
|
|
@@ -12,41 +12,29 @@
|
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git://github.com/websolutespa/bom.git"
|
|
14
14
|
},
|
|
15
|
-
"prepack": {
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
|
-
"main": "./dist/index.js"
|
|
18
|
-
},
|
|
19
|
-
"postpack": {
|
|
20
|
-
"types": "./src/index.ts",
|
|
21
|
-
"main": "./src/index.ts"
|
|
22
|
-
},
|
|
23
|
-
"sideEffects": false,
|
|
24
|
-
"publishConfig": {
|
|
25
|
-
"access": "public"
|
|
26
|
-
},
|
|
27
15
|
"scripts": {
|
|
28
|
-
"build": "tsup ./src/index.ts --format esm,cjs --dts --external react",
|
|
29
16
|
"lint": "eslint *.ts*",
|
|
30
17
|
"test": "jest",
|
|
31
18
|
"test-watch": "npm test -- --watch",
|
|
32
19
|
"coverage:integration": "npm run test -- --coverage",
|
|
33
20
|
"coverage": "run-s -c --silent coverage:*",
|
|
34
|
-
"
|
|
21
|
+
"compile": "tsup ./src/index.ts --format esm,cjs --dts",
|
|
35
22
|
"prepack": "bom prepack",
|
|
36
23
|
"postpack": "bom postpack"
|
|
37
24
|
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
|
|
25
|
+
"dependencies": {},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@websolutespa/bom-core": "*",
|
|
40
28
|
"@websolutespa/bom-mixer-models": "*",
|
|
41
29
|
"@websolutespa/bom-mixer-store": "*",
|
|
42
|
-
"framer-motion": "
|
|
43
|
-
"iron-session": "
|
|
44
|
-
"next": "
|
|
45
|
-
"react-dom": "
|
|
46
|
-
"react": "
|
|
47
|
-
"styled-components": "
|
|
48
|
-
"swiper": "
|
|
49
|
-
"zustand": "
|
|
30
|
+
"framer-motion": ">= 7.2.1",
|
|
31
|
+
"iron-session": ">= 6.2.1",
|
|
32
|
+
"next": ">= 12.3.2",
|
|
33
|
+
"react-dom": ">= 18.2.0",
|
|
34
|
+
"react": ">= 18.2.0",
|
|
35
|
+
"styled-components": ">= 5.3.5",
|
|
36
|
+
"swiper": ">= 8.3.2",
|
|
37
|
+
"zustand": ">= 4.1.1"
|
|
50
38
|
},
|
|
51
39
|
"devDependencies": {
|
|
52
40
|
"@types/react": "^18.0.18",
|
|
@@ -55,15 +43,29 @@
|
|
|
55
43
|
"@websolutespa/bom-cli": "*",
|
|
56
44
|
"@websolutespa/test": "*",
|
|
57
45
|
"@websolutespa/tsconfig": "*",
|
|
58
|
-
"eslint": "^8.
|
|
46
|
+
"eslint": "^8.36.0",
|
|
59
47
|
"eslint-config-websolute": "*",
|
|
60
48
|
"npm-run-all": "^4.1.5",
|
|
61
49
|
"raw-loader": "^4.0.2",
|
|
62
50
|
"react": "^18.2.0",
|
|
63
51
|
"ts-node": "^10.9.1",
|
|
64
|
-
"tsup": "^6.
|
|
65
|
-
"typescript": "^4.8.
|
|
52
|
+
"tsup": "^6.7.0",
|
|
53
|
+
"typescript": "^4.8.4"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
58
|
+
"sideEffects": false,
|
|
59
|
+
"prepack": {
|
|
60
|
+
"types": "./dist/index.d.ts",
|
|
61
|
+
"main": "./dist/index.js",
|
|
62
|
+
"module": "./dist/index.mjs"
|
|
63
|
+
},
|
|
64
|
+
"postpack": {
|
|
65
|
+
"types": "./src/index.ts",
|
|
66
|
+
"main": "./src/index.ts"
|
|
66
67
|
},
|
|
67
68
|
"types": "./dist/index.d.ts",
|
|
68
|
-
"main": "./dist/index.js"
|
|
69
|
+
"main": "./dist/index.js",
|
|
70
|
+
"module": "./dist/index.mjs"
|
|
69
71
|
}
|