@scayle/storefront-product-detail 1.0.1 → 1.0.2

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/module.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@scayle/storefront-product-detail",
3
3
  "configKey": "product-detail",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "compatibility": {
6
6
  "bridge": false,
7
7
  "nuxt": ">=3.13"
8
8
  },
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.4",
11
- "unbuild": "3.0.1"
11
+ "unbuild": "3.2.0"
12
12
  }
13
13
  }
package/dist/module.mjs CHANGED
@@ -1,10 +1,12 @@
1
1
  import { defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
2
2
 
3
+ const PACKAGE_NAME = "@scayle/storefront-product-detail";
4
+ const PACKAGE_VERSION = "1.0.2";
3
5
  const module = defineNuxtModule({
4
6
  meta: {
5
- name: "@scayle/storefront-product-detail",
7
+ name: PACKAGE_NAME,
6
8
  configKey: "product-detail",
7
- version: "1.0.0",
9
+ version: PACKAGE_VERSION,
8
10
  compatibility: {
9
11
  bridge: false,
10
12
  nuxt: ">=3.13"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-product-detail",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Collection of essential composables and utilities to work with product detail",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "@nuxt/kit": "^3.13.0",
44
44
  "@scayle/storefront-nuxt": "^8.0.0",
45
45
  "@vue/test-utils": "2.4.6",
46
- "@vueuse/core": "12.0.0",
46
+ "@vueuse/core": "12.3.0",
47
47
  "vue-router": "4.5.0"
48
48
  },
49
49
  "devDependencies": {
@@ -52,19 +52,19 @@
52
52
  "@nuxt/schema": "3.14.1592",
53
53
  "@nuxt/test-utils": "3.15.1",
54
54
  "@scayle/eslint-config-storefront": "4.4.0",
55
- "@scayle/storefront-nuxt": "8.1.4",
56
- "@types/node": "22.10.2",
55
+ "@scayle/storefront-nuxt": "8.3.2",
56
+ "@types/node": "22.10.5",
57
57
  "@vue/test-utils": "2.4.6",
58
- "@vueuse/core": "12.0.0",
59
- "dprint": "0.47.6",
58
+ "@vueuse/core": "12.3.0",
59
+ "dprint": "0.48.0",
60
60
  "eslint": "9.17.0",
61
- "happy-dom": "15.11.7",
61
+ "happy-dom": "16.5.3",
62
62
  "eslint-formatter-gitlab": "5.1.0",
63
63
  "nuxt": "3.14.1592",
64
64
  "publint": "0.2.12",
65
- "typescript": "5.6.3",
65
+ "typescript": "5.7.3",
66
66
  "vitest": "2.1.8",
67
67
  "vue-router": "4.5.0",
68
- "vue-tsc": "2.1.10"
68
+ "vue-tsc": "2.2.0"
69
69
  }
70
70
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,179 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { useProductSeoData } from "~/src/runtime";
3
- import { variantFactory } from "@scayle/storefront-nuxt/dist/test/factories";
4
- import { ref } from "vue";
5
- describe("useProductSeoData", () => {
6
- it("should return product seo data from product", () => {
7
- const {
8
- title,
9
- productBreadcrumbJsonLd,
10
- productJsonLd,
11
- robots,
12
- canonicalLink
13
- } = useProductSeoData(
14
- [{ value: "value", to: "/" }],
15
- { baseUrl: "baseUrl", fullPath: "fullPath" },
16
- {
17
- name: "name",
18
- variants: [variantFactory.build({ id: 1 })],
19
- brand: "brand",
20
- productDescription: "description",
21
- images: []
22
- }
23
- );
24
- expect(title.value).toBe("name");
25
- expect(productBreadcrumbJsonLd.value).toStrictEqual({
26
- "@context": "https://schema.org",
27
- "@type": "BreadcrumbList",
28
- "itemListElement": [
29
- {
30
- "@type": "ListItem",
31
- "item": "/",
32
- "name": "value",
33
- "position": 1
34
- }
35
- ]
36
- });
37
- expect(productJsonLd.value).toStrictEqual({
38
- "@context": "https://schema.org",
39
- "@type": "Product",
40
- "brand": {
41
- "@type": "Brand",
42
- "name": "brand"
43
- },
44
- "description": "description",
45
- "image": [],
46
- "name": "name",
47
- "offers": [
48
- {
49
- "@type": "Offer",
50
- "availability": "https://schema.org/InStock",
51
- "itemCondition": "https://schema.org/NewCondition",
52
- "mpn": void 0,
53
- "price": 1,
54
- "priceCurrency": "USD",
55
- "sku": "1"
56
- }
57
- ],
58
- "url": "baseUrlfullPath"
59
- });
60
- expect(robots).toBe("index, follow");
61
- expect(canonicalLink.value).toStrictEqual([
62
- {
63
- "href": "baseUrlfullPath",
64
- "key": "canonical",
65
- "rel": "canonical"
66
- }
67
- ]);
68
- });
69
- it("should handle reactivity correctly with changing parameters", () => {
70
- const breadcrubs = [{ value: "value", to: "/" }];
71
- const urlParams = { baseUrl: "baseUrl", fullPath: "fullPath" };
72
- const productInfo = ref({
73
- name: "name",
74
- variants: [variantFactory.build({ id: 1 })],
75
- brand: "brand",
76
- productDescription: "description",
77
- images: []
78
- });
79
- const {
80
- title,
81
- productBreadcrumbJsonLd,
82
- productJsonLd,
83
- canonicalLink
84
- } = useProductSeoData(
85
- breadcrubs,
86
- urlParams,
87
- productInfo
88
- );
89
- expect(title.value).toBe("name");
90
- expect(productBreadcrumbJsonLd.value).toStrictEqual({
91
- "@context": "https://schema.org",
92
- "@type": "BreadcrumbList",
93
- "itemListElement": [
94
- {
95
- "@type": "ListItem",
96
- "item": "/",
97
- "name": "value",
98
- "position": 1
99
- }
100
- ]
101
- });
102
- expect(productJsonLd.value).toStrictEqual({
103
- "@context": "https://schema.org",
104
- "@type": "Product",
105
- "brand": {
106
- "@type": "Brand",
107
- "name": "brand"
108
- },
109
- "description": "description",
110
- "image": [],
111
- "name": "name",
112
- "offers": [
113
- {
114
- "@type": "Offer",
115
- "availability": "https://schema.org/InStock",
116
- "itemCondition": "https://schema.org/NewCondition",
117
- "mpn": void 0,
118
- "price": 1,
119
- "priceCurrency": "USD",
120
- "sku": "1"
121
- }
122
- ],
123
- "url": "baseUrlfullPath"
124
- });
125
- expect(canonicalLink.value).toStrictEqual([
126
- {
127
- "href": "baseUrlfullPath",
128
- "key": "canonical",
129
- "rel": "canonical"
130
- }
131
- ]);
132
- breadcrubs[0].to = "/other";
133
- urlParams.baseUrl = "otherUrl";
134
- productInfo.value.name = "otherName";
135
- expect(title.value).toBe("otherName");
136
- expect(productBreadcrumbJsonLd.value).toStrictEqual({
137
- "@context": "https://schema.org",
138
- "@type": "BreadcrumbList",
139
- "itemListElement": [
140
- {
141
- "@type": "ListItem",
142
- "item": "/other",
143
- "name": "value",
144
- "position": 1
145
- }
146
- ]
147
- });
148
- expect(productJsonLd.value).toStrictEqual({
149
- "@context": "https://schema.org",
150
- "@type": "Product",
151
- "brand": {
152
- "@type": "Brand",
153
- "name": "brand"
154
- },
155
- "description": "description",
156
- "image": [],
157
- "name": "otherName",
158
- "offers": [
159
- {
160
- "@type": "Offer",
161
- "availability": "https://schema.org/InStock",
162
- "itemCondition": "https://schema.org/NewCondition",
163
- "mpn": void 0,
164
- "price": 1,
165
- "priceCurrency": "USD",
166
- "sku": "1"
167
- }
168
- ],
169
- "url": "otherUrlfullPath"
170
- });
171
- expect(canonicalLink.value).toStrictEqual([
172
- {
173
- "href": "otherUrlfullPath",
174
- "key": "canonical",
175
- "rel": "canonical"
176
- }
177
- ]);
178
- });
179
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,39 +0,0 @@
1
- import { it, describe, expect } from "vitest";
2
- import { attributeGroupFactory } from "@scayle/storefront-nuxt/dist/test/factories";
3
- import { getFilteredAttributeGroups } from "./attribute.js";
4
- describe("attribute", () => {
5
- describe("getFilteredAttributeGroups", () => {
6
- it("should return correct filtered and formatted attributes", () => {
7
- const attributes = {
8
- design: attributeGroupFactory.build({
9
- type: "design",
10
- label: "Jackenart",
11
- values: { id: 2534, label: "Bomberjacke", value: "bomberjacke" }
12
- }),
13
- extras: attributeGroupFactory.build({
14
- label: "Extras",
15
- type: "extras",
16
- multiSelect: true,
17
- values: [
18
- { id: 2427, label: "Weicher Griff", value: "weicher_griff" },
19
- { id: 2435, label: "Ton-in-Ton-N\xE4hte", value: "tonintonnhte" },
20
- { id: 2438, label: "Label-Stickerei", value: "labelstickerei" }
21
- ]
22
- })
23
- };
24
- const formattedAttributes = getFilteredAttributeGroups(
25
- attributes,
26
- ["design", "extras"]
27
- );
28
- expect(formattedAttributes).toHaveLength(2);
29
- expect(formattedAttributes.get("design")).toStrictEqual([
30
- "Jackenart: Bomberjacke"
31
- ]);
32
- expect(formattedAttributes.get("extras")).toStrictEqual([
33
- "Weicher Griff",
34
- "Ton-in-Ton-N\xE4hte",
35
- "Label-Stickerei"
36
- ]);
37
- });
38
- });
39
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,97 +0,0 @@
1
- import { it, describe } from "vitest";
2
- import { getCombineWithProductIds } from "~/src/runtime/utils/product";
3
- import { advancedAttributeFactory } from "@scayle/storefront-nuxt/dist/test/factories";
4
- describe("getCombineWithProductIds", () => {
5
- it("should return productIds from data", ({ expect }) => {
6
- const combineWithAttribute = advancedAttributeFactory.build({
7
- key: "combineWith",
8
- label: "Kombiniere mit",
9
- values: [
10
- {
11
- fieldSet: [
12
- [
13
- {
14
- value: "206131"
15
- }
16
- ]
17
- ],
18
- groupSet: []
19
- },
20
- {
21
- fieldSet: [
22
- [
23
- {
24
- value: "206017"
25
- }
26
- ]
27
- ],
28
- groupSet: []
29
- },
30
- {
31
- fieldSet: [
32
- [
33
- {
34
- value: "206012"
35
- }
36
- ]
37
- ],
38
- groupSet: []
39
- }
40
- ]
41
- });
42
- expect(getCombineWithProductIds(combineWithAttribute)).toStrictEqual([
43
- 206131,
44
- 206017,
45
- 206012
46
- ]);
47
- });
48
- it("should return empty array when attribute is not available", ({ expect }) => {
49
- expect(getCombineWithProductIds(void 0)).toStrictEqual([]);
50
- });
51
- it("should return productIds ignore invalid data", ({ expect }) => {
52
- const combineWithAttributeWithInvalidData = advancedAttributeFactory.build({
53
- key: "combineWith",
54
- label: "Kombiniere mit",
55
- values: [
56
- {
57
- fieldSet: [
58
- [
59
- {
60
- value: "206131"
61
- }
62
- ],
63
- [
64
- {
65
- value: "TEST"
66
- }
67
- ]
68
- ],
69
- groupSet: []
70
- },
71
- {
72
- fieldSet: [
73
- [
74
- {
75
- value: "206017"
76
- }
77
- ]
78
- ],
79
- groupSet: []
80
- },
81
- {
82
- fieldSet: [
83
- [
84
- {
85
- value: "206012"
86
- }
87
- ]
88
- ],
89
- groupSet: []
90
- }
91
- ]
92
- });
93
- expect(
94
- getCombineWithProductIds(combineWithAttributeWithInvalidData)
95
- ).toStrictEqual([206131, 206017, 206012]);
96
- });
97
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,38 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { generateProductSchema } from "~/src/runtime/utils/seo";
3
- import { variantFactory } from "@scayle/storefront-nuxt/dist/test/factories";
4
- describe("generateProductSchema", () => {
5
- it("should return productSchema from product", () => {
6
- const productSchema = generateProductSchema({
7
- productName: "productName",
8
- brandName: "brandName",
9
- variants: [variantFactory.build({ id: 1 })],
10
- url: "url",
11
- images: [],
12
- description: "description"
13
- });
14
- expect(productSchema).toStrictEqual({
15
- "@context": "https://schema.org",
16
- "@type": "Product",
17
- "brand": {
18
- "@type": "Brand",
19
- "name": "brandName"
20
- },
21
- "description": "description",
22
- "image": [],
23
- "name": "productName",
24
- "offers": [
25
- {
26
- "@type": "Offer",
27
- "availability": "https://schema.org/InStock",
28
- "itemCondition": "https://schema.org/NewCondition",
29
- "mpn": void 0,
30
- "price": 1,
31
- "priceCurrency": "USD",
32
- "sku": "1"
33
- }
34
- ],
35
- "url": "url"
36
- });
37
- });
38
- });