@websolutespa/bom-mixer-hooks 1.7.4 → 1.8.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 +18 -0
- package/dist/index.d.ts +4 -83
- package/dist/index.js +114 -333
- package/dist/index.mjs +31 -242
- package/package.json +2 -3
- package/src/index.ts +0 -4
- package/src/useApi/useApi.test.tsx +3 -3
- package/src/useBreakpoint/useBreakpoint.default.ts +275 -0
- package/src/useBreakpoint/useBreakpoint.test.tsx +1 -1
- package/src/useCollectionApi/local.collection.ts +2 -2
- package/src/useCollectionApi/useCollectionApi.test.tsx +3 -3
- package/src/useCurrency/useCurrency.test.tsx +1 -1
- package/src/useDateTimeFormat/useDateTimeFormat.test.tsx +1 -1
- package/src/useFilters/filter.ts +0 -1
- package/src/useFilters/useFilters.ts +2 -2
- package/src/useHttp/useHttp.test.tsx +1 -1
- package/src/useLabel/useLabel.test.tsx +1 -1
- package/src/useLayout/useLayout.default.ts +252 -0
- package/src/useLayout/useLayout.test.tsx +2 -2
- package/src/useNumber/useNumber.test.tsx +1 -1
- package/src/usePage/usePage.default.ts +19 -0
- package/src/usePage/usePage.test.tsx +1 -1
- package/src/useUnit/useUnit.test.tsx +1 -1
- package/src/useCart/useCart.test.tsx +0 -89
- package/src/useCart/useCart.tsx +0 -129
- package/src/useCheckout/useCheckout.test.tsx +0 -53
- package/src/useCheckout/useCheckout.tsx +0 -92
- package/src/useSwiperIndex/useSwiperIndex.ts +0 -30
- package/src/useUser/useUser.test.ts +0 -22
- package/src/useUser/useUser.ts +0 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @websolutespa/bom-mixer-hooks
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f8a1d97: Modified: removed sample hooks
|
|
8
|
+
- Updated dependencies [f8a1d97]
|
|
9
|
+
- @websolutespa/bom-mixer-models@1.8.0
|
|
10
|
+
- @websolutespa/bom-mixer-store@1.8.0
|
|
11
|
+
- @websolutespa/bom-core@1.8.0
|
|
12
|
+
|
|
13
|
+
## 1.7.5
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Added: getRemoteApiRequestOptions, getLocalApiRequestOptions
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @websolutespa/bom-mixer-store@1.7.7
|
|
20
|
+
|
|
3
21
|
## 1.7.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { RefObject, Dispatch, SetStateAction, CSSProperties, MutableRefObject, ComponentProps, useEffect } from 'react';
|
|
3
3
|
import { ApiRequestOptions } from '@websolutespa/bom-mixer-store';
|
|
4
|
-
import
|
|
5
|
-
import * as zustand_middleware from 'zustand/middleware';
|
|
6
|
-
import { StateStorage } from 'zustand/middleware';
|
|
4
|
+
import { QueryParams, IEquatable, IFeatureType, ILabel, ILocalizable, ILayout, IPage } from '@websolutespa/bom-core';
|
|
7
5
|
import * as zustand from 'zustand';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
+
import { ILazyModules } from '@websolutespa/bom-mixer-models';
|
|
10
8
|
import { NextRouter } from 'next/router';
|
|
11
9
|
|
|
12
10
|
declare function useApiFetch<T = unknown>(pathname: string, options?: ApiRequestOptions): [T | undefined, boolean, any, react.Dispatch<any>];
|
|
@@ -45,70 +43,6 @@ type Breakpoint = {
|
|
|
45
43
|
type MediaQuery = Record<BreakpointType, CSSProperties['width']>;
|
|
46
44
|
declare function useBreakpoint(mediaQuery?: MediaQuery): Breakpoint;
|
|
47
45
|
|
|
48
|
-
type CartProps = {
|
|
49
|
-
hydrated: boolean;
|
|
50
|
-
items: ICartItem[];
|
|
51
|
-
};
|
|
52
|
-
type CartActions = {
|
|
53
|
-
count(): number;
|
|
54
|
-
has(item: ISchema): boolean;
|
|
55
|
-
find(item: ISchema): ICartItem | undefined;
|
|
56
|
-
add(item: ICartAddItem, qty?: number): void;
|
|
57
|
-
remove(item: ISchema): number;
|
|
58
|
-
update(item: ICartItem): void;
|
|
59
|
-
clear(): void;
|
|
60
|
-
};
|
|
61
|
-
type CartState = CartProps & {
|
|
62
|
-
actions: CartActions;
|
|
63
|
-
};
|
|
64
|
-
declare const CartContext: react.Context<(Omit<zustand.StoreApi<CartState>, "persist"> & {
|
|
65
|
-
persist: {
|
|
66
|
-
setOptions: (options: Partial<zustand_middleware.PersistOptions<CartState, unknown>>) => void;
|
|
67
|
-
clearStorage: () => void;
|
|
68
|
-
rehydrate: () => void | Promise<void>;
|
|
69
|
-
hasHydrated: () => boolean;
|
|
70
|
-
onHydrate: (fn: (state: CartState) => void) => () => void;
|
|
71
|
-
onFinishHydration: (fn: (state: CartState) => void) => () => void;
|
|
72
|
-
getOptions: () => Partial<zustand_middleware.PersistOptions<CartState, unknown>>;
|
|
73
|
-
};
|
|
74
|
-
}) | null>;
|
|
75
|
-
type CartProviderProps = React.PropsWithChildren<{
|
|
76
|
-
items?: ICartItem[];
|
|
77
|
-
storage?: StateStorage;
|
|
78
|
-
}>;
|
|
79
|
-
declare function CartProvider({ children, ...props }: CartProviderProps): react_jsx_runtime.JSX.Element;
|
|
80
|
-
declare function useCart<T>(selector: (state: CartState) => T): T;
|
|
81
|
-
|
|
82
|
-
type CheckoutProps = {
|
|
83
|
-
hydrated: boolean;
|
|
84
|
-
data: IAddressOptions;
|
|
85
|
-
checkout: ICheckoutPartial;
|
|
86
|
-
};
|
|
87
|
-
type CheckoutActions = {
|
|
88
|
-
setCheckout(checkout: ICheckoutPartial): void;
|
|
89
|
-
};
|
|
90
|
-
type CheckoutState = CheckoutProps & {
|
|
91
|
-
actions: CheckoutActions;
|
|
92
|
-
};
|
|
93
|
-
declare const CheckoutContext: react.Context<(Omit<zustand.StoreApi<CheckoutState>, "persist"> & {
|
|
94
|
-
persist: {
|
|
95
|
-
setOptions: (options: Partial<zustand_middleware.PersistOptions<CheckoutState, unknown>>) => void;
|
|
96
|
-
clearStorage: () => void;
|
|
97
|
-
rehydrate: () => void | Promise<void>;
|
|
98
|
-
hasHydrated: () => boolean;
|
|
99
|
-
onHydrate: (fn: (state: CheckoutState) => void) => () => void;
|
|
100
|
-
onFinishHydration: (fn: (state: CheckoutState) => void) => () => void;
|
|
101
|
-
getOptions: () => Partial<zustand_middleware.PersistOptions<CheckoutState, unknown>>;
|
|
102
|
-
};
|
|
103
|
-
}) | null>;
|
|
104
|
-
type CheckoutProviderProps = React.PropsWithChildren<{
|
|
105
|
-
data: IAddressOptions;
|
|
106
|
-
checkout?: ICheckoutPartial;
|
|
107
|
-
storage?: StateStorage;
|
|
108
|
-
}>;
|
|
109
|
-
declare function CheckoutProvider({ children, ...props }: CheckoutProviderProps): react_jsx_runtime.JSX.Element;
|
|
110
|
-
declare function useCheckout<T>(selector: (state: CheckoutState) => T): T;
|
|
111
|
-
|
|
112
46
|
declare function useClickAnyWhere(handler: (event: MouseEvent) => void): void;
|
|
113
47
|
|
|
114
48
|
type ClickOutGetContainer = () => HTMLElement | null;
|
|
@@ -591,8 +525,6 @@ declare function useSorting<T>(items_: T[], callback_: (items: T[], sort?: IEqua
|
|
|
591
525
|
setSort: (sort?: IEquatable) => void;
|
|
592
526
|
};
|
|
593
527
|
|
|
594
|
-
declare function useSwiperIndex(): [number, (index: number) => void];
|
|
595
|
-
|
|
596
528
|
/**
|
|
597
529
|
* Like `useRef`, but it returns immutable ref that contains actual value.
|
|
598
530
|
*
|
|
@@ -611,21 +543,10 @@ declare function useUnit(unit?: string, locale?: string): (value: number) => str
|
|
|
611
543
|
*/
|
|
612
544
|
declare function useUnmountEffect(effect: CallableFunction): void;
|
|
613
545
|
|
|
614
|
-
type UserState = {
|
|
615
|
-
user?: IUser;
|
|
616
|
-
};
|
|
617
|
-
type UserActions = {
|
|
618
|
-
setUser: (user?: IUser) => void;
|
|
619
|
-
};
|
|
620
|
-
type UserStore = UserState & {
|
|
621
|
-
actions: UserActions;
|
|
622
|
-
};
|
|
623
|
-
declare const useUser: zustand.UseBoundStore<zustand.StoreApi<UserStore>>;
|
|
624
|
-
|
|
625
546
|
type WindowSize = {
|
|
626
547
|
width: number;
|
|
627
548
|
height: number;
|
|
628
549
|
};
|
|
629
550
|
declare function useWindowSize(): WindowSize;
|
|
630
551
|
|
|
631
|
-
export { BodyScrollOptions,
|
|
552
|
+
export { BodyScrollOptions, ClickOutGetContainer, CurrentStateType, ElementStackItem, ExtraProvider, Filter, FilterMode, FilterParams, FilterValues, GeoLocationSensorState, IExtra, IFilter, IFilterOption, IGeolocationPositionError, ILabelContext, ILayoutContext, ILazyModulesContext, IPageContext, IPaginationInfo, IParams, IParamsEncoded, IParamsQs, IUseSearchParamsEncodedResult, IUseSearchParamsQsResult, IUseSearchParamsResult, IUseSearchParamsValueResult, KeyCode, KeyMod, KeyboardOptions, KeyboardResult, LabelProvider, LabelService, LayoutProvider, LazyModulesProvider, PageProvider, SSRState, SizeResult, SizeType, Sorting, UIReducer, UIValue, UseFiltersResultType, UseKeyboard, UseKeyboardHandler, createElementWithId, createGenericContext, detectIsBrowser, filtersToParams, getCurrentPosition, getFilteredItems, getFilters, getOwnerPaddingRight, getOwnerScrollbarWidth, getPagedItems, getPaginationInfo, getRealSize, getSearchParams, getSearchParamsEncoded, getSearchParamsQs, getUID, hasGeolocation, isElement, isPaginationInfo, localCollectionDelete, localCollectionFetch, localCollectionGet, localCollectionPatch, localCollectionPost, localCollectionPut, parseLabel, parseParams, pushSearchParams, pushSearchParamsEncoded, pushSearchParamsQs, replaceSearchParams, replaceSearchParamsEncoded, replaceSearchParamsEncodedSilently, replaceSearchParamsQs, replaceSearchParamsQsSilently, replaceSearchParamsSilently, scrollToRelativeY, scrollToSelector, scrollToY, setFilters, updateSearchParams, updateSearchParamsEncoded, updateSearchParamsQs, useApi, useApiDelete, useApiFetch, useApiGet, useApiPatch, useApiPost, useApiPut, useBodyScroll, useBreakpoint, useClickAnyWhere, useClickOut, useCollectionApi, useCollectionApiDelete, useCollectionApiGet, useCollectionApiPatch, useCollectionApiPost, useCollectionApiPut, useCurrency, useCurrentState, useDateTimeFormat, useDebounce, useDebounceCallback, useDebugChangedProps, useDomObserver, useDrawer, useElementSize, useEventListener, useExtra, useFilters, useGeolocation, useIdle, useInfiniteLoader, useIntersectionObserver, useIsomorphicLayoutEffect, useKeyboard, useLabel, useLayout, useLazyModules, useModal, useMounted, useNumber, usePage, usePagination, usePortal, usePrevious, useRealSize, useResize, useSSR, useScroll, useScrollTo, useScrolled, useSearchParams, useSearchParamsEncoded, useSearchParamsQs, useSearchParamsValue, useSorting, useSyncedRef, useUI, useUnit, useUnmountEffect, useWindowSize };
|