@frontic/nuxt 0.1.13 → 0.1.15
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/runtime/composables/useFronticPage.d.ts +2 -2
- package/dist/runtime/composables/useFronticSearch.d.ts +5 -8
- package/dist/runtime/composables/useFronticSearch.js +2 -7
- package/dist/runtime/frontic-stack.d.ts +21 -8
- package/dist/runtime/server/api/frontic/[...path].js +0 -1
- package/dist/runtime/types/search.d.ts +3 -5
- package/package.json +1 -1
|
@@ -72,7 +72,7 @@ export declare function useFronticPage(slug?: MaybeRef<string>, options?: UseFro
|
|
|
72
72
|
/**
|
|
73
73
|
* Route metadata (code, redirect, alternates, context)
|
|
74
74
|
*/
|
|
75
|
-
route: ComputedRef<
|
|
75
|
+
route: ComputedRef<RouteMeta | undefined>;
|
|
76
76
|
/**
|
|
77
77
|
* Alternate URLs for hreflang tags
|
|
78
78
|
*/
|
|
@@ -80,7 +80,7 @@ export declare function useFronticPage(slug?: MaybeRef<string>, options?: UseFro
|
|
|
80
80
|
/**
|
|
81
81
|
* Suggested route when context changes (for locale switching)
|
|
82
82
|
*/
|
|
83
|
-
suggested: ComputedRef<
|
|
83
|
+
suggested: ComputedRef<AlternateRoute | undefined>;
|
|
84
84
|
/**
|
|
85
85
|
* Query status: 'pending' | 'error' | 'success'
|
|
86
86
|
*/
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* For simple listing access without search features, use useFronticListing instead.
|
|
8
8
|
*/
|
|
9
|
+
import { type ShallowRef } from 'vue';
|
|
9
10
|
import type { MaybeRef } from 'vue';
|
|
10
|
-
import type { Listings, ListingParameters, ListingQueryFilters, ListingQuerySorts } from '@frontic/stack/generated-types';
|
|
11
|
+
import type { Listings, ListingParameters, ListingQueryFilters, ListingQuerySorts, Responses } from '@frontic/stack/generated-types';
|
|
11
12
|
import type { UseFronticSearchOptions, SearchState } from '../types/search.js';
|
|
12
13
|
/**
|
|
13
14
|
* Full-featured composable for managing Frontic search listings with filtering, sorting, and pagination
|
|
@@ -38,17 +39,13 @@ import type { UseFronticSearchOptions, SearchState } from '../types/search.js';
|
|
|
38
39
|
*/
|
|
39
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>): {
|
|
40
41
|
/**
|
|
41
|
-
* The
|
|
42
|
+
* The listing response containing items, pagination info, and filter metadata.
|
|
42
43
|
*/
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The items array from the listing response.
|
|
46
|
-
*/
|
|
47
|
-
result: import("vue").ComputedRef<unknown[] | undefined>;
|
|
44
|
+
result: ShallowRef<Responses[TSearch] | undefined>;
|
|
48
45
|
/**
|
|
49
46
|
* Query status: 'pending' | 'error' | 'success'
|
|
50
47
|
*/
|
|
51
|
-
status:
|
|
48
|
+
status: ShallowRef<import("@pinia/colada").DataStateStatus>;
|
|
52
49
|
/**
|
|
53
50
|
* Current search state including active filters, sorts, pagination, and available options.
|
|
54
51
|
* Use this to build filter/sort UI components.
|
|
@@ -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
|
|
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
|
*/
|
|
@@ -107,22 +107,35 @@ declare interface Page {
|
|
|
107
107
|
id?: string
|
|
108
108
|
slug?: string
|
|
109
109
|
title?: string
|
|
110
|
+
type?: string
|
|
111
|
+
block?: string
|
|
110
112
|
meta?: Record<string, unknown>
|
|
111
113
|
data?: Record<string, unknown>
|
|
112
|
-
route?:
|
|
114
|
+
route?: RouteMeta
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
declare interface PageRoute {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
href: string
|
|
119
|
+
path: string
|
|
120
|
+
slug: string
|
|
121
|
+
url: string
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
declare interface AlternateRoute {
|
|
123
|
-
locale
|
|
124
|
+
declare interface AlternateRoute extends PageRoute {
|
|
125
|
+
locale: string
|
|
126
|
+
region: string
|
|
124
127
|
lang?: string
|
|
125
|
-
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare interface RouteMeta {
|
|
131
|
+
code: 200 | 301 | 404
|
|
132
|
+
redirect?: PageRoute
|
|
133
|
+
alternates?: AlternateRoute[]
|
|
134
|
+
context?: {
|
|
135
|
+
region: string
|
|
136
|
+
locale: string
|
|
137
|
+
suggested?: AlternateRoute
|
|
138
|
+
}
|
|
126
139
|
}
|
|
127
140
|
|
|
128
141
|
declare interface Context {
|
|
@@ -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
|
|
168
|
-
|
|
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<
|
|
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.
|
|
3
|
+
"version": "0.1.15",
|
|
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",
|