@teamnovu/kit-shopware-composables 0.0.23 → 0.0.25

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/keys.d.ts CHANGED
@@ -40,12 +40,15 @@ export declare const productKeys: {
40
40
  headlessDetail: (body: MaybeRef<unknown>) => readonly ["product", "detail", {
41
41
  readonly body: unknown;
42
42
  }];
43
- detail: (body: MaybeRef<unknown>) => readonly ["product", "detail", {
43
+ detail: (productId: MaybeRef<string>, body: MaybeRef<unknown>) => readonly ["product", "detail", MaybeRef<string>, {
44
44
  readonly body: unknown;
45
45
  }];
46
46
  search: (body: MaybeRef<unknown>) => readonly ["product", "search", {
47
47
  readonly body: unknown;
48
48
  }];
49
+ searchSuggest: (body: MaybeRef<unknown>) => readonly ["product", "searchSuggest", {
50
+ readonly body: unknown;
51
+ }];
49
52
  };
50
53
  export declare const cartKeys: {
51
54
  get: () => readonly ["cart"];
@@ -2,5 +2,6 @@ export * from './useReadCategoryListQuery';
2
2
  export * from './useReadCompactProductListingQuery';
3
3
  export * from './useReadCustomProductDetailQuery';
4
4
  export * from './useSearchPageQuery';
5
+ export * from './useSearchSuggestQuery';
5
6
  export * from './useReadProductQuery';
6
7
  export * from './useReadProductDetailQuery';
@@ -4,10 +4,10 @@ import { UndefinedInitialQueryOptions, UseQueryReturnType } from '@tanstack/vue-
4
4
  import { BrandedResponse } from '@teamnovu/kit-shopware-api-client';
5
5
  import { Operations } from '..';
6
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", {
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
8
  readonly body: unknown;
9
9
  }]> & {
10
- queryKey: readonly ["product", "detail", {
10
+ queryKey: readonly ["product", "detail", MaybeRef<string>, {
11
11
  readonly body: unknown;
12
12
  }] & {
13
13
  [dataTagSymbol]: BrandedResponse<Operations, "readProductDetail post /product/{productId}">;
@@ -0,0 +1,17 @@
1
+ import { OperationOptions } from '../types/query';
2
+ import { UndefinedInitialQueryOptions, UseQueryReturnType } from '@tanstack/vue-query';
3
+ import { BrandedResponse } from '@teamnovu/kit-shopware-api-client';
4
+ import { Operations } from '..';
5
+ declare const searchSuggestOperation = "searchSuggest post /search-suggest";
6
+ export declare function useSearchSuggestQueryOptions(body?: OperationOptions<typeof searchSuggestOperation, 'params'>): UndefinedInitialQueryOptions<BrandedResponse<Operations, "searchSuggest post /search-suggest">, Error, BrandedResponse<Operations, "searchSuggest post /search-suggest">, readonly ["product", "searchSuggest", {
7
+ readonly body: unknown;
8
+ }]> & {
9
+ queryKey: readonly ["product", "searchSuggest", {
10
+ readonly body: unknown;
11
+ }] & {
12
+ [dataTagSymbol]: BrandedResponse<Operations, "searchSuggest post /search-suggest">;
13
+ [dataTagErrorSymbol]: Error;
14
+ };
15
+ };
16
+ export declare function useSearchSuggestQuery(body?: OperationOptions<typeof searchSuggestOperation, 'params'>): UseQueryReturnType<BrandedResponse<Operations, "searchSuggest post /search-suggest">, Error>;
17
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/kit-shopware-composables",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "A collection of composables for the Shopware API",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
package/src/keys.ts CHANGED
@@ -73,9 +73,10 @@ export const productKeys = {
73
73
  body,
74
74
  },
75
75
  ] as const,
76
- detail: (body: MaybeRef<unknown>) =>
76
+ detail: (productId: MaybeRef<string>, body: MaybeRef<unknown>) =>
77
77
  [
78
78
  ...productKeys.details(),
79
+ productId,
79
80
  {
80
81
  body,
81
82
  },
@@ -88,6 +89,14 @@ export const productKeys = {
88
89
  body,
89
90
  },
90
91
  ] as const,
92
+ searchSuggest: (body: MaybeRef<unknown>) =>
93
+ [
94
+ ...productKeys.all(),
95
+ 'searchSuggest',
96
+ {
97
+ body,
98
+ },
99
+ ] as const,
91
100
  }
92
101
 
93
102
  export const cartKeys = {
@@ -2,5 +2,6 @@ export * from './useReadCategoryListQuery'
2
2
  export * from './useReadCompactProductListingQuery'
3
3
  export * from './useReadCustomProductDetailQuery'
4
4
  export * from './useSearchPageQuery'
5
+ export * from './useSearchSuggestQuery'
5
6
  export * from './useReadProductQuery'
6
7
  export * from './useReadProductDetailQuery'
@@ -12,7 +12,7 @@ export function useReadProductDetailQueryOptions(
12
12
  body?: OperationOptions<typeof readProductDetailOperation, 'params'>,
13
13
  ) {
14
14
  const client = useShopwareQueryClient()
15
- const queryKey = productKeys.detail(body)
15
+ const queryKey = productKeys.detail(productId, body)
16
16
 
17
17
  return queryOptions({
18
18
  queryKey,
@@ -0,0 +1,31 @@
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
+
7
+ const searchSuggestOperation = 'searchSuggest post /search-suggest' satisfies OperationKey
8
+
9
+ export function useSearchSuggestQueryOptions(
10
+ body?: OperationOptions<typeof searchSuggestOperation, 'params'>,
11
+ ) {
12
+ const client = useShopwareQueryClient()
13
+ const queryKey = productKeys.searchSuggest(body)
14
+
15
+ return queryOptions({
16
+ queryKey,
17
+ queryFn: async ({ signal }) => {
18
+ const opts = unrefOptions(body)
19
+ return client.query(searchSuggestOperation, {
20
+ ...opts,
21
+ signal,
22
+ })
23
+ },
24
+ })
25
+ }
26
+
27
+ export function useSearchSuggestQuery(
28
+ body?: OperationOptions<typeof searchSuggestOperation, 'params'>,
29
+ ) {
30
+ return useQuery(useSearchSuggestQueryOptions(body))
31
+ }