@scayle/storefront-nuxt 7.91.0 → 7.93.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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.93.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Test factories are now exported via package source root (`./src/index.ts`).
8
+ Now, all test factories can be imported as follows:
9
+
10
+ ```ts
11
+ import { categoryFactory } from '@scayle/storefront-nuxt'
12
+ ```
13
+
14
+ - Add `product`, `variant`, `price`, `attribute` and `route` test factories.
15
+
16
+ ### Patch Changes
17
+
18
+ - Added dependency `vitest@2.1.4`
19
+
20
+ ## 7.92.0
21
+
22
+ ### Minor Changes
23
+
24
+ - Add nitropack as a peer dependency
25
+
26
+ ### Patch Changes
27
+
28
+ - Removed dependency `nitropack@^2.9.7`
29
+ **Dependencies**
30
+
31
+ - Updated dependency to @scayle/storefront-core@7.66.3
32
+
3
33
  ## 7.91.0
4
34
 
5
35
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,15 +1,44 @@
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';
1
+ import { M as ModuleBaseOptions, f as ShopConfig } from './shared/storefront-nuxt.80aa5060.mjs';
2
+ export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.80aa5060.mjs';
2
3
  export { rpcCall } from '../dist/runtime/rpc/rpcCall.js';
3
4
  export { extendPromise } from '../dist/runtime/utils/promise.js';
4
5
  export * from '../dist/runtime/utils/seo.js';
6
+ import { Category, Product, Variant, AttributeGroup, AdvancedAttribute, Price, RpcContext } from '@scayle/storefront-core';
5
7
  export * from '@scayle/storefront-core';
6
8
  export { LogLevel } from '@scayle/storefront-core';
9
+ import { Factory } from 'fishery';
10
+ import { RouteLocationNormalizedLoadedGeneric } from 'vue-router';
7
11
  export { unwrap } from '@scayle/storefront-core/dist/utils/response';
8
12
  import '@scayle/unstorage-compression-driver';
9
13
  import 'unstorage';
10
14
  import '../dist/runtime/utils/zodSchema.js';
11
15
  import '@nuxt/schema';
12
16
 
17
+ declare const categoryFactory: Factory<Category, any, Category>;
18
+
19
+ declare const productFactory: Factory<Product, any, Product>;
20
+
21
+ declare const variantFactory: Factory<Variant, any, Variant>;
22
+
23
+ declare const attributeGroupFactory: Factory<AttributeGroup, any, AttributeGroup>;
24
+ declare const advancedAttributeFactory: Factory<AdvancedAttribute, any, AdvancedAttribute>;
25
+
26
+ declare const priceFactory: Factory<Price, any, Price>;
27
+
28
+ interface ModuleOptionsFactoryParams {
29
+ shops: ShopConfig[];
30
+ }
31
+ declare const moduleOptionsFactory: Factory<ModuleBaseOptions, ModuleOptionsFactoryParams, ModuleBaseOptions>;
32
+
33
+ declare const shopConfigFactory: Factory<ShopConfig, any, ShopConfig>;
34
+
35
+ interface RpcContextFactoryParams {
36
+ isLoggedIn: boolean;
37
+ }
38
+ declare const rpcContextFactory: Factory<RpcContext, RpcContextFactoryParams, RpcContext>;
39
+
40
+ declare const routeFactory: Factory<RouteLocationNormalizedLoadedGeneric, any, RouteLocationNormalizedLoadedGeneric>;
41
+
13
42
  interface RpcMethodsStorefront {
14
43
  }
15
44
  declare module '@scayle/storefront-core' {
@@ -17,4 +46,4 @@ declare module '@scayle/storefront-core' {
17
46
  }
18
47
  }
19
48
 
20
- export type { RpcMethodsStorefront };
49
+ export { ModuleBaseOptions, type RpcMethodsStorefront, ShopConfig, advancedAttributeFactory, attributeGroupFactory, categoryFactory, moduleOptionsFactory, priceFactory, productFactory, routeFactory, rpcContextFactory, shopConfigFactory, variantFactory };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,44 @@
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';
1
+ import { M as ModuleBaseOptions, f as ShopConfig } from './shared/storefront-nuxt.80aa5060.js';
2
+ export { e as AdditionalShopConfig, A as AppKeys, B as BapiConfig, i as CheckoutEvent, C as CheckoutShopConfig, j as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, d as SapiConfig, a as SessionConfig, g as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.80aa5060.js';
2
3
  export { rpcCall } from '../dist/runtime/rpc/rpcCall.js';
3
4
  export { extendPromise } from '../dist/runtime/utils/promise.js';
4
5
  export * from '../dist/runtime/utils/seo.js';
6
+ import { Category, Product, Variant, AttributeGroup, AdvancedAttribute, Price, RpcContext } from '@scayle/storefront-core';
5
7
  export * from '@scayle/storefront-core';
6
8
  export { LogLevel } from '@scayle/storefront-core';
9
+ import { Factory } from 'fishery';
10
+ import { RouteLocationNormalizedLoadedGeneric } from 'vue-router';
7
11
  export { unwrap } from '@scayle/storefront-core/dist/utils/response';
8
12
  import '@scayle/unstorage-compression-driver';
9
13
  import 'unstorage';
10
14
  import '../dist/runtime/utils/zodSchema.js';
11
15
  import '@nuxt/schema';
12
16
 
17
+ declare const categoryFactory: Factory<Category, any, Category>;
18
+
19
+ declare const productFactory: Factory<Product, any, Product>;
20
+
21
+ declare const variantFactory: Factory<Variant, any, Variant>;
22
+
23
+ declare const attributeGroupFactory: Factory<AttributeGroup, any, AttributeGroup>;
24
+ declare const advancedAttributeFactory: Factory<AdvancedAttribute, any, AdvancedAttribute>;
25
+
26
+ declare const priceFactory: Factory<Price, any, Price>;
27
+
28
+ interface ModuleOptionsFactoryParams {
29
+ shops: ShopConfig[];
30
+ }
31
+ declare const moduleOptionsFactory: Factory<ModuleBaseOptions, ModuleOptionsFactoryParams, ModuleBaseOptions>;
32
+
33
+ declare const shopConfigFactory: Factory<ShopConfig, any, ShopConfig>;
34
+
35
+ interface RpcContextFactoryParams {
36
+ isLoggedIn: boolean;
37
+ }
38
+ declare const rpcContextFactory: Factory<RpcContext, RpcContextFactoryParams, RpcContext>;
39
+
40
+ declare const routeFactory: Factory<RouteLocationNormalizedLoadedGeneric, any, RouteLocationNormalizedLoadedGeneric>;
41
+
13
42
  interface RpcMethodsStorefront {
14
43
  }
15
44
  declare module '@scayle/storefront-core' {
@@ -17,4 +46,4 @@ declare module '@scayle/storefront-core' {
17
46
  }
18
47
  }
19
48
 
20
- export type { RpcMethodsStorefront };
49
+ export { ModuleBaseOptions, type RpcMethodsStorefront, ShopConfig, advancedAttributeFactory, attributeGroupFactory, categoryFactory, moduleOptionsFactory, priceFactory, productFactory, routeFactory, rpcContextFactory, shopConfigFactory, variantFactory };
package/dist/index.mjs CHANGED
@@ -1,5 +1,245 @@
1
1
  export { rpcCall } from '../dist/runtime/rpc/rpcCall.js';
2
2
  export { extendPromise } from '../dist/runtime/utils/promise.js';
3
3
  export * from '../dist/runtime/utils/seo.js';
4
+ import { HashAlgorithm, StorefrontAPIClient, Log } from '@scayle/storefront-core';
4
5
  export * from '@scayle/storefront-core';
5
6
  export { unwrap } from '@scayle/storefront-core/dist/utils/response';
7
+ import { Factory } from 'fishery';
8
+
9
+ const categoryFactory = Factory.define(() => {
10
+ return {
11
+ id: 1,
12
+ path: "/women",
13
+ name: "women",
14
+ slug: "test",
15
+ parentId: 2048,
16
+ rootlineIds: [2045, 2048, 2058],
17
+ childrenIds: [],
18
+ properties: [],
19
+ isHidden: false,
20
+ depth: 3,
21
+ supportedFilter: ["color", "brand", "size"],
22
+ shopLevelCustomData: {},
23
+ countryLevelCustomData: {}
24
+ };
25
+ });
26
+
27
+ const attributeGroupFactory = Factory.define(() => {
28
+ return {
29
+ id: 1,
30
+ key: "name",
31
+ label: "Test Attribute",
32
+ type: null,
33
+ multiSelect: false,
34
+ values: {
35
+ label: "Test Attribute"
36
+ }
37
+ };
38
+ });
39
+ const advancedAttributeFactory = Factory.define(
40
+ () => ({
41
+ id: 553,
42
+ key: "productName",
43
+ label: "Produktname",
44
+ type: "",
45
+ values: [
46
+ {
47
+ fieldSet: [[{ value: "Jacke 'Premium Essentials'" }]],
48
+ groupSet: []
49
+ }
50
+ ]
51
+ })
52
+ );
53
+
54
+ const priceFactory = Factory.define(() => {
55
+ return {
56
+ currencyCode: "USD",
57
+ tax: { vat: { amount: 1, rate: 0 } },
58
+ withoutTax: 2,
59
+ withTax: 100,
60
+ appliedReductions: []
61
+ };
62
+ });
63
+
64
+ const variantFactory = Factory.define(() => ({
65
+ id: 1,
66
+ lowestPriorPrice: {
67
+ withTax: 23,
68
+ relativeDifferenceToPrice: null
69
+ },
70
+ stock: { warehouseId: 1, quantity: 2 },
71
+ createdAt: "",
72
+ updatedAt: "",
73
+ price: priceFactory.build()
74
+ }));
75
+
76
+ const productFactory = Factory.define((options) => {
77
+ const attributes = {
78
+ name: attributeGroupFactory.build({
79
+ key: "name",
80
+ label: "Test Product",
81
+ values: {
82
+ label: "Test Product"
83
+ }
84
+ }),
85
+ brand: attributeGroupFactory.build({
86
+ key: "brand",
87
+ label: "Brand",
88
+ type: "string",
89
+ values: {
90
+ label: "Brand Name",
91
+ id: 101,
92
+ value: "brand-name"
93
+ }
94
+ }),
95
+ color: attributeGroupFactory.build({
96
+ key: "color",
97
+ label: "Color",
98
+ type: "",
99
+ values: {
100
+ id: 6,
101
+ label: "Wei\xDF",
102
+ value: "weiss"
103
+ }
104
+ })
105
+ };
106
+ return {
107
+ id: 1,
108
+ attributes: options.params.attributes ?? attributes,
109
+ isActive: true,
110
+ isSoldOut: false,
111
+ isNew: false,
112
+ createdAt: "",
113
+ updatedAt: "",
114
+ images: [{ hash: "test image" }],
115
+ siblings: [
116
+ {
117
+ id: 5,
118
+ attributes: options.params.attributes ?? attributes,
119
+ isActive: true,
120
+ isSoldOut: false,
121
+ isNew: false,
122
+ createdAt: "",
123
+ updatedAt: "",
124
+ images: []
125
+ }
126
+ ],
127
+ variants: [
128
+ variantFactory.build({ id: 1 }),
129
+ variantFactory.build({ id: 2 })
130
+ ]
131
+ };
132
+ });
133
+
134
+ const moduleOptionsFactory = Factory.define(({ transientParams }) => {
135
+ return {
136
+ sapi: {
137
+ host: "sapiHost",
138
+ token: "sapiToken"
139
+ },
140
+ oauth: {
141
+ apiHost: "oauthHost",
142
+ clientId: "clientId",
143
+ clientSecret: "clientSecret"
144
+ },
145
+ appKeys: {
146
+ basketKey: "basketKey",
147
+ wishlistKey: "wishlistKey",
148
+ hashAlgorithm: HashAlgorithm.MD5
149
+ },
150
+ shopSelector: "path",
151
+ shops: (transientParams?.shops || []).reduce((acc, curr) => {
152
+ return {
153
+ [curr.shopId]: curr,
154
+ ...acc
155
+ };
156
+ }, {})
157
+ };
158
+ });
159
+
160
+ const shopConfigFactory = Factory.define(() => {
161
+ return {
162
+ shopId: 1,
163
+ domain: "localhost",
164
+ locale: "en-US",
165
+ currency: "USD",
166
+ checkout: {
167
+ host: "checkoutHost",
168
+ secret: "checkoutSecret",
169
+ token: "checkoutToken",
170
+ user: "checkoutUser"
171
+ },
172
+ auth: {
173
+ resetPasswordUrl: "resetPasswordUrl"
174
+ },
175
+ paymentProviders: []
176
+ };
177
+ });
178
+
179
+ const rpcContextFactory = Factory.define(({ transientParams }) => {
180
+ return {
181
+ locale: "de",
182
+ checkout: {
183
+ url: "",
184
+ token: "",
185
+ secret: "",
186
+ user: ""
187
+ },
188
+ bapiClient: new StorefrontAPIClient({ host: "", shopId: 1001 }),
189
+ sapiClient: new StorefrontAPIClient({ host: "", shopId: 1001 }),
190
+ cached: (fn, _options) => {
191
+ return async (...args) => {
192
+ return await fn(...args);
193
+ };
194
+ },
195
+ isCmsPreview: false,
196
+ shopId: 1001,
197
+ domain: "localhost",
198
+ destroySessionsForUserId: () => Promise.resolve(),
199
+ generateBasketKeyForUserId: (userId) => Promise.resolve(`basket-${userId}`),
200
+ generateWishlistKeyForUserId: (userId) => Promise.resolve(`wishlist-${userId}`),
201
+ log: new Log(),
202
+ auth: {},
203
+ runtimeConfiguration: {},
204
+ headers: new Headers(),
205
+ ...transientParams.isLoggedIn ? {
206
+ wishlistKey: "wishlistKey",
207
+ basketKey: "basketKey",
208
+ sessionId: "sessionId",
209
+ user: void 0,
210
+ accessToken: void 0,
211
+ refreshToken: void 0,
212
+ destroySession: () => Promise.resolve(),
213
+ createUserBoundSession: () => Promise.resolve(),
214
+ updateUser: () => Promise.resolve(),
215
+ updateTokens: () => Promise.resolve()
216
+ } : {
217
+ wishlistKey: void 0,
218
+ basketKey: void 0,
219
+ sessionId: void 0,
220
+ user: void 0,
221
+ accessToken: void 0,
222
+ refreshToken: void 0,
223
+ destroySession: void 0,
224
+ createUserBoundSession: void 0,
225
+ updateUser: void 0,
226
+ updateTokens: void 0
227
+ }
228
+ };
229
+ });
230
+
231
+ const routeFactory = Factory.define(
232
+ () => ({
233
+ name: "test",
234
+ params: {},
235
+ matched: [],
236
+ path: "/test",
237
+ fullPath: "/test",
238
+ redirectedFrom: void 0,
239
+ hash: "",
240
+ meta: { test: "" },
241
+ query: {}
242
+ })
243
+ );
244
+
245
+ export { advancedAttributeFactory, attributeGroupFactory, categoryFactory, moduleOptionsFactory, priceFactory, productFactory, routeFactory, rpcContextFactory, shopConfigFactory, variantFactory };
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.91.0",
3
+ "version": "7.93.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -48,7 +48,7 @@ export default {
48
48
  }`;
49
49
  }
50
50
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
51
- const PACKAGE_VERSION = "7.91.0";
51
+ const PACKAGE_VERSION = "7.93.0";
52
52
  const logger = createConsola({
53
53
  fancy: true,
54
54
  formatOptions: {
@@ -1,4 +1,4 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | true | string[] | import("@scayle/storefront-core").ShopUser | Response | import("@scayle/storefront-api").Product | import("@scayle/storefront-api").Product[] | {
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | true | import("@scayle/storefront-core").ShopUser | string[] | import("@scayle/storefront-api").Product | import("@scayle/storefront-api").Product[] | {
2
2
  count: number;
3
3
  } | {
4
4
  filters: import("@scayle/storefront-api").FiltersEndpointResponseData;
@@ -34,7 +34,7 @@ declare const _default: import("h3").EventHandler<import("h3").EventHandlerReque
34
34
  activeNode: import("@scayle/storefront-api").Category;
35
35
  } | import("@scayle/storefront-core").Order | import("@scayle/storefront-api").TypeaheadSuggestionsEndpointResponseData | import("@scayle/storefront-api").SearchV2SuggestionsEndpointResponseData | import("@scayle/storefront-api").SearchEntity | import("@scayle/storefront-api").ShopConfiguration | {
36
36
  user: import("@scayle/storefront-core").ShopUser | undefined;
37
- } | import("@scayle/storefront-api").Wishlist | import("@scayle/storefront-core").ShopUserAddress[] | {
37
+ } | import("@scayle/storefront-api").Wishlist | Response | import("@scayle/storefront-core").ShopUserAddress[] | {
38
38
  accessToken: string;
39
39
  checkoutJwt: string;
40
40
  } | import("@scayle/storefront-api").VariantDetail[] | import("@scayle/storefront-api").NavigationAllEndpointResponseData | import("@scayle/storefront-api").NavigationTree | {
@@ -1,8 +1,8 @@
1
1
  declare const _default: import("nuxt/app").Plugin<{
2
- currentShop: import("../..").PublicShopConfig;
3
- availableShops: import("../..").PublicShopConfig[];
2
+ currentShop: import("../../module").PublicShopConfig;
3
+ availableShops: import("../../module").PublicShopConfig[];
4
4
  }> & import("nuxt/app").ObjectPlugin<{
5
- currentShop: import("../..").PublicShopConfig;
6
- availableShops: import("../..").PublicShopConfig[];
5
+ currentShop: import("../../module").PublicShopConfig;
6
+ availableShops: import("../../module").PublicShopConfig[];
7
7
  }>;
8
8
  export default _default;