@shopware/helpers 0.0.0-canary-20250116171244
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/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/index.d.mts +617 -0
- package/dist/index.d.ts +617 -0
- package/dist/index.mjs +455 -0
- package/package.json +52 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
function getProductFreeShipping(product) {
|
|
2
|
+
return product?.shippingFree || false;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function getMainImageUrl(object) {
|
|
6
|
+
if (!object)
|
|
7
|
+
return "";
|
|
8
|
+
if ("cover" in object && object.cover) {
|
|
9
|
+
if ("media" in object.cover) {
|
|
10
|
+
return object?.cover?.media?.url || "";
|
|
11
|
+
}
|
|
12
|
+
if ("url" in object.cover) {
|
|
13
|
+
return object?.cover?.url || "";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if ("media" in object && Array.isArray(object.media) && object.media.length > 0) {
|
|
17
|
+
return object?.media?.[0]?.media?.url || "";
|
|
18
|
+
}
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getTranslatedProperty(element, property) {
|
|
23
|
+
return element?.translated?.[property] || element?.[property] || "";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getProductName({ product } = {}) {
|
|
27
|
+
if (!product) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return getTranslatedProperty(product, "name");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getProductReviews({ product } = {}) {
|
|
34
|
+
if (!product || !product.productReviews) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
return product.productReviews.map(
|
|
38
|
+
({ id, externalUser, customerId, createdAt, content, points }) => ({
|
|
39
|
+
id,
|
|
40
|
+
author: externalUser ? externalUser : customerId,
|
|
41
|
+
date: createdAt,
|
|
42
|
+
message: content,
|
|
43
|
+
rating: points
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getProductTierPrices(product) {
|
|
49
|
+
if (!product || !product.calculatedPrices?.length) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const size = product.calculatedPrices.length;
|
|
53
|
+
return product.calculatedPrices.map(({ unitPrice, quantity }, index) => ({
|
|
54
|
+
label: index === size - 1 ? `from ${quantity}` : `to ${quantity}`,
|
|
55
|
+
quantity,
|
|
56
|
+
unitPrice
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function getProductUrl(product) {
|
|
61
|
+
if (!product)
|
|
62
|
+
return "/";
|
|
63
|
+
const seoUrl = product.seoUrls?.[0]?.seoPathInfo;
|
|
64
|
+
return seoUrl ? `/${seoUrl}` : `/detail/${product.id}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getProductRatingAverage(product) {
|
|
68
|
+
return product?.ratingAverage;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function getProductCalculatedListingPrice(product) {
|
|
72
|
+
return product?.calculatedPrice?.listPrice?.price || product?.calculatedPrice?.unitPrice;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function getProductRealPrice(product) {
|
|
76
|
+
if (!product) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const real = product.calculatedPrice;
|
|
80
|
+
if (product.calculatedPrices && product.calculatedPrices.length > 1) {
|
|
81
|
+
return product.calculatedPrices[product.calculatedPrices.length - 1];
|
|
82
|
+
}
|
|
83
|
+
return real;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function getProductFromPrice(product) {
|
|
87
|
+
if (!product) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const realPrice = getProductRealPrice(product);
|
|
91
|
+
const displayFromPriceLabel = (product.calculatedPrices?.length ?? 0) > 0;
|
|
92
|
+
if (displayFromPriceLabel)
|
|
93
|
+
return realPrice?.unitPrice;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function getProductRoute(product) {
|
|
97
|
+
return {
|
|
98
|
+
path: getProductUrl(product),
|
|
99
|
+
state: {
|
|
100
|
+
routeName: "frontend.detail.page",
|
|
101
|
+
foreignKey: product?.id
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function getEntityPrefix(category) {
|
|
107
|
+
switch (category.linkType) {
|
|
108
|
+
case "category":
|
|
109
|
+
return "navigation";
|
|
110
|
+
case "product":
|
|
111
|
+
return "detail";
|
|
112
|
+
case "landing_page":
|
|
113
|
+
return "landingPage";
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function getCategoryUrl(category) {
|
|
117
|
+
if (!category)
|
|
118
|
+
return "/";
|
|
119
|
+
switch (category.type) {
|
|
120
|
+
case void 0:
|
|
121
|
+
return "/";
|
|
122
|
+
case "link":
|
|
123
|
+
return category.externalLink || category?.seoUrls?.[0]?.seoPathInfo && `/${category?.seoUrls?.[0]?.seoPathInfo.replace(/^\/+/, "")}` || `/${getEntityPrefix(category)}/${category.internalLink}`;
|
|
124
|
+
default:
|
|
125
|
+
return category.seoUrls?.[0]?.seoPathInfo ? `/${category.seoUrls[0].seoPathInfo}` : `/${getEntityPrefix(category)}/${category.id}`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const isCategory$1 = (category) => {
|
|
130
|
+
return category?.type === "page" || category?.type === "link" || category?.type === "folder";
|
|
131
|
+
};
|
|
132
|
+
function getCategoryImageUrl(category) {
|
|
133
|
+
return isCategory$1(category) ? category?.media?.url || "" : "";
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getCategoryBreadcrumbs(category, options) {
|
|
137
|
+
const breadcrumbs = category?.translated?.breadcrumb || category?.breadcrumb || [];
|
|
138
|
+
const startIndex = options?.startIndex || 0;
|
|
139
|
+
if (breadcrumbs.length <= startIndex)
|
|
140
|
+
return [];
|
|
141
|
+
return breadcrumbs.slice(startIndex).map((element) => {
|
|
142
|
+
return {
|
|
143
|
+
name: element
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function getCategoryRoute(category) {
|
|
149
|
+
if (!category)
|
|
150
|
+
return "/";
|
|
151
|
+
if (category.type === "page" || category.type === "link" && category.linkType === "category") {
|
|
152
|
+
return {
|
|
153
|
+
path: getCategoryUrl(category),
|
|
154
|
+
state: {
|
|
155
|
+
routeName: "frontend.navigation.page",
|
|
156
|
+
foreignKey: category?.id
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
if (category.type === "link" && category.linkType === "product") {
|
|
161
|
+
return {
|
|
162
|
+
path: getCategoryUrl(category),
|
|
163
|
+
state: {
|
|
164
|
+
routeName: "frontend.detail.page",
|
|
165
|
+
foreignKey: category?.internalLink
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (category.type === "link" && category.linkType === "landing_page") {
|
|
170
|
+
return {
|
|
171
|
+
path: getCategoryUrl(category),
|
|
172
|
+
state: {
|
|
173
|
+
routeName: "frontend.landing.page",
|
|
174
|
+
foreignKey: category?.internalLink
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
return getCategoryUrl(category);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function isCmsSlot(content) {
|
|
182
|
+
return content.apiAlias === "cms_slot";
|
|
183
|
+
}
|
|
184
|
+
function _getVisibilityClasses(content) {
|
|
185
|
+
const visibilityCssClasses = {};
|
|
186
|
+
if (isCmsSlot(content) || !content?.visibility) {
|
|
187
|
+
return visibilityCssClasses;
|
|
188
|
+
}
|
|
189
|
+
const visibilityMap = {
|
|
190
|
+
mobile: "max-md:hidden",
|
|
191
|
+
tablet: "md:max-lg:hidden",
|
|
192
|
+
desktop: "lg:hidden"
|
|
193
|
+
};
|
|
194
|
+
for (const [device, isVisible] of Object.entries(content.visibility)) {
|
|
195
|
+
if (!isVisible && visibilityMap[device]) {
|
|
196
|
+
visibilityCssClasses[visibilityMap[device]] = true;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return visibilityCssClasses;
|
|
200
|
+
}
|
|
201
|
+
function getCmsLayoutConfiguration(content) {
|
|
202
|
+
const result = {
|
|
203
|
+
cssClasses: null,
|
|
204
|
+
layoutStyles: {}
|
|
205
|
+
};
|
|
206
|
+
if (!content || isCmsSlot(content)) {
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
const visibilityCssClasses = _getVisibilityClasses(content);
|
|
210
|
+
const mappedCssClasses = typeof content.cssClass === "string" ? content.cssClass.split(" ").reduce((accumulator, cssClass) => {
|
|
211
|
+
return Object.assign(accumulator, { [cssClass]: true });
|
|
212
|
+
}, {}) : {};
|
|
213
|
+
const cssClasses = Object.keys(visibilityCssClasses).length ? Object.assign({}, mappedCssClasses, visibilityCssClasses) : mappedCssClasses;
|
|
214
|
+
result.cssClasses = cssClasses;
|
|
215
|
+
if (content.backgroundColor) {
|
|
216
|
+
result.layoutStyles.backgroundColor = content.backgroundColor;
|
|
217
|
+
}
|
|
218
|
+
if (content.marginBottom) {
|
|
219
|
+
result.layoutStyles.marginBottom = content.marginBottom;
|
|
220
|
+
}
|
|
221
|
+
if (content.marginLeft) {
|
|
222
|
+
result.layoutStyles.marginLeft = content.marginLeft;
|
|
223
|
+
}
|
|
224
|
+
if (content.marginRight) {
|
|
225
|
+
result.layoutStyles.marginRight = content.marginRight;
|
|
226
|
+
}
|
|
227
|
+
if (content.marginTop) {
|
|
228
|
+
result.layoutStyles.marginTop = content.marginTop;
|
|
229
|
+
}
|
|
230
|
+
if (content.backgroundMedia) {
|
|
231
|
+
result.layoutStyles.backgroundImage = `url("${content.backgroundMedia.url}")`;
|
|
232
|
+
}
|
|
233
|
+
if (content.backgroundMediaMode) {
|
|
234
|
+
result.layoutStyles.backgroundSize = content.backgroundMediaMode;
|
|
235
|
+
}
|
|
236
|
+
if (content.sizingMode) {
|
|
237
|
+
result.layoutStyles.sizingMode = content.sizingMode;
|
|
238
|
+
}
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const DEFAULT_BG_IMAGE_SIZE = 800;
|
|
243
|
+
function roundUp(num) {
|
|
244
|
+
return num ? Math.ceil(num / 100) * 100 : DEFAULT_BG_IMAGE_SIZE;
|
|
245
|
+
}
|
|
246
|
+
const getUrlFromBackgroundImage = (url) => {
|
|
247
|
+
const regex = /(?:\(['"]?)(.*?)(?:['"]?\))/;
|
|
248
|
+
if (url.length > 1e3) {
|
|
249
|
+
throw new Error("Url is too long");
|
|
250
|
+
}
|
|
251
|
+
const match = url.match(regex);
|
|
252
|
+
return !match ? url : match[1];
|
|
253
|
+
};
|
|
254
|
+
function getBackgroundImageUrl(url, element) {
|
|
255
|
+
const backgroundImage = getUrlFromBackgroundImage(url);
|
|
256
|
+
const width = element.backgroundMedia?.metaData?.width ?? 0;
|
|
257
|
+
const height = element.backgroundMedia?.metaData?.height ?? 0;
|
|
258
|
+
const biggestParam = width > height ? `width=${roundUp(width > 1920 ? 1900 : width)}` : `height=${roundUp(height > 1920 ? 1900 : height)}`;
|
|
259
|
+
const srcPath = `${backgroundImage}?${biggestParam}&fit=crop,smart`;
|
|
260
|
+
return `url("${srcPath}")`;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function urlIsAbsolute(url) {
|
|
264
|
+
return /^(?:[a-z+]+:)?\/\//i.test(url);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function buildUrlPrefix(url, prefix) {
|
|
268
|
+
if (typeof url === "string") {
|
|
269
|
+
if (urlIsAbsolute(url))
|
|
270
|
+
return { path: url };
|
|
271
|
+
const resultUrl = url[0] !== "/" ? `/${url}` : url;
|
|
272
|
+
return { path: prefix ? `/${prefix}${resultUrl}` : resultUrl };
|
|
273
|
+
}
|
|
274
|
+
if (url.path && prefix) {
|
|
275
|
+
url.path = `/${prefix}${url.path}`;
|
|
276
|
+
}
|
|
277
|
+
return url.path && typeof url.path === "string" ? url : { path: "" };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const helpersCssClasses = [
|
|
281
|
+
"max-md:hidden",
|
|
282
|
+
"md:max-lg:hidden",
|
|
283
|
+
"lg:hidden"
|
|
284
|
+
];
|
|
285
|
+
|
|
286
|
+
function isMaintenanceMode(errors) {
|
|
287
|
+
return !!errors.find((element) => {
|
|
288
|
+
return element.code === "FRAMEWORK__API_SALES_CHANNEL_MAINTENANCE_MODE";
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function getCmsTranslate(key, params) {
|
|
293
|
+
if (!params)
|
|
294
|
+
return key;
|
|
295
|
+
let translatedText = key;
|
|
296
|
+
for (const param in params) {
|
|
297
|
+
const placeholder = `{${param}}`;
|
|
298
|
+
const paramValue = params[param];
|
|
299
|
+
if (paramValue)
|
|
300
|
+
translatedText = translatedText.replace(
|
|
301
|
+
placeholder,
|
|
302
|
+
paramValue?.toString()
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
return translatedText;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function getCmsBreadcrumbs(page) {
|
|
309
|
+
return [
|
|
310
|
+
{
|
|
311
|
+
name: page.translated.name
|
|
312
|
+
}
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function getCmsEntityObject(response) {
|
|
317
|
+
switch (response.resourceType) {
|
|
318
|
+
case "frontend.detail.page":
|
|
319
|
+
return response.product;
|
|
320
|
+
case "frontend.navigation.page":
|
|
321
|
+
return response.category;
|
|
322
|
+
case "frontend.landing.page":
|
|
323
|
+
return response.landingPage;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function isProduct(entity) {
|
|
327
|
+
return entity.apiAlias === "product";
|
|
328
|
+
}
|
|
329
|
+
function isCategory(entity) {
|
|
330
|
+
return entity.apiAlias === "category";
|
|
331
|
+
}
|
|
332
|
+
function isLandingPage(entity) {
|
|
333
|
+
return entity.apiAlias === "landing_page";
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const getFilter = (code, aggregation) => {
|
|
337
|
+
return {
|
|
338
|
+
label: getTranslatedProperty(aggregation, "name") || code,
|
|
339
|
+
code,
|
|
340
|
+
...aggregation
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
function isEntitiesAggregation(aggregation) {
|
|
344
|
+
return aggregation.entities !== void 0;
|
|
345
|
+
}
|
|
346
|
+
function getListingFilters(aggregations) {
|
|
347
|
+
if (!aggregations) {
|
|
348
|
+
return [];
|
|
349
|
+
}
|
|
350
|
+
const transformedFilters = [];
|
|
351
|
+
for (const [aggregationName, aggregation] of Object.entries(aggregations)) {
|
|
352
|
+
if (aggregationName === "properties" && isEntitiesAggregation(aggregation)) {
|
|
353
|
+
for (const filterEntity of aggregation.entities) {
|
|
354
|
+
transformedFilters.push(getFilter(aggregationName, filterEntity));
|
|
355
|
+
}
|
|
356
|
+
} else if (!["properties", "options"].includes(aggregationName)) {
|
|
357
|
+
transformedFilters.push(getFilter(aggregationName, aggregation));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return transformedFilters;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const toFixedValue = 2;
|
|
364
|
+
const decimalsRegExp = new RegExp(`[.,]0{${toFixedValue}}$`);
|
|
365
|
+
function removeDecimals(value) {
|
|
366
|
+
return value.replace(decimalsRegExp, "");
|
|
367
|
+
}
|
|
368
|
+
function getFormattedPrice(value, currency, options = {
|
|
369
|
+
direction: "ltr",
|
|
370
|
+
removeDecimals: false,
|
|
371
|
+
removeCurrency: false
|
|
372
|
+
}) {
|
|
373
|
+
let formattedPrice = [(+value).toFixed(toFixedValue), currency];
|
|
374
|
+
if (options.removeDecimals) {
|
|
375
|
+
formattedPrice[0] = removeDecimals(formattedPrice[0]);
|
|
376
|
+
}
|
|
377
|
+
if (options.removeCurrency) {
|
|
378
|
+
formattedPrice.pop();
|
|
379
|
+
}
|
|
380
|
+
if (options.direction === "rtl" && !options.removeCurrency) {
|
|
381
|
+
formattedPrice = formattedPrice.reverse();
|
|
382
|
+
}
|
|
383
|
+
return formattedPrice.join(" ");
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function downloadFile(file, name) {
|
|
387
|
+
const media = document.createElement("a");
|
|
388
|
+
media.href = URL.createObjectURL(file);
|
|
389
|
+
media.download = name;
|
|
390
|
+
document.body.appendChild(media);
|
|
391
|
+
media.click();
|
|
392
|
+
document.body.removeChild(media);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function getBiggestThumbnailUrl(media) {
|
|
396
|
+
if (!media?.thumbnails?.length) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const biggest = media.thumbnails.reduce((previous, current) => {
|
|
400
|
+
return current.width > previous.width ? current : previous;
|
|
401
|
+
});
|
|
402
|
+
return biggest?.url;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function getMedia(lineItem) {
|
|
406
|
+
return lineItem?.downloads?.reduce((acc, current) => {
|
|
407
|
+
acc.push({
|
|
408
|
+
id: current.id,
|
|
409
|
+
fileName: `${current.media.fileName}.${current.media.fileExtension}`,
|
|
410
|
+
accessGranted: current.accessGranted
|
|
411
|
+
});
|
|
412
|
+
return acc;
|
|
413
|
+
}, []) || [];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function getSmallestThumbnailUrl(media) {
|
|
417
|
+
if (!media || !media?.thumbnails?.length) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const lowest = media.thumbnails.reduce((previous, current) => {
|
|
421
|
+
return current.width < previous.width ? current : previous;
|
|
422
|
+
});
|
|
423
|
+
return lowest?.url;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
function getSrcSetForMedia(media) {
|
|
427
|
+
if (!media?.thumbnails?.length) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
return media.thumbnails.map((thumbnail) => {
|
|
431
|
+
return thumbnail.url ? `${thumbnail.url} ${thumbnail.width}w` : void 0;
|
|
432
|
+
}).filter((value) => !!value).join(", ");
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function getShippingMethodDeliveryTime(shippingMethod) {
|
|
436
|
+
return shippingMethod.deliveryTime?.translated.name;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function getLanguageName(language) {
|
|
440
|
+
return language.translationCode?.translated.name || "";
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function relativeUrlSlash(relativeUrl, slash = true) {
|
|
444
|
+
const hasUrlSlash = relativeUrl.indexOf("/") === 0;
|
|
445
|
+
if (slash) {
|
|
446
|
+
return hasUrlSlash ? relativeUrl : `/${relativeUrl}`;
|
|
447
|
+
}
|
|
448
|
+
return hasUrlSlash ? relativeUrl.substring(1) : relativeUrl;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function canUseQuoteActions(quote) {
|
|
452
|
+
return ["replied"].includes(quote.stateMachineState?.technicalName ?? "");
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export { buildUrlPrefix, canUseQuoteActions, downloadFile, getBackgroundImageUrl, getBiggestThumbnailUrl, getCategoryBreadcrumbs, getCategoryImageUrl, getCategoryRoute, getCategoryUrl, getCmsBreadcrumbs, getCmsEntityObject, getCmsLayoutConfiguration, getCmsTranslate, getFormattedPrice, getLanguageName, getListingFilters, getMainImageUrl, getMedia, getProductCalculatedListingPrice, getProductFreeShipping, getProductFromPrice, getProductName, getProductRatingAverage, getProductReviews, getProductRoute, getProductTierPrices, getProductUrl, getShippingMethodDeliveryTime, getSmallestThumbnailUrl, getSrcSetForMedia, getTranslatedProperty, helpersCssClasses, isCategory, isLandingPage, isMaintenanceMode, isProduct, relativeUrlSlash, urlIsAbsolute };
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shopware/helpers",
|
|
3
|
+
"version": "0.0.0-canary-20250116171244",
|
|
4
|
+
"description": "Shopware helpers for accessing API data",
|
|
5
|
+
"author": "Shopware",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/shopware/frontends.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://frontends.shopware.com/packages/helpers.html",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"shopware",
|
|
14
|
+
"api",
|
|
15
|
+
"helpers"
|
|
16
|
+
],
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/shopware/frontends/issues"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"module": "./dist/index.mjs",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./dist/index.d.mts",
|
|
30
|
+
"default": "./dist/index.mjs"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@biomejs/biome": "1.8.3",
|
|
36
|
+
"@vitest/coverage-v8": "2.1.8",
|
|
37
|
+
"happy-dom": "16.6.0",
|
|
38
|
+
"unbuild": "2.0.0",
|
|
39
|
+
"vitest": "2.1.8",
|
|
40
|
+
"tsconfig": "0.0.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "unbuild && pnpm build:types",
|
|
44
|
+
"build:types": "tsc ./src/*.ts --declaration --allowJs --emitDeclarationOnly --outDir ./temp --skipLibCheck",
|
|
45
|
+
"dev": "unbuild --stub",
|
|
46
|
+
"lint": "biome check .",
|
|
47
|
+
"lint:fix": "biome check . --write && pnpm run typecheck",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"test:watch": "vitest"
|
|
51
|
+
}
|
|
52
|
+
}
|