@shopware/cms-base-layer 1.4.1 → 1.5.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
@@ -36,6 +36,9 @@ pnpm install -D @shopware/cms-base-layer
36
36
 
37
37
  # bun
38
38
  bun install -D @shopware/cms-base-layer
39
+
40
+ # deno
41
+ deno install --dev @shopware/cms-base-layer
39
42
  ```
40
43
 
41
44
  <!-- /automd -->
@@ -129,21 +132,21 @@ No additional packages needed to be installed.
129
132
 
130
133
  Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/cms-base-layer/CHANGELOG.md)
131
134
 
132
- ### Latest changes: 1.4.1
135
+ ### Latest changes: 1.5.0
133
136
 
134
- ### Patch Changes
137
+ ### Minor Changes
135
138
 
136
- - [#1685](https://github.com/shopware/frontends/pull/1685) [`7324620`](https://github.com/shopware/frontends/commit/7324620a3f39c1b62f7cc294192a3e8b8b336d09) Thanks [@mdanilowicz](https://github.com/mdanilowicz)! - Remove `salutationId` as a required field from the forms:
139
+ - [#1727](https://github.com/shopware/frontends/pull/1727) [`94872b7`](https://github.com/shopware/frontends/commit/94872b7c6f6337ff8ce0bcfd9320e4178a4927f0) Thanks [@mdanilowicz](https://github.com/mdanilowicz)! - Added CmsBlockHtml to render html blocks.
140
+ Added CmsElementHtml to render html element.
137
141
 
138
- - SwNewsletterForm
139
- - SwContactForm
142
+ ### Patch Changes
140
143
 
141
- - [#1659](https://github.com/shopware/frontends/pull/1659) [`7c10417`](https://github.com/shopware/frontends/commit/7c10417e9c0bb9fe049a0e36abf115be6c63c945) Thanks [@patzick](https://github.com/patzick)! - SwVariantConfigurator - URL prefix on Variant Change
144
+ - [#1843](https://github.com/shopware/frontends/pull/1843) [`1859893`](https://github.com/shopware/frontends/commit/1859893ec3fe1cdead4b1c39e34943d9a70deaa4) Thanks [@mdanilowicz](https://github.com/mdanilowicz)! - Enhance form error handling and fix TS errors
142
145
 
143
- - [#1677](https://github.com/shopware/frontends/pull/1677) [`d663627`](https://github.com/shopware/frontends/commit/d663627aaa00abc797f5c2413c4e978f95bd6f89) Thanks [@mdanilowicz](https://github.com/mdanilowicz)! - Fix displaying product variants on the product page
146
+ - [#1812](https://github.com/shopware/frontends/pull/1812) [`c28810d`](https://github.com/shopware/frontends/commit/c28810d0ca503b97c232438e200bbf5ba5dab403) Thanks [@patzick](https://github.com/patzick)! - Fix date formatting based on locale, previously always returned en-US format
144
147
 
145
- - [#1692](https://github.com/shopware/frontends/pull/1692) [`2440a55`](https://github.com/shopware/frontends/commit/2440a55066d31edf2942dbab19a7b5043cdff532) Thanks [@mdanilowicz](https://github.com/mdanilowicz)! - Change `h5` HTML tag to `div` for better accessibility structure - for ProductCard component
148
+ - [#1857](https://github.com/shopware/frontends/pull/1857) [`e78d51e`](https://github.com/shopware/frontends/commit/e78d51e6af0726b12620d9f7e8f2c3150aa80cfa) Thanks [@mdanilowicz](https://github.com/mdanilowicz)! - Fix wrong `SharedPrice` component in `SwListingProductPrice.vue` file
146
149
 
147
- - Updated dependencies [[`7324620`](https://github.com/shopware/frontends/commit/7324620a3f39c1b62f7cc294192a3e8b8b336d09)]:
148
- - @shopware/api-client@1.2.1
149
- - @shopware/composables@1.8.1
150
+ - Updated dependencies [[`d016d6b`](https://github.com/shopware/frontends/commit/d016d6b845bff9a148405a74dae88d7fc81ec99c), [`c28810d`](https://github.com/shopware/frontends/commit/c28810d0ca503b97c232438e200bbf5ba5dab403), [`a7ff606`](https://github.com/shopware/frontends/commit/a7ff60681d1a164d5c9f2020c506262e96fad5dc), [`d016d6b`](https://github.com/shopware/frontends/commit/d016d6b845bff9a148405a74dae88d7fc81ec99c), [`bd70905`](https://github.com/shopware/frontends/commit/bd70905b8443fd57d8d8cb3cfc6501a9117dea49)]:
151
+ - @shopware/api-client@1.3.0
152
+ - @shopware/composables@1.9.0
@@ -213,7 +213,7 @@ const invokeSubmit = async () => {
213
213
  v-if="$v.firstName.$error"
214
214
  class="pt-1 text-sm text-red-600 focus:ring-brand-primary border-gray-300"
215
215
  >
216
- {{ $v.firstName.$errors[0].$message }}
216
+ {{ $v.firstName.$errors[0]?.$message ?? '' }}
217
217
  </span>
218
218
  </div>
219
219
  <div class="col-span-4">
@@ -237,7 +237,7 @@ const invokeSubmit = async () => {
237
237
  v-if="$v.lastName.$error"
238
238
  class="pt-1 text-sm text-red-600 focus:ring-brand-primary border-gray-300"
239
239
  >
240
- {{ $v.lastName.$errors[0].$message }}
240
+ {{ $v.lastName.$errors[0]?.$message ?? '' }}
241
241
  </span>
242
242
  </div>
243
243
  <div class="col-span-6">
@@ -261,7 +261,7 @@ const invokeSubmit = async () => {
261
261
  v-if="$v.email.$error"
262
262
  class="pt-1 text-sm text-red-600 focus:ring-brand-primary border-gray-300"
263
263
  >
264
- {{ $v.email.$errors[0].$message }}
264
+ {{ $v.email.$errors[0]?.$message ?? '' }}
265
265
  </span>
266
266
  </div>
267
267
  <div class="col-span-6">
@@ -285,7 +285,7 @@ const invokeSubmit = async () => {
285
285
  v-if="$v.phone.$error"
286
286
  class="pt-1 text-sm text-red-600 focus:ring-brand-primary border-gray-300"
287
287
  >
288
- {{ $v.phone.$errors[0].$message }}
288
+ {{ $v.phone.$errors[0]?.$message ?? '' }}
289
289
  </span>
290
290
  </div>
291
291
  <div class="col-span-12">
@@ -309,7 +309,7 @@ const invokeSubmit = async () => {
309
309
  v-if="$v.subject.$error"
310
310
  class="pt-1 text-sm text-red-600 focus:ring-brand-primary border-gray-300"
311
311
  >
312
- {{ $v.subject.$errors[0].$message }}
312
+ {{ $v.subject.$errors[0]?.$message ?? '' }}
313
313
  </span>
314
314
  </div>
315
315
  <div class="col-span-12">
@@ -334,7 +334,7 @@ const invokeSubmit = async () => {
334
334
  v-if="$v.comment.$error"
335
335
  class="pt-1 text-sm text-red-600 focus:ring-brand-primary border-gray-300"
336
336
  >
337
- {{ $v.comment.$errors[0].$message }}
337
+ {{ $v.comment.$errors[0]?.$message || '' }}
338
338
  </span>
339
339
  </div>
340
340
  <div class="col-span-12">
@@ -12,6 +12,7 @@ type Translations = {
12
12
  listing: {
13
13
  variantsFrom: string;
14
14
  previously: string;
15
+ from: string;
15
16
  to: string;
16
17
  };
17
18
  };
@@ -78,7 +79,7 @@ const {
78
79
  <template v-if="regulationPrice">
79
80
  <div class="flex gap-2 justify-end text-gray-500 text-3.5 mb-2">
80
81
  {{ translations.listing.previously }}
81
- <SharedPrice :value="regulationPrice" />
82
+ <SwSharedPrice :value="regulationPrice" />
82
83
  </div>
83
84
  </template>
84
85
  <template v-if="!regulationPrice">
@@ -79,7 +79,7 @@ const { newsletterSubscribe, newsletterUnsubscribe } = useNewsletter();
79
79
 
80
80
  const getFormTitle = computed(() => getConfigValue("title"));
81
81
  const state = reactive({
82
- option: subscriptionOptions[0].value,
82
+ option: subscriptionOptions[0]?.value ?? "",
83
83
  salutationId: "",
84
84
  firstName: "",
85
85
  lastName: "",
@@ -216,7 +216,7 @@ const invokeSubmit = async () => {
216
216
  v-if="$v.email?.$error"
217
217
  class="pt-1 text-sm text-red-600 focus:ring-brand-primary border-gray-300"
218
218
  >
219
- {{ $v.email?.$errors[0].$message }}
219
+ {{ $v.email?.$errors[0]?.$message || '' }}
220
220
  </span>
221
221
  </div>
222
222
  <div v-if="state.option === 'subscribe'" class="col-span-4">
@@ -260,7 +260,7 @@ const invokeSubmit = async () => {
260
260
  v-if="$v.firstName?.$error"
261
261
  class="pt-1 text-sm text-red-600 focus:ring-brand-primary border-gray-300"
262
262
  >
263
- {{ $v.firstName?.$errors[0].$message }}
263
+ {{ $v.firstName?.$errors[0]?.$message || '' }}
264
264
  </span>
265
265
  </div>
266
266
  <div v-if="state.option === 'subscribe'" class="col-span-4">
@@ -284,7 +284,7 @@ const invokeSubmit = async () => {
284
284
  v-if="$v.lastName?.$error"
285
285
  class="pt-1 text-sm text-red-600 focus:ring-brand-primary border-gray-300"
286
286
  >
287
- {{ $v.lastName?.$errors[0].$message }}
287
+ {{ $v.lastName?.$errors[0]?.$message || '' }}
288
288
  </span>
289
289
  </div>
290
290
  <div class="col-span-12">
@@ -51,7 +51,8 @@ const addToCartProxy = async () => {
51
51
  const errors = getErrorsCodes();
52
52
  for (const element of errors) {
53
53
  const { messageKey, params } = resolveCartError(element);
54
- pushError(getCmsTranslate(translations.errors[messageKey], params));
54
+ if (translations.errors[messageKey])
55
+ pushError(getCmsTranslate(translations.errors[messageKey], params));
55
56
  }
56
57
 
57
58
  if (!errors.length)
@@ -127,7 +127,8 @@ const addToCartProxy = async () => {
127
127
  const errors = getErrorsCodes();
128
128
  for (const element of errors) {
129
129
  const { messageKey, params } = resolveCartError(element);
130
- pushError(getCmsTranslate(translations.errors[messageKey], params));
130
+ if (translations.errors[messageKey])
131
+ pushError(getCmsTranslate(translations.errors[messageKey], params));
131
132
  }
132
133
 
133
134
  if (!errors.length)
@@ -1,7 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import { defu } from "defu";
3
3
  import { computed, onMounted, ref, toRefs } from "vue";
4
- import { useCmsTranslations, useProductReviews } from "#imports";
4
+ import {
5
+ useCmsTranslations,
6
+ useProductReviews,
7
+ useShopwareContext,
8
+ } from "#imports";
5
9
  import type { Schemas } from "#shopware";
6
10
 
7
11
  const props = defineProps<{
@@ -12,12 +16,14 @@ const props = defineProps<{
12
16
  type Translations = {
13
17
  product: {
14
18
  noReviews: string;
19
+ reviewNotAccepted: string;
15
20
  };
16
21
  };
17
22
 
18
23
  let translations: Translations = {
19
24
  product: {
20
25
  noReviews: "No reviews yet.",
26
+ reviewNotAccepted: "Your review has not been approved yet",
21
27
  },
22
28
  };
23
29
 
@@ -42,15 +48,17 @@ const reviewsList = computed<Schemas["ProductReview"][]>(
42
48
 
43
49
  const format: Intl.DateTimeFormatOptions = {
44
50
  year: "numeric",
45
- month: "short",
51
+ month: "numeric",
46
52
  day: "numeric",
47
53
  hour: "numeric",
48
54
  minute: "numeric",
49
- hour12: true,
50
55
  };
51
56
 
52
- const formatDate = (date: string) =>
53
- new Date(date).toLocaleDateString("en-us", format);
57
+ const { browserLocale } = useShopwareContext();
58
+
59
+ const formatDate = (date: string) => {
60
+ return new Intl.DateTimeFormat(browserLocale, format).format(new Date(date));
61
+ };
54
62
  </script>
55
63
 
56
64
  <template>
@@ -70,6 +78,13 @@ const formatDate = (date: string) =>
70
78
  >
71
79
  <span>{{ formatDate(review.createdAt) }}</span>
72
80
  </div>
81
+ <div
82
+ v-if="!review.status"
83
+ class="mt-2 text-3 p-2 bg-[#d4f0f5] flex gap-2 items-center"
84
+ >
85
+ <div class="w-6 h-6 i-carbon-warning" />
86
+ {{ translations.product.reviewNotAccepted }}
87
+ </div>
73
88
  <div
74
89
  class="cms-block-product-description-reviews__reviews-rating inline-flex items-center mt-2"
75
90
  >
@@ -38,9 +38,11 @@ const { getConfigValue } = useCmsElementConfig({
38
38
  config: SliderElementConfig;
39
39
  });
40
40
 
41
- const slots = useSlots();
41
+ const slots = useSlots() as {
42
+ default?: () => { children: VNodeArrayChildren }[];
43
+ };
42
44
  const childrenRaw = computed(
43
- () => (slots?.default?.()[0].children as VNodeArrayChildren) ?? [],
45
+ () => (slots?.default?.()[0]?.children as VNodeArrayChildren) ?? [],
44
46
  );
45
47
  const slidesToScroll = computed(() =>
46
48
  props.slidesToScroll >= props.slidesToShow
@@ -184,7 +186,7 @@ function buildImageSliderTrackStyle(
184
186
  const childComponent =
185
187
  imageSliderTrack.value?.children[transformIndex + 1];
186
188
  // If image exist
187
- height = childComponent?.children[0].children[0].clientHeight
189
+ height = childComponent?.children[0]?.children[0]?.clientHeight
188
190
  ? `${childComponent.clientHeight}px`
189
191
  : "auto";
190
192
  }
@@ -0,0 +1 @@
1
+ Render a HTML section
@@ -0,0 +1,17 @@
1
+ <script setup lang="ts">
2
+ import type { CmsBlockHtml } from "@shopware/composables";
3
+
4
+ defineProps<{
5
+ content: CmsBlockHtml;
6
+ }>();
7
+ </script>
8
+
9
+ <template>
10
+ <div>
11
+ <CmsGenericElement
12
+ v-for="slot in content.slots"
13
+ :key="slot.versionId"
14
+ :content="slot"
15
+ />
16
+ </div>
17
+ </template>
@@ -82,7 +82,7 @@ const toggleTab = (index: number) => {
82
82
  :autoplay="false"
83
83
  >
84
84
  <SwProductCard
85
- v-for="product of crossSellCollections[currentTabIndex].products"
85
+ v-for="product of crossSellCollections[currentTabIndex]?.products"
86
86
  :key="product.id"
87
87
  class="w-[300px]"
88
88
  :product="product"
@@ -0,0 +1,24 @@
1
+ <script setup lang="ts">
2
+ import type { CmsElementHtml } from "@shopware/composables";
3
+
4
+ import { getCmsLayoutConfiguration } from "@shopware/helpers";
5
+ import { h } from "vue";
6
+
7
+ const props = defineProps<{
8
+ content: CmsElementHtml;
9
+ }>();
10
+
11
+ const { cssClasses, layoutStyles } = getCmsLayoutConfiguration(props.content);
12
+
13
+ const HtmlComponent = () => {
14
+ return h("div", {
15
+ class: cssClasses,
16
+ style: layoutStyles,
17
+ innerHTML: props.content.data.content || "",
18
+ });
19
+ };
20
+ </script>
21
+
22
+ <template>
23
+ <HtmlComponent />
24
+ </template>
@@ -3,25 +3,32 @@ import type { CmsElementProductDescriptionReviews } from "@shopware/composables"
3
3
  import { useCmsTranslations } from "@shopware/composables";
4
4
  import { getProductName, getTranslatedProperty } from "@shopware/helpers";
5
5
  import { defu } from "defu";
6
- import { computed, ref } from "vue";
6
+ import { type Ref, computed, onMounted, ref } from "vue";
7
7
  import xss from "xss";
8
8
  import { useProduct } from "#imports";
9
+ import type { Schemas } from "#shopware";
9
10
 
10
11
  const props = defineProps<{
11
12
  content: CmsElementProductDescriptionReviews;
12
13
  }>();
13
14
 
14
15
  type Translations = {
15
- products: {
16
+ product: {
16
17
  description: string;
17
18
  reviews: string;
19
+ messages: {
20
+ reviewAdded: string;
21
+ };
18
22
  };
19
23
  };
20
24
 
21
25
  let translations: Translations = {
22
- products: {
26
+ product: {
23
27
  description: "Description",
24
28
  reviews: "Reviews",
29
+ messages: {
30
+ reviewAdded: "Thank you for submitting your review",
31
+ },
25
32
  },
26
33
  };
27
34
  translations = defu(useCmsTranslations(), translations) as Translations;
@@ -37,7 +44,13 @@ const toggleTabs = (tabNumber: number) => {
37
44
  currentTab.value = tabNumber;
38
45
  };
39
46
 
40
- const reviews = computed(() => props.content.data.reviews.elements);
47
+ const reviews: Ref<Schemas["ProductReview"][]> = ref([]);
48
+
49
+ onMounted(async () => {
50
+ if (props.content.data?.reviews?.elements) {
51
+ reviews.value = props.content.data.reviews.elements;
52
+ }
53
+ });
41
54
  </script>
42
55
 
43
56
  <template>
@@ -60,7 +73,7 @@ const reviews = computed(() => props.content.data.reviews.elements);
60
73
  @click="() => toggleTabs(1)"
61
74
  >
62
75
  <i class="fas fa-space-shuttle text-base mr-1" />
63
- {{ translations.products.description }}
76
+ {{ translations.product.description }}
64
77
  </a>
65
78
  </li>
66
79
  <li class="mr-2 text-center">
@@ -71,10 +84,11 @@ const reviews = computed(() => props.content.data.reviews.elements);
71
84
  ? 'text-secondary-500 bg-white'
72
85
  : 'text-white bg-secondary-500',
73
86
  ]"
87
+ data-testid="product-reviews-tab"
74
88
  @click="() => toggleTabs(2)"
75
89
  >
76
90
  <i class="fas fa-cog text-base mr-1" />
77
- {{ translations.products.reviews }}
91
+ {{ translations.product.reviews }} ({{ reviews.length }})
78
92
  </a>
79
93
  </li>
80
94
  </ul>
package/nuxt.config.ts CHANGED
@@ -17,5 +17,7 @@ export default defineNuxtConfig({
17
17
  build: {
18
18
  transpile: ["@shopware/cms-base-layer"],
19
19
  },
20
- telemetry: false,
20
+ telemetry: {
21
+ enabled: false,
22
+ },
21
23
  }) as NuxtConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware/cms-base-layer",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Vue CMS Nuxt Layer for Shopware",
5
5
  "author": "Shopware",
6
6
  "repository": {
@@ -29,32 +29,32 @@
29
29
  "nuxt.config.ts"
30
30
  ],
31
31
  "dependencies": {
32
- "@nuxt/kit": "3.15.4",
33
- "@tresjs/cientos": "4.0.2",
34
- "@tresjs/core": "4.3.1",
32
+ "@nuxt/kit": "3.16.2",
33
+ "@tresjs/cientos": "4.3.0",
34
+ "@tresjs/core": "4.3.3",
35
35
  "@vuelidate/core": "2.0.3",
36
36
  "@vuelidate/validators": "2.0.4",
37
- "@vueuse/core": "12.5.0",
37
+ "@vueuse/core": "13.1.0",
38
38
  "entities": "6.0.0",
39
39
  "html-to-ast": "0.0.6",
40
40
  "three": "0.173.0",
41
41
  "vue": "3.5.13",
42
42
  "xss": "1.0.15",
43
- "@shopware/composables": "1.8.1",
44
- "@shopware/api-client": "1.2.1",
45
- "@shopware/helpers": "1.4.0"
43
+ "@shopware/composables": "1.9.0",
44
+ "@shopware/helpers": "1.4.0",
45
+ "@shopware/api-client": "1.3.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@biomejs/biome": "1.8.3",
49
- "@nuxt/schema": "3.15.4",
49
+ "@nuxt/schema": "3.16.2",
50
50
  "@types/three": "0.173.0",
51
- "@vitest/coverage-v8": "3.0.5",
52
- "nuxt": "3.15.4",
53
- "typescript": "5.6.3",
51
+ "@vitest/coverage-v8": "3.1.1",
52
+ "nuxt": "3.16.2",
53
+ "typescript": "5.8.3",
54
54
  "unbuild": "2.0.0",
55
- "vitest": "3.0.5",
55
+ "vitest": "3.1.1",
56
56
  "vue-router": "4.5.0",
57
- "vue-tsc": "2.2.0",
57
+ "vue-tsc": "2.2.8",
58
58
  "tsconfig": "0.0.0"
59
59
  },
60
60
  "scripts": {