@websolutespa/bom-mixer-hooks 0.0.2 → 0.1.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 +13 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -9
- package/dist/index.mjs +2 -2
- package/package.json +33 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
# @websolutespa/bom-mixer-hooks
|
|
2
|
-
|
|
3
|
-
## 0.0
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- Added:
|
|
1
|
+
# @websolutespa/bom-mixer-hooks
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added: @websolutespa/bom-core.
|
|
8
|
+
|
|
9
|
+
## 0.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 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>];
|
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);
|
|
@@ -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();
|
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.1.0",
|
|
4
|
+
"description": "Mixer Hooks module of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bom",
|
|
7
7
|
"mixer",
|
|
@@ -12,41 +12,30 @@
|
|
|
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
25
|
"dependencies": {
|
|
39
|
-
"@websolutespa/bom-
|
|
26
|
+
"@websolutespa/bom-core": "*",
|
|
40
27
|
"@websolutespa/bom-mixer-models": "*",
|
|
41
|
-
"@websolutespa/bom-mixer-store": "*"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
28
|
+
"@websolutespa/bom-mixer-store": "*"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"framer-motion": ">= 7.2.1",
|
|
32
|
+
"iron-session": ">= 6.2.1",
|
|
33
|
+
"next": ">= 12.3.2",
|
|
34
|
+
"react-dom": ">= 18.2.0",
|
|
35
|
+
"react": ">= 18.2.0",
|
|
36
|
+
"styled-components": ">= 5.3.5",
|
|
37
|
+
"swiper": ">= 8.3.2",
|
|
38
|
+
"zustand": ">= 4.1.1"
|
|
50
39
|
},
|
|
51
40
|
"devDependencies": {
|
|
52
41
|
"@types/react": "^18.0.18",
|
|
@@ -55,15 +44,29 @@
|
|
|
55
44
|
"@websolutespa/bom-cli": "*",
|
|
56
45
|
"@websolutespa/test": "*",
|
|
57
46
|
"@websolutespa/tsconfig": "*",
|
|
58
|
-
"eslint": "^8.
|
|
47
|
+
"eslint": "^8.36.0",
|
|
59
48
|
"eslint-config-websolute": "*",
|
|
60
49
|
"npm-run-all": "^4.1.5",
|
|
61
50
|
"raw-loader": "^4.0.2",
|
|
62
51
|
"react": "^18.2.0",
|
|
63
52
|
"ts-node": "^10.9.1",
|
|
64
|
-
"tsup": "^6.
|
|
65
|
-
"typescript": "^4.8.
|
|
53
|
+
"tsup": "^6.7.0",
|
|
54
|
+
"typescript": "^4.8.4"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"sideEffects": false,
|
|
60
|
+
"prepack": {
|
|
61
|
+
"types": "./dist/index.d.ts",
|
|
62
|
+
"main": "./dist/index.js",
|
|
63
|
+
"module": "./dist/index.mjs"
|
|
64
|
+
},
|
|
65
|
+
"postpack": {
|
|
66
|
+
"types": "./src/index.ts",
|
|
67
|
+
"main": "./src/index.ts"
|
|
66
68
|
},
|
|
67
69
|
"types": "./dist/index.d.ts",
|
|
68
|
-
"main": "./dist/index.js"
|
|
70
|
+
"main": "./dist/index.js",
|
|
71
|
+
"module": "./dist/index.mjs"
|
|
69
72
|
}
|