@scayle/storefront-nuxt 7.88.1 → 7.89.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 +34 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +2 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/utils/category.d.ts +4 -0
- package/dist/runtime/utils/category.js +20 -0
- package/dist/runtime/utils/seo.d.ts +4 -0
- package/dist/runtime/utils/seo.js +28 -0
- package/dist/test-factories/category.d.ts +3 -0
- package/dist/test-factories/category.mjs +18 -0
- package/dist/test-factories/index.d.ts +4 -0
- package/dist/test-factories/index.mjs +4 -0
- package/dist/test-factories/moduleOptions.d.ts +7 -0
- package/dist/test-factories/moduleOptions.mjs +27 -0
- package/dist/test-factories/rpcContext.d.ts +7 -0
- package/dist/test-factories/rpcContext.mjs +57 -0
- package/dist/test-factories/shopConfig.d.ts +3 -0
- package/dist/test-factories/shopConfig.mjs +19 -0
- package/package.json +14 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.89.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add `category` test factory and expose all test factories. Moreover, `fishery` has
|
|
8
|
+
been added to the `peerDependencies` as it is main dependency for the test factories.
|
|
9
|
+
They can be used as follows:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { categoryFactory } from '@scayle/storefront-nuxt/test-factories'
|
|
13
|
+
|
|
14
|
+
categoryFactory.build()
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- Introduce `seo` and `category` utilities within the module and expose them as externals.
|
|
18
|
+
The category utilities consist of various functions that manage category tree-structured data.
|
|
19
|
+
The SEO utilities focus primarily on generating schemas and manipulating URLs for SEO purposes.
|
|
20
|
+
|
|
21
|
+
They are exposed externally and can be used as follows:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { sanitizeCanonicalURL } from '@scayle/storefront-nuxt'
|
|
25
|
+
|
|
26
|
+
sanitizeCanonicalURL('/en/women-2045')
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Added dependency `schema-dts@1.1.2`
|
|
32
|
+
- Updated dependency `ufo@^1.5.3` to `ufo@^1.5.4`
|
|
33
|
+
**Dependencies**
|
|
34
|
+
|
|
35
|
+
- Updated dependency to @scayle/unstorage-compression-driver@0.1.5
|
|
36
|
+
|
|
3
37
|
## 7.88.1
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.80aa5060.mjs';
|
|
2
2
|
export { rpcCall } from '../dist/runtime/rpc/rpcCall.js';
|
|
3
3
|
export { extendPromise } from '../dist/runtime/utils/promise.js';
|
|
4
|
+
export * from '../dist/runtime/utils/category.js';
|
|
5
|
+
export * from '../dist/runtime/utils/seo.js';
|
|
4
6
|
export * from '@scayle/storefront-core';
|
|
5
7
|
export { LogLevel } from '@scayle/storefront-core';
|
|
6
8
|
export { unwrap } from '@scayle/storefront-core/dist/utils/response';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.80aa5060.js';
|
|
2
2
|
export { rpcCall } from '../dist/runtime/rpc/rpcCall.js';
|
|
3
3
|
export { extendPromise } from '../dist/runtime/utils/promise.js';
|
|
4
|
+
export * from '../dist/runtime/utils/category.js';
|
|
5
|
+
export * from '../dist/runtime/utils/seo.js';
|
|
4
6
|
export * from '@scayle/storefront-core';
|
|
5
7
|
export { LogLevel } from '@scayle/storefront-core';
|
|
6
8
|
export { unwrap } from '@scayle/storefront-core/dist/utils/response';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { rpcCall } from '../dist/runtime/rpc/rpcCall.js';
|
|
2
2
|
export { extendPromise } from '../dist/runtime/utils/promise.js';
|
|
3
|
+
export * from '../dist/runtime/utils/category.js';
|
|
4
|
+
export * from '../dist/runtime/utils/seo.js';
|
|
3
5
|
export * from '@scayle/storefront-core';
|
|
4
6
|
export { unwrap } from '@scayle/storefront-core/dist/utils/response';
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Category } from '@scayle/storefront-core';
|
|
2
|
+
export declare const getCategoryAncestors: (category: Category, categories?: Category[]) => Category[];
|
|
3
|
+
export declare const isSaleCategory: (category: Category) => boolean;
|
|
4
|
+
export declare const flattenCategoryTree: (categoryTree: Category[]) => Category[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const getCategoryAncestors = (category, categories = []) => {
|
|
2
|
+
if (!category?.parent) {
|
|
3
|
+
return categories;
|
|
4
|
+
}
|
|
5
|
+
return getCategoryAncestors(category.parent, [category.parent, ...categories]);
|
|
6
|
+
};
|
|
7
|
+
export const isSaleCategory = (category) => {
|
|
8
|
+
return category.properties.some(({ name }) => name === "sale");
|
|
9
|
+
};
|
|
10
|
+
export const flattenCategoryTree = (categoryTree) => {
|
|
11
|
+
const flattenedCategoryTreeList = categoryTree.flatMap((categoryNode) => [
|
|
12
|
+
categoryNode,
|
|
13
|
+
...categoryNode.children ? flattenCategoryTree(categoryNode.children) : []
|
|
14
|
+
]);
|
|
15
|
+
return [
|
|
16
|
+
...new Map(
|
|
17
|
+
flattenedCategoryTreeList.map((item) => [item.id, item])
|
|
18
|
+
).values()
|
|
19
|
+
];
|
|
20
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WithContext, BreadcrumbList } from 'schema-dts';
|
|
2
|
+
import type { BreadcrumbItem } from '@scayle/storefront-core';
|
|
3
|
+
export declare const sanitizeCanonicalURL: (url: string, whitelistParams?: string[]) => string;
|
|
4
|
+
export declare const generateCategoryBreadcrumbSchema: (breadcrumbs: BreadcrumbItem[]) => WithContext<BreadcrumbList>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { parseURL, stringifyParsedURL, parseQuery, stringifyQuery } from "ufo";
|
|
2
|
+
const CANONICAL_PARAMS_WHITELIST = ["page"];
|
|
3
|
+
export const sanitizeCanonicalURL = (url, whitelistParams = CANONICAL_PARAMS_WHITELIST) => {
|
|
4
|
+
const parsedURL = parseURL(url);
|
|
5
|
+
if (!parsedURL.search) {
|
|
6
|
+
return url;
|
|
7
|
+
}
|
|
8
|
+
const parsedQuery = parseQuery(parsedURL.search);
|
|
9
|
+
const purifiedQuery = Object.fromEntries(
|
|
10
|
+
Object.entries(parsedQuery).filter(
|
|
11
|
+
([key]) => whitelistParams.includes(key)
|
|
12
|
+
)
|
|
13
|
+
);
|
|
14
|
+
return stringifyParsedURL({
|
|
15
|
+
...parsedURL,
|
|
16
|
+
search: stringifyQuery(purifiedQuery)
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export const generateCategoryBreadcrumbSchema = (breadcrumbs) => ({
|
|
20
|
+
"@context": "https://schema.org",
|
|
21
|
+
"@type": "BreadcrumbList",
|
|
22
|
+
itemListElement: breadcrumbs.map((item, index) => ({
|
|
23
|
+
"@type": "ListItem",
|
|
24
|
+
position: index + 1,
|
|
25
|
+
name: item.value,
|
|
26
|
+
item: item.to
|
|
27
|
+
}))
|
|
28
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Factory } from "fishery";
|
|
2
|
+
export const categoryFactory = Factory.define(() => {
|
|
3
|
+
return {
|
|
4
|
+
id: 1,
|
|
5
|
+
path: "/women",
|
|
6
|
+
name: "women",
|
|
7
|
+
slug: "test",
|
|
8
|
+
parentId: 2048,
|
|
9
|
+
rootlineIds: [2045, 2048, 2058],
|
|
10
|
+
childrenIds: [],
|
|
11
|
+
properties: [],
|
|
12
|
+
isHidden: false,
|
|
13
|
+
depth: 3,
|
|
14
|
+
supportedFilter: ["color", "brand", "size"],
|
|
15
|
+
shopLevelCustomData: {},
|
|
16
|
+
countryLevelCustomData: {}
|
|
17
|
+
};
|
|
18
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Factory } from 'fishery';
|
|
2
|
+
import type { ModuleBaseOptions, ShopConfig } from '../../src/module';
|
|
3
|
+
interface ModuleOptionsFactoryParams {
|
|
4
|
+
shops: ShopConfig[];
|
|
5
|
+
}
|
|
6
|
+
export declare const moduleOptionsFactory: Factory<ModuleBaseOptions, ModuleOptionsFactoryParams, ModuleBaseOptions>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Factory } from "fishery";
|
|
2
|
+
import { HashAlgorithm } from "@scayle/storefront-core";
|
|
3
|
+
export const moduleOptionsFactory = Factory.define(({ transientParams }) => {
|
|
4
|
+
return {
|
|
5
|
+
sapi: {
|
|
6
|
+
host: "sapiHost",
|
|
7
|
+
token: "sapiToken"
|
|
8
|
+
},
|
|
9
|
+
oauth: {
|
|
10
|
+
apiHost: "oauthHost",
|
|
11
|
+
clientId: "clientId",
|
|
12
|
+
clientSecret: "clientSecret"
|
|
13
|
+
},
|
|
14
|
+
appKeys: {
|
|
15
|
+
basketKey: "basketKey",
|
|
16
|
+
wishlistKey: "wishlistKey",
|
|
17
|
+
hashAlgorithm: HashAlgorithm.MD5
|
|
18
|
+
},
|
|
19
|
+
shopSelector: "path",
|
|
20
|
+
shops: (transientParams?.shops || []).reduce((acc, curr) => {
|
|
21
|
+
return {
|
|
22
|
+
[curr.shopId]: curr,
|
|
23
|
+
...acc
|
|
24
|
+
};
|
|
25
|
+
}, {})
|
|
26
|
+
};
|
|
27
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Factory } from 'fishery';
|
|
2
|
+
import { type RpcContext } from '@scayle/storefront-core';
|
|
3
|
+
interface RpcContextFactoryParams {
|
|
4
|
+
isLoggedIn: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const rpcContextFactory: Factory<RpcContext, RpcContextFactoryParams, RpcContext>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Factory } from "fishery";
|
|
2
|
+
import { vi } from "vitest";
|
|
3
|
+
import {
|
|
4
|
+
StorefrontAPIClient
|
|
5
|
+
} from "@scayle/storefront-core";
|
|
6
|
+
import { Log } from "../../src/runtime/log";
|
|
7
|
+
export const rpcContextFactory = Factory.define(({ transientParams }) => {
|
|
8
|
+
return {
|
|
9
|
+
locale: "de",
|
|
10
|
+
checkout: {
|
|
11
|
+
url: "",
|
|
12
|
+
token: "",
|
|
13
|
+
secret: "",
|
|
14
|
+
user: ""
|
|
15
|
+
},
|
|
16
|
+
bapiClient: new StorefrontAPIClient({ host: "", shopId: 1001 }),
|
|
17
|
+
sapiClient: new StorefrontAPIClient({ host: "", shopId: 1001 }),
|
|
18
|
+
cached: (fn, _options) => {
|
|
19
|
+
return async (...args) => {
|
|
20
|
+
return await fn(...args);
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
isCmsPreview: false,
|
|
24
|
+
shopId: 1001,
|
|
25
|
+
domain: "localhost",
|
|
26
|
+
destroySessionsForUserId: vi.fn(),
|
|
27
|
+
generateBasketKeyForUserId: (userId) => Promise.resolve(`basket-${userId}`),
|
|
28
|
+
generateWishlistKeyForUserId: (userId) => Promise.resolve(`wishlist-${userId}`),
|
|
29
|
+
log: new Log(),
|
|
30
|
+
auth: {},
|
|
31
|
+
runtimeConfiguration: {},
|
|
32
|
+
headers: new Headers(),
|
|
33
|
+
...transientParams.isLoggedIn ? {
|
|
34
|
+
wishlistKey: "wishlistKey",
|
|
35
|
+
basketKey: "basketKey",
|
|
36
|
+
sessionId: "sessionId",
|
|
37
|
+
user: void 0,
|
|
38
|
+
accessToken: void 0,
|
|
39
|
+
refreshToken: void 0,
|
|
40
|
+
destroySession: vi.fn(),
|
|
41
|
+
createUserBoundSession: vi.fn(),
|
|
42
|
+
updateUser: vi.fn(),
|
|
43
|
+
updateTokens: vi.fn()
|
|
44
|
+
} : {
|
|
45
|
+
wishlistKey: void 0,
|
|
46
|
+
basketKey: void 0,
|
|
47
|
+
sessionId: void 0,
|
|
48
|
+
user: void 0,
|
|
49
|
+
accessToken: void 0,
|
|
50
|
+
refreshToken: void 0,
|
|
51
|
+
destroySession: void 0,
|
|
52
|
+
createUserBoundSession: void 0,
|
|
53
|
+
updateUser: void 0,
|
|
54
|
+
updateTokens: void 0
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Factory } from "fishery";
|
|
2
|
+
export const shopConfigFactory = Factory.define(() => {
|
|
3
|
+
return {
|
|
4
|
+
shopId: 1,
|
|
5
|
+
domain: "localhost",
|
|
6
|
+
locale: "en-US",
|
|
7
|
+
currency: "USD",
|
|
8
|
+
checkout: {
|
|
9
|
+
host: "checkoutHost",
|
|
10
|
+
secret: "checkoutSecret",
|
|
11
|
+
token: "checkoutToken",
|
|
12
|
+
user: "checkoutUser"
|
|
13
|
+
},
|
|
14
|
+
auth: {
|
|
15
|
+
resetPasswordUrl: "resetPasswordUrl"
|
|
16
|
+
},
|
|
17
|
+
paymentProviders: []
|
|
18
|
+
};
|
|
19
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.89.0",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"types": "./dist/runtime/composables/index.d.ts",
|
|
30
30
|
"import": "./dist/runtime/composables/index.js"
|
|
31
31
|
},
|
|
32
|
+
"./test-factories": {
|
|
33
|
+
"types": "./dist/test-factories/index.d.ts",
|
|
34
|
+
"default": "./dist/test-factories/index.mjs"
|
|
35
|
+
},
|
|
32
36
|
".": {
|
|
33
37
|
"types": "./dist/index.d.ts",
|
|
34
38
|
"default": "./dist/index.mjs"
|
|
@@ -66,7 +70,7 @@
|
|
|
66
70
|
"@opentelemetry/api": "^1.9.0",
|
|
67
71
|
"@scayle/h3-session": "^0.4.1",
|
|
68
72
|
"@scayle/storefront-core": "7.66.1",
|
|
69
|
-
"@scayle/unstorage-compression-driver": "^0.1.
|
|
73
|
+
"@scayle/unstorage-compression-driver": "^0.1.5",
|
|
70
74
|
"@vueuse/core": "11.2.0",
|
|
71
75
|
"consola": "^3.2.3",
|
|
72
76
|
"core-js": "^3.37.1",
|
|
@@ -76,11 +80,12 @@
|
|
|
76
80
|
"knitwork": "^1.1.0",
|
|
77
81
|
"nitropack": "^2.9.7",
|
|
78
82
|
"ofetch": "^1.3.4",
|
|
79
|
-
"ufo": "^1.5.
|
|
83
|
+
"ufo": "^1.5.4",
|
|
80
84
|
"uncrypto": "^0.1.3",
|
|
81
85
|
"unstorage": "^1.10.2",
|
|
82
86
|
"vue-router": "^4.4.0",
|
|
83
|
-
"zod": "^3.23.8"
|
|
87
|
+
"zod": "^3.23.8",
|
|
88
|
+
"schema-dts": "1.1.2"
|
|
84
89
|
},
|
|
85
90
|
"devDependencies": {
|
|
86
91
|
"@nuxt/eslint": "0.6.1",
|
|
@@ -89,9 +94,9 @@
|
|
|
89
94
|
"@nuxt/test-utils": "3.14.4",
|
|
90
95
|
"@scayle/eslint-config-storefront": "4.3.2",
|
|
91
96
|
"@scayle/eslint-plugin-vue-composable": "0.2.1",
|
|
92
|
-
"@types/node": "22.8.
|
|
97
|
+
"@types/node": "22.8.7",
|
|
93
98
|
"dprint": "0.47.5",
|
|
94
|
-
"eslint": "9.
|
|
99
|
+
"eslint": "9.14.0",
|
|
95
100
|
"eslint-formatter-gitlab": "5.1.0",
|
|
96
101
|
"fishery": "2.2.2",
|
|
97
102
|
"h3": "1.13.0",
|
|
@@ -106,7 +111,8 @@
|
|
|
106
111
|
"h3": "^1.10.0",
|
|
107
112
|
"nuxt": ">=3.10.0",
|
|
108
113
|
"unstorage": ">= 1.10.1",
|
|
109
|
-
"vue": ">=3.4.0"
|
|
114
|
+
"vue": ">=3.4.0",
|
|
115
|
+
"fishery": "^2.2.2"
|
|
110
116
|
},
|
|
111
117
|
"resolutions": {
|
|
112
118
|
"h3": "1.13.0",
|
|
@@ -115,6 +121,6 @@
|
|
|
115
121
|
"@nuxt/schema": "3.13.2"
|
|
116
122
|
},
|
|
117
123
|
"volta": {
|
|
118
|
-
"node": "22.
|
|
124
|
+
"node": "22.11.0"
|
|
119
125
|
}
|
|
120
126
|
}
|