@frontic/nuxt 0.1.14 → 0.1.16

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * For simple listing access without search features, use useFronticListing instead.
8
8
  */
9
- import { type ComputedRef, type ShallowRef } from 'vue';
9
+ import { type ShallowRef } from 'vue';
10
10
  import type { MaybeRef } from 'vue';
11
11
  import type { Listings, ListingParameters, ListingQueryFilters, ListingQuerySorts, Responses } from '@frontic/stack/generated-types';
12
12
  import type { UseFronticSearchOptions, SearchState } from '../types/search.js';
@@ -39,13 +39,9 @@ import type { UseFronticSearchOptions, SearchState } from '../types/search.js';
39
39
  */
40
40
  export declare function useFronticSearch<TSearch extends keyof Listings, TFilters extends Record<string, unknown> = TSearch extends keyof ListingQueryFilters ? ListingQueryFilters[TSearch] : Record<string, unknown>, TSorts extends Record<string, unknown> = TSearch extends keyof ListingQuerySorts ? ListingQuerySorts[TSearch] : Record<string, unknown>>(name: TSearch, params: MaybeRef<TSearch extends keyof ListingParameters ? ListingParameters[TSearch] : Record<string, unknown>>, options?: UseFronticSearchOptions<TSearch, TFilters, TSorts>): {
41
41
  /**
42
- * The full listing response containing items, pagination info, and filter metadata.
42
+ * The listing response containing items, pagination info, and filter metadata.
43
43
  */
44
- data: ShallowRef<Responses[TSearch] | undefined>;
45
- /**
46
- * The items array from the listing response.
47
- */
48
- result: ComputedRef<Responses[TSearch] | undefined>;
44
+ result: ShallowRef<Responses[TSearch] | undefined>;
49
45
  /**
50
46
  * Query status: 'pending' | 'error' | 'success'
51
47
  */
@@ -243,17 +243,12 @@ export function useFronticSearch(name, params, options) {
243
243
  _sortQuery.value = void 0;
244
244
  await refreshListing();
245
245
  }
246
- const result = computed(() => data.value?.items);
247
246
  return {
248
247
  // ========== State ==========
249
248
  /**
250
- * The full listing response containing items, pagination info, and filter metadata.
249
+ * The listing response containing items, pagination info, and filter metadata.
251
250
  */
252
- data,
253
- /**
254
- * The items array from the listing response.
255
- */
256
- result,
251
+ result: data,
257
252
  /**
258
253
  * Query status: 'pending' | 'error' | 'success'
259
254
  */
@@ -1,4 +1,5 @@
1
1
  import { proxyRequest, getHeader, createError, defineEventHandler } from "h3";
2
+ import { useRuntimeConfig } from "nitropack/runtime";
2
3
  export default defineEventHandler(async (event) => {
3
4
  const targetUrl = getHeader(event, "fs-target-url");
4
5
  if (!targetUrl) {
@@ -164,10 +164,8 @@ export interface UseFronticSearchOptions<TSearch extends keyof Listings = keyof
164
164
  * @template TSorts - Sort fields for this listing
165
165
  */
166
166
  export interface UseSearchReturn<TSearch extends keyof Listings = keyof Listings, TFilters = TSearch extends keyof ListingQueryFilters ? ListingQueryFilters[TSearch] : Record<string, unknown>, TSorts = TSearch extends keyof ListingQuerySorts ? ListingQuerySorts[TSearch] : Record<string, unknown>> {
167
- /** The full listing response containing items, pagination info, and filter metadata */
168
- data: ShallowRef<(TSearch extends keyof Responses ? Responses[TSearch] : unknown) | undefined>;
169
- /** The items array from the listing response */
170
- result: Ref<unknown[] | undefined>;
167
+ /** The listing response containing items, pagination info, and filter metadata */
168
+ result: ShallowRef<Responses[TSearch] | undefined>;
171
169
  /** Current fetch status of the search */
172
170
  status: UseQueryReturn['status'];
173
171
  /** Current state of the search including page, sort, search, and filter settings (fully typed) */
@@ -177,7 +175,7 @@ export interface UseSearchReturn<TSearch extends keyof Listings = keyof Listings
177
175
  /**
178
176
  * Loads more items in the current search results (infinite scroll)
179
177
  */
180
- loadNext: () => Promise<(TSearch extends keyof Responses ? Responses[TSearch] : unknown) | undefined>;
178
+ loadNext: () => Promise<Responses[TSearch] | undefined>;
181
179
  /**
182
180
  * Fetches the search with current query parameters (uses cache if valid)
183
181
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontic/nuxt",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Nuxt module for Frontstack headless commerce - zero config data fetching composables with smart caching, page routing, and context management",
5
5
  "license": "MIT",
6
6
  "author": "Frontic",
@@ -51,6 +51,7 @@
51
51
  "@nuxt/module-builder": "^1.0.2",
52
52
  "@nuxt/schema": "^3.17.0",
53
53
  "h3": "^1.15.0",
54
+ "nitropack": "^2.13.1",
54
55
  "nuxt": "^3.17.0",
55
56
  "typescript": "5.6.3",
56
57
  "vitest": "^2.x",