@frontic/nuxt 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +126 -0
  2. package/package.json +10 -4
package/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # @frontic/nuxt
2
+
3
+ Nuxt module for integrating with [Frontstack](https://frontstack.dev) headless commerce. Provides auto-imported composables for data fetching with smart caching, page routing, and context management.
4
+
5
+ ## Features
6
+
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 Frontstack schema
9
+ - **Search & filtering** - Ready-to-use search state management with filters, sorting, and pagination
10
+ - **Page routing** - Dynamic page resolution with automatic redirects and 404 handling
11
+ - **Context management** - Locale and region switching with cookie persistence
12
+ - **Built-in proxy** - CORS-free API requests through your Nuxt server
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npx nuxi@latest module add @frontic/nuxt
18
+ ```
19
+
20
+ ## Quick Start
21
+
22
+ ```typescript
23
+ // nuxt.config.ts
24
+ export default defineNuxtConfig({
25
+ modules: ['@frontic/nuxt'],
26
+ frontic: {
27
+ contextDomain: 'your-shop.com',
28
+ },
29
+ })
30
+ ```
31
+
32
+ Generate the Frontstack client:
33
+
34
+ ```bash
35
+ npx @frontic/cli generate
36
+ ```
37
+
38
+ ## Composables
39
+
40
+ ### useFronticPage
41
+
42
+ Dynamic page routing with automatic redirects and 404 handling:
43
+
44
+ ```typescript
45
+ const { page, data, type, block, alternates } = useFronticPage()
46
+ ```
47
+
48
+ ### useFronticSearch
49
+
50
+ Full-featured search with filtering, sorting, and pagination:
51
+
52
+ ```typescript
53
+ const { result, state, searchTerm, filterResult, sortResult, loadNext } = useFronticSearch(
54
+ 'ProductSearch',
55
+ {},
56
+ {
57
+ filter: {
58
+ select: ['properties.color', 'properties.size'],
59
+ label: { 'properties.color': 'Color' },
60
+ },
61
+ sorting: {
62
+ label: { 'name:asc': 'Name A-Z', 'price.amount:asc': 'Price: Low to High' },
63
+ },
64
+ }
65
+ )
66
+ ```
67
+
68
+ ### useFronticListing
69
+
70
+ Simple listing access:
71
+
72
+ ```typescript
73
+ const { listing, status, refresh } = useFronticListing('FeaturedProducts', { limit: 10 })
74
+ ```
75
+
76
+ ### useFronticBlock
77
+
78
+ Fetch single blocks (products, categories):
79
+
80
+ ```typescript
81
+ const { block, status } = useFronticBlock('Product', 'product-handle')
82
+ ```
83
+
84
+ ### useFronticContext
85
+
86
+ Manage locale and region:
87
+
88
+ ```typescript
89
+ const { contexts, current, update } = useFronticContext()
90
+ ```
91
+
92
+ ## Configuration
93
+
94
+ ```typescript
95
+ export default defineNuxtConfig({
96
+ frontic: {
97
+ // Page routing
98
+ contextDomain: 'your-shop.com',
99
+ redirectOn301: true,
100
+ throwOn404: true,
101
+
102
+ // API proxy
103
+ proxy: true, // or '/api/custom-path'
104
+ fetchApiSecret: process.env.FRONTSTACK_FETCH_SECRET,
105
+
106
+ // Context cookies
107
+ contextCookieName: 'fs-context',
108
+ contextCookieMaxAge: 31536000,
109
+
110
+ // Composables
111
+ composables: true, // or ['page', 'search', 'listing', 'block', 'context', 'client']
112
+
113
+ // UI components (optional)
114
+ prefix: 'Ui',
115
+ componentDir: '@/components/ui',
116
+ },
117
+ })
118
+ ```
119
+
120
+ ## Documentation
121
+
122
+ Full documentation at [docs.frontstack.dev/reference/nuxt-module](https://docs.frontstack.dev/reference/nuxt-module)
123
+
124
+ ## License
125
+
126
+ MIT
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontic/nuxt",
3
- "version": "0.1.0",
4
- "description": "Nuxt module for auto-importing UI components - inspired by shadcn-vue",
3
+ "version": "0.1.1",
4
+ "description": "Nuxt module for Frontstack headless commerce - data fetching composables with smart caching, page routing, and context management",
5
5
  "license": "MIT",
6
6
  "author": "Frontic",
7
7
  "repository": {
@@ -19,7 +19,12 @@
19
19
  "frontic",
20
20
  "frontstack",
21
21
  "vue",
22
- "components"
22
+ "headless-commerce",
23
+ "e-commerce",
24
+ "pinia-colada",
25
+ "composables",
26
+ "ssr",
27
+ "typescript"
23
28
  ],
24
29
  "type": "module",
25
30
  "exports": {
@@ -30,7 +35,8 @@
30
35
  },
31
36
  "main": "./dist/module.mjs",
32
37
  "files": [
33
- "dist"
38
+ "dist",
39
+ "README.md"
34
40
  ],
35
41
  "dependencies": {
36
42
  "@nuxt/kit": "^3.17.0",