nextemos 2.0.2 → 2.1.1
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/dist/helpers/fetchRequest.d.ts +22 -0
- package/dist/helpers/fetchRequest.js +104 -0
- package/dist/helpers/index.d.ts +0 -0
- package/dist/helpers/index.js +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +11 -0
- package/dist/hooks/useFetch.d.ts +21 -0
- package/dist/hooks/useFetch.js +79 -0
- package/dist/hooks/useLocalStorage.d.ts +9 -0
- package/dist/hooks/useLocalStorage.js +48 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -137
- package/dist/interfaces/banner.d.ts +83 -0
- package/dist/interfaces/banner.js +2 -0
- package/dist/interfaces/elements.d.ts +66 -0
- package/dist/interfaces/elements.js +2 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/interfaces/index.js +19 -0
- package/dist/interfaces/response.d.ts +64 -0
- package/dist/interfaces/response.js +2 -0
- package/package.json +2 -3
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface APIResponse<T = any> {
|
|
2
|
+
data?: T;
|
|
3
|
+
error?: string;
|
|
4
|
+
status: number;
|
|
5
|
+
}
|
|
6
|
+
type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE';
|
|
7
|
+
interface RequestOptions extends RequestInit {
|
|
8
|
+
url: string;
|
|
9
|
+
method: HTTPMethod;
|
|
10
|
+
params?: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a HTTP client for making requests.
|
|
14
|
+
* @returns {object} HTTP client with methods for making requests.
|
|
15
|
+
*/
|
|
16
|
+
declare const fetchRequest: () => {
|
|
17
|
+
get: <T>(url: string, options?: Omit<RequestOptions, 'method'>) => Promise<APIResponse<T>>;
|
|
18
|
+
post: <T_1>(url: string, data: any, options?: Omit<RequestOptions, 'method'>) => Promise<APIResponse<T_1>>;
|
|
19
|
+
put: <T_2>(url: string, data: any, options?: Omit<RequestOptions, 'method'>) => Promise<APIResponse<T_2>>;
|
|
20
|
+
delete: <T_3>(url: string, options?: Omit<RequestOptions, 'method'>) => Promise<APIResponse<T_3>>;
|
|
21
|
+
};
|
|
22
|
+
export default fetchRequest;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
/**
|
|
24
|
+
* Creates a HTTP client for making requests.
|
|
25
|
+
* @returns {object} HTTP client with methods for making requests.
|
|
26
|
+
*/
|
|
27
|
+
const fetchRequest = () => {
|
|
28
|
+
/**
|
|
29
|
+
* Makes an HTTP request using fetch.
|
|
30
|
+
* @template T
|
|
31
|
+
* @param {RequestOptions} options - Request options.
|
|
32
|
+
* @returns {Promise<APIResponse<T>>} Response from the API.
|
|
33
|
+
*/
|
|
34
|
+
const request = (_a) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
var { url, method, params } = _a, requestOptions = __rest(_a, ["url", "method", "params"]);
|
|
36
|
+
const apiURL = new URL(url); // Assuming url already contains apiUrl and apiVersion
|
|
37
|
+
if (params) {
|
|
38
|
+
Object.keys(params).forEach(key => apiURL.searchParams.append(key, params[key]));
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const response = yield fetch(apiURL.toString(), Object.assign(Object.assign({}, requestOptions), { method }));
|
|
42
|
+
const responseData = yield response.json().catch(() => ({}));
|
|
43
|
+
if (!response.ok) {
|
|
44
|
+
const errorMessage = (responseData === null || responseData === void 0 ? void 0 : responseData.message) || 'Something went wrong!';
|
|
45
|
+
console.error(`Error: ${response.status} - ${errorMessage}`);
|
|
46
|
+
return { status: response.status, error: errorMessage };
|
|
47
|
+
}
|
|
48
|
+
return { status: response.status, data: responseData };
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('HTTP request failed:', error);
|
|
52
|
+
return { status: 500, error: 'Internal Server Error' };
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Makes a GET request.
|
|
57
|
+
* @template T
|
|
58
|
+
* @param {string} url - Endpoint URL.
|
|
59
|
+
* @param {RequestOptions} [options] - Request options.
|
|
60
|
+
* @returns {Promise<APIResponse<T>>} Response from the API.
|
|
61
|
+
*/
|
|
62
|
+
const get = (url, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
return yield request(Object.assign(Object.assign({}, options), { method: 'GET', url }));
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Makes a POST request.
|
|
67
|
+
* @template T
|
|
68
|
+
* @param {string} url - Endpoint URL.
|
|
69
|
+
* @param {any} data - Request payload.
|
|
70
|
+
* @param {RequestOptions} [options] - Request options.
|
|
71
|
+
* @returns {Promise<APIResponse<T>>} Response from the API.
|
|
72
|
+
*/
|
|
73
|
+
const post = (url, data, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
+
return yield request(Object.assign(Object.assign({}, options), { method: 'POST', url, body: data }));
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* Makes a PUT request.
|
|
78
|
+
* @template T
|
|
79
|
+
* @param {string} url - Endpoint URL.
|
|
80
|
+
* @param {any} data - Request payload.
|
|
81
|
+
* @param {RequestOptions} [options] - Request options.
|
|
82
|
+
* @returns {Promise<APIResponse<T>>} Response from the API.
|
|
83
|
+
*/
|
|
84
|
+
const put = (url, data, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
+
return yield request(Object.assign(Object.assign({}, options), { method: 'PUT', url, body: data }));
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* Makes a DELETE request.
|
|
89
|
+
* @template T
|
|
90
|
+
* @param {string} url - Endpoint URL.
|
|
91
|
+
* @param {RequestOptions} [options] - Request options.
|
|
92
|
+
* @returns {Promise<APIResponse<T>>} Response from the API.
|
|
93
|
+
*/
|
|
94
|
+
const remove = (url, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
+
return yield request(Object.assign(Object.assign({}, options), { method: 'DELETE', url }));
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
get,
|
|
99
|
+
post,
|
|
100
|
+
put,
|
|
101
|
+
delete: remove,
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
exports.default = fetchRequest;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useLocalStorage = exports.useFetch = void 0;
|
|
7
|
+
/// hooks
|
|
8
|
+
var useFetch_1 = require("./useFetch");
|
|
9
|
+
Object.defineProperty(exports, "useFetch", { enumerable: true, get: function () { return __importDefault(useFetch_1).default; } });
|
|
10
|
+
var useLocalStorage_1 = require("./useLocalStorage");
|
|
11
|
+
Object.defineProperty(exports, "useLocalStorage", { enumerable: true, get: function () { return __importDefault(useLocalStorage_1).default; } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for the fetch props.
|
|
3
|
+
*/
|
|
4
|
+
interface IFetchProps {
|
|
5
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
6
|
+
url: string;
|
|
7
|
+
requestOptions?: RequestInit;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Custom hook for making HTTP requests using the fetch API.
|
|
11
|
+
*
|
|
12
|
+
* @param {IFetchProps} param0 - The fetch props.
|
|
13
|
+
* @returns {Object} - An object containing the response, loading state, error, and refetch function.
|
|
14
|
+
*/
|
|
15
|
+
declare const useFetch: <T>({ method, url, requestOptions }: IFetchProps) => {
|
|
16
|
+
response: T | null;
|
|
17
|
+
loading: boolean;
|
|
18
|
+
error: string | null;
|
|
19
|
+
refetch: () => void;
|
|
20
|
+
};
|
|
21
|
+
export default useFetch;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
/**
|
|
14
|
+
* Custom hook for making HTTP requests using the fetch API.
|
|
15
|
+
*
|
|
16
|
+
* @param {IFetchProps} param0 - The fetch props.
|
|
17
|
+
* @returns {Object} - An object containing the response, loading state, error, and refetch function.
|
|
18
|
+
*/
|
|
19
|
+
const useFetch = ({ method = "GET", url, requestOptions = {} }) => {
|
|
20
|
+
// State for storing the response data.
|
|
21
|
+
const [response, setResponse] = (0, react_1.useState)(null);
|
|
22
|
+
// State for tracking the loading state.
|
|
23
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
24
|
+
// State for storing the error message.
|
|
25
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
26
|
+
// State for triggering a refetch.
|
|
27
|
+
const [reload, setReload] = (0, react_1.useState)(0);
|
|
28
|
+
/**
|
|
29
|
+
* Function for triggering a refetch.
|
|
30
|
+
*/
|
|
31
|
+
const refetch = () => setReload((prev) => prev + 1);
|
|
32
|
+
(0, react_1.useEffect)(() => {
|
|
33
|
+
// Create an AbortController instance to cancel the fetch request if needed.
|
|
34
|
+
const controller = new AbortController();
|
|
35
|
+
const signal = controller.signal;
|
|
36
|
+
/**
|
|
37
|
+
* Function for fetching the data.
|
|
38
|
+
*/
|
|
39
|
+
const fetchData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
setLoading(true);
|
|
41
|
+
try {
|
|
42
|
+
// Make the fetch request with the provided method, URL, and options.
|
|
43
|
+
const res = yield fetch(url, Object.assign(Object.assign({ method: method.toUpperCase() }, requestOptions), { signal }));
|
|
44
|
+
// Check if the response is not OK and throw an error.
|
|
45
|
+
if (!res.ok) {
|
|
46
|
+
throw new Error(`Error: ${res.statusText}`);
|
|
47
|
+
}
|
|
48
|
+
// Parse the response data as JSON.
|
|
49
|
+
const data = yield res.json();
|
|
50
|
+
// Update the response state with the fetched data.
|
|
51
|
+
setResponse(data);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
// Handle any errors that occur during the fetch request.
|
|
55
|
+
if (error instanceof Error) {
|
|
56
|
+
setError(error.message);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
setError('An unknown error occurred');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
setLoading(false);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
// Call the fetchData function.
|
|
67
|
+
fetchData();
|
|
68
|
+
// Cleanup function to abort the fetch request if the component unmounts or the dependencies change.
|
|
69
|
+
return () => controller.abort();
|
|
70
|
+
}, [url, method, requestOptions, reload]);
|
|
71
|
+
// Return the response, loading state, error, and refetch function.
|
|
72
|
+
return {
|
|
73
|
+
response,
|
|
74
|
+
loading,
|
|
75
|
+
error,
|
|
76
|
+
refetch
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
exports.default = useFetch;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook that synchronizes state with localStorage.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} key - The key to store the value under in localStorage.
|
|
5
|
+
* @param {any} initialValue - The initial value to use if the key does not exist in localStorage.
|
|
6
|
+
* @returns {[any, function]} - The current value stored in localStorage and a function to update it.
|
|
7
|
+
*/
|
|
8
|
+
declare const useLocalStorage: (key: string, initialValue: any) => any[];
|
|
9
|
+
export default useLocalStorage;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
/**
|
|
5
|
+
* Custom hook that synchronizes state with localStorage.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} key - The key to store the value under in localStorage.
|
|
8
|
+
* @param {any} initialValue - The initial value to use if the key does not exist in localStorage.
|
|
9
|
+
* @returns {[any, function]} - The current value stored in localStorage and a function to update it.
|
|
10
|
+
*/
|
|
11
|
+
const useLocalStorage = (key, initialValue) => {
|
|
12
|
+
// Initialize the state with a function to read from localStorage or use the initial value
|
|
13
|
+
const [storedValue, setStoredValue] = (0, react_1.useState)(() => {
|
|
14
|
+
try {
|
|
15
|
+
// Attempt to get the item from localStorage using the key
|
|
16
|
+
const item = window.localStorage.getItem(key);
|
|
17
|
+
// If the item exists, parse it from JSON; otherwise, return the initial value
|
|
18
|
+
return item ? JSON.parse(item) : initialValue;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
// Log any errors and return the initial value
|
|
22
|
+
console.error(error);
|
|
23
|
+
return initialValue;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Function to update the state and localStorage.
|
|
28
|
+
*
|
|
29
|
+
* @param {any} value - The new value to store, or a function that returns the new value.
|
|
30
|
+
*/
|
|
31
|
+
const setValue = (value) => {
|
|
32
|
+
try {
|
|
33
|
+
// Determine the new value to store, supporting functional updates
|
|
34
|
+
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
35
|
+
// Update the state with the new value
|
|
36
|
+
setStoredValue(valueToStore);
|
|
37
|
+
// Store the new value in localStorage as a JSON string
|
|
38
|
+
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
// Log any errors that occur during the update
|
|
42
|
+
console.error(error);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
// Return the current value and the function to update it
|
|
46
|
+
return [storedValue, setValue];
|
|
47
|
+
};
|
|
48
|
+
exports.default = useLocalStorage;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
|
@@ -1,140 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
7
|
}
|
|
20
|
-
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
15
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
var __copyProps = (to, from, except, desc) => {
|
|
28
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
-
for (let key of __getOwnPropNames(from))
|
|
30
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
-
}
|
|
33
|
-
return to;
|
|
34
|
-
};
|
|
35
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
-
var __async = (__this, __arguments, generator) => {
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
var fulfilled = (value) => {
|
|
39
|
-
try {
|
|
40
|
-
step(generator.next(value));
|
|
41
|
-
} catch (e) {
|
|
42
|
-
reject(e);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var rejected = (value) => {
|
|
46
|
-
try {
|
|
47
|
-
step(generator.throw(value));
|
|
48
|
-
} catch (e) {
|
|
49
|
-
reject(e);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
53
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// src/index.ts
|
|
58
|
-
var src_exports = {};
|
|
59
|
-
__export(src_exports, {
|
|
60
|
-
useFetch: () => useFetch_default,
|
|
61
|
-
useLocalStorage: () => useLocalStorage_default
|
|
62
|
-
});
|
|
63
|
-
module.exports = __toCommonJS(src_exports);
|
|
64
|
-
|
|
65
|
-
// src/hooks/useFetch.ts
|
|
66
|
-
var import_react = require("react");
|
|
67
|
-
var useFetch = ({ method = "GET", url, requestOptions = {} }) => {
|
|
68
|
-
const [response, setResponse] = (0, import_react.useState)(null);
|
|
69
|
-
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
70
|
-
const [error, setError] = (0, import_react.useState)(null);
|
|
71
|
-
const [reload, setReload] = (0, import_react.useState)(0);
|
|
72
|
-
const refetch = () => setReload((prev) => prev + 1);
|
|
73
|
-
(0, import_react.useEffect)(() => {
|
|
74
|
-
const controller = new AbortController();
|
|
75
|
-
const signal = controller.signal;
|
|
76
|
-
const fetchData = () => __async(void 0, null, function* () {
|
|
77
|
-
setLoading(true);
|
|
78
|
-
try {
|
|
79
|
-
const res = yield fetch(url, __spreadProps(__spreadValues({
|
|
80
|
-
method: method.toUpperCase()
|
|
81
|
-
}, requestOptions), {
|
|
82
|
-
signal
|
|
83
|
-
}));
|
|
84
|
-
if (!res.ok) {
|
|
85
|
-
throw new Error(`Error: ${res.statusText}`);
|
|
86
|
-
}
|
|
87
|
-
const data = yield res.json();
|
|
88
|
-
setResponse(data);
|
|
89
|
-
} catch (error2) {
|
|
90
|
-
if (error2 instanceof Error) {
|
|
91
|
-
setError(error2.message);
|
|
92
|
-
} else {
|
|
93
|
-
setError("An unknown error occurred");
|
|
94
|
-
}
|
|
95
|
-
} finally {
|
|
96
|
-
setLoading(false);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
fetchData();
|
|
100
|
-
return () => controller.abort();
|
|
101
|
-
}, [url, method, requestOptions, reload]);
|
|
102
|
-
return {
|
|
103
|
-
response,
|
|
104
|
-
loading,
|
|
105
|
-
error,
|
|
106
|
-
refetch
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
var useFetch_default = useFetch;
|
|
110
|
-
|
|
111
|
-
// src/hooks/useLocalStorage.ts
|
|
112
|
-
var import_react2 = require("react");
|
|
113
|
-
var useLocalStorage = (key, initialValue) => {
|
|
114
|
-
const [storedValue, setStoredValue] = (0, import_react2.useState)(() => {
|
|
115
|
-
try {
|
|
116
|
-
const item = window.localStorage.getItem(key);
|
|
117
|
-
return item ? JSON.parse(item) : initialValue;
|
|
118
|
-
} catch (error) {
|
|
119
|
-
console.error(error);
|
|
120
|
-
return initialValue;
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
const setValue = (value) => {
|
|
124
|
-
try {
|
|
125
|
-
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
126
|
-
setStoredValue(valueToStore);
|
|
127
|
-
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
128
|
-
} catch (error) {
|
|
129
|
-
console.error(error);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
return [storedValue, setValue];
|
|
133
|
-
};
|
|
134
|
-
var useLocalStorage_default = useLocalStorage;
|
|
135
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
136
|
-
0 && (module.exports = {
|
|
137
|
-
useFetch,
|
|
138
|
-
useLocalStorage
|
|
139
|
-
});
|
|
140
|
-
//# sourceMappingURL=index.js.map
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// export * from './helpers';
|
|
18
|
+
__exportStar(require("./hooks"), exports);
|
|
19
|
+
__exportStar(require("./interfaces"), exports);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { IResponse, IResponsePaging } from './response';
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing a response containing multiple banners with pagination information.
|
|
4
|
+
* Extends IResponsePaging to inherit properties related to response status and pagination.
|
|
5
|
+
*/
|
|
6
|
+
export interface IBannersResponse extends IResponsePaging {
|
|
7
|
+
/**
|
|
8
|
+
* An array of Banner objects representing the banners retrieved in the response.
|
|
9
|
+
*/
|
|
10
|
+
banners: Banner[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Interface representing a response containing a single banner.
|
|
14
|
+
* Extends IResponse to inherit properties related to response status.
|
|
15
|
+
*/
|
|
16
|
+
export interface IBannerResponse extends IResponse {
|
|
17
|
+
/**
|
|
18
|
+
* The Banner object representing the banner retrieved in the response.
|
|
19
|
+
*/
|
|
20
|
+
banner: Banner;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Interface representing the structure of a banner object.
|
|
24
|
+
*/
|
|
25
|
+
interface Banner {
|
|
26
|
+
/**
|
|
27
|
+
* Unique identifier for the banner.
|
|
28
|
+
*/
|
|
29
|
+
id: number;
|
|
30
|
+
/**
|
|
31
|
+
* Identifier for the tenant associated with the banner.
|
|
32
|
+
*/
|
|
33
|
+
tenantId: string;
|
|
34
|
+
/**
|
|
35
|
+
* Identifier for the template used by the banner.
|
|
36
|
+
*/
|
|
37
|
+
templateId: number;
|
|
38
|
+
/**
|
|
39
|
+
* URL link to the banner image.
|
|
40
|
+
*/
|
|
41
|
+
imageLink: string;
|
|
42
|
+
/**
|
|
43
|
+
* Key identifier for the banner.
|
|
44
|
+
*/
|
|
45
|
+
key: string;
|
|
46
|
+
/**
|
|
47
|
+
* Indicates whether the banner is approved.
|
|
48
|
+
*/
|
|
49
|
+
isApproved: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Additional extension data associated with the banner.
|
|
52
|
+
*/
|
|
53
|
+
extensionData: Object;
|
|
54
|
+
/**
|
|
55
|
+
* Identifier for the content item associated with the banner.
|
|
56
|
+
*/
|
|
57
|
+
contentItemId: number;
|
|
58
|
+
/**
|
|
59
|
+
* Identifier for the content type of the banner.
|
|
60
|
+
*/
|
|
61
|
+
contentTypeId: number;
|
|
62
|
+
/**
|
|
63
|
+
* External identifier for the banner.
|
|
64
|
+
*/
|
|
65
|
+
externalId: number;
|
|
66
|
+
/**
|
|
67
|
+
* Optional target URL link for the banner.
|
|
68
|
+
*/
|
|
69
|
+
targetLink?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Name or title of the banner.
|
|
72
|
+
*/
|
|
73
|
+
name: string;
|
|
74
|
+
/**
|
|
75
|
+
* Optional description or details about the banner.
|
|
76
|
+
*/
|
|
77
|
+
description?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Order or priority of the banner.
|
|
80
|
+
*/
|
|
81
|
+
order: number;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @interface IDiv
|
|
4
|
+
*/
|
|
5
|
+
export interface IDiv extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @interface IButton
|
|
9
|
+
*/
|
|
10
|
+
export interface IButton extends React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @interface IElement
|
|
14
|
+
*/
|
|
15
|
+
export interface IElement extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @interface ILink
|
|
19
|
+
*/
|
|
20
|
+
export interface ILink extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @interface IInput
|
|
24
|
+
*/
|
|
25
|
+
export interface IInput extends React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @interface ITextarea
|
|
29
|
+
*/
|
|
30
|
+
export interface ITextarea extends React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @interface ISelect
|
|
34
|
+
*/
|
|
35
|
+
export interface ISelect extends React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @interface IOption
|
|
39
|
+
*/
|
|
40
|
+
export interface IOption extends React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement> {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @interface ILiElement
|
|
44
|
+
*/
|
|
45
|
+
export interface ILiElement extends React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @interface IUlElement
|
|
49
|
+
*/
|
|
50
|
+
export interface IUlElement extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement> {
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @interface IParagraph
|
|
54
|
+
*/
|
|
55
|
+
export interface IParagraph extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement> {
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @interface IHeading
|
|
59
|
+
*/
|
|
60
|
+
export interface IHeading extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement> {
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @interface ITable
|
|
64
|
+
*/
|
|
65
|
+
export interface ITable extends React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement> {
|
|
66
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/// interfaces
|
|
18
|
+
__exportStar(require("./elements"), exports);
|
|
19
|
+
__exportStar(require("./banner"), exports);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The IResponse interface represents the structure of a standard response object returned by an API.
|
|
3
|
+
* It contains various properties to convey the success status, additional messages, and scripts to be executed on the client side.
|
|
4
|
+
*/
|
|
5
|
+
export interface IResponse {
|
|
6
|
+
/**
|
|
7
|
+
* Indicates whether the API request was successful (true) or not (false).
|
|
8
|
+
*/
|
|
9
|
+
isSuccess: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* A string representing the status code of the API response. This can be used to convey specific success or error codes.
|
|
12
|
+
*/
|
|
13
|
+
statusCode: string;
|
|
14
|
+
/**
|
|
15
|
+
* A message providing additional details about the response. This can be used for error messages or success confirmations.
|
|
16
|
+
*/
|
|
17
|
+
message: string;
|
|
18
|
+
/**
|
|
19
|
+
* A script to be executed on the client side after the response is processed. This could be JavaScript code for dynamic updates or other purposes.
|
|
20
|
+
*/
|
|
21
|
+
script: string;
|
|
22
|
+
/**
|
|
23
|
+
* A script to be inserted and executed in the <head> section of the HTML document. This is useful for scripts that need to be loaded before the rest of the page content.
|
|
24
|
+
*/
|
|
25
|
+
headerScript: string;
|
|
26
|
+
/**
|
|
27
|
+
* A script to be inserted and executed at the end of the HTML document, typically before the closing </body> tag. This is useful for scripts that depend on the DOM being fully loaded.
|
|
28
|
+
*/
|
|
29
|
+
footerScript: string;
|
|
30
|
+
/**
|
|
31
|
+
* A string indicating whether the environment should be refreshed. This can be used to trigger a reload or reset of certain parts of the application.
|
|
32
|
+
*/
|
|
33
|
+
refreshEnvironment: string;
|
|
34
|
+
/**
|
|
35
|
+
* An array of strings representing tags associated with the response. Tags can be used for categorization, filtering, or other metadata purposes.
|
|
36
|
+
*/
|
|
37
|
+
tags: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The IResponsePaging interface extends the IResponse interface to include additional properties for handling paginated responses.
|
|
41
|
+
* This is useful for responses that return large datasets spread across multiple pages.
|
|
42
|
+
*/
|
|
43
|
+
export interface IResponsePaging extends IResponse {
|
|
44
|
+
/**
|
|
45
|
+
* The total number of items available across all pages. This is useful for understanding the size of the dataset.
|
|
46
|
+
*/
|
|
47
|
+
totalItems: number;
|
|
48
|
+
/**
|
|
49
|
+
* The number of items taken (or returned) in the current response. This typically corresponds to the page size or a subset of it.
|
|
50
|
+
*/
|
|
51
|
+
taked: number;
|
|
52
|
+
/**
|
|
53
|
+
* The number of items skipped from the beginning of the dataset. This is useful for determining the starting point of the current page of data.
|
|
54
|
+
*/
|
|
55
|
+
skipped: number;
|
|
56
|
+
/**
|
|
57
|
+
* The number of items to be displayed per page. This helps in controlling the amount of data shown on each page.
|
|
58
|
+
*/
|
|
59
|
+
pageSize: number;
|
|
60
|
+
/**
|
|
61
|
+
* The current page number being displayed. This helps in navigating through the paginated dataset.
|
|
62
|
+
*/
|
|
63
|
+
currentPage: number;
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextemos",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "For helpers and hooks used in NextJS projects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"clean": "rimraf dist",
|
|
20
20
|
"prebuild": "npm run clean",
|
|
21
|
-
"build": "
|
|
21
|
+
"build": "tsc",
|
|
22
22
|
"preversion": "npm run build",
|
|
23
23
|
"version": "npm publish"
|
|
24
24
|
},
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"react": "^18.3.1",
|
|
30
30
|
"react-dom": "^18.3.1",
|
|
31
31
|
"rimraf": "^5.0.7",
|
|
32
|
-
"tsup": "^8.1.0",
|
|
33
32
|
"typescript": "^5.4.5"
|
|
34
33
|
},
|
|
35
34
|
"peerDependencies": {
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/hooks/useFetch.ts","../src/hooks/useLocalStorage.ts"],"sourcesContent":["// export * from './helpers';\nexport * from './hooks';\nexport * from './interfaces';","import { useState, useEffect } from \"react\";\n\n/**\n * Interface for the fetch props.\n */\ninterface IFetchProps {\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS';\n url: string;\n requestOptions?: RequestInit;\n}\n\n/**\n * Custom hook for making HTTP requests using the fetch API.\n *\n * @param {IFetchProps} param0 - The fetch props.\n * @returns {Object} - An object containing the response, loading state, error, and refetch function.\n */\nconst useFetch = <T,>({ method = \"GET\", url, requestOptions = {} }: IFetchProps) => {\n // State for storing the response data.\n const [response, setResponse] = useState<T | null>(null);\n\n // State for tracking the loading state.\n const [loading, setLoading] = useState<boolean>(true);\n\n // State for storing the error message.\n const [error, setError] = useState<string | null>(null);\n\n // State for triggering a refetch.\n const [reload, setReload] = useState<number>(0);\n\n /**\n * Function for triggering a refetch.\n */\n const refetch = () => setReload((prev: number) => prev + 1);\n\n useEffect(() => {\n // Create an AbortController instance to cancel the fetch request if needed.\n const controller = new AbortController();\n const signal = controller.signal;\n\n /**\n * Function for fetching the data.\n */\n const fetchData = async () => {\n setLoading(true);\n try {\n // Make the fetch request with the provided method, URL, and options.\n const res = await fetch(url, {\n method: method.toUpperCase(),\n ...requestOptions,\n signal\n });\n\n // Check if the response is not OK and throw an error.\n if (!res.ok) {\n throw new Error(`Error: ${res.statusText}`);\n }\n\n // Parse the response data as JSON.\n const data = await res.json() as T;\n\n // Update the response state with the fetched data.\n setResponse(data);\n } catch (error) {\n // Handle any errors that occur during the fetch request.\n if (error instanceof Error) {\n setError(error.message);\n } else {\n setError('An unknown error occurred');\n }\n } finally {\n setLoading(false);\n }\n };\n\n // Call the fetchData function.\n fetchData();\n\n // Cleanup function to abort the fetch request if the component unmounts or the dependencies change.\n return () => controller.abort();\n }, [url, method, requestOptions, reload]);\n\n // Return the response, loading state, error, and refetch function.\n return {\n response,\n loading,\n error,\n refetch\n };\n}\n\nexport default useFetch;\n","import { useState } from 'react';\n\n/**\n * Custom hook that synchronizes state with localStorage.\n *\n * @param {string} key - The key to store the value under in localStorage.\n * @param {any} initialValue - The initial value to use if the key does not exist in localStorage.\n * @returns {[any, function]} - The current value stored in localStorage and a function to update it.\n */\nconst useLocalStorage = (key: string, initialValue: any) => {\n // Initialize the state with a function to read from localStorage or use the initial value\n const [storedValue, setStoredValue] = useState(() => {\n try {\n // Attempt to get the item from localStorage using the key\n const item = window.localStorage.getItem(key);\n // If the item exists, parse it from JSON; otherwise, return the initial value\n return item ? JSON.parse(item) : initialValue;\n } catch (error) {\n // Log any errors and return the initial value\n console.error(error);\n return initialValue;\n }\n });\n\n /**\n * Function to update the state and localStorage.\n *\n * @param {any} value - The new value to store, or a function that returns the new value.\n */\n const setValue = (value: any) => {\n try {\n // Determine the new value to store, supporting functional updates\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n // Update the state with the new value\n setStoredValue(valueToStore);\n // Store the new value in localStorage as a JSON string\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n } catch (error) {\n // Log any errors that occur during the update\n console.error(error);\n }\n };\n\n // Return the current value and the function to update it\n return [storedValue, setValue];\n};\n\nexport default useLocalStorage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoC;AAiBpC,IAAM,WAAW,CAAK,EAAE,SAAS,OAAO,KAAK,iBAAiB,CAAC,EAAE,MAAmB;AAEhF,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAmB,IAAI;AAGvD,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAkB,IAAI;AAGpD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAwB,IAAI;AAGtD,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAiB,CAAC;AAK9C,QAAM,UAAU,MAAM,UAAU,CAAC,SAAiB,OAAO,CAAC;AAE1D,8BAAU,MAAM;AAEZ,UAAM,aAAa,IAAI,gBAAgB;AACvC,UAAM,SAAS,WAAW;AAK1B,UAAM,YAAY,MAAY;AAC1B,iBAAW,IAAI;AACf,UAAI;AAEA,cAAM,MAAM,MAAM,MAAM,KAAK;AAAA,UACzB,QAAQ,OAAO,YAAY;AAAA,WACxB,iBAFsB;AAAA,UAGzB;AAAA,QACJ,EAAC;AAGD,YAAI,CAAC,IAAI,IAAI;AACT,gBAAM,IAAI,MAAM,UAAU,IAAI,UAAU,EAAE;AAAA,QAC9C;AAGA,cAAM,OAAO,MAAM,IAAI,KAAK;AAG5B,oBAAY,IAAI;AAAA,MACpB,SAASA,QAAO;AAEZ,YAAIA,kBAAiB,OAAO;AACxB,mBAASA,OAAM,OAAO;AAAA,QAC1B,OAAO;AACH,mBAAS,2BAA2B;AAAA,QACxC;AAAA,MACJ,UAAE;AACE,mBAAW,KAAK;AAAA,MACpB;AAAA,IACJ;AAGA,cAAU;AAGV,WAAO,MAAM,WAAW,MAAM;AAAA,EAClC,GAAG,CAAC,KAAK,QAAQ,gBAAgB,MAAM,CAAC;AAGxC,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;AAEA,IAAO,mBAAQ;;;AC3Ff,IAAAC,gBAAyB;AASzB,IAAM,kBAAkB,CAAC,KAAa,iBAAsB;AAExD,QAAM,CAAC,aAAa,cAAc,QAAI,wBAAS,MAAM;AACjD,QAAI;AAEA,YAAM,OAAO,OAAO,aAAa,QAAQ,GAAG;AAE5C,aAAO,OAAO,KAAK,MAAM,IAAI,IAAI;AAAA,IACrC,SAAS,OAAO;AAEZ,cAAQ,MAAM,KAAK;AACnB,aAAO;AAAA,IACX;AAAA,EACJ,CAAC;AAOD,QAAM,WAAW,CAAC,UAAe;AAC7B,QAAI;AAEA,YAAM,eAAe,iBAAiB,WAAW,MAAM,WAAW,IAAI;AAEtE,qBAAe,YAAY;AAE3B,aAAO,aAAa,QAAQ,KAAK,KAAK,UAAU,YAAY,CAAC;AAAA,IACjE,SAAS,OAAO;AAEZ,cAAQ,MAAM,KAAK;AAAA,IACvB;AAAA,EACJ;AAGA,SAAO,CAAC,aAAa,QAAQ;AACjC;AAEA,IAAO,0BAAQ;","names":["error","import_react"]}
|