@teamnovu/kit-shopware-composables 0.0.22 → 0.0.24
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/index.mjs +384 -354
- package/dist/keys.d.ts +4 -1
- package/dist/query/products/index.d.ts +1 -0
- package/dist/query/products/useReadProductDetailQuery.d.ts +18 -0
- package/package.json +1 -1
- package/src/keys.ts +9 -1
- package/src/query/products/index.ts +1 -0
- package/src/query/products/useReadProductDetailQuery.ts +38 -0
- package/src/query/products/useReadProductQuery.ts +1 -1
package/dist/keys.d.ts
CHANGED
|
@@ -37,7 +37,10 @@ export declare const productKeys: {
|
|
|
37
37
|
readonly url: MaybeRef<string>;
|
|
38
38
|
readonly body: unknown;
|
|
39
39
|
}];
|
|
40
|
-
|
|
40
|
+
headlessDetail: (body: MaybeRef<unknown>) => readonly ["product", "detail", {
|
|
41
|
+
readonly body: unknown;
|
|
42
|
+
}];
|
|
43
|
+
detail: (productId: MaybeRef<string>, body: MaybeRef<unknown>) => readonly ["product", "detail", MaybeRef<string>, {
|
|
41
44
|
readonly body: unknown;
|
|
42
45
|
}];
|
|
43
46
|
search: (body: MaybeRef<unknown>) => readonly ["product", "search", {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OperationOptions } from '../types/query';
|
|
2
|
+
import { MaybeRef } from 'vue';
|
|
3
|
+
import { UndefinedInitialQueryOptions, UseQueryReturnType } from '@tanstack/vue-query';
|
|
4
|
+
import { BrandedResponse } from '@teamnovu/kit-shopware-api-client';
|
|
5
|
+
import { Operations } from '..';
|
|
6
|
+
declare const readProductDetailOperation = "readProductDetail post /product/{productId}";
|
|
7
|
+
export declare function useReadProductDetailQueryOptions(productId: MaybeRef<string>, body?: OperationOptions<typeof readProductDetailOperation, 'params'>): UndefinedInitialQueryOptions<BrandedResponse<Operations, "readProductDetail post /product/{productId}">, Error, BrandedResponse<Operations, "readProductDetail post /product/{productId}">, readonly ["product", "detail", MaybeRef<string>, {
|
|
8
|
+
readonly body: unknown;
|
|
9
|
+
}]> & {
|
|
10
|
+
queryKey: readonly ["product", "detail", MaybeRef<string>, {
|
|
11
|
+
readonly body: unknown;
|
|
12
|
+
}] & {
|
|
13
|
+
[dataTagSymbol]: BrandedResponse<Operations, "readProductDetail post /product/{productId}">;
|
|
14
|
+
[dataTagErrorSymbol]: Error;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare function useReadProductDetailQuery(productId: MaybeRef<string>, body?: OperationOptions<typeof readProductDetailOperation, 'params'>): UseQueryReturnType<BrandedResponse<Operations, "readProductDetail post /product/{productId}">, Error>;
|
|
18
|
+
export {};
|
package/package.json
CHANGED
package/src/keys.ts
CHANGED
|
@@ -66,9 +66,17 @@ export const productKeys = {
|
|
|
66
66
|
body,
|
|
67
67
|
},
|
|
68
68
|
] as const,
|
|
69
|
-
|
|
69
|
+
headlessDetail: (body: MaybeRef<unknown>) =>
|
|
70
|
+
[
|
|
71
|
+
...productKeys.details(),
|
|
72
|
+
{
|
|
73
|
+
body,
|
|
74
|
+
},
|
|
75
|
+
] as const,
|
|
76
|
+
detail: (productId: MaybeRef<string>, body: MaybeRef<unknown>) =>
|
|
70
77
|
[
|
|
71
78
|
...productKeys.details(),
|
|
79
|
+
productId,
|
|
72
80
|
{
|
|
73
81
|
body,
|
|
74
82
|
},
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { queryOptions, useQuery } from '@tanstack/vue-query'
|
|
2
|
+
import { useShopwareQueryClient } from '../../inject'
|
|
3
|
+
import { productKeys } from '../../keys'
|
|
4
|
+
import { unrefOptions } from '../../util/unrefOptions'
|
|
5
|
+
import type { OperationKey, OperationOptions } from '../types/query'
|
|
6
|
+
import { unref, type MaybeRef } from 'vue'
|
|
7
|
+
|
|
8
|
+
const readProductDetailOperation = 'readProductDetail post /product/{productId}' satisfies OperationKey
|
|
9
|
+
|
|
10
|
+
export function useReadProductDetailQueryOptions(
|
|
11
|
+
productId: MaybeRef<string>,
|
|
12
|
+
body?: OperationOptions<typeof readProductDetailOperation, 'params'>,
|
|
13
|
+
) {
|
|
14
|
+
const client = useShopwareQueryClient()
|
|
15
|
+
const queryKey = productKeys.detail(productId, body)
|
|
16
|
+
|
|
17
|
+
return queryOptions({
|
|
18
|
+
queryKey,
|
|
19
|
+
queryFn: async ({ signal }) => {
|
|
20
|
+
const opts = unrefOptions(body)
|
|
21
|
+
return client.query(readProductDetailOperation, {
|
|
22
|
+
...opts,
|
|
23
|
+
params: {
|
|
24
|
+
...opts.params,
|
|
25
|
+
productId: unref(productId),
|
|
26
|
+
},
|
|
27
|
+
signal,
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function useReadProductDetailQuery(
|
|
34
|
+
productId: MaybeRef<string>,
|
|
35
|
+
body?: OperationOptions<typeof readProductDetailOperation, 'params'>,
|
|
36
|
+
) {
|
|
37
|
+
return useQuery(useReadProductDetailQueryOptions(productId, body))
|
|
38
|
+
}
|
|
@@ -10,7 +10,7 @@ export function useReadProductQueryOptions(
|
|
|
10
10
|
body?: OperationOptions<typeof readProductOperation, 'params'>,
|
|
11
11
|
) {
|
|
12
12
|
const client = useShopwareQueryClient()
|
|
13
|
-
const queryKey = productKeys.
|
|
13
|
+
const queryKey = productKeys.headlessDetail(body)
|
|
14
14
|
|
|
15
15
|
return queryOptions({
|
|
16
16
|
queryKey,
|