@teamnovu/kit-shopware-composables 0.0.3 → 0.0.4
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/api-types/storeApiSchema.localhost.http +1 -1
- package/dist/helpers/checkout/index.d.ts +5 -0
- package/dist/helpers/checkout/useAddresses.d.ts +210 -0
- package/dist/helpers/checkout/useOrderDetails.d.ts +186 -0
- package/dist/helpers/checkout/useOrderPayment.d.ts +73 -0
- package/dist/helpers/checkout/usePaymentMethods.d.ts +155 -0
- package/dist/helpers/checkout/useShippingMethods.d.ts +173 -0
- package/dist/helpers/general/index.d.ts +2 -0
- package/dist/{usePagination.d.ts → helpers/general/usePagination.d.ts} +1 -1
- package/dist/{general → helpers/general}/useSeoUrl.d.ts +1 -1
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/product/index.d.ts +2 -0
- package/dist/helpers/product/useProductPrice.d.ts +61 -0
- package/dist/{products → helpers/product}/useProductVariantForOptions.d.ts +1 -1
- package/dist/helpers/user/index.d.ts +2 -0
- package/dist/helpers/user/useIsLoggedIn.d.ts +2 -0
- package/dist/helpers/user/useUser.d.ts +167 -0
- package/dist/index.d.ts +3 -221
- package/dist/index.mjs +851 -222
- package/dist/inject.d.ts +2 -2
- package/dist/keys.d.ts +32 -0
- package/dist/query/address/index.d.ts +3 -0
- package/dist/query/address/useCreateCustomerAddressMutation.d.ts +166 -0
- package/dist/query/address/useDeleteCustomerAddressMutation.d.ts +5 -0
- package/dist/query/address/useListAddressQuery.d.ts +48 -0
- package/dist/query/cart/index.d.ts +4 -0
- package/dist/query/cart/useAddLineItemMutation.d.ts +131 -0
- package/dist/query/cart/useReadCartQuery.d.ts +108 -0
- package/dist/query/cart/useRemoveLineItemMutation.d.ts +136 -0
- package/dist/query/cart/useUpdateLineItemMutation.d.ts +131 -0
- package/dist/query/checkout/index.d.ts +2 -0
- package/dist/query/checkout/useCheckout.d.ts +1 -0
- package/dist/query/checkout/useCreateOrderMutation.d.ts +281 -0
- package/dist/query/context/index.d.ts +2 -0
- package/dist/query/context/useReadContextQuery.d.ts +153 -0
- package/dist/query/context/useUpdateContextMutation.d.ts +60 -0
- package/dist/query/customer/index.d.ts +6 -0
- package/dist/query/customer/useChangeEmailMutation.d.ts +15 -0
- package/dist/query/customer/useChangeProfileMutation.d.ts +15 -0
- package/dist/query/customer/useLoginCustomerMutation.d.ts +30 -0
- package/dist/query/customer/useLogoutCustomerMutation.d.ts +15 -0
- package/dist/query/customer/useReadCustomerQuery.d.ts +220 -0
- package/dist/query/customer/useRegisterCustomerMutation.d.ts +266 -0
- package/dist/query/index.d.ts +10 -0
- package/dist/query/order/index.d.ts +1 -0
- package/dist/query/order/useReadOrderQuery.d.ts +44 -0
- package/dist/query/payment/index.d.ts +3 -0
- package/dist/query/payment/useHandlePaymentMutation.d.ts +15 -0
- package/dist/query/payment/useOrderSetPaymentMutation.d.ts +15 -0
- package/dist/query/payment/useReadPaymentMethodQuery.d.ts +31 -0
- package/dist/query/products/index.d.ts +3 -0
- package/dist/query/products/useReadCategoryListQuery.d.ts +48 -0
- package/dist/query/products/useReadCompactProductListingQuery.d.ts +35 -0
- package/dist/query/products/useReadCustomProductDetailQuery.d.ts +67 -0
- package/dist/query/shipping/index.d.ts +1 -0
- package/dist/query/shipping/useReadShippingMethodQuery.d.ts +55 -0
- package/dist/query/types/index.d.ts +2 -0
- package/dist/query/types/operations.d.ts +5 -0
- package/dist/query/types/query.d.ts +17 -0
- package/dist/util/index.d.ts +3 -0
- package/dist/util/unrefOptions.d.ts +4 -0
- package/dist/util/useOptimistic.d.ts +12 -0
- package/docs/index.md +457 -0
- package/docs/info.json +3 -0
- package/package.json +5 -1
- package/src/helpers/checkout/index.ts +5 -0
- package/src/helpers/checkout/useAddresses.ts +57 -0
- package/src/helpers/checkout/useOrderDetails.ts +94 -0
- package/src/helpers/checkout/useOrderPayment.ts +28 -0
- package/src/helpers/checkout/usePaymentMethods.ts +35 -0
- package/src/helpers/checkout/useShippingMethods.ts +35 -0
- package/src/helpers/general/index.ts +2 -0
- package/src/helpers/index.ts +4 -0
- package/src/helpers/product/index.ts +2 -0
- package/src/{products → helpers/product}/useProductPrice.ts +1 -43
- package/src/helpers/user/index.ts +2 -0
- package/src/helpers/user/useIsLoggedIn.ts +10 -0
- package/src/helpers/user/useUser.ts +53 -0
- package/src/index.ts +4 -29
- package/src/inject.ts +3 -3
- package/src/keys.ts +57 -0
- package/src/query/address/index.ts +3 -0
- package/src/query/address/useCreateCustomerAddressMutation.ts +32 -0
- package/src/query/address/useDeleteCustomerAddressMutation.ts +32 -0
- package/src/query/address/useListAddressQuery.ts +29 -0
- package/src/query/cart/index.ts +4 -0
- package/src/query/cart/useAddLineItemMutation.ts +45 -0
- package/src/query/cart/useReadCartQuery.ts +28 -0
- package/src/query/cart/useRemoveLineItemMutation.ts +32 -0
- package/src/query/cart/useUpdateLineItemMutation.ts +45 -0
- package/src/query/checkout/index.ts +2 -0
- package/src/query/checkout/useCheckout.ts +2 -0
- package/src/query/checkout/useCreateOrderMutation.ts +35 -0
- package/src/query/context/index.ts +2 -0
- package/src/query/context/useReadContextQuery.ts +19 -0
- package/src/query/context/useUpdateContextMutation.ts +36 -0
- package/src/query/customer/index.ts +6 -0
- package/src/query/customer/useChangeEmailMutation.ts +32 -0
- package/src/query/customer/useChangeProfileMutation.ts +32 -0
- package/src/query/customer/useLoginCustomerMutation.ts +42 -0
- package/src/query/customer/useLogoutCustomerMutation.ts +32 -0
- package/src/query/customer/useReadCustomerQuery.ts +27 -0
- package/src/query/customer/useRegisterCustomerMutation.ts +32 -0
- package/src/query/index.ts +10 -0
- package/src/query/order/index.ts +1 -0
- package/src/query/order/useReadOrderQuery.ts +33 -0
- package/src/query/payment/index.ts +3 -0
- package/src/query/payment/useHandlePaymentMutation.ts +27 -0
- package/src/query/payment/useOrderSetPaymentMutation.ts +32 -0
- package/src/query/payment/useReadPaymentMethodQuery.ts +30 -0
- package/src/query/products/index.ts +3 -0
- package/src/query/products/useReadCategoryListQuery.ts +28 -0
- package/src/query/products/useReadCompactProductListingQuery.ts +41 -0
- package/src/query/products/useReadCustomProductDetailQuery.ts +41 -0
- package/src/query/shipping/index.ts +1 -0
- package/src/query/shipping/useReadShippingMethodQuery.ts +29 -0
- package/src/query/types/index.ts +2 -0
- package/src/query/types/operations.ts +6 -0
- package/src/query/types/query.ts +39 -0
- package/src/util/index.ts +3 -0
- package/src/util/unrefOptions.ts +19 -0
- package/src/util/useOptimistic.ts +49 -0
- package/tsconfig.json +5 -2
- package/dist/cart/useCartAddItemMutation.d.ts +0 -12
- package/dist/cart/useCartQueryOptions.d.ts +0 -9
- package/dist/cart/useCartRemoveItemMutation.d.ts +0 -7
- package/dist/cart/useCartUpdateItemMutation.d.ts +0 -12
- package/dist/context/useContextOptions.d.ts +0 -9
- package/dist/context/useContextUpdate.d.ts +0 -4
- package/dist/products/useCategoryQueryOptions.d.ts +0 -17
- package/dist/products/useProductListingQueryOptions.d.ts +0 -19
- package/dist/products/useProductListingQueryOptions.test.d.ts +0 -1
- package/dist/products/useProductPrice.d.ts +0 -49
- package/dist/products/useProductQueryOptions.d.ts +0 -19
- package/dist/types/query.d.ts +0 -7
- package/src/cart/useCartAddItemMutation.ts +0 -48
- package/src/cart/useCartQueryOptions.ts +0 -19
- package/src/cart/useCartRemoveItemMutation.ts +0 -32
- package/src/cart/useCartUpdateItemMutation.ts +0 -48
- package/src/context/useContextOptions.ts +0 -16
- package/src/context/useContextUpdate.ts +0 -16
- package/src/products/useCategoryQueryOptions.ts +0 -25
- package/src/products/useProductListingQueryOptions.test.ts +0 -24
- package/src/products/useProductListingQueryOptions.ts +0 -29
- package/src/products/useProductQueryOptions.ts +0 -29
- package/src/types/query.ts +0 -18
- /package/src/{usePagination.ts → helpers/general/usePagination.ts} +0 -0
- /package/src/{general → helpers/general}/useSeoUrl.ts +0 -0
- /package/src/{products → helpers/product}/useProductVariantForOptions.ts +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { OperationOptions } from '../types/query';
|
|
2
|
+
import { UndefinedInitialQueryOptions, UseQueryReturnType } from '@tanstack/vue-query';
|
|
3
|
+
import { components, GenericRecord } from '../../../api-types/storeApiTypes';
|
|
4
|
+
declare const readCategoryListOperation = "readCategoryList post /category";
|
|
5
|
+
export declare const useReadCategoryListQueryOptions: (options?: OperationOptions<typeof readCategoryListOperation>) => UndefinedInitialQueryOptions<{
|
|
6
|
+
elements?: components["schemas"]["Category"][];
|
|
7
|
+
} & {
|
|
8
|
+
aggregations?: GenericRecord[];
|
|
9
|
+
entity?: string;
|
|
10
|
+
limit?: number;
|
|
11
|
+
page?: number;
|
|
12
|
+
total?: number;
|
|
13
|
+
}, Error, {
|
|
14
|
+
elements?: components["schemas"]["Category"][];
|
|
15
|
+
} & {
|
|
16
|
+
aggregations?: GenericRecord[];
|
|
17
|
+
entity?: string;
|
|
18
|
+
limit?: number;
|
|
19
|
+
page?: number;
|
|
20
|
+
total?: number;
|
|
21
|
+
}, readonly ["category", "list", {
|
|
22
|
+
readonly body: unknown;
|
|
23
|
+
}]> & {
|
|
24
|
+
queryKey: readonly ["category", "list", {
|
|
25
|
+
readonly body: unknown;
|
|
26
|
+
}] & {
|
|
27
|
+
[dataTagSymbol]: {
|
|
28
|
+
elements?: components["schemas"]["Category"][];
|
|
29
|
+
} & {
|
|
30
|
+
aggregations?: GenericRecord[];
|
|
31
|
+
entity?: string;
|
|
32
|
+
limit?: number;
|
|
33
|
+
page?: number;
|
|
34
|
+
total?: number;
|
|
35
|
+
};
|
|
36
|
+
[dataTagErrorSymbol]: Error;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare function useReadCategoryListQuery(options?: OperationOptions<typeof readCategoryListOperation>): UseQueryReturnType<{
|
|
40
|
+
elements?: components["schemas"]["Category"][];
|
|
41
|
+
} & {
|
|
42
|
+
aggregations?: GenericRecord[];
|
|
43
|
+
entity?: string;
|
|
44
|
+
limit?: number;
|
|
45
|
+
page?: number;
|
|
46
|
+
total?: number;
|
|
47
|
+
}, Error>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MaybeRef } from 'vue';
|
|
2
|
+
import { OperationOptions } from '../types/query';
|
|
3
|
+
import { UndefinedInitialQueryOptions, UseQueryReturnType } from '@tanstack/vue-query';
|
|
4
|
+
import { components } from '../../../api-types/storeApiTypes';
|
|
5
|
+
declare const readListingOperation = "readCompactProductListing post /novu/headless/product-listing/{seoUrl}";
|
|
6
|
+
export declare function useReadCompactProductListingQueryOptions(seoUrl: MaybeRef<string>, options?: OperationOptions<typeof readListingOperation, 'params'>): UndefinedInitialQueryOptions<{
|
|
7
|
+
apiAlias: "novuProductListing";
|
|
8
|
+
category: components["schemas"]["Category"];
|
|
9
|
+
listing: components["schemas"]["ProductListingResult"];
|
|
10
|
+
}, Error, {
|
|
11
|
+
apiAlias: "novuProductListing";
|
|
12
|
+
category: components["schemas"]["Category"];
|
|
13
|
+
listing: components["schemas"]["ProductListingResult"];
|
|
14
|
+
}, readonly ["product", "list", {
|
|
15
|
+
readonly url: MaybeRef<string>;
|
|
16
|
+
readonly body: unknown;
|
|
17
|
+
}]> & {
|
|
18
|
+
queryKey: readonly ["product", "list", {
|
|
19
|
+
readonly url: MaybeRef<string>;
|
|
20
|
+
readonly body: unknown;
|
|
21
|
+
}] & {
|
|
22
|
+
[dataTagSymbol]: {
|
|
23
|
+
apiAlias: "novuProductListing";
|
|
24
|
+
category: components["schemas"]["Category"];
|
|
25
|
+
listing: components["schemas"]["ProductListingResult"];
|
|
26
|
+
};
|
|
27
|
+
[dataTagErrorSymbol]: Error;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function useReadCompactProductListingQuery(seoUrl: MaybeRef<string>, options?: OperationOptions<typeof readListingOperation, 'params'>): UseQueryReturnType<{
|
|
31
|
+
apiAlias: "novuProductListing";
|
|
32
|
+
category: components["schemas"]["Category"];
|
|
33
|
+
listing: components["schemas"]["ProductListingResult"];
|
|
34
|
+
}, Error>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { MaybeRef } from 'vue';
|
|
2
|
+
import { OperationOptions } from '../types/query';
|
|
3
|
+
import { UndefinedInitialQueryOptions, UseQueryReturnType } from '@tanstack/vue-query';
|
|
4
|
+
import { components, GenericRecord } from '../../../api-types/storeApiTypes';
|
|
5
|
+
declare const readCustomProductDetailOperation = "readCustomProductDetail post /novu/headless/product/{seoUrl}";
|
|
6
|
+
export declare function useReadCustomProductDetailOptions(seoUrl: MaybeRef<string>, body?: OperationOptions<typeof readCustomProductDetailOperation, 'params'>): UndefinedInitialQueryOptions<{
|
|
7
|
+
apiAlias: "product_detail";
|
|
8
|
+
configurator: components["schemas"]["PropertyGroup"][];
|
|
9
|
+
cross_sellings: components["schemas"]["CrossSellingElementCollection"];
|
|
10
|
+
custom_fields: GenericRecord;
|
|
11
|
+
product: components["schemas"]["Product"] & {
|
|
12
|
+
extensions?: {
|
|
13
|
+
novuSeoUrls?: GenericRecord;
|
|
14
|
+
search?: GenericRecord;
|
|
15
|
+
variants?: components["schemas"]["Product"][];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}, Error, {
|
|
19
|
+
apiAlias: "product_detail";
|
|
20
|
+
configurator: components["schemas"]["PropertyGroup"][];
|
|
21
|
+
cross_sellings: components["schemas"]["CrossSellingElementCollection"];
|
|
22
|
+
custom_fields: GenericRecord;
|
|
23
|
+
product: components["schemas"]["Product"] & {
|
|
24
|
+
extensions?: {
|
|
25
|
+
novuSeoUrls?: GenericRecord;
|
|
26
|
+
search?: GenericRecord;
|
|
27
|
+
variants?: components["schemas"]["Product"][];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}, readonly ["product", "detail", {
|
|
31
|
+
readonly url: MaybeRef<string>;
|
|
32
|
+
readonly body: unknown;
|
|
33
|
+
}]> & {
|
|
34
|
+
queryKey: readonly ["product", "detail", {
|
|
35
|
+
readonly url: MaybeRef<string>;
|
|
36
|
+
readonly body: unknown;
|
|
37
|
+
}] & {
|
|
38
|
+
[dataTagSymbol]: {
|
|
39
|
+
apiAlias: "product_detail";
|
|
40
|
+
configurator: components["schemas"]["PropertyGroup"][];
|
|
41
|
+
cross_sellings: components["schemas"]["CrossSellingElementCollection"];
|
|
42
|
+
custom_fields: GenericRecord;
|
|
43
|
+
product: components["schemas"]["Product"] & {
|
|
44
|
+
extensions?: {
|
|
45
|
+
novuSeoUrls?: GenericRecord;
|
|
46
|
+
search?: GenericRecord;
|
|
47
|
+
variants?: components["schemas"]["Product"][];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
[dataTagErrorSymbol]: Error;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare function useReadCustomProductDetailQuery(seoUrl: MaybeRef<string>, body?: OperationOptions<typeof readCustomProductDetailOperation, 'params'>): UseQueryReturnType<{
|
|
55
|
+
apiAlias: "product_detail";
|
|
56
|
+
configurator: components["schemas"]["PropertyGroup"][];
|
|
57
|
+
cross_sellings: components["schemas"]["CrossSellingElementCollection"];
|
|
58
|
+
custom_fields: GenericRecord;
|
|
59
|
+
product: components["schemas"]["Product"] & {
|
|
60
|
+
extensions?: {
|
|
61
|
+
novuSeoUrls?: GenericRecord;
|
|
62
|
+
search?: GenericRecord;
|
|
63
|
+
variants?: components["schemas"]["Product"][];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}, Error>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useReadShippingMethodQuery';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { OperationOptions } from '../types/query';
|
|
2
|
+
import { UndefinedInitialQueryOptions, UseQueryReturnType } from '@tanstack/vue-query';
|
|
3
|
+
import { GenericRecord, components } from '../../../api-types/storeApiTypes';
|
|
4
|
+
export declare const readShippingMethodOperation = "readShippingMethod post /shipping-method";
|
|
5
|
+
export declare function useReadShippingMethodQueryOptions(options?: OperationOptions<typeof readShippingMethodOperation>): UndefinedInitialQueryOptions<{
|
|
6
|
+
aggregations?: GenericRecord;
|
|
7
|
+
elements: components["schemas"]["ShippingMethod"][];
|
|
8
|
+
total?: number;
|
|
9
|
+
} & {
|
|
10
|
+
aggregations?: GenericRecord[];
|
|
11
|
+
entity?: string;
|
|
12
|
+
limit?: number;
|
|
13
|
+
page?: number;
|
|
14
|
+
total?: number;
|
|
15
|
+
}, Error, {
|
|
16
|
+
aggregations?: GenericRecord;
|
|
17
|
+
elements: components["schemas"]["ShippingMethod"][];
|
|
18
|
+
total?: number;
|
|
19
|
+
} & {
|
|
20
|
+
aggregations?: GenericRecord[];
|
|
21
|
+
entity?: string;
|
|
22
|
+
limit?: number;
|
|
23
|
+
page?: number;
|
|
24
|
+
total?: number;
|
|
25
|
+
}, readonly ["shippingMethod", "list", {
|
|
26
|
+
readonly body: unknown;
|
|
27
|
+
}]> & {
|
|
28
|
+
queryKey: readonly ["shippingMethod", "list", {
|
|
29
|
+
readonly body: unknown;
|
|
30
|
+
}] & {
|
|
31
|
+
[dataTagSymbol]: {
|
|
32
|
+
aggregations?: GenericRecord;
|
|
33
|
+
elements: components["schemas"]["ShippingMethod"][];
|
|
34
|
+
total?: number;
|
|
35
|
+
} & {
|
|
36
|
+
aggregations?: GenericRecord[];
|
|
37
|
+
entity?: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
page?: number;
|
|
40
|
+
total?: number;
|
|
41
|
+
};
|
|
42
|
+
[dataTagErrorSymbol]: Error;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare function useReadShippingMethodQuery(options?: OperationOptions<typeof readShippingMethodOperation>): UseQueryReturnType<{
|
|
46
|
+
aggregations?: GenericRecord;
|
|
47
|
+
elements: components["schemas"]["ShippingMethod"][];
|
|
48
|
+
total?: number;
|
|
49
|
+
} & {
|
|
50
|
+
aggregations?: GenericRecord[];
|
|
51
|
+
entity?: string;
|
|
52
|
+
limit?: number;
|
|
53
|
+
page?: number;
|
|
54
|
+
total?: number;
|
|
55
|
+
}, Error>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { operations } from '../../../api-types/storeApiTypes.d.ts';
|
|
2
|
+
import { QueryKey, UseQueryOptions } from '@tanstack/vue-query';
|
|
3
|
+
import { OperationProp, OperationOptions as RawOperationOptions } from '@teamnovu/kit-shopware-api-client';
|
|
4
|
+
import { MaybeRef, UnwrapRef } from 'vue';
|
|
5
|
+
import { Operations } from './operations';
|
|
6
|
+
export type PartialProps<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
7
|
+
export type ShallowMaybeRefs<T> = {
|
|
8
|
+
[K in keyof T]: MaybeRef<T[K]>;
|
|
9
|
+
};
|
|
10
|
+
export type ShallowUnwrapRefs<T> = {
|
|
11
|
+
[K in keyof T]: UnwrapRef<T[K]>;
|
|
12
|
+
};
|
|
13
|
+
export type OperationKey = keyof operations;
|
|
14
|
+
export type OperationBody<K extends OperationKey> = OperationProp<Operations, K, 'body'>;
|
|
15
|
+
export type OperationResponse<K extends OperationKey> = OperationProp<Operations, K, 'response'>;
|
|
16
|
+
export type OperationOptions<K extends OperationKey, OmitKeys extends keyof RawOperationOptions<Operations, K> = never> = MaybeRef<ShallowMaybeRefs<PartialProps<RawOperationOptions<Operations, K>, OmitKeys>>>;
|
|
17
|
+
export type Options<K extends OperationKey, QK extends QueryKey = QueryKey> = UseQueryOptions<OperationResponse<K>, Error, OperationResponse<K>, OperationResponse<K>, QK>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { OperationOptions as RawOperationOptions } from '@teamnovu/kit-shopware-api-client';
|
|
2
|
+
import { OperationOptions, PartialProps } from '../query/types/query';
|
|
3
|
+
import { Operations } from '../query/types';
|
|
4
|
+
export declare function unrefOptions<K extends keyof Operations, OmitKeys extends keyof RawOperationOptions<Operations, K> = never>(options: OperationOptions<K, OmitKeys> | undefined): PartialProps<RawOperationOptions<Operations, K>, OmitKeys>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QueryKey, UseMutationOptions } from '@tanstack/vue-query';
|
|
2
|
+
export declare function useOptimistic<CacheValue, UpdateValue>(queryKey: QueryKey, updateFn: (newValue: UpdateValue, oldValue: CacheValue) => CacheValue, options?: UseMutationOptions<unknown, unknown, UpdateValue, unknown>): {
|
|
3
|
+
onMutate: (newValue: UpdateValue) => Promise<{
|
|
4
|
+
previousValue: CacheValue | undefined;
|
|
5
|
+
}>;
|
|
6
|
+
onError: (err: unknown, newValue: UpdateValue, context: {
|
|
7
|
+
previousValue?: CacheValue;
|
|
8
|
+
} | undefined) => void;
|
|
9
|
+
onSettled: (data: unknown, error: unknown, variables: UpdateValue, context: {
|
|
10
|
+
previousValue?: CacheValue;
|
|
11
|
+
} | undefined) => void;
|
|
12
|
+
};
|