@shopbite-de/storefront 1.31.2 → 2.0.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.
Files changed (193) hide show
  1. package/.github/workflows/ci.yaml +54 -0
  2. package/.nuxtrc +1 -1
  3. package/CLAUDE.md +23 -8
  4. package/app/app.vue +10 -6
  5. package/app/assets/css/main.css +100 -61
  6. package/app/components/AddToWishlist.vue +15 -25
  7. package/app/components/Address/Card.vue +6 -11
  8. package/app/components/Address/Detail.vue +23 -23
  9. package/app/components/Address/Fields.vue +175 -73
  10. package/app/components/Address/Form.vue +107 -106
  11. package/app/components/Cart/Bar.vue +6 -9
  12. package/app/components/Cart/Item.vue +48 -63
  13. package/app/components/Cart/QuickView.vue +38 -25
  14. package/app/components/Cart/Upsell.vue +24 -62
  15. package/app/components/Category/Breadcrumb.vue +29 -3
  16. package/app/components/Category/FilterGroup.vue +20 -41
  17. package/app/components/Category/Listing.vue +100 -130
  18. package/app/components/Category/SearchInput.vue +22 -19
  19. package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
  20. package/app/components/Checkout/LoginOrRegister.vue +28 -29
  21. package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
  22. package/app/components/Checkout/Summary.vue +90 -60
  23. package/app/components/Checkout/VoucherInput.vue +40 -27
  24. package/app/components/Contact/Form.vue +164 -192
  25. package/app/components/DemoBanner.vue +5 -5
  26. package/app/components/Footer/StoreStatus.vue +2 -2
  27. package/app/components/Footer.vue +125 -57
  28. package/app/components/Header.vue +283 -18
  29. package/app/components/Home/Categories.vue +116 -0
  30. package/app/components/Home/Facts.vue +71 -0
  31. package/app/components/Home/Faq.vue +34 -16
  32. package/app/components/Home/Hero.vue +172 -0
  33. package/app/components/Home/Highlights.vue +29 -37
  34. package/app/components/Home/Restaurant.vue +102 -0
  35. package/app/components/Menu/BonCard.vue +180 -0
  36. package/app/components/Menu/CartPanel.vue +24 -0
  37. package/app/components/Menu/CategoryIndex.vue +54 -0
  38. package/app/components/Menu/OrderMode.vue +20 -0
  39. package/app/components/Menu/SectionHeader.vue +38 -0
  40. package/app/components/Navigation/MobileTop.vue +23 -15
  41. package/app/components/Order/Confirmation.vue +119 -0
  42. package/app/components/Order/Detail.vue +80 -88
  43. package/app/components/Product/CardSkeleton.vue +8 -12
  44. package/app/components/Product/Configurator.vue +8 -16
  45. package/app/components/Product/CrossSelling.vue +75 -83
  46. package/app/components/Product/DeselectIngredient.vue +17 -22
  47. package/app/components/Product/Detail.vue +35 -27
  48. package/app/components/Product/QuickView.vue +80 -51
  49. package/app/components/SalesChannelSwitch.vue +14 -28
  50. package/app/components/Sb/Button.vue +70 -0
  51. package/app/components/Sb/Checkbox.vue +73 -0
  52. package/app/components/Sb/Chip.vue +51 -0
  53. package/app/components/Sb/ChoiceGroup.vue +82 -0
  54. package/app/components/Sb/ConfirmDialog.vue +60 -0
  55. package/app/components/Sb/Field.vue +77 -0
  56. package/app/components/Sb/Icon.vue +66 -0
  57. package/app/components/Sb/IconButton.vue +55 -0
  58. package/app/components/Sb/Input.vue +23 -0
  59. package/app/components/Sb/SegmentedControl.vue +34 -0
  60. package/app/components/Sb/Select.vue +49 -0
  61. package/app/components/Sb/Sheet.vue +83 -0
  62. package/app/components/Sb/Stars.vue +60 -0
  63. package/app/components/Sb/StatusPill.vue +38 -0
  64. package/app/components/Sb/Stepper.vue +72 -0
  65. package/app/components/User/AccountHeader.vue +16 -0
  66. package/app/components/User/AuthPanel.vue +41 -0
  67. package/app/components/User/Detail.vue +32 -29
  68. package/app/components/User/LoginForm.vue +92 -98
  69. package/app/components/User/RegistrationForm.vue +285 -249
  70. package/app/components/Wishlist.vue +55 -155
  71. package/app/composables/useCartMutations.ts +9 -27
  72. package/app/composables/useCheckoutMethodGuard.ts +2 -24
  73. package/app/composables/useContactForm.ts +66 -0
  74. package/app/composables/useHomeMenuCategories.ts +41 -0
  75. package/app/composables/useNavigation.ts +10 -2
  76. package/app/composables/useOrderMode.ts +65 -0
  77. package/app/composables/useRegistrationForm.ts +161 -0
  78. package/app/composables/useRestaurantSchema.ts +1 -1
  79. package/app/composables/useShareLink.ts +3 -13
  80. package/app/composables/useSortingSelection.ts +13 -0
  81. package/app/composables/useThemePreset.ts +15 -0
  82. package/app/composables/useVoucherCode.ts +7 -16
  83. package/app/composables/useWishlistActions.ts +0 -51
  84. package/app/error.vue +31 -9
  85. package/app/layouts/account.vue +45 -50
  86. package/app/layouts/default.vue +2 -3
  87. package/app/layouts/listing.vue +3 -5
  88. package/app/pages/[...all].vue +8 -4
  89. package/app/pages/account/recover/password/index.vue +113 -80
  90. package/app/pages/anmelden.vue +11 -10
  91. package/app/pages/bestellung/[id]/erfolg.vue +1 -15
  92. package/app/pages/bestellung/[id]/fehler.vue +63 -51
  93. package/app/pages/bestellung/[id]/index.vue +3 -85
  94. package/app/pages/bestellung/kasse.vue +29 -0
  95. package/app/pages/bestellung.vue +8 -60
  96. package/app/pages/index.vue +12 -52
  97. package/app/pages/kontakt.vue +27 -7
  98. package/app/pages/konto/adressen.vue +106 -102
  99. package/app/pages/konto/bestellung/[id].vue +9 -43
  100. package/app/pages/konto/bestellungen.vue +55 -33
  101. package/app/pages/konto/index.vue +47 -62
  102. package/app/pages/konto/profil.vue +162 -100
  103. package/app/pages/maintenance.vue +8 -6
  104. package/app/pages/merkliste.vue +7 -8
  105. package/app/pages/passwort-vergessen.vue +92 -75
  106. package/app/pages/registrierung/bestaetigen.vue +20 -48
  107. package/app/pages/registrierung/index.vue +16 -7
  108. package/app/pages/suche.vue +94 -95
  109. package/app/plugins/theme-preset.ts +9 -0
  110. package/app/utils/highlight.ts +25 -0
  111. package/app/utils/product.ts +9 -0
  112. package/app/validation/registrationSchema.ts +1 -1
  113. package/docs/notes/2026-10-07-issue-434-property-group-projection.md +27 -0
  114. package/docs/notes/2026-10-07-listing-payload.md +38 -0
  115. package/docs/notes/2026-10-07-nuxt-4.6-inline-error-rendering.md +31 -0
  116. package/modules/theme.ts +115 -0
  117. package/nuxt.config.ts +27 -15
  118. package/package.json +6 -8
  119. package/playwright.config.ts +11 -0
  120. package/server/api/listing/[categoryId].get.ts +10 -11
  121. package/server/api/product/[productId].get.ts +4 -2
  122. package/server/api/product/variant.get.ts +1 -2
  123. package/server/api/search.get.ts +7 -12
  124. package/shared/theme/presets.ts +303 -0
  125. package/test/a11y/presets.test.ts +225 -0
  126. package/test/nuxt/AccountPagesPreset.test.ts +191 -0
  127. package/test/nuxt/AuthPagesPreset.test.ts +87 -0
  128. package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
  129. package/test/nuxt/CartItem.test.ts +18 -3
  130. package/test/nuxt/CartUpsell.test.ts +1 -2
  131. package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
  132. package/test/nuxt/CheckoutOnePage.test.ts +115 -0
  133. package/test/nuxt/CheckoutSummary.test.ts +6 -6
  134. package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
  135. package/test/nuxt/ContactFormPreset.test.ts +115 -0
  136. package/test/nuxt/FooterStoreStatus.test.ts +2 -2
  137. package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
  138. package/test/nuxt/HomeFaq.test.ts +3 -2
  139. package/test/nuxt/MenuBonCard.test.ts +122 -0
  140. package/test/nuxt/OrderPagesPreset.test.ts +132 -0
  141. package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
  142. package/test/nuxt/ProductCrossSelling.test.ts +2 -1
  143. package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
  144. package/test/nuxt/ProductSheetPreset.test.ts +105 -0
  145. package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
  146. package/test/nuxt/RegistrationForm.test.ts +89 -270
  147. package/test/nuxt/SbBaseComponents.test.ts +170 -0
  148. package/test/nuxt/SbStars.test.ts +25 -0
  149. package/test/nuxt/useCartMutations.test.ts +3 -17
  150. package/test/nuxt/useCartUpsell.test.ts +1 -1
  151. package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
  152. package/test/nuxt/useShareLink.test.ts +1 -9
  153. package/test/nuxt/useWishlistActions.test.ts +3 -26
  154. package/test/unit/highlight.spec.ts +31 -0
  155. package/test/unit/product.spec.ts +12 -0
  156. package/test/unit/themePresets.spec.ts +61 -0
  157. package/app/app.config.ts +0 -19
  158. package/app/components/AnimatedSection.vue +0 -74
  159. package/app/components/BottomNavi.vue +0 -70
  160. package/app/components/Category/Header.vue +0 -48
  161. package/app/components/Checkout/PaymentMethod.vue +0 -30
  162. package/app/components/Checkout/ShippingMethod.vue +0 -30
  163. package/app/components/Cta.vue +0 -30
  164. package/app/components/Feature/Card.vue +0 -121
  165. package/app/components/Features.vue +0 -42
  166. package/app/components/Footer/Contact.vue +0 -82
  167. package/app/components/Header/Body.vue +0 -82
  168. package/app/components/Header/Right.vue +0 -187
  169. package/app/components/Header/Title.vue +0 -10
  170. package/app/components/Hero.vue +0 -233
  171. package/app/components/Home/MenuCategories.vue +0 -148
  172. package/app/components/ImageGallery.vue +0 -63
  173. package/app/components/Loading.vue +0 -29
  174. package/app/components/Navigation/DesktopLeft.vue +0 -39
  175. package/app/components/Product/Card.vue +0 -177
  176. package/app/components/Product/CardCompact.vue +0 -72
  177. package/app/components/Product/CardDietBadges.vue +0 -43
  178. package/app/components/Product/CardIngredients.vue +0 -35
  179. package/app/components/Product/CardKitchen.vue +0 -34
  180. package/app/components/Product/Category.vue +0 -160
  181. package/app/components/Product/SearchBar.vue +0 -95
  182. package/app/components/PublicAnnouncement.vue +0 -17
  183. package/app/pages/bestellung/bestaetigen.vue +0 -16
  184. package/app/pages/bestellung/warenkorb.vue +0 -49
  185. package/app/pages/bestellung/zahlung-versand.vue +0 -25
  186. package/test/nuxt/AddressFields.test.ts +0 -222
  187. package/test/nuxt/AnimatedSection.test.ts +0 -67
  188. package/test/nuxt/ContactForm.test.ts +0 -207
  189. package/test/nuxt/FooterContact.test.ts +0 -102
  190. package/test/nuxt/HeaderRight.test.ts +0 -142
  191. package/test/nuxt/Hero.test.ts +0 -126
  192. package/test/nuxt/HomeMenuCategories.test.ts +0 -94
  193. package/test/nuxt/LoginForm.test.ts +0 -159
@@ -0,0 +1,25 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { mountSuspended } from "@nuxt/test-utils/runtime";
3
+ import SbStars from "~/components/Sb/Stars.vue";
4
+ import type { VueWrapper } from "@vue/test-utils";
5
+
6
+ function fills(wrapper: VueWrapper) {
7
+ return wrapper.findAll("svg").map((svg) => {
8
+ const filled = svg.findAll('path[fill="currentColor"]');
9
+ if (filled.length === 0) return 0;
10
+ return filled[0]!.attributes("clip-path") ? 0.5 : 1;
11
+ });
12
+ }
13
+
14
+ describe("SbStars (#444)", () => {
15
+ it("draws 4,5 as four full and one half star, hidden from AT", async () => {
16
+ const wrapper = await mountSuspended(SbStars, { props: { value: 4.5 } });
17
+ expect(fills(wrapper)).toEqual([1, 1, 1, 1, 0.5]);
18
+ expect(wrapper.attributes("aria-hidden")).toBe("true");
19
+ });
20
+
21
+ it("rounds to whole and half stars", async () => {
22
+ const wrapper = await mountSuspended(SbStars, { props: { value: 3.8 } });
23
+ expect(fills(wrapper)).toEqual([1, 1, 1, 1, 0]);
24
+ });
25
+ });
@@ -12,13 +12,11 @@ const {
12
12
  mockAddProducts,
13
13
  mockChangeProductQuantity,
14
14
  mockRemoveItem,
15
- mockToastAdd,
16
15
  } = vi.hoisted(() => ({
17
16
  mockRefreshCart: vi.fn(),
18
17
  mockAddProducts: vi.fn(),
19
18
  mockChangeProductQuantity: vi.fn(),
20
19
  mockRemoveItem: vi.fn(),
21
- mockToastAdd: vi.fn(),
22
20
  }));
23
21
 
24
22
  // Read lazily inside the factory, i.e. after module initialisation.
@@ -32,10 +30,6 @@ mockNuxtImport("useCart", () => () => ({
32
30
  removeItem: mockRemoveItem,
33
31
  }));
34
32
 
35
- mockNuxtImport("useToast", () => () => ({
36
- add: mockToastAdd,
37
- }));
38
-
39
33
  function cartWith(items: { id: string; quantity: number }[]) {
40
34
  return { lineItems: items } as unknown as Schemas["Cart"];
41
35
  }
@@ -163,7 +157,7 @@ describe("useCartMutations", () => {
163
157
  await pending;
164
158
 
165
159
  expect(mockChangeProductQuantity).toHaveBeenCalledTimes(2);
166
- expect(mockToastAdd).not.toHaveBeenCalled();
160
+ expect(mockRefreshCart).not.toHaveBeenCalledWith();
167
161
  } finally {
168
162
  vi.useRealTimers();
169
163
  }
@@ -189,24 +183,16 @@ describe("useCartMutations", () => {
189
183
  await setQuantity("li-1", 3);
190
184
 
191
185
  expect(mockChangeProductQuantity).toHaveBeenCalledTimes(1);
192
- expect(mockToastAdd).toHaveBeenCalledWith(
193
- expect.objectContaining({ title: "Menge konnte nicht geändert werden" }),
194
- );
186
+ expect(mockRefreshCart).toHaveBeenCalledWith();
195
187
  });
196
188
 
197
- it("reports a final failure, re-syncs the cart and resolves undefined", async () => {
189
+ it("re-syncs the cart and resolves undefined after a final failure", async () => {
198
190
  mockRemoveItem.mockRejectedValue(new Error("network"));
199
191
 
200
192
  const { removeLineItem, isMutating } = useCartMutations();
201
193
  const result = await removeLineItem({ id: "li-1" } as Schemas["LineItem"]);
202
194
 
203
195
  expect(result).toBeUndefined();
204
- expect(mockToastAdd).toHaveBeenCalledWith(
205
- expect.objectContaining({
206
- title: "Artikel konnte nicht entfernt werden",
207
- color: "error",
208
- }),
209
- );
210
196
  expect(mockRefreshCart).toHaveBeenCalledWith();
211
197
  expect(isMutating.value).toBe(false);
212
198
  });
@@ -94,7 +94,7 @@ describe("useCartUpsell", () => {
94
94
  });
95
95
 
96
96
  it("reports nothing when the add failed", async () => {
97
- // useCartMutations shows the error toast itself and resolves undefined.
97
+ // useCartMutations re-syncs the cart itself and resolves undefined.
98
98
  mockAddLineItems.mockResolvedValue(undefined);
99
99
 
100
100
  await useCartUpsell().addUpsellProduct(tiramisu);
@@ -15,14 +15,12 @@ const {
15
15
  mockSetShippingMethod,
16
16
  mockGetPaymentMethods,
17
17
  mockSetPaymentMethod,
18
- mockToastAdd,
19
18
  } = vi.hoisted(() => ({
20
19
  mockRefreshCart: vi.fn(),
21
20
  mockGetShippingMethods: vi.fn(),
22
21
  mockSetShippingMethod: vi.fn(),
23
22
  mockGetPaymentMethods: vi.fn(),
24
23
  mockSetPaymentMethod: vi.fn(),
25
- mockToastAdd: vi.fn(),
26
24
  }));
27
25
 
28
26
  // Reactive state shared with the mocked composables. Only read lazily
@@ -50,10 +48,6 @@ mockNuxtImport("useSessionContext", () => () => ({
50
48
  sessionContext,
51
49
  }));
52
50
 
53
- mockNuxtImport("useToast", () => () => ({
54
- add: mockToastAdd,
55
- }));
56
-
57
51
  const delivery = {
58
52
  id: "sm-delivery",
59
53
  name: "Lieferung",
@@ -157,7 +151,6 @@ describe("useCheckoutMethodGuard", () => {
157
151
  expect(mockRefreshCart).toHaveBeenCalledTimes(1);
158
152
  expect(mockGetShippingMethods).not.toHaveBeenCalled();
159
153
  expect(mockSetShippingMethod).not.toHaveBeenCalled();
160
- expect(mockToastAdd).not.toHaveBeenCalled();
161
154
  expect(isShippingMethodBlocked.value).toBe(false);
162
155
  });
163
156
 
@@ -181,13 +174,6 @@ describe("useCheckoutMethodGuard", () => {
181
174
  });
182
175
  expect(mockSetShippingMethod).toHaveBeenCalledWith({ id: pickup.id });
183
176
  expect(mockRefreshCart).toHaveBeenCalledTimes(2);
184
- expect(mockToastAdd).toHaveBeenCalledWith(
185
- expect.objectContaining({
186
- title: "Versandart geändert",
187
- description:
188
- "Lieferung ist nicht mehr verfügbar. Abholung wurde ausgewählt.",
189
- }),
190
- );
191
177
  });
192
178
 
193
179
  it("falls back to the first available method when the default is not available", async () => {
@@ -216,7 +202,6 @@ describe("useCheckoutMethodGuard", () => {
216
202
  await expect(ensureAvailableShippingMethod()).resolves.toBe(false);
217
203
 
218
204
  expect(mockSetShippingMethod).not.toHaveBeenCalled();
219
- expect(mockToastAdd).not.toHaveBeenCalled();
220
205
  expect(isShippingMethodBlocked.value).toBe(true);
221
206
  });
222
207
 
@@ -228,7 +213,6 @@ describe("useCheckoutMethodGuard", () => {
228
213
  await expect(ensureAvailableShippingMethod()).resolves.toBe(false);
229
214
 
230
215
  expect(mockSetShippingMethod).toHaveBeenCalledWith({ id: pickup.id });
231
- expect(mockToastAdd).not.toHaveBeenCalled();
232
216
  });
233
217
  });
234
218
 
@@ -249,13 +233,6 @@ describe("useCheckoutMethodGuard", () => {
249
233
  expect(mockSetPaymentMethod).toHaveBeenCalledWith({ id: paypal.id });
250
234
  expect(mockSetShippingMethod).not.toHaveBeenCalled();
251
235
  expect(isPaymentMethodBlocked.value).toBe(false);
252
- expect(mockToastAdd).toHaveBeenCalledWith(
253
- expect.objectContaining({
254
- title: "Zahlart geändert",
255
- description:
256
- "Barzahlung ist nicht mehr verfügbar. PayPal wurde ausgewählt.",
257
- }),
258
- );
259
236
  });
260
237
 
261
238
  it("returns false when no alternative payment method exists", async () => {
@@ -268,7 +245,6 @@ describe("useCheckoutMethodGuard", () => {
268
245
  await expect(ensureAvailablePaymentMethod()).resolves.toBe(false);
269
246
 
270
247
  expect(mockSetPaymentMethod).not.toHaveBeenCalled();
271
- expect(mockToastAdd).not.toHaveBeenCalled();
272
248
  expect(isPaymentMethodBlocked.value).toBe(true);
273
249
  });
274
250
  });
@@ -305,7 +281,6 @@ describe("useCheckoutMethodGuard", () => {
305
281
  mockSetPaymentMethod.mock.invocationCallOrder[0] as number,
306
282
  );
307
283
  expect(mockRefreshCart).toHaveBeenCalledTimes(3);
308
- expect(mockToastAdd).toHaveBeenCalledTimes(2);
309
284
  });
310
285
 
311
286
  it("leaves the payment method untouched when shipping cannot be resolved", async () => {
@@ -321,7 +296,6 @@ describe("useCheckoutMethodGuard", () => {
321
296
 
322
297
  expect(mockGetPaymentMethods).not.toHaveBeenCalled();
323
298
  expect(mockSetPaymentMethod).not.toHaveBeenCalled();
324
- expect(mockToastAdd).not.toHaveBeenCalled();
325
299
  });
326
300
 
327
301
  it("returns false when the payment method cannot be resolved", async () => {
@@ -356,7 +330,6 @@ describe("useCheckoutMethodGuard", () => {
356
330
  await expect(second).resolves.toBe(true);
357
331
 
358
332
  expect(mockSetShippingMethod).toHaveBeenCalledTimes(1);
359
- expect(mockToastAdd).toHaveBeenCalledTimes(1);
360
333
  // second call re-checked after the first one finished
361
334
  expect(mockRefreshCart).toHaveBeenCalledTimes(3);
362
335
  expect(mockRefreshCart.mock.invocationCallOrder[2]).toBeGreaterThan(
@@ -2,11 +2,9 @@ import { afterEach, describe, expect, it, vi } from "vitest";
2
2
  import { mountSuspended, mockNuxtImport } from "@nuxt/test-utils/runtime";
3
3
  import { defineComponent, h } from "vue";
4
4
 
5
- const { add, trackShare } = vi.hoisted(() => ({
6
- add: vi.fn(),
5
+ const { trackShare } = vi.hoisted(() => ({
7
6
  trackShare: vi.fn(),
8
7
  }));
9
- mockNuxtImport("useToast", () => () => ({ add }));
10
8
  mockNuxtImport("useTrackEvent", () => () => ({ trackShare }));
11
9
 
12
10
  const sharedPath = () =>
@@ -28,7 +26,6 @@ async function mountShare() {
28
26
  describe("useShareLink", () => {
29
27
  afterEach(() => {
30
28
  vi.unstubAllGlobals();
31
- add.mockReset();
32
29
  trackShare.mockReset();
33
30
  });
34
31
 
@@ -44,7 +41,6 @@ describe("useShareLink", () => {
44
41
  title: "Pizza",
45
42
  url: window.location.href,
46
43
  });
47
- expect(add).not.toHaveBeenCalled();
48
44
  expect(trackShare).toHaveBeenCalledWith("share", "P1", sharedPath());
49
45
  });
50
46
 
@@ -60,9 +56,6 @@ describe("useShareLink", () => {
60
56
  await api.share({ productNumber: "P1" });
61
57
 
62
58
  expect(writeText).toHaveBeenCalledWith(window.location.href);
63
- expect(add).toHaveBeenCalledWith(
64
- expect.objectContaining({ title: "Link kopiert" }),
65
- );
66
59
  expect(trackShare).toHaveBeenCalledWith("copy", "P1", sharedPath());
67
60
  });
68
61
 
@@ -97,7 +90,6 @@ describe("useShareLink", () => {
97
90
  await api.share({ productNumber: "P1" });
98
91
 
99
92
  expect(writeText).not.toHaveBeenCalled();
100
- expect(add).not.toHaveBeenCalled();
101
93
  expect(trackShare).not.toHaveBeenCalled();
102
94
  });
103
95
  });
@@ -6,14 +6,12 @@ import type { Schemas } from "#shopware";
6
6
  const {
7
7
  mockAddProducts,
8
8
  mockRefreshCart,
9
- mockToastAdd,
10
9
  mockTriggerProductAdded,
11
10
  mockClearWishlist,
12
11
  mockTrackEvent,
13
12
  } = vi.hoisted(() => ({
14
13
  mockAddProducts: vi.fn(),
15
14
  mockRefreshCart: vi.fn(),
16
- mockToastAdd: vi.fn(),
17
15
  mockTriggerProductAdded: vi.fn(),
18
16
  mockClearWishlist: vi.fn(),
19
17
  mockTrackEvent: vi.fn(),
@@ -24,10 +22,6 @@ mockNuxtImport("useCart", () => () => ({
24
22
  refreshCart: mockRefreshCart,
25
23
  }));
26
24
 
27
- mockNuxtImport("useToast", () => () => ({
28
- add: mockToastAdd,
29
- }));
30
-
31
25
  mockNuxtImport("useProductEvents", () => () => ({
32
26
  triggerProductAdded: mockTriggerProductAdded,
33
27
  }));
@@ -55,9 +49,6 @@ describe("useWishlistActions", () => {
55
49
  const { clearWishlistHandler, isLoading } = useWishlistActions();
56
50
  await clearWishlistHandler();
57
51
  expect(mockClearWishlist).toHaveBeenCalled();
58
- expect(mockToastAdd).toHaveBeenCalledWith(
59
- expect.objectContaining({ title: "Merkliste geleert" }),
60
- );
61
52
  expect(isLoading.value).toBe(false);
62
53
  });
63
54
 
@@ -72,22 +63,16 @@ describe("useWishlistActions", () => {
72
63
  ]);
73
64
  expect(mockRefreshCart).toHaveBeenCalled();
74
65
  expect(mockTriggerProductAdded).toHaveBeenCalled();
75
- expect(mockToastAdd).toHaveBeenCalledWith(
76
- expect.objectContaining({ title: "In den Warenkorb gelegt" }),
77
- );
78
66
  expect(mockTrackEvent).toHaveBeenCalledWith(mockProduct, 1);
79
67
  });
80
68
 
81
- it("should warn when adding a base product with variants", async () => {
69
+ it("should not add a base product with variants", async () => {
82
70
  const baseProduct = { ...mockProduct, childCount: 2 };
83
71
  const { addSingleItemToCart } = useWishlistActions();
84
72
 
85
73
  await addSingleItemToCart(baseProduct);
86
74
 
87
75
  expect(mockAddProducts).not.toHaveBeenCalled();
88
- expect(mockToastAdd).toHaveBeenCalledWith(
89
- expect.objectContaining({ title: "Variante erforderlich" }),
90
- );
91
76
  });
92
77
 
93
78
  it("should add all items to cart", async () => {
@@ -104,9 +89,7 @@ describe("useWishlistActions", () => {
104
89
  { id: "p1", quantity: 1, type: "product" },
105
90
  { id: "p2", quantity: 1, type: "product" },
106
91
  ]);
107
- expect(mockToastAdd).toHaveBeenCalledWith(
108
- expect.objectContaining({ title: "Produkte hinzugefügt" }),
109
- );
92
+ expect(mockRefreshCart).toHaveBeenCalledWith({ id: "cart-1" });
110
93
  expect(isAddingToCart.value).toBe(false);
111
94
  });
112
95
 
@@ -129,12 +112,6 @@ describe("useWishlistActions", () => {
129
112
  expect(mockAddProducts).toHaveBeenCalledWith([
130
113
  { id: "p1", quantity: 1, type: "product" },
131
114
  ]);
132
- expect(mockToastAdd).toHaveBeenCalledWith(
133
- expect.objectContaining({
134
- description: expect.stringContaining(
135
- "1 Produkte hinzugefügt. 1 Produkt(e) übersprungen",
136
- ),
137
- }),
138
- );
115
+ expect(mockTriggerProductAdded).toHaveBeenCalled();
139
116
  });
140
117
  });
@@ -0,0 +1,31 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { splitHighlight } from "../../app/utils/highlight";
3
+
4
+ describe("splitHighlight", () => {
5
+ it("keeps text without highlights as one part", () => {
6
+ expect(splitHighlight("Pizzeria La Fattoria")).toEqual([
7
+ { text: "Pizzeria La Fattoria", highlight: false },
8
+ ]);
9
+ });
10
+
11
+ it("splits the MDC highlight syntax", () => {
12
+ expect(
13
+ splitHighlight("Alle [Informationen]{.text-primary} auf einen Blick"),
14
+ ).toEqual([
15
+ { text: "Alle ", highlight: false },
16
+ { text: "Informationen", highlight: true },
17
+ { text: " auf einen Blick", highlight: false },
18
+ ]);
19
+ });
20
+
21
+ it("handles a highlight at the end", () => {
22
+ expect(
23
+ splitHighlight(
24
+ "Italienische Küche aus der [Alten Schmiede.]{.text-primary}",
25
+ ),
26
+ ).toEqual([
27
+ { text: "Italienische Küche aus der ", highlight: false },
28
+ { text: "Alten Schmiede.", highlight: true },
29
+ ]);
30
+ });
31
+ });
@@ -6,6 +6,7 @@ import {
6
6
  hasYesOption,
7
7
  lineItemHoldsProduct,
8
8
  productIsAvailable,
9
+ productNeedsChoice,
9
10
  } from "../../app/utils/product";
10
11
 
11
12
  const product = (overrides: Partial<Schemas["Product"]> = {}) =>
@@ -31,6 +32,17 @@ describe("productIsAvailable", () => {
31
32
  });
32
33
  });
33
34
 
35
+ describe("productNeedsChoice", () => {
36
+ it("is true for a parent with variants", () => {
37
+ expect(productNeedsChoice(product({ childCount: 3 }))).toBe(true);
38
+ });
39
+
40
+ it("is false without variants or without the field", () => {
41
+ expect(productNeedsChoice(product({ childCount: 0 }))).toBe(false);
42
+ expect(productNeedsChoice(product())).toBe(false);
43
+ });
44
+ });
45
+
34
46
  describe("lineItemHoldsProduct", () => {
35
47
  const lineItem = (overrides: Partial<Schemas["LineItem"]>) =>
36
48
  ({ id: "li", type: "product", ...overrides }) as Schemas["LineItem"];
@@ -0,0 +1,61 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import {
3
+ contrastFailures,
4
+ contrastRatio,
5
+ isThemePresetName,
6
+ presetCss,
7
+ resolvePreset,
8
+ THEME_PRESETS,
9
+ } from "../../shared/theme/presets";
10
+
11
+ describe("theme presets", () => {
12
+ it("computes WCAG contrast ratios", () => {
13
+ expect(contrastRatio("#000000", "#FFFFFF")).toBeCloseTo(21, 5);
14
+ expect(contrastRatio("#FFFFFF", "#FFFFFF")).toBeCloseTo(1, 5);
15
+ // order of the arguments does not matter
16
+ expect(contrastRatio("#3F7D20", "#FFFFFF")).toBeCloseTo(
17
+ contrastRatio("#FFFFFF", "#3F7D20"),
18
+ 10,
19
+ );
20
+ });
21
+
22
+ it.each(Object.keys(THEME_PRESETS))(
23
+ "preset %s passes every contrast pair (WCAG AA)",
24
+ (name) => {
25
+ const preset = THEME_PRESETS[name as keyof typeof THEME_PRESETS];
26
+ expect(contrastFailures(preset.colors)).toEqual([]);
27
+ },
28
+ );
29
+
30
+ it("reports overrides that break a contrast pair", () => {
31
+ const preset = resolvePreset("trattoria", { primary: "#9CCB7E" });
32
+ expect(contrastFailures(preset.colors)).toContainEqual(
33
+ expect.objectContaining({ fg: "onPrimary", bg: "primary", min: 4.5 }),
34
+ );
35
+ });
36
+
37
+ it("applies colour overrides without changing the preset", () => {
38
+ const preset = resolvePreset("trattoria", { primary: "#2E6B1A" });
39
+ expect(preset.colors.primary).toBe("#2E6B1A");
40
+ expect(preset.colors.bg).toBe(THEME_PRESETS.trattoria.colors.bg);
41
+ expect(THEME_PRESETS.trattoria.colors.primary).toBe("#3F7D20");
42
+ });
43
+
44
+ it("knows the preset names", () => {
45
+ expect(isThemePresetName("grill")).toBe(true);
46
+ expect(isThemePresetName("toString")).toBe(false);
47
+ expect(isThemePresetName("")).toBe(false);
48
+ });
49
+
50
+ it("scopes the stylesheet to the preset", () => {
51
+ const css = presetCss(resolvePreset("grill"));
52
+ expect(css).toContain(':root[data-preset="grill"] {');
53
+ expect(css).toContain("--sb-primary-tint: #3A2E1E;");
54
+ expect(css).toContain(
55
+ '--font-sb-display: "Bricolage Grotesque", sans-serif;',
56
+ );
57
+ expect(css).toContain("--font-sans: var(--font-sb-body);");
58
+ expect(css).not.toContain("--ui-");
59
+ expect(css).toContain("color-scheme: dark;");
60
+ });
61
+ });
package/app/app.config.ts DELETED
@@ -1,19 +0,0 @@
1
- export default defineAppConfig({
2
- ui: {
3
- colors: {
4
- // Alias of the colour scale in main.css; a hex value here produced
5
- // invalid `var(--color-#ff5b00-*)` declarations (#319).
6
- primary: "brand",
7
- },
8
- drawer: {
9
- slots: {
10
- content: "fixed bg-default ring ring-default flex focus:outline-none",
11
- },
12
- },
13
- },
14
- toaster: {
15
- position: "bottom-right" as const,
16
- expand: false,
17
- duration: 2000,
18
- },
19
- });
@@ -1,74 +0,0 @@
1
- <script setup lang="ts">
2
- import {
3
- ABOVE_VIEWPORT_MARGIN,
4
- useScrollAnimation,
5
- } from "~/composables/useScrollAnimation";
6
-
7
- interface Props {
8
- animation?:
9
- "fade-up" | "fade-down" | "fade-left" | "fade-right" | "fade" | "scale";
10
- duration?:
11
- "duration-500" | "duration-700" | "duration-1000" | "duration-1500";
12
- delay?: string;
13
- threshold?: number;
14
- rootMargin?: string;
15
- }
16
-
17
- const props = withDefaults(defineProps<Props>(), {
18
- animation: "fade-up",
19
- duration: "duration-1000",
20
- delay: "delay-0",
21
- threshold: 0.1,
22
- rootMargin: `${ABOVE_VIEWPORT_MARGIN} 0px 100px 0px`,
23
- });
24
-
25
- // Visible in SSR and on the first client render; hidden only after mount
26
- // for sections below the fold, until they scroll into view (#250).
27
- const { isHidden, elementRef } = useScrollAnimation({
28
- threshold: props.threshold,
29
- rootMargin: props.rootMargin,
30
- });
31
-
32
- const animationClasses = {
33
- "fade-up": {
34
- initial: "opacity-0 translate-y-20",
35
- final: "opacity-100 translate-y-0",
36
- },
37
- "fade-down": {
38
- initial: "opacity-0 -translate-y-20",
39
- final: "opacity-100 translate-y-0",
40
- },
41
- "fade-left": {
42
- initial: "opacity-0 translate-x-20",
43
- final: "opacity-100 translate-x-0",
44
- },
45
- "fade-right": {
46
- initial: "opacity-0 -translate-x-20",
47
- final: "opacity-100 translate-x-0",
48
- },
49
- fade: {
50
- initial: "opacity-0",
51
- final: "opacity-100",
52
- },
53
- scale: {
54
- initial: "opacity-0 scale-95",
55
- final: "opacity-100 scale-100",
56
- },
57
- };
58
-
59
- const currentAnimation = animationClasses[props.animation];
60
- </script>
61
-
62
- <template>
63
- <div
64
- ref="elementRef"
65
- class="transition-all ease-out"
66
- :class="[
67
- duration,
68
- delay,
69
- isHidden ? currentAnimation.initial : currentAnimation.final,
70
- ]"
71
- >
72
- <slot />
73
- </div>
74
- </template>
@@ -1,70 +0,0 @@
1
- <script setup lang="ts">
2
- import {
3
- PhoneIcon,
4
- BookOpenIcon,
5
- HeartIcon,
6
- MapPinIcon,
7
- HomeIcon,
8
- } from "@heroicons/vue/24/outline";
9
-
10
- const route = useRoute();
11
- // Route and phone come from the site config; without a value the button is
12
- // left out instead of pointing at another shop (#251).
13
- const { site } = useRuntimeConfig().public;
14
- </script>
15
-
16
- <template>
17
- <div
18
- class="backdrop-blur bg-white/30 fixed bottom-0 w-full px-2 md:hidden z-50"
19
- >
20
- <div class="flex flex-row justify-between items-center py-2 gap-1">
21
- <NuxtLink
22
- v-if="site.googleBusinessProfileUrl"
23
- title="Routenplaner"
24
- class="flex flex-col justify-center items-center bg-blackish rounded-md px-3.5 py-2.5 basis-1/4 gap-2"
25
- :to="site.googleBusinessProfileUrl"
26
- target="_blank"
27
- rel="noopener"
28
- >
29
- <MapPinIcon class="w-5 h-5 text-white" />
30
- <div class="text-white text-xs">Route</div>
31
- </NuxtLink>
32
- <NuxtLink
33
- title="Zu deiner Merkliste"
34
- to="/merkliste"
35
- class="flex flex-col justify-center items-center bg-blackish rounded-md px-3.5 py-2.5 basis-1/4 gap-2"
36
- :class="{ hidden: route.name === 'merkliste' }"
37
- >
38
- <HeartIcon class="w-5 h-5 text-white" />
39
- <div class="text-white text-xs">Merkliste</div>
40
- </NuxtLink>
41
- <NuxtLink
42
- title="Zur Startseite"
43
- to="/"
44
- class="flex flex-col justify-center items-center bg-blackish rounded-md px-3.5 py-2.5 basis-1/4 gap-2"
45
- :class="{ hidden: route.name === 'index' }"
46
- >
47
- <HomeIcon class="w-5 h-5 text-white" />
48
- <div class="text-white text-xs">Startseite</div>
49
- </NuxtLink>
50
- <NuxtLink
51
- title="Zur Speisekarte"
52
- to="/speisekarte"
53
- class="flex flex-col justify-center items-center bg-blackish rounded-md px-3.5 py-2.5 basis-1/4 gap-2"
54
- :class="{ hidden: route.name === 'speisekarte' }"
55
- >
56
- <BookOpenIcon class="w-5 h-5 text-white" />
57
- <div class="text-white text-xs">Speisekarte</div>
58
- </NuxtLink>
59
- <NuxtLink
60
- v-if="site.telephone"
61
- title="Anrufen"
62
- :to="toTelHref(site.telephone)"
63
- class="flex flex-col justify-center items-center bg-blackish rounded-md px-3.5 py-2.5 basis-1/4 gap-2"
64
- >
65
- <PhoneIcon class="w-5 h-5 text-white" />
66
- <div class="text-white text-xs">Anrufen</div>
67
- </NuxtLink>
68
- </div>
69
- </div>
70
- </template>
@@ -1,48 +0,0 @@
1
- <script setup lang="ts">
2
- import type { Schemas } from "#shopware";
3
-
4
- const props = defineProps<{
5
- category: Schemas["Category"];
6
- }>();
7
-
8
- const { category: categoryRef } = toRefs(props);
9
-
10
- const categoryCover = computed(
11
- () => categoryRef.value.media?.url ?? "/category-placeholder.webp",
12
- );
13
-
14
- // Shopware thumbnails (400/800/1920 px) instead of the original, which is
15
- // several thousand pixels wide (#273). The box is 700 px at most.
16
- const srcset = computed(() => mediaSrcSet(categoryRef.value.media));
17
- </script>
18
-
19
- <template>
20
- <div
21
- class="relative mb-4 mt-8 min-h-36 w-full overflow-hidden rounded-[0.5rem]"
22
- >
23
- <img
24
- :src="categoryCover"
25
- :srcset="srcset"
26
- sizes="(min-width: 768px) 700px, 100vw"
27
- fetchpriority="high"
28
- decoding="async"
29
- class="absolute inset-0 h-full w-full object-cover"
30
- :alt="category.name + ' Cover Image'"
31
- />
32
- <div class="absolute inset-0 bg-linear-to-t from-black/50 to-black/10" />
33
-
34
- <div class="relative p-4">
35
- <h1
36
- class="text-white text-4xl md:text-5xl lg:text-6xl font-extrabold leading-none tracking-tighter mb-3"
37
- >
38
- {{ categoryRef.name }}
39
- </h1>
40
- <p
41
- v-if="categoryRef.description"
42
- class="text-white/90 text-[16px] text-pretty mt-1"
43
- >
44
- {{ categoryRef.description }}
45
- </p>
46
- </div>
47
- </div>
48
- </template>