@shopware/helpers 1.6.0 → 1.7.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/README.md CHANGED
@@ -30,31 +30,107 @@ export default defineConfig({
30
30
  });
31
31
  ```
32
32
 
33
+ ## `getBackgroundImageUrl` helper
34
+
35
+ The `getBackgroundImageUrl` function generates optimized CSS `url()` values for CMS background images. It extracts the raw URL, calculates the appropriate dimensions based on the media metadata, and applies image transformation parameters.
36
+
37
+ ### Usage
38
+
39
+ ```ts
40
+ import { getBackgroundImageUrl } from "@shopware/helpers";
41
+
42
+ const optimizedUrl = getBackgroundImageUrl(
43
+ "url(https://cdn.shopware.store/.../image.jpg)",
44
+ cmsBlockOrSection, // object with backgroundMedia.metaData.width/height
45
+ { format: "webp", quality: 85 }, // optional
46
+ );
47
+ // => 'url("https://cdn.shopware.store/.../image.jpg?width=1000&fit=crop,smart&format=webp&quality=85")'
48
+ ```
49
+
50
+ ### Parameters
51
+
52
+ | Parameter | Type | Description |
53
+ |-----------|------|-------------|
54
+ | `url` | `string` | CSS `url()` string containing the background image URL |
55
+ | `element` | `{ backgroundMedia?: { metaData?: { width?: number; height?: number } } }` | CMS section or block object with media metadata |
56
+ | `options` | `BackgroundImageOptions` (optional) | Format and quality settings |
57
+
58
+ ### `BackgroundImageOptions`
59
+
60
+ ```ts
61
+ type BackgroundImageOptions = {
62
+ format?: string; // "webp" | "avif" | "jpg" | "png"
63
+ quality?: number; // 0-100
64
+ };
65
+ ```
66
+
67
+ When `format` or `quality` are provided, they are appended as query parameters to the image URL. If omitted, only the dimension and fit parameters are applied.
68
+
69
+ ## `generateCdnSrcSet` helper
70
+
71
+ Generates an HTML `srcset` string using CDN width-based resizing. Useful as a fallback when media has no pre-generated thumbnails — the CDN handles on-the-fly resizing via query parameters.
72
+
73
+ ### Usage
74
+
75
+ ```ts
76
+ import { generateCdnSrcSet } from "@shopware/helpers";
77
+
78
+ const srcset = generateCdnSrcSet(
79
+ "https://cdn.shopware.store/.../image.jpg",
80
+ [400, 800, 1200, 1600], // optional, these are the defaults
81
+ { format: "webp", quality: 85 }, // optional
82
+ );
83
+ // => "https://cdn.shopware.store/.../image.jpg?width=400&fit=crop,smart&format=webp&quality=85 400w, ...800w, ...1200w, ...1600w"
84
+ ```
85
+
86
+ ### Parameters
87
+
88
+ | Parameter | Type | Description |
89
+ |-----------|------|-------------|
90
+ | `src` | `string \| undefined` | Base image URL |
91
+ | `widths` | `number[]` (optional) | Array of widths to generate (default: `[400, 800, 1200, 1600]`) |
92
+ | `options` | `{ format?: string; quality?: number }` (optional) | Format and quality settings |
93
+
94
+ Returns `undefined` if `src` is falsy or URL parsing fails.
95
+
96
+ ## `buildCdnImageUrl` helper
97
+
98
+ Builds an optimized CDN image URL with size parameters based on rendered element dimensions. Adds `width` or `height` (whichever is larger) rounded up to the nearest 100px, plus `fit=crop,smart`.
99
+
100
+ ### Usage
101
+
102
+ ```ts
103
+ import { buildCdnImageUrl } from "@shopware/helpers";
104
+
105
+ const url = buildCdnImageUrl(
106
+ "https://cdn.shopware.store/.../image.jpg",
107
+ { width: 724, height: 760 },
108
+ );
109
+ // => "https://cdn.shopware.store/.../image.jpg?height=800&fit=crop,smart"
110
+ ```
111
+
112
+ ### Parameters
113
+
114
+ | Parameter | Type | Description |
115
+ |-----------|------|-------------|
116
+ | `src` | `string \| undefined` | Base image URL |
117
+ | `dimensions` | `{ width: number; height: number }` | Rendered element dimensions in pixels |
118
+ | `options` | `{ format?: string; quality?: number }` (optional) | Format and quality settings |
119
+
120
+ Returns an empty string if `src` is falsy. Returns the original `src` if URL parsing fails.
121
+
33
122
  <!-- AUTO GENERATED CHANGELOG -->
34
123
 
35
124
  ## Changelog
36
125
 
37
126
  Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/helpers/CHANGELOG.md)
38
127
 
39
- ### Latest changes: 1.6.0
128
+ ### Latest changes: 1.7.0
40
129
 
41
130
  ### Minor Changes
42
131
 
43
- - [#1985](https://github.com/shopware/frontends/pull/1985) [`2cbda25`](https://github.com/shopware/frontends/commit/2cbda257a1056454e12f2fba9052f83eecb6d986) Thanks [@mkucmus](https://github.com/mkucmus)! - Added methods to extract product info:
44
- - `isProductOnSale`
45
- - `isProductTopSeller`
46
- - `getProductManufacturerName`
47
-
48
- - [#2176](https://github.com/shopware/frontends/pull/2176) [`c647baf`](https://github.com/shopware/frontends/commit/c647baf93e7174b849f5961ee5803add99d78602) Thanks [@mkucmus](https://github.com/mkucmus)! - - Add `getProductListingFromCmsPage` helper to extract product listing from CMS page structure
49
- - Enable early access to listing data during SSR before component tree renders
132
+ - [#2287](https://github.com/shopware/frontends/pull/2287) [`c9bde38`](https://github.com/shopware/frontends/commit/c9bde38d497d5c6c2fbd97700a362eb44ce8881f) Thanks [@mkucmus](https://github.com/mkucmus)! - Add generateCdnSrcSet and buildCdnImageUrl helpers for synthetic responsive image srcset generation via CDN query params
50
133
 
51
134
  ### Patch Changes
52
135
 
53
- - [#2030](https://github.com/shopware/frontends/pull/2030) [`22ff62e`](https://github.com/shopware/frontends/commit/22ff62e354f024599d64ea8096af57695248851c) Thanks [@mkucmus](https://github.com/mkucmus)! - Extended `ListingFilter` type to support property options and manufacturer entities:
54
- - Added optional `options` property for property group options
55
- - Added optional `entities` property for manufacturer entities
56
- - Improved type safety by explicitly typing empty array return in `getListingFilters()`
57
-
58
- - [#2153](https://github.com/shopware/frontends/pull/2153) [`56cd178`](https://github.com/shopware/frontends/commit/56cd178e25fe2399b7170ccac3044e980621f041) Thanks [@mkucmus](https://github.com/mkucmus)! - Fix `getSrcSetForMedia` to properly encode special characters (spaces, commas, parentheses) in media URLs
59
-
60
- - [#2162](https://github.com/shopware/frontends/pull/2162) [`e1fae3e`](https://github.com/shopware/frontends/commit/e1fae3eb6430e5c8e133456fbaf7f215f80c36f6) Thanks [@mkucmus](https://github.com/mkucmus)! - Export encodeUrlPath helper function to properly handle special characters (spaces, commas) in image URLs
136
+ - [#2320](https://github.com/shopware/frontends/pull/2320) [`a871c7b`](https://github.com/shopware/frontends/commit/a871c7b6256b75c2e40d93fc0354ba1971420062) Thanks [@mdanilowicz](https://github.com/mdanilowicz)! - Improve getSmallestThumbnailUrl - add media.url fallback when thumbnails are missing or empty
package/dist/index.d.mts CHANGED
@@ -397,6 +397,10 @@ type LayoutConfiguration = {
397
397
  */
398
398
  declare function getCmsLayoutConfiguration<T extends CmsBlock | CmsSection | CmsSlot>(content: T): LayoutConfiguration;
399
399
 
400
+ type BackgroundImageOptions = {
401
+ format?: string;
402
+ quality?: number;
403
+ };
400
404
  declare function getBackgroundImageUrl<T extends {
401
405
  backgroundMedia?: {
402
406
  metaData?: {
@@ -404,7 +408,7 @@ declare function getBackgroundImageUrl<T extends {
404
408
  height?: number;
405
409
  };
406
410
  };
407
- }>(url: string, element: T): string;
411
+ }>(url: string, element: T, options?: BackgroundImageOptions): string;
408
412
 
409
413
  type UrlRoute = {
410
414
  path?: string;
@@ -616,7 +620,7 @@ declare function getMedia<T extends {
616
620
  }>(lineItem: T): ProductMedia[];
617
621
 
618
622
  /**
619
- * Returns the smallest thumbnail url from the media object
623
+ * Returns the smallest thumbnail url from the media object or the media.url if no thumbnails are available
620
624
  *
621
625
  * @param media image object
622
626
  *
@@ -628,6 +632,7 @@ declare function getSmallestThumbnailUrl<T extends {
628
632
  width: number;
629
633
  url: string;
630
634
  }>;
635
+ url?: string;
631
636
  }>(media?: T): string | undefined;
632
637
 
633
638
  /**
@@ -640,6 +645,41 @@ declare function getSmallestThumbnailUrl<T extends {
640
645
  * @category Media
641
646
  */
642
647
  declare function encodeUrlPath(urlString: string): string;
648
+ /**
649
+ * Generates a srcset string using CDN width-based resizing.
650
+ * Useful as a fallback when media has no pre-generated thumbnails.
651
+ *
652
+ * @param src - Base image URL
653
+ * @param widths - Array of widths to generate (default: [400, 800, 1200, 1600])
654
+ * @param options - Optional format and quality params
655
+ * @returns srcset string or undefined if src is invalid
656
+ *
657
+ * @public
658
+ * @category Media
659
+ */
660
+ declare function generateCdnSrcSet(src: string | undefined, widths?: number[], options?: {
661
+ format?: string;
662
+ quality?: number;
663
+ }): string | undefined;
664
+ /**
665
+ * Builds an optimized CDN image URL with size parameters.
666
+ * Adds width or height (whichever is larger, width if equal)
667
+ * rounded up to the nearest 100px.
668
+ *
669
+ * @param src - Base image URL
670
+ * @param dimensions - Rendered element dimensions (width and height)
671
+ * @returns Optimized image URL string
672
+ *
673
+ * @public
674
+ * @category Media
675
+ */
676
+ declare function buildCdnImageUrl(src: string | undefined, dimensions: {
677
+ width: number;
678
+ height: number;
679
+ }, options?: {
680
+ format?: string;
681
+ quality?: number;
682
+ }): string;
643
683
  /**
644
684
  * Returns the srcset attribute for the image, for available breakpoints
645
685
  *
@@ -715,4 +755,4 @@ declare function canUseQuoteActions<T extends {
715
755
  };
716
756
  }>(quote: T): boolean;
717
757
 
718
- export { type HelpersCssClasses, type LayoutConfiguration, type TierPrice, type UiMediaGalleryItem, type UiMediaGalleryItemUrl, type UiProductOption, type UiProductProperty, type UiProductReview, type UrlRouteOutput, buildUrlPrefix, canUseQuoteActions, downloadFile, encodeUrlPath, getBackgroundImageUrl, getBiggestThumbnailUrl, getCategoryBreadcrumbs, getCategoryImageUrl, getCategoryRoute, getCategoryUrl, getCmsBreadcrumbs, getCmsEntityObject, getCmsLayoutConfiguration, getCmsTranslate, getFormattedPrice, getLanguageName, getListingFilters, getMainImageUrl, getMedia, getPaymentMethodIcon, getProductCalculatedListingPrice, getProductFreeShipping, getProductFromPrice, getProductListingFromCmsPage, getProductManufacturerName, getProductName, getProductRatingAverage, getProductReviews, getProductRoute, getProductTierPrices, getProductUrl, getShippingMethodDeliveryTime, getShippingMethodIcon, getSmallestThumbnailUrl, getSrcSetForMedia, getTranslatedProperty, helpersCssClasses, isCategory, isLandingPage, isMaintenanceMode, isProduct, isProductOnSale, isProductTopSeller, relativeUrlSlash, urlIsAbsolute };
758
+ export { type BackgroundImageOptions, type HelpersCssClasses, type LayoutConfiguration, type TierPrice, type UiMediaGalleryItem, type UiMediaGalleryItemUrl, type UiProductOption, type UiProductProperty, type UiProductReview, type UrlRouteOutput, buildCdnImageUrl, buildUrlPrefix, canUseQuoteActions, downloadFile, encodeUrlPath, generateCdnSrcSet, getBackgroundImageUrl, getBiggestThumbnailUrl, getCategoryBreadcrumbs, getCategoryImageUrl, getCategoryRoute, getCategoryUrl, getCmsBreadcrumbs, getCmsEntityObject, getCmsLayoutConfiguration, getCmsTranslate, getFormattedPrice, getLanguageName, getListingFilters, getMainImageUrl, getMedia, getPaymentMethodIcon, getProductCalculatedListingPrice, getProductFreeShipping, getProductFromPrice, getProductListingFromCmsPage, getProductManufacturerName, getProductName, getProductRatingAverage, getProductReviews, getProductRoute, getProductTierPrices, getProductUrl, getShippingMethodDeliveryTime, getShippingMethodIcon, getSmallestThumbnailUrl, getSrcSetForMedia, getTranslatedProperty, helpersCssClasses, isCategory, isLandingPage, isMaintenanceMode, isProduct, isProductOnSale, isProductTopSeller, relativeUrlSlash, urlIsAbsolute };
package/dist/index.d.ts CHANGED
@@ -397,6 +397,10 @@ type LayoutConfiguration = {
397
397
  */
398
398
  declare function getCmsLayoutConfiguration<T extends CmsBlock | CmsSection | CmsSlot>(content: T): LayoutConfiguration;
399
399
 
400
+ type BackgroundImageOptions = {
401
+ format?: string;
402
+ quality?: number;
403
+ };
400
404
  declare function getBackgroundImageUrl<T extends {
401
405
  backgroundMedia?: {
402
406
  metaData?: {
@@ -404,7 +408,7 @@ declare function getBackgroundImageUrl<T extends {
404
408
  height?: number;
405
409
  };
406
410
  };
407
- }>(url: string, element: T): string;
411
+ }>(url: string, element: T, options?: BackgroundImageOptions): string;
408
412
 
409
413
  type UrlRoute = {
410
414
  path?: string;
@@ -616,7 +620,7 @@ declare function getMedia<T extends {
616
620
  }>(lineItem: T): ProductMedia[];
617
621
 
618
622
  /**
619
- * Returns the smallest thumbnail url from the media object
623
+ * Returns the smallest thumbnail url from the media object or the media.url if no thumbnails are available
620
624
  *
621
625
  * @param media image object
622
626
  *
@@ -628,6 +632,7 @@ declare function getSmallestThumbnailUrl<T extends {
628
632
  width: number;
629
633
  url: string;
630
634
  }>;
635
+ url?: string;
631
636
  }>(media?: T): string | undefined;
632
637
 
633
638
  /**
@@ -640,6 +645,41 @@ declare function getSmallestThumbnailUrl<T extends {
640
645
  * @category Media
641
646
  */
642
647
  declare function encodeUrlPath(urlString: string): string;
648
+ /**
649
+ * Generates a srcset string using CDN width-based resizing.
650
+ * Useful as a fallback when media has no pre-generated thumbnails.
651
+ *
652
+ * @param src - Base image URL
653
+ * @param widths - Array of widths to generate (default: [400, 800, 1200, 1600])
654
+ * @param options - Optional format and quality params
655
+ * @returns srcset string or undefined if src is invalid
656
+ *
657
+ * @public
658
+ * @category Media
659
+ */
660
+ declare function generateCdnSrcSet(src: string | undefined, widths?: number[], options?: {
661
+ format?: string;
662
+ quality?: number;
663
+ }): string | undefined;
664
+ /**
665
+ * Builds an optimized CDN image URL with size parameters.
666
+ * Adds width or height (whichever is larger, width if equal)
667
+ * rounded up to the nearest 100px.
668
+ *
669
+ * @param src - Base image URL
670
+ * @param dimensions - Rendered element dimensions (width and height)
671
+ * @returns Optimized image URL string
672
+ *
673
+ * @public
674
+ * @category Media
675
+ */
676
+ declare function buildCdnImageUrl(src: string | undefined, dimensions: {
677
+ width: number;
678
+ height: number;
679
+ }, options?: {
680
+ format?: string;
681
+ quality?: number;
682
+ }): string;
643
683
  /**
644
684
  * Returns the srcset attribute for the image, for available breakpoints
645
685
  *
@@ -715,4 +755,4 @@ declare function canUseQuoteActions<T extends {
715
755
  };
716
756
  }>(quote: T): boolean;
717
757
 
718
- export { type HelpersCssClasses, type LayoutConfiguration, type TierPrice, type UiMediaGalleryItem, type UiMediaGalleryItemUrl, type UiProductOption, type UiProductProperty, type UiProductReview, type UrlRouteOutput, buildUrlPrefix, canUseQuoteActions, downloadFile, encodeUrlPath, getBackgroundImageUrl, getBiggestThumbnailUrl, getCategoryBreadcrumbs, getCategoryImageUrl, getCategoryRoute, getCategoryUrl, getCmsBreadcrumbs, getCmsEntityObject, getCmsLayoutConfiguration, getCmsTranslate, getFormattedPrice, getLanguageName, getListingFilters, getMainImageUrl, getMedia, getPaymentMethodIcon, getProductCalculatedListingPrice, getProductFreeShipping, getProductFromPrice, getProductListingFromCmsPage, getProductManufacturerName, getProductName, getProductRatingAverage, getProductReviews, getProductRoute, getProductTierPrices, getProductUrl, getShippingMethodDeliveryTime, getShippingMethodIcon, getSmallestThumbnailUrl, getSrcSetForMedia, getTranslatedProperty, helpersCssClasses, isCategory, isLandingPage, isMaintenanceMode, isProduct, isProductOnSale, isProductTopSeller, relativeUrlSlash, urlIsAbsolute };
758
+ export { type BackgroundImageOptions, type HelpersCssClasses, type LayoutConfiguration, type TierPrice, type UiMediaGalleryItem, type UiMediaGalleryItemUrl, type UiProductOption, type UiProductProperty, type UiProductReview, type UrlRouteOutput, buildCdnImageUrl, buildUrlPrefix, canUseQuoteActions, downloadFile, encodeUrlPath, generateCdnSrcSet, getBackgroundImageUrl, getBiggestThumbnailUrl, getCategoryBreadcrumbs, getCategoryImageUrl, getCategoryRoute, getCategoryUrl, getCmsBreadcrumbs, getCmsEntityObject, getCmsLayoutConfiguration, getCmsTranslate, getFormattedPrice, getLanguageName, getListingFilters, getMainImageUrl, getMedia, getPaymentMethodIcon, getProductCalculatedListingPrice, getProductFreeShipping, getProductFromPrice, getProductListingFromCmsPage, getProductManufacturerName, getProductName, getProductRatingAverage, getProductReviews, getProductRoute, getProductTierPrices, getProductUrl, getShippingMethodDeliveryTime, getShippingMethodIcon, getSmallestThumbnailUrl, getSrcSetForMedia, getTranslatedProperty, helpersCssClasses, isCategory, isLandingPage, isMaintenanceMode, isProduct, isProductOnSale, isProductTopSeller, relativeUrlSlash, urlIsAbsolute };
package/dist/index.mjs CHANGED
@@ -260,12 +260,18 @@ const getUrlFromBackgroundImage = (url) => {
260
260
  const match = url.match(regex);
261
261
  return !match ? url : match[1];
262
262
  };
263
- function getBackgroundImageUrl(url, element) {
263
+ function getBackgroundImageUrl(url, element, options) {
264
264
  const backgroundImage = getUrlFromBackgroundImage(url);
265
265
  const width = element.backgroundMedia?.metaData?.width ?? 0;
266
266
  const height = element.backgroundMedia?.metaData?.height ?? 0;
267
267
  const biggestParam = width > height ? `width=${roundUp(width > 1920 ? 1900 : width)}` : `height=${roundUp(height > 1920 ? 1900 : height)}`;
268
- const srcPath = `${backgroundImage}?${biggestParam}&fit=crop,smart`;
268
+ let srcPath = `${backgroundImage}?${biggestParam}&fit=crop,smart`;
269
+ if (options?.format) {
270
+ srcPath += `&format=${options.format}`;
271
+ }
272
+ if (options?.quality) {
273
+ srcPath += `&quality=${options.quality}`;
274
+ }
269
275
  return `url("${srcPath}")`;
270
276
  }
271
277
 
@@ -428,6 +434,9 @@ function getMedia(lineItem) {
428
434
 
429
435
  function getSmallestThumbnailUrl(media) {
430
436
  if (!media || !media?.thumbnails?.length) {
437
+ if (media?.url) {
438
+ return media.url;
439
+ }
431
440
  return;
432
441
  }
433
442
  const lowest = media.thumbnails.reduce((previous, current) => {
@@ -445,6 +454,51 @@ function encodeUrlPath(urlString) {
445
454
  return urlString;
446
455
  }
447
456
  }
457
+ function generateCdnSrcSet(src, widths = [400, 800, 1200, 1600], options) {
458
+ if (!src) return void 0;
459
+ try {
460
+ return widths.map((w) => {
461
+ const url = new URL(encodeUrlPath(src));
462
+ url.searchParams.set("width", String(w));
463
+ url.searchParams.set("fit", "crop,smart");
464
+ if (options?.format) {
465
+ url.searchParams.set("format", options.format);
466
+ }
467
+ if (options?.quality) {
468
+ url.searchParams.set("quality", String(options.quality));
469
+ }
470
+ return `${url.toString()} ${w}w`;
471
+ }).join(", ");
472
+ } catch {
473
+ return void 0;
474
+ }
475
+ }
476
+ function buildCdnImageUrl(src, dimensions, options) {
477
+ if (!src) return "";
478
+ try {
479
+ const url = new URL(encodeUrlPath(src));
480
+ const DEFAULT_SIZE = 10;
481
+ const w = dimensions.width ? Math.ceil(dimensions.width / 100) * 100 : DEFAULT_SIZE;
482
+ const h = dimensions.height ? Math.ceil(dimensions.height / 100) * 100 : DEFAULT_SIZE;
483
+ if (w > DEFAULT_SIZE || h > DEFAULT_SIZE) {
484
+ if (dimensions.width >= dimensions.height) {
485
+ url.searchParams.set("width", String(w));
486
+ } else {
487
+ url.searchParams.set("height", String(h));
488
+ }
489
+ url.searchParams.set("fit", "crop,smart");
490
+ }
491
+ if (options?.format) {
492
+ url.searchParams.set("format", options.format);
493
+ }
494
+ if (options?.quality) {
495
+ url.searchParams.set("quality", String(options.quality));
496
+ }
497
+ return url.toString();
498
+ } catch {
499
+ return src;
500
+ }
501
+ }
448
502
  function getSrcSetForMedia(media) {
449
503
  if (!media?.thumbnails?.length) {
450
504
  return;
@@ -482,4 +536,4 @@ function canUseQuoteActions(quote) {
482
536
  return ["replied"].includes(quote.stateMachineState?.technicalName ?? "");
483
537
  }
484
538
 
485
- export { buildUrlPrefix, canUseQuoteActions, downloadFile, encodeUrlPath, getBackgroundImageUrl, getBiggestThumbnailUrl, getCategoryBreadcrumbs, getCategoryImageUrl, getCategoryRoute, getCategoryUrl, getCmsBreadcrumbs, getCmsEntityObject, getCmsLayoutConfiguration, getCmsTranslate, getFormattedPrice, getLanguageName, getListingFilters, getMainImageUrl, getMedia, getPaymentMethodIcon, getProductCalculatedListingPrice, getProductFreeShipping, getProductFromPrice, getProductListingFromCmsPage, getProductManufacturerName, getProductName, getProductRatingAverage, getProductReviews, getProductRoute, getProductTierPrices, getProductUrl, getShippingMethodDeliveryTime, getShippingMethodIcon, getSmallestThumbnailUrl, getSrcSetForMedia, getTranslatedProperty, helpersCssClasses, isCategory, isLandingPage, isMaintenanceMode, isProduct, isProductOnSale, isProductTopSeller, relativeUrlSlash, urlIsAbsolute };
539
+ export { buildCdnImageUrl, buildUrlPrefix, canUseQuoteActions, downloadFile, encodeUrlPath, generateCdnSrcSet, getBackgroundImageUrl, getBiggestThumbnailUrl, getCategoryBreadcrumbs, getCategoryImageUrl, getCategoryRoute, getCategoryUrl, getCmsBreadcrumbs, getCmsEntityObject, getCmsLayoutConfiguration, getCmsTranslate, getFormattedPrice, getLanguageName, getListingFilters, getMainImageUrl, getMedia, getPaymentMethodIcon, getProductCalculatedListingPrice, getProductFreeShipping, getProductFromPrice, getProductListingFromCmsPage, getProductManufacturerName, getProductName, getProductRatingAverage, getProductReviews, getProductRoute, getProductTierPrices, getProductUrl, getShippingMethodDeliveryTime, getShippingMethodIcon, getSmallestThumbnailUrl, getSrcSetForMedia, getTranslatedProperty, helpersCssClasses, isCategory, isLandingPage, isMaintenanceMode, isProduct, isProductOnSale, isProductTopSeller, relativeUrlSlash, urlIsAbsolute };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware/helpers",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Shopware helpers for accessing API data",
5
5
  "author": "Shopware",
6
6
  "type": "module",
@@ -33,19 +33,20 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@biomejs/biome": "1.8.3",
36
- "@vitest/coverage-v8": "3.2.4",
37
- "happy-dom": "20.0.10",
36
+ "@typescript/native-preview": "7.0.0-dev.20260111.1",
37
+ "@vitest/coverage-v8": "4.0.18",
38
+ "happy-dom": "20.8.9",
38
39
  "unbuild": "2.0.0",
39
- "vitest": "3.2.4",
40
+ "vitest": "4.0.18",
40
41
  "tsconfig": "0.0.0"
41
42
  },
42
43
  "scripts": {
43
44
  "build": "unbuild && pnpm build:types",
44
- "build:types": "tsc ./src/*.ts --declaration --allowJs --emitDeclarationOnly --outDir ./temp --skipLibCheck",
45
+ "build:types": "tsgo ./src/*.ts --ignoreConfig --declaration --allowJs --emitDeclarationOnly --outDir ./temp --skipLibCheck",
45
46
  "dev": "unbuild --stub",
46
47
  "lint": "biome check .",
47
48
  "lint:fix": "biome check . --write && pnpm run typecheck",
48
- "typecheck": "tsc --noEmit",
49
+ "typecheck": "tsgo --noEmit",
49
50
  "test": "vitest run",
50
51
  "test:watch": "vitest"
51
52
  }