@frontic/nuxt 0.5.1 → 0.6.0
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/README.md +6 -6
- package/dist/module.d.mts +18 -8
- package/dist/module.mjs +13 -11
- package/dist/runtime/composables/useFronticClient.d.ts +1 -1
- package/dist/runtime/composables/useFronticClient.js +5 -1
- package/dist/runtime/composables/useFronticPage.js +11 -1
- package/dist/runtime/composables/useFronticSearch.js +16 -2
- package/dist/runtime/frontic-stack.d.ts +1 -1
- package/dist/runtime/types/listing.d.ts +4 -4
- package/dist/runtime/types/search.d.ts +3 -3
- package/dist/runtime/utils/filter-helpers.d.ts +1 -1
- package/dist/runtime/utils/resolve-context-domain.d.ts +1 -0
- package/dist/runtime/utils/resolve-context-domain.js +17 -0
- package/dist/runtime/utils/state-helpers.d.ts +6 -6
- package/package.json +17 -16
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @frontic/nuxt
|
|
2
2
|
|
|
3
|
-
Nuxt module for
|
|
3
|
+
Nuxt module for building with the [Frontic](https://frontic.com) API and [Frontic UI](https://ui.frontic.com) components. Provides auto-imported composables for data fetching with smart caching, page routing, and context management.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **Smart caching** via [Pinia Colada](https://pinia-colada.esm.dev/) - stale-while-revalidate, request deduplication, SSR hydration
|
|
8
|
-
- **Type-safe composables** - Full TypeScript support with generated types from your
|
|
8
|
+
- **Type-safe composables** - Full TypeScript support with generated types from your Frontic schema
|
|
9
9
|
- **Search & filtering** - Ready-to-use search state management with filters, sorting, pagination, and infinite scroll
|
|
10
10
|
- **Page routing** - Dynamic page resolution with automatic redirects and 404 handling
|
|
11
11
|
- **Context management** - Locale and region switching with cookie persistence
|
|
@@ -30,7 +30,7 @@ export default defineNuxtConfig({
|
|
|
30
30
|
})
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Generate the
|
|
33
|
+
Generate the Frontic client:
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
npx @frontic/cli generate
|
|
@@ -102,7 +102,7 @@ export default defineNuxtConfig({
|
|
|
102
102
|
|
|
103
103
|
// API proxy
|
|
104
104
|
proxy: true, // or '/api/custom-path'
|
|
105
|
-
fetchApiSecret: process.env.
|
|
105
|
+
fetchApiSecret: process.env.FRONTIC_FETCH_SECRET,
|
|
106
106
|
|
|
107
107
|
// Context cookies
|
|
108
108
|
contextCookieName: 'fs-context',
|
|
@@ -112,7 +112,7 @@ export default defineNuxtConfig({
|
|
|
112
112
|
composables: true, // or ['page', 'search', 'listing', 'block', 'context', 'client']
|
|
113
113
|
|
|
114
114
|
// UI components (optional)
|
|
115
|
-
|
|
115
|
+
componentsPrefix: '',
|
|
116
116
|
componentDir: '@/components/ui',
|
|
117
117
|
},
|
|
118
118
|
})
|
|
@@ -120,7 +120,7 @@ export default defineNuxtConfig({
|
|
|
120
120
|
|
|
121
121
|
## Documentation
|
|
122
122
|
|
|
123
|
-
Full documentation at [docs.
|
|
123
|
+
Full documentation at [docs.frontic.com](https://docs.frontic.com)
|
|
124
124
|
|
|
125
125
|
## License
|
|
126
126
|
|
package/dist/module.d.mts
CHANGED
|
@@ -23,10 +23,11 @@ type FronticComposablesConfig = boolean | FronticComposable[];
|
|
|
23
23
|
*/
|
|
24
24
|
interface FronticOptions {
|
|
25
25
|
/**
|
|
26
|
-
* Prefix for all
|
|
27
|
-
*
|
|
26
|
+
* Prefix for all auto-imported Frontic UI components.
|
|
27
|
+
* Set to 'Ui' to get `<UiButton>`, or leave empty for `<Button>`.
|
|
28
|
+
* @default ''
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
|
+
componentsPrefix: string;
|
|
30
31
|
/**
|
|
31
32
|
* Directory that the components live in.
|
|
32
33
|
* @default "@/components/ui"
|
|
@@ -57,7 +58,7 @@ interface FronticOptions {
|
|
|
57
58
|
composables?: FronticComposablesConfig;
|
|
58
59
|
/**
|
|
59
60
|
* Enable/configure the API proxy for CORS prevention
|
|
60
|
-
* - true: Enable proxy at default path '/api/
|
|
61
|
+
* - true: Enable proxy at default path '/api/frontic'
|
|
61
62
|
* - false: Disable proxy
|
|
62
63
|
* - string: Enable proxy at custom path
|
|
63
64
|
*
|
|
@@ -65,12 +66,21 @@ interface FronticOptions {
|
|
|
65
66
|
*/
|
|
66
67
|
proxy?: boolean | string;
|
|
67
68
|
/**
|
|
68
|
-
* Context domain for page slug construction
|
|
69
|
-
*
|
|
69
|
+
* Context domain for scope/region/locale resolution and page slug construction.
|
|
70
|
+
*
|
|
71
|
+
* Controls which Frontic domain is used across all composables:
|
|
72
|
+
* - useFronticPage: prepended to the pathname to construct the page slug
|
|
73
|
+
* - useFronticBlock/Listing/Context: injected as contextDomain request option
|
|
74
|
+
*
|
|
75
|
+
* - string: Static domain (e.g. 'shop.com')
|
|
76
|
+
* - true: Read `contextDomain` property from current @nuxtjs/i18n locale object
|
|
77
|
+
*
|
|
78
|
+
* When not set, useFronticPage derives the domain from the request URL host.
|
|
70
79
|
*
|
|
71
80
|
* @example 'demo-shop.com'
|
|
81
|
+
* @example true
|
|
72
82
|
*/
|
|
73
|
-
contextDomain?: string;
|
|
83
|
+
contextDomain?: string | boolean;
|
|
74
84
|
/**
|
|
75
85
|
* Cookie name for persisting the context token
|
|
76
86
|
* @default 'fs-context'
|
|
@@ -115,7 +125,7 @@ interface FronticOptions {
|
|
|
115
125
|
*
|
|
116
126
|
* For client-side requests, the secret is automatically injected by the proxy
|
|
117
127
|
*
|
|
118
|
-
* @example process.env.
|
|
128
|
+
* @example process.env.FRONTIC_FETCH_SECRET
|
|
119
129
|
*/
|
|
120
130
|
fetchApiSecret?: string;
|
|
121
131
|
}
|
package/dist/module.mjs
CHANGED
|
@@ -13,7 +13,7 @@ function isComposableEnabled(config, name) {
|
|
|
13
13
|
}
|
|
14
14
|
const module$1 = defineNuxtModule({
|
|
15
15
|
defaults: {
|
|
16
|
-
|
|
16
|
+
componentsPrefix: "",
|
|
17
17
|
componentDir: "@/components/ui",
|
|
18
18
|
composables: true,
|
|
19
19
|
proxy: true,
|
|
@@ -35,7 +35,7 @@ const module$1 = defineNuxtModule({
|
|
|
35
35
|
async setup(options, nuxt) {
|
|
36
36
|
const {
|
|
37
37
|
componentDir,
|
|
38
|
-
|
|
38
|
+
componentsPrefix,
|
|
39
39
|
composables: composablesConfig = true,
|
|
40
40
|
proxy: proxyConfig = true,
|
|
41
41
|
contextDomain,
|
|
@@ -52,12 +52,10 @@ const module$1 = defineNuxtModule({
|
|
|
52
52
|
const { resolve: resolveModule } = createResolver(_dirname);
|
|
53
53
|
const runtimeDir = resolveModule("./runtime");
|
|
54
54
|
const fronticClientFile = "generated-client.ts";
|
|
55
|
-
const
|
|
56
|
-
const frontstackDir = join(ROOT_DIR_PATH, ".frontstack");
|
|
57
|
-
const fronticClientDir = existsSync(join(fronticDir, fronticClientFile)) ? fronticDir : frontstackDir;
|
|
55
|
+
const fronticClientDir = join(ROOT_DIR_PATH, ".frontic");
|
|
58
56
|
const fronticClientPath = join(fronticClientDir, fronticClientFile);
|
|
59
57
|
const hasFronticClient = existsSync(fronticClientPath);
|
|
60
|
-
const proxyPath = typeof proxyConfig === "string" ? proxyConfig : proxyConfig !== false ? "/api/
|
|
58
|
+
const proxyPath = typeof proxyConfig === "string" ? proxyConfig : proxyConfig !== false ? "/api/frontic" : void 0;
|
|
61
59
|
if (proxyPath && hasFronticClient) {
|
|
62
60
|
addServerHandler({
|
|
63
61
|
route: `${proxyPath}/**`,
|
|
@@ -71,6 +69,11 @@ const module$1 = defineNuxtModule({
|
|
|
71
69
|
const contextEnabled = isComposableEnabled(composablesConfig, "context");
|
|
72
70
|
const clientEnabled = isComposableEnabled(composablesConfig, "client");
|
|
73
71
|
const anyComposableEnabled = ALL_COMPOSABLES.some((c) => isComposableEnabled(composablesConfig, c));
|
|
72
|
+
if (contextDomain === true && !hasNuxtModule("@nuxtjs/i18n", nuxt)) {
|
|
73
|
+
console.warn(
|
|
74
|
+
"\n[@frontic/nuxt] contextDomain: true requires @nuxtjs/i18n module.\nInstall @nuxtjs/i18n and add a `contextDomain` property to your locale objects,\nor use a static string instead: frontic: { contextDomain: 'your-domain.com' }\n"
|
|
75
|
+
);
|
|
76
|
+
}
|
|
74
77
|
if (anyComposableEnabled && !hasFronticClient) {
|
|
75
78
|
const enabledList = ALL_COMPOSABLES.filter((c) => isComposableEnabled(composablesConfig, c)).map((c) => {
|
|
76
79
|
if (c === "client") return "useFronticClient";
|
|
@@ -85,8 +88,7 @@ frontic: { composables: false }
|
|
|
85
88
|
`
|
|
86
89
|
);
|
|
87
90
|
}
|
|
88
|
-
const
|
|
89
|
-
const clientDirPath = join(ROOT_DIR_PATH, clientDirName);
|
|
91
|
+
const clientDirPath = fronticClientDir;
|
|
90
92
|
nuxt.options.vite ||= {};
|
|
91
93
|
nuxt.options.vite.resolve ||= {};
|
|
92
94
|
nuxt.options.vite.resolve.alias ||= {};
|
|
@@ -98,10 +100,10 @@ frontic: { composables: false }
|
|
|
98
100
|
nuxt.hook("prepare:types", ({ tsConfig }) => {
|
|
99
101
|
tsConfig.compilerOptions ||= {};
|
|
100
102
|
tsConfig.compilerOptions.paths ||= {};
|
|
101
|
-
tsConfig.compilerOptions.paths["@frontic/stack/*"] = [
|
|
103
|
+
tsConfig.compilerOptions.paths["@frontic/stack/*"] = [`../.frontic/*`];
|
|
102
104
|
if (hasFronticClient) {
|
|
103
105
|
tsConfig.include = tsConfig.include || [];
|
|
104
|
-
tsConfig.include.push(
|
|
106
|
+
tsConfig.include.push(`../.frontic/generated-types.d.ts`, `../.frontic/fetch-api.d.ts`);
|
|
105
107
|
}
|
|
106
108
|
});
|
|
107
109
|
if (anyComposableEnabled) {
|
|
@@ -214,7 +216,7 @@ frontic: { composables: false }
|
|
|
214
216
|
extensions: [".ts", ".js"]
|
|
215
217
|
});
|
|
216
218
|
addComponentExports({
|
|
217
|
-
prefix,
|
|
219
|
+
prefix: componentsPrefix,
|
|
218
220
|
filePath: resolve(filePath),
|
|
219
221
|
priority: 1
|
|
220
222
|
});
|
|
@@ -35,7 +35,7 @@ export interface UseFronticClientOptions {
|
|
|
35
35
|
* Creates an SSR-aware Frontic client with automatic proxy and context injection
|
|
36
36
|
*
|
|
37
37
|
* @param options - Optional configuration to override defaults
|
|
38
|
-
* @returns Type-safe
|
|
38
|
+
* @returns Type-safe Frontic client instance
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```ts
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useRuntimeConfig, useRequestURL } from "nuxt/app";
|
|
2
2
|
import { createClient } from "@frontic/stack/generated-client";
|
|
3
|
+
import { resolveI18nContextDomain } from "../utils/resolve-context-domain.js";
|
|
3
4
|
export function useFronticClient(options) {
|
|
4
5
|
const config = useRuntimeConfig();
|
|
5
6
|
const fronticConfig = config.public.frontic;
|
|
@@ -13,7 +14,10 @@ export function useFronticClient(options) {
|
|
|
13
14
|
const resolveContextDomain = () => {
|
|
14
15
|
if (options?.contextDomain === false) return void 0;
|
|
15
16
|
if (typeof options?.contextDomain === "string") return options.contextDomain;
|
|
16
|
-
|
|
17
|
+
const configDomain = fronticConfig?.contextDomain;
|
|
18
|
+
if (typeof configDomain === "string") return configDomain;
|
|
19
|
+
if (configDomain === true) return resolveI18nContextDomain();
|
|
20
|
+
return void 0;
|
|
17
21
|
};
|
|
18
22
|
const resolveRequestUrl = () => {
|
|
19
23
|
if (options?.requestUrl === false) return void 0;
|
|
@@ -3,6 +3,7 @@ import { computed, toValue, watch } from "vue";
|
|
|
3
3
|
import { useQuery } from "@pinia/colada";
|
|
4
4
|
import { fetchPageQuery } from "./pages.js";
|
|
5
5
|
import { useFronticClient } from "./useFronticClient.js";
|
|
6
|
+
import { resolveI18nContextDomain } from "../utils/resolve-context-domain.js";
|
|
6
7
|
export function useFronticPage(slug, options) {
|
|
7
8
|
const requestURL = useRequestURL();
|
|
8
9
|
const config = useRuntimeConfig();
|
|
@@ -10,7 +11,16 @@ export function useFronticPage(slug, options) {
|
|
|
10
11
|
const pageSlug = computed(() => {
|
|
11
12
|
if (slug) return toValue(slug);
|
|
12
13
|
const pathname = requestURL.pathname.replace(/\/+$/, "");
|
|
13
|
-
|
|
14
|
+
let domain;
|
|
15
|
+
const optionDomain = options?.contextDomain ? toValue(options.contextDomain) : void 0;
|
|
16
|
+
if (typeof optionDomain === "string") {
|
|
17
|
+
domain = optionDomain;
|
|
18
|
+
} else if (typeof fronticConfig?.contextDomain === "string") {
|
|
19
|
+
domain = fronticConfig.contextDomain;
|
|
20
|
+
} else if (fronticConfig?.contextDomain === true) {
|
|
21
|
+
domain = resolveI18nContextDomain();
|
|
22
|
+
}
|
|
23
|
+
return `${domain ?? requestURL.host}${pathname}`;
|
|
14
24
|
});
|
|
15
25
|
const _client = useFronticClient();
|
|
16
26
|
const pageQuery = fetchPageQuery({
|
|
@@ -188,8 +188,22 @@ export function useFronticSearch(name, params, options) {
|
|
|
188
188
|
const rawFilters = response.filter;
|
|
189
189
|
const rawAggregation = response.aggregation;
|
|
190
190
|
const pageData = response.page;
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
const activeFilters = applyFilterConfig(makeFilterState(rawFilters), filterConfig);
|
|
192
|
+
const typeConfig = filterConfig.type;
|
|
193
|
+
if (typeConfig) {
|
|
194
|
+
for (const field of Object.keys(typeConfig)) {
|
|
195
|
+
if (field in activeFilters) continue;
|
|
196
|
+
const rangeFilter = _rangeFilterList.value.find((f) => f.field === field);
|
|
197
|
+
if (rangeFilter) {
|
|
198
|
+
activeFilters[field] = { ...rangeFilter.from !== void 0 && { from: rangeFilter.from }, ...rangeFilter.to !== void 0 && { to: rangeFilter.to } };
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const equalsFilter = [..._orFilterList.value, ..._andFilterList.value].find((f) => f.field === field);
|
|
202
|
+
if (equalsFilter) {
|
|
203
|
+
activeFilters[field] = equalsFilter.value;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
193
207
|
const availableFilters = processAvailableFilters(rawFilters, rawAggregation, filterConfig);
|
|
194
208
|
const responseHasSort = "sort" in response;
|
|
195
209
|
const availableSorts = processAvailableSorts(sortConfig, responseHasSort);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Ambient type declarations for @frontic/stack/* virtual modules.
|
|
3
3
|
*
|
|
4
|
-
* At runtime, @frontic/stack/* resolves to the user's .frontic/
|
|
4
|
+
* At runtime, @frontic/stack/* resolves to the user's .frontic/ directory
|
|
5
5
|
* directory via aliases configured by the @frontic/nuxt module.
|
|
6
6
|
* These declarations provide fallback types so that:
|
|
7
7
|
* 1. The module builds with proper .d.ts output (mkdist can resolve imports)
|
|
@@ -14,7 +14,7 @@ export type { Query, Sort, EqualsFilter, LogicalFilter, Filter, RangeFilter, Con
|
|
|
14
14
|
* These options match the client's RequestOptions interface
|
|
15
15
|
*
|
|
16
16
|
* TODO(FSC-3044): Replace with imported RequestOptions from @frontic/stack/generated-types
|
|
17
|
-
* once the CLI exports it. See: https://linear.app/
|
|
17
|
+
* once the CLI exports it. See: https://linear.app/frontic/issue/FSC-3044
|
|
18
18
|
*/
|
|
19
19
|
export interface FronticRequestOptions {
|
|
20
20
|
/**
|
|
@@ -109,7 +109,7 @@ export interface ListingFieldConfig<TFields = Record<string, unknown>> {
|
|
|
109
109
|
type?: Partial<Record<NoInfer<keyof TFields & string>, string>>;
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
|
-
* Filter option from API response (matches
|
|
112
|
+
* Filter option from API response (matches Frontic response structure)
|
|
113
113
|
* @internal - Used internally, components should use UiFilter
|
|
114
114
|
*/
|
|
115
115
|
export interface FilterOption {
|
|
@@ -246,7 +246,7 @@ export interface UseListingConfig<TListing extends string = string, TFilters = R
|
|
|
246
246
|
* Type-safe: label must use valid sort field names with :asc/:desc suffix
|
|
247
247
|
*
|
|
248
248
|
* Special handling for 'default' sort:
|
|
249
|
-
* - The 'default' sort represents
|
|
249
|
+
* - The 'default' sort represents Frontic backend's default sorting (no sort applied to query)
|
|
250
250
|
* - It's automatically included if a label is provided in sorts.label
|
|
251
251
|
* - Can be controlled via include/exclude mode like other sorts
|
|
252
252
|
* - Use resetSorting() to return to default sorting
|
|
@@ -320,7 +320,7 @@ export interface UseListingReturn<TResponse = unknown, TFilters = Record<string,
|
|
|
320
320
|
*/
|
|
321
321
|
sortItems: (sortBy: string) => Promise<void>;
|
|
322
322
|
/**
|
|
323
|
-
* Resets sorting to default (
|
|
323
|
+
* Resets sorting to default (Frontic backend default)
|
|
324
324
|
*/
|
|
325
325
|
resetSorting: () => Promise<void>;
|
|
326
326
|
/**
|
|
@@ -115,7 +115,7 @@ export interface UseFronticSearchOptions<TSearch extends keyof Listings = keyof
|
|
|
115
115
|
* Type-safe: label must use valid sort field names with :asc/:desc suffix
|
|
116
116
|
*
|
|
117
117
|
* Special handling for 'default' sort:
|
|
118
|
-
* - The 'default' sort represents
|
|
118
|
+
* - The 'default' sort represents Frontic backend's default sorting (no sort applied to query)
|
|
119
119
|
* - It's automatically included if a label is provided in sorting.label
|
|
120
120
|
* - Can be controlled via include/exclude mode like other sorts
|
|
121
121
|
* - Use resetSorting() to return to default sorting
|
|
@@ -152,7 +152,7 @@ export interface UseFronticSearchOptions<TSearch extends keyof Listings = keyof
|
|
|
152
152
|
*/
|
|
153
153
|
disableSorting?: boolean;
|
|
154
154
|
/**
|
|
155
|
-
* Number of items per page (sent as `limit` to the
|
|
155
|
+
* Number of items per page (sent as `limit` to the Frontic API).
|
|
156
156
|
* When omitted, the backend default is used.
|
|
157
157
|
*/
|
|
158
158
|
limit?: number;
|
|
@@ -229,7 +229,7 @@ export interface UseSearchReturn<TSearch extends keyof Listings = keyof Listings
|
|
|
229
229
|
*/
|
|
230
230
|
sortResult: (sortBy?: string) => Promise<void>;
|
|
231
231
|
/**
|
|
232
|
-
* Resets sorting to default (
|
|
232
|
+
* Resets sorting to default (Frontic backend default)
|
|
233
233
|
*/
|
|
234
234
|
resetSorting: () => Promise<void>;
|
|
235
235
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveI18nContextDomain(): string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useNuxtApp } from "nuxt/app";
|
|
2
|
+
export function resolveI18nContextDomain() {
|
|
3
|
+
try {
|
|
4
|
+
const app = useNuxtApp();
|
|
5
|
+
const i18n = app.$i18n;
|
|
6
|
+
if (i18n) {
|
|
7
|
+
const domain = i18n.localeProperties.value.contextDomain;
|
|
8
|
+
if (typeof domain === "string") return domain;
|
|
9
|
+
console.warn("[@frontic/nuxt] contextDomain: true but current locale has no contextDomain property");
|
|
10
|
+
} else {
|
|
11
|
+
console.warn("[@frontic/nuxt] contextDomain: true but @nuxtjs/i18n is not available");
|
|
12
|
+
}
|
|
13
|
+
} catch {
|
|
14
|
+
console.warn("[@frontic/nuxt] contextDomain: true but @nuxtjs/i18n is not available");
|
|
15
|
+
}
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { ListingFieldConfig, UiFilter, UiSort, AggregationTotal, FilterOption } from '../types/listing.js';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Frontic filter response structure
|
|
9
9
|
*/
|
|
10
10
|
interface FrontstackFilterResponse {
|
|
11
11
|
[key: string]: FilterOption[] | undefined;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Frontic aggregation response structure
|
|
15
15
|
* Matches the _aggregation schema from the Fetch API
|
|
16
16
|
*/
|
|
17
17
|
interface FrontstackAggregationResponse {
|
|
@@ -22,7 +22,7 @@ interface FrontstackAggregationResponse {
|
|
|
22
22
|
/**
|
|
23
23
|
* Extracts active (selected) filters from the API response
|
|
24
24
|
*
|
|
25
|
-
* @param filters - The filter response from
|
|
25
|
+
* @param filters - The filter response from Frontic API
|
|
26
26
|
* @returns Record of active filters keyed by field name
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
@@ -43,8 +43,8 @@ export declare function makeFilterState(filters: FrontstackFilterResponse | unde
|
|
|
43
43
|
* Aggregation data is merged onto matching filters or added as new entries.
|
|
44
44
|
*
|
|
45
45
|
* @template TFilters - Filter fields type for this listing (provides typed keys)
|
|
46
|
-
* @param rawFilters - Raw filter response from
|
|
47
|
-
* @param rawAggregation - Raw aggregation response from
|
|
46
|
+
* @param rawFilters - Raw filter response from Frontic API
|
|
47
|
+
* @param rawAggregation - Raw aggregation response from Frontic API
|
|
48
48
|
* @param config - Filter configuration (select, mode, label, sort, type)
|
|
49
49
|
* @returns Array of UiFilter objects ready for rendering (with typed keys)
|
|
50
50
|
*
|
|
@@ -103,7 +103,7 @@ export declare function applyFilterConfig(filters: Record<string, FilterOption[]
|
|
|
103
103
|
* @param filters - The filter state record
|
|
104
104
|
* @returns Number of fields with active filters
|
|
105
105
|
*/
|
|
106
|
-
export declare function countActiveFilters(filters: Record<string,
|
|
106
|
+
export declare function countActiveFilters(filters: Record<string, unknown> | undefined): number;
|
|
107
107
|
/**
|
|
108
108
|
* Parses a sort string into field and order components
|
|
109
109
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontic/nuxt",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Nuxt module for
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Nuxt module for Frontic - data fetching composables with smart caching, page routing, and context management",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontic",
|
|
7
7
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "git+https://github.com/frontic/frontic-nuxt.git",
|
|
10
10
|
"directory": "packages/nuxt"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://docs.
|
|
12
|
+
"homepage": "https://docs.frontic.com",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/frontic/frontic-nuxt/issues"
|
|
15
15
|
},
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"nuxt",
|
|
18
18
|
"nuxt-module",
|
|
19
19
|
"frontic",
|
|
20
|
-
"
|
|
20
|
+
"frontic-api",
|
|
21
21
|
"vue",
|
|
22
22
|
"headless-commerce",
|
|
23
23
|
"e-commerce",
|
|
@@ -42,6 +42,18 @@
|
|
|
42
42
|
"dist",
|
|
43
43
|
"README.md"
|
|
44
44
|
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"prepack": "nuxt-module-build build",
|
|
47
|
+
"dev": "nuxi dev playground",
|
|
48
|
+
"dev:build": "nuxi build playground",
|
|
49
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
50
|
+
"build": "nuxt-module-build build",
|
|
51
|
+
"typecheck": "vue-tsc --noEmit",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:watch": "vitest watch",
|
|
54
|
+
"test:coverage": "vitest run --coverage",
|
|
55
|
+
"clean": "rm -rf dist .nuxt"
|
|
56
|
+
},
|
|
45
57
|
"dependencies": {
|
|
46
58
|
"@nuxt/kit": "^3.17.0",
|
|
47
59
|
"@pinia/colada": "^1.0.0",
|
|
@@ -65,16 +77,5 @@
|
|
|
65
77
|
},
|
|
66
78
|
"peerDependencies": {
|
|
67
79
|
"nuxt": ">=3.17.0"
|
|
68
|
-
},
|
|
69
|
-
"scripts": {
|
|
70
|
-
"dev": "nuxi dev playground",
|
|
71
|
-
"dev:build": "nuxi build playground",
|
|
72
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
73
|
-
"build": "nuxt-module-build build",
|
|
74
|
-
"typecheck": "vue-tsc --noEmit",
|
|
75
|
-
"test": "vitest run",
|
|
76
|
-
"test:watch": "vitest watch",
|
|
77
|
-
"test:coverage": "vitest run --coverage",
|
|
78
|
-
"clean": "rm -rf dist .nuxt"
|
|
79
80
|
}
|
|
80
|
-
}
|
|
81
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Frontic
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|