@plasmicpkgs/commerce 0.0.52 → 0.0.53
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/commerce.cjs.development.js +16 -6
- package/dist/commerce.cjs.development.js.map +1 -1
- package/dist/commerce.cjs.production.min.js +1 -1
- package/dist/commerce.cjs.production.min.js.map +1 -1
- package/dist/commerce.esm.js +16 -6
- package/dist/commerce.esm.js.map +1 -1
- package/dist/utils/types.d.ts +2 -0
- package/dist/utils/use-data.d.ts +2 -1
- package/dist/utils/use-hook.d.ts +1 -0
- package/package.json +2 -2
package/dist/utils/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SWRConfiguration } from 'swr';
|
|
2
2
|
import type { CommerceError } from './errors';
|
|
3
3
|
import type { ResponseState } from './use-data';
|
|
4
|
+
import { Provider } from '../commerce';
|
|
4
5
|
/**
|
|
5
6
|
* Returns the properties in T with the properties in type K, overriding properties defined in T
|
|
6
7
|
*/
|
|
@@ -28,6 +29,7 @@ export declare type HookFetcherContext<H extends HookSchemaBase> = {
|
|
|
28
29
|
options: HookFetcherOptions;
|
|
29
30
|
input: H['fetcherInput'];
|
|
30
31
|
fetch: <T = H['fetchData'] extends {} | null ? H['fetchData'] : any, B = H['body']>(options: FetcherOptions<B>) => Promise<T>;
|
|
32
|
+
provider?: Provider;
|
|
31
33
|
};
|
|
32
34
|
export declare type HookFetcherOptions = {
|
|
33
35
|
method?: string;
|
package/dist/utils/use-data.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SWRResponse } from "swr";
|
|
2
|
+
import { Provider } from "../commerce";
|
|
2
3
|
import { CommerceError } from "./errors";
|
|
3
4
|
import type { Fetcher, HookFetcherFn, HookFetcherOptions, HookFetchInput, HookSWRInput, SWRHookSchemaBase, SwrOptions } from "./types";
|
|
4
5
|
export declare type ResponseState<Result> = SWRResponse<Result, CommerceError> & {
|
|
@@ -7,6 +8,6 @@ export declare type ResponseState<Result> = SWRResponse<Result, CommerceError> &
|
|
|
7
8
|
export declare type UseData = <H extends SWRHookSchemaBase>(options: {
|
|
8
9
|
fetchOptions: HookFetcherOptions;
|
|
9
10
|
fetcher: HookFetcherFn<H>;
|
|
10
|
-
}, input: HookFetchInput | HookSWRInput, fetcherFn: Fetcher, swrOptions?: SwrOptions<H["data"], H["fetcherInput"]
|
|
11
|
+
}, input: HookFetchInput | HookSWRInput, fetcherFn: Fetcher, swrOptions?: SwrOptions<H["data"], H["fetcherInput"]>, provider?: Provider) => ResponseState<H["data"]>;
|
|
11
12
|
declare const useData: UseData;
|
|
12
13
|
export default useData;
|
package/dist/utils/use-hook.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Provider } from '../commerce';
|
|
2
2
|
import type { MutationHook, PickRequired, SWRHook } from './types';
|
|
3
3
|
export declare function useFetcher(): import("./types").Fetcher<any, any>;
|
|
4
|
+
export declare function useProvider(): Provider;
|
|
4
5
|
export declare function useHook<P extends Provider, H extends MutationHook<any> | SWRHook<any>>(fn: (provider: P) => H): H;
|
|
5
6
|
export declare function useSWRHook<H extends SWRHook<any>>(hook: PickRequired<H, 'fetcher'>): (input?: any) => any;
|
|
6
7
|
export declare function useMutationHook<H extends MutationHook<any>>(hook: PickRequired<H, 'fetcher'>): (input?: any) => (input?: any) => any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/commerce",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"description": "Plasmic registration calls for commerce components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"react-hook-form": "^7.28.0",
|
|
43
43
|
"swr": "^1.2.2"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "cd0d2b042c5bf1ee300065cea2efb6bec58a0830"
|
|
46
46
|
}
|