@scayle/storefront-product-detail 1.1.4 → 1.3.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/CHANGELOG.md +58 -0
- package/dist/module.json +3 -3
- package/dist/module.mjs +1 -1
- package/dist/runtime/composables/useProductSeoData.d.ts +0 -2
- package/dist/runtime/composables/useProductSeoData.js +0 -1
- package/dist/runtime/utils/seo.d.ts +24 -3
- package/dist/runtime/utils/seo.js +3 -3
- package/dist/types.d.mts +2 -2
- package/package.json +27 -26
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -8
- package/dist/types.d.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @scayle/storefront-product-detail
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **\[SEO\]** Moved the product image from the `ProductGroup` JSONLD to the `Product` JSONLD to better align with [Google's recommendation](https://developers.google.com/search/docs/appearance/structured-data/merchant-listing).
|
|
8
|
+
|
|
9
|
+
Instead of passing all product images to `useProductSeoData`, the primary product image is expected to be included in the passed `variants`.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
useProductSeoData({
|
|
13
|
+
name: 'Name',
|
|
14
|
+
brand: 'Brand',
|
|
15
|
+
productDescription: 'Description',
|
|
16
|
+
variants: variants.value.map((variant) => {
|
|
17
|
+
return generateProductSchema({
|
|
18
|
+
productName: 'Name',
|
|
19
|
+
variant,
|
|
20
|
+
url: `${$config.public.baseUrl}${route.fullPath}`,
|
|
21
|
+
size,
|
|
22
|
+
})
|
|
23
|
+
}),
|
|
24
|
+
images: images.value,
|
|
25
|
+
productId: product.value?.id || 0,
|
|
26
|
+
color: formatColors(colors.value),
|
|
27
|
+
variesBy: variants.value.length > 1
|
|
28
|
+
? ['https://schema.org/size']
|
|
29
|
+
: undefined,
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Will become
|
|
33
|
+
|
|
34
|
+
useProductSeoData({
|
|
35
|
+
name: 'Name',
|
|
36
|
+
brand: 'Brand',
|
|
37
|
+
productDescription: 'Description',
|
|
38
|
+
variants: variants.value.map((variant) => {
|
|
39
|
+
return generateProductSchema({
|
|
40
|
+
productName: 'Name',
|
|
41
|
+
variant,
|
|
42
|
+
url: `${$config.public.baseUrl}${route.fullPath}`,
|
|
43
|
+
size,
|
|
44
|
+
images: images.value[0],
|
|
45
|
+
})
|
|
46
|
+
}),
|
|
47
|
+
productId: product.value?.id || 0,
|
|
48
|
+
color: formatColors(colors.value),
|
|
49
|
+
variesBy: variants.value.length > 1
|
|
50
|
+
? ['https://schema.org/size']
|
|
51
|
+
: undefined,
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 1.2.0
|
|
56
|
+
|
|
57
|
+
### Minor Changes
|
|
58
|
+
|
|
59
|
+
- Update to `@nuxt/module-builder@1`. This version of Nuxt Module Builder is ESM-only, so CommonJS (`.cjs`) files will no longer be built or distributed with the package. However as of Nuxt 3, only esm is used so this should not have any impact as this module does not support Nuxt 2.
|
|
60
|
+
|
|
3
61
|
## 1.1.4
|
|
4
62
|
|
|
5
63
|
### Patch Changes
|
package/dist/module.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-product-detail",
|
|
3
3
|
"configKey": "product-detail",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"compatibility": {
|
|
6
6
|
"bridge": false,
|
|
7
7
|
"nuxt": ">=3.13"
|
|
8
8
|
},
|
|
9
9
|
"builder": {
|
|
10
|
-
"@nuxt/module-builder": "0.
|
|
11
|
-
"unbuild": "
|
|
10
|
+
"@nuxt/module-builder": "1.0.1",
|
|
11
|
+
"unbuild": "3.5.0"
|
|
12
12
|
}
|
|
13
13
|
}
|
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
const PACKAGE_NAME = "@scayle/storefront-product-detail";
|
|
4
|
-
const PACKAGE_VERSION = "1.
|
|
4
|
+
const PACKAGE_VERSION = "1.3.0";
|
|
5
5
|
const module = defineNuxtModule({
|
|
6
6
|
meta: {
|
|
7
7
|
name: PACKAGE_NAME,
|
|
@@ -16,8 +16,6 @@ interface ProductInfo {
|
|
|
16
16
|
color: string;
|
|
17
17
|
/** Array of product variants. */
|
|
18
18
|
variants: WithContext<Product>[];
|
|
19
|
-
/** Array of image URLs for the product. */
|
|
20
|
-
images: string[];
|
|
21
19
|
variesBy?: ProductGroup['variesBy'];
|
|
22
20
|
}
|
|
23
21
|
export interface UseProductSeoDataReturn {
|
|
@@ -19,7 +19,6 @@ export function useProductSeoData(breadcrumbs, urlParams, productInfo) {
|
|
|
19
19
|
productId: info.productId.toString(),
|
|
20
20
|
name: info.name,
|
|
21
21
|
description: info.productDescription,
|
|
22
|
-
images: info.images,
|
|
23
22
|
brandName: info.brand,
|
|
24
23
|
color: info.color,
|
|
25
24
|
variants: info.variants,
|
|
@@ -3,22 +3,43 @@ import type { Product, WithContext, ProductGroup } from 'schema-dts';
|
|
|
3
3
|
/**
|
|
4
4
|
* Generates an object following the schema.org `Product` type with context.
|
|
5
5
|
*
|
|
6
|
+
* @param params - Options for generating the schema product.
|
|
7
|
+
* @param params.productName - Name of the product.
|
|
8
|
+
* @param params.variant - Variant of the product.
|
|
9
|
+
* @param params.url - URL of the product.
|
|
10
|
+
* @param params.image - URL of the product image.
|
|
11
|
+
* @param params.size - Size of the product.
|
|
12
|
+
*
|
|
6
13
|
* @see https://schema.org/Product Used to specify `@type` of the returned schema.
|
|
7
14
|
* @see https://schema.org/Brand Used to define schema of `brand`.
|
|
8
15
|
*
|
|
9
16
|
* @returns An object following the schema.org `Product` type with context.
|
|
10
17
|
*/
|
|
11
|
-
export declare const generateProductSchema: ({ productName, variant, url, size, }: {
|
|
18
|
+
export declare const generateProductSchema: ({ productName, variant, url, image, size, }: {
|
|
12
19
|
productName: string;
|
|
13
20
|
variant: Variant;
|
|
14
21
|
url: string;
|
|
22
|
+
image: string;
|
|
15
23
|
size?: string;
|
|
16
24
|
}) => WithContext<Product>;
|
|
17
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Generates an object following the schema.org `ProductGroup` type with context.
|
|
27
|
+
*
|
|
28
|
+
* @param params - Options for generating the schema product group.
|
|
29
|
+
* @param params.productId - ID of the product group.
|
|
30
|
+
* @param params.name - Name of the product group.
|
|
31
|
+
* @param params.description - Description of the product group.
|
|
32
|
+
* @param params.brandName - Name of the brand.
|
|
33
|
+
* @param params.color - Color of the product group.
|
|
34
|
+
* @param params.variants - Variants of the product group.
|
|
35
|
+
* @param params.variesBy - Varies by of the product group.
|
|
36
|
+
*
|
|
37
|
+
* @returns An object following the schema.org `ProductGroup` type with context.
|
|
38
|
+
*/
|
|
39
|
+
export declare const generateProductGroupSchema: ({ productId, name, description, brandName, color, variants, variesBy, }: {
|
|
18
40
|
productId: string;
|
|
19
41
|
name: string;
|
|
20
42
|
description: string;
|
|
21
|
-
images: string[];
|
|
22
43
|
brandName: string;
|
|
23
44
|
color: string;
|
|
24
45
|
variants: Product[];
|
|
@@ -20,6 +20,7 @@ export const generateProductSchema = ({
|
|
|
20
20
|
productName,
|
|
21
21
|
variant,
|
|
22
22
|
url,
|
|
23
|
+
image,
|
|
23
24
|
size
|
|
24
25
|
}) => {
|
|
25
26
|
return {
|
|
@@ -27,14 +28,14 @@ export const generateProductSchema = ({
|
|
|
27
28
|
"@type": "Product",
|
|
28
29
|
name: `${productName} (${size})`,
|
|
29
30
|
size,
|
|
30
|
-
offers: generateSchemaProductOffer({ variant, baseUrl: url })
|
|
31
|
+
offers: generateSchemaProductOffer({ variant, baseUrl: url }),
|
|
32
|
+
image
|
|
31
33
|
};
|
|
32
34
|
};
|
|
33
35
|
export const generateProductGroupSchema = ({
|
|
34
36
|
productId,
|
|
35
37
|
name,
|
|
36
38
|
description,
|
|
37
|
-
images,
|
|
38
39
|
brandName,
|
|
39
40
|
color,
|
|
40
41
|
variants,
|
|
@@ -46,7 +47,6 @@ export const generateProductGroupSchema = ({
|
|
|
46
47
|
productGroupID: productId,
|
|
47
48
|
name: `${name}, ${color}`,
|
|
48
49
|
description,
|
|
49
|
-
image: images,
|
|
50
50
|
brand: {
|
|
51
51
|
"@type": "Brand",
|
|
52
52
|
name: brandName
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NuxtModule } from '@nuxt/schema'
|
|
2
2
|
|
|
3
|
-
import type { default as Module } from './module.
|
|
3
|
+
import type { default as Module } from './module.mjs'
|
|
4
4
|
|
|
5
5
|
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
6
|
|
|
7
|
-
export { default } from './module.
|
|
7
|
+
export { default } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-product-detail",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Collection of essential composables and utilities to work with product detail",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,17 +11,15 @@
|
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"types": "./dist/types.d.
|
|
15
|
-
"import": "./dist/module.mjs"
|
|
16
|
-
"require": "./dist/module.cjs"
|
|
14
|
+
"types": "./dist/types.d.mts",
|
|
15
|
+
"import": "./dist/module.mjs"
|
|
17
16
|
},
|
|
18
17
|
"./composables": {
|
|
19
18
|
"types": "./dist/runtime/composables/index.d.ts",
|
|
20
19
|
"import": "./dist/runtime/composables/index.js"
|
|
21
20
|
}
|
|
22
21
|
},
|
|
23
|
-
"main": "./dist/module.
|
|
24
|
-
"types": "./dist/types.d.ts",
|
|
22
|
+
"main": "./dist/module.mjs",
|
|
25
23
|
"files": [
|
|
26
24
|
"CHANGELOG.md",
|
|
27
25
|
"dist"
|
|
@@ -33,8 +31,9 @@
|
|
|
33
31
|
"build": "nuxt-module-build build",
|
|
34
32
|
"dev": "nuxi dev playground",
|
|
35
33
|
"dev:build": "nuxi build playground",
|
|
36
|
-
"prep": "nuxt-module-build
|
|
37
|
-
"lint": "eslint .
|
|
34
|
+
"prep": "nuxt-module-build prepare && nuxi prepare playground",
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"lint:ci": "eslint . --format gitlab",
|
|
38
37
|
"lint:fix": "eslint . --fix",
|
|
39
38
|
"format": "dprint check",
|
|
40
39
|
"format:fix": "dprint fmt",
|
|
@@ -42,7 +41,8 @@
|
|
|
42
41
|
"test:watch": "vitest --passWithNoTests",
|
|
43
42
|
"test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit --outputFile=./coverage/junit.xml",
|
|
44
43
|
"typecheck": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
45
|
-
"package:lint": "publint"
|
|
44
|
+
"package:lint": "publint",
|
|
45
|
+
"verify-packaging": "attw --pack . --profile esm-only"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@nuxt/kit": ">=3.13.0",
|
|
@@ -54,27 +54,28 @@
|
|
|
54
54
|
"vue": "^3.5.13"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@nuxt/
|
|
59
|
-
"@nuxt/
|
|
60
|
-
"@nuxt/
|
|
61
|
-
"@
|
|
62
|
-
"@scayle/storefront
|
|
63
|
-
"@
|
|
57
|
+
"@arethetypeswrong/cli": "0.18.0",
|
|
58
|
+
"@nuxt/kit": "3.16.2",
|
|
59
|
+
"@nuxt/module-builder": "1.0.1",
|
|
60
|
+
"@nuxt/schema": "3.16.2",
|
|
61
|
+
"@nuxt/test-utils": "3.18.0",
|
|
62
|
+
"@scayle/eslint-config-storefront": "4.5.1",
|
|
63
|
+
"@scayle/storefront-nuxt": "8.25.3",
|
|
64
|
+
"@types/node": "22.15.17",
|
|
64
65
|
"@vue/test-utils": "2.4.6",
|
|
65
|
-
"@vueuse/core": "13.
|
|
66
|
+
"@vueuse/core": "13.1.0",
|
|
66
67
|
"dprint": "0.49.1",
|
|
67
|
-
"eslint-formatter-gitlab": "
|
|
68
|
-
"eslint": "9.
|
|
69
|
-
"happy-dom": "17.4.
|
|
70
|
-
"nuxt": "3.
|
|
68
|
+
"eslint-formatter-gitlab": "6.0.0",
|
|
69
|
+
"eslint": "9.26.0",
|
|
70
|
+
"happy-dom": "17.4.6",
|
|
71
|
+
"nuxt": "3.16.2",
|
|
71
72
|
"publint": "0.2.12",
|
|
72
73
|
"schema-dts": "1.1.5",
|
|
73
|
-
"typescript": "5.8.
|
|
74
|
-
"unbuild": "
|
|
75
|
-
"vitest": "
|
|
76
|
-
"vue-router": "4.5.
|
|
77
|
-
"vue-tsc": "2.2.
|
|
74
|
+
"typescript": "5.8.3",
|
|
75
|
+
"unbuild": "3.5.0",
|
|
76
|
+
"vitest": "3.1.3",
|
|
77
|
+
"vue-router": "4.5.1",
|
|
78
|
+
"vue-tsc": "2.2.10",
|
|
78
79
|
"vue": "3.5.13"
|
|
79
80
|
}
|
|
80
81
|
}
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
package/dist/types.d.ts
DELETED