@shopbite-de/storefront 1.31.3 → 2.0.1
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/.github/workflows/ci.yaml +87 -0
- package/.gitignore +5 -0
- package/CLAUDE.md +27 -8
- package/app/app.vue +10 -6
- package/app/assets/css/main.css +103 -61
- package/app/components/AddToWishlist.vue +15 -25
- package/app/components/Address/Card.vue +6 -11
- package/app/components/Address/Detail.vue +23 -23
- package/app/components/Address/Fields.vue +175 -73
- package/app/components/Address/Form.vue +107 -106
- package/app/components/Cart/Bar.vue +6 -9
- package/app/components/Cart/Item.vue +48 -63
- package/app/components/Cart/QuickView.vue +38 -25
- package/app/components/Cart/Upsell.vue +24 -62
- package/app/components/Category/Breadcrumb.vue +29 -3
- package/app/components/Category/FilterGroup.vue +20 -41
- package/app/components/Category/Listing.vue +100 -130
- package/app/components/Category/SearchInput.vue +22 -19
- package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
- package/app/components/Checkout/LoginOrRegister.vue +28 -29
- package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
- package/app/components/Checkout/Summary.vue +90 -60
- package/app/components/Checkout/VoucherInput.vue +40 -27
- package/app/components/Contact/Form.vue +164 -192
- package/app/components/DemoBanner.vue +5 -5
- package/app/components/Footer/StoreStatus.vue +2 -2
- package/app/components/Footer.vue +125 -57
- package/app/components/Header.vue +283 -18
- package/app/components/Home/Categories.vue +116 -0
- package/app/components/Home/Facts.vue +71 -0
- package/app/components/Home/Faq.vue +34 -16
- package/app/components/Home/Hero.vue +172 -0
- package/app/components/Home/Highlights.vue +29 -37
- package/app/components/Home/Restaurant.vue +102 -0
- package/app/components/Menu/BonCard.vue +180 -0
- package/app/components/Menu/CartPanel.vue +24 -0
- package/app/components/Menu/CategoryIndex.vue +54 -0
- package/app/components/Menu/OrderMode.vue +20 -0
- package/app/components/Menu/SectionHeader.vue +38 -0
- package/app/components/Navigation/MobileTop.vue +23 -15
- package/app/components/Order/Confirmation.vue +119 -0
- package/app/components/Order/Detail.vue +80 -88
- package/app/components/Product/CardSkeleton.vue +8 -12
- package/app/components/Product/Configurator.vue +8 -16
- package/app/components/Product/CrossSelling.vue +75 -83
- package/app/components/Product/DeselectIngredient.vue +17 -22
- package/app/components/Product/Detail.vue +35 -27
- package/app/components/Product/QuickView.vue +80 -51
- package/app/components/SalesChannelSwitch.vue +14 -28
- package/app/components/Sb/Button.vue +70 -0
- package/app/components/Sb/Checkbox.vue +73 -0
- package/app/components/Sb/Chip.vue +51 -0
- package/app/components/Sb/ChoiceGroup.vue +82 -0
- package/app/components/Sb/ConfirmDialog.vue +60 -0
- package/app/components/Sb/Field.vue +77 -0
- package/app/components/Sb/Icon.vue +66 -0
- package/app/components/Sb/IconButton.vue +55 -0
- package/app/components/Sb/Input.vue +23 -0
- package/app/components/Sb/SegmentedControl.vue +34 -0
- package/app/components/Sb/Select.vue +49 -0
- package/app/components/Sb/Sheet.vue +83 -0
- package/app/components/Sb/Stars.vue +60 -0
- package/app/components/Sb/StatusPill.vue +38 -0
- package/app/components/Sb/Stepper.vue +72 -0
- package/app/components/User/AccountHeader.vue +16 -0
- package/app/components/User/AuthPanel.vue +41 -0
- package/app/components/User/Detail.vue +32 -29
- package/app/components/User/LoginForm.vue +92 -98
- package/app/components/User/RegistrationForm.vue +285 -249
- package/app/components/Wishlist.vue +55 -155
- package/app/composables/useCartMutations.ts +9 -27
- package/app/composables/useCheckoutMethodGuard.ts +2 -24
- package/app/composables/useContactForm.ts +66 -0
- package/app/composables/useHomeMenuCategories.ts +41 -0
- package/app/composables/useNavigation.ts +10 -2
- package/app/composables/useOrderMode.ts +65 -0
- package/app/composables/useRegistrationForm.ts +161 -0
- package/app/composables/useRestaurantSchema.ts +1 -1
- package/app/composables/useShareLink.ts +3 -13
- package/app/composables/useSortingSelection.ts +13 -0
- package/app/composables/useThemePreset.ts +24 -0
- package/app/composables/useVoucherCode.ts +7 -16
- package/app/composables/useWishlistActions.ts +0 -51
- package/app/error.vue +31 -9
- package/app/layouts/account.vue +45 -50
- package/app/layouts/default.vue +2 -3
- package/app/layouts/listing.vue +3 -5
- package/app/pages/[...all].vue +8 -4
- package/app/pages/account/recover/password/index.vue +113 -80
- package/app/pages/anmelden.vue +11 -10
- package/app/pages/bestellung/[id]/erfolg.vue +1 -15
- package/app/pages/bestellung/[id]/fehler.vue +63 -51
- package/app/pages/bestellung/[id]/index.vue +3 -85
- package/app/pages/bestellung/kasse.vue +29 -0
- package/app/pages/bestellung.vue +8 -60
- package/app/pages/index.vue +12 -52
- package/app/pages/kontakt.vue +27 -7
- package/app/pages/konto/adressen.vue +106 -102
- package/app/pages/konto/bestellung/[id].vue +9 -43
- package/app/pages/konto/bestellungen.vue +55 -33
- package/app/pages/konto/index.vue +47 -62
- package/app/pages/konto/profil.vue +162 -100
- package/app/pages/maintenance.vue +8 -6
- package/app/pages/merkliste.vue +7 -8
- package/app/pages/passwort-vergessen.vue +92 -75
- package/app/pages/registrierung/bestaetigen.vue +20 -48
- package/app/pages/registrierung/index.vue +16 -7
- package/app/pages/suche.vue +94 -95
- package/app/plugins/theme-preset.ts +9 -0
- package/app/utils/highlight.ts +25 -0
- package/app/utils/product.ts +9 -0
- package/app/validation/registrationSchema.ts +1 -1
- package/modules/theme.ts +123 -0
- package/nuxt.config.ts +30 -16
- package/package.json +6 -8
- package/playwright.config.ts +11 -0
- package/server/api/listing/[categoryId].get.ts +3 -0
- package/shared/theme/presets.ts +303 -0
- package/test/a11y/presets.test.ts +225 -0
- package/test/layer/nuxt.config.ts +8 -0
- package/test/nuxt/AccountPagesPreset.test.ts +191 -0
- package/test/nuxt/AuthPagesPreset.test.ts +87 -0
- package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
- package/test/nuxt/CartItem.test.ts +18 -3
- package/test/nuxt/CartUpsell.test.ts +1 -2
- package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
- package/test/nuxt/CheckoutOnePage.test.ts +115 -0
- package/test/nuxt/CheckoutSummary.test.ts +6 -6
- package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
- package/test/nuxt/ContactFormPreset.test.ts +115 -0
- package/test/nuxt/FooterStoreStatus.test.ts +2 -2
- package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
- package/test/nuxt/HomeFaq.test.ts +3 -2
- package/test/nuxt/MenuBonCard.test.ts +122 -0
- package/test/nuxt/OrderPagesPreset.test.ts +132 -0
- package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
- package/test/nuxt/ProductCrossSelling.test.ts +2 -1
- package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
- package/test/nuxt/ProductSheetPreset.test.ts +105 -0
- package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
- package/test/nuxt/RegistrationForm.test.ts +89 -270
- package/test/nuxt/SbBaseComponents.test.ts +170 -0
- package/test/nuxt/SbStars.test.ts +25 -0
- package/test/nuxt/useCartMutations.test.ts +3 -17
- package/test/nuxt/useCartUpsell.test.ts +1 -1
- package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
- package/test/nuxt/useShareLink.test.ts +1 -9
- package/test/nuxt/useWishlistActions.test.ts +3 -26
- package/test/unit/highlight.spec.ts +31 -0
- package/test/unit/product.spec.ts +12 -0
- package/test/unit/themePresets.spec.ts +61 -0
- package/app/app.config.ts +0 -19
- package/app/components/AnimatedSection.vue +0 -74
- package/app/components/BottomNavi.vue +0 -70
- package/app/components/Category/Header.vue +0 -48
- package/app/components/Checkout/PaymentMethod.vue +0 -30
- package/app/components/Checkout/ShippingMethod.vue +0 -30
- package/app/components/Cta.vue +0 -30
- package/app/components/Feature/Card.vue +0 -121
- package/app/components/Features.vue +0 -42
- package/app/components/Footer/Contact.vue +0 -82
- package/app/components/Header/Body.vue +0 -82
- package/app/components/Header/Right.vue +0 -187
- package/app/components/Header/Title.vue +0 -10
- package/app/components/Hero.vue +0 -233
- package/app/components/Home/MenuCategories.vue +0 -148
- package/app/components/ImageGallery.vue +0 -63
- package/app/components/Loading.vue +0 -29
- package/app/components/Navigation/DesktopLeft.vue +0 -39
- package/app/components/Product/Card.vue +0 -177
- package/app/components/Product/CardCompact.vue +0 -72
- package/app/components/Product/CardDietBadges.vue +0 -43
- package/app/components/Product/CardIngredients.vue +0 -35
- package/app/components/Product/CardKitchen.vue +0 -34
- package/app/components/Product/SearchBar.vue +0 -95
- package/app/components/PublicAnnouncement.vue +0 -17
- package/app/pages/bestellung/bestaetigen.vue +0 -16
- package/app/pages/bestellung/warenkorb.vue +0 -49
- package/app/pages/bestellung/zahlung-versand.vue +0 -25
- package/test/nuxt/AddressFields.test.ts +0 -222
- package/test/nuxt/AnimatedSection.test.ts +0 -67
- package/test/nuxt/ContactForm.test.ts +0 -207
- package/test/nuxt/FooterContact.test.ts +0 -102
- package/test/nuxt/HeaderRight.test.ts +0 -142
- package/test/nuxt/Hero.test.ts +0 -126
- package/test/nuxt/HomeMenuCategories.test.ts +0 -94
- package/test/nuxt/LoginForm.test.ts +0 -159
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ApiClientError } from "@shopware/api-client";
|
|
2
|
+
import type { Schemas } from "#shopware";
|
|
3
|
+
import { createRegistrationSchema } from "~/validation/registrationSchema";
|
|
4
|
+
import type { RegistrationSchema } from "~/validation/registrationSchema";
|
|
5
|
+
|
|
6
|
+
export type RegistrationResult =
|
|
7
|
+
| {
|
|
8
|
+
ok: true;
|
|
9
|
+
data: RegistrationSchema;
|
|
10
|
+
customer: Schemas["Customer"] | undefined;
|
|
11
|
+
needsConfirmation: boolean;
|
|
12
|
+
}
|
|
13
|
+
| { ok: false; message: string };
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* State, schema and submit of the customer registration (#443), shared by
|
|
17
|
+
* the Nuxt UI form (User/RegistrationForm.vue) and the form of the presets
|
|
18
|
+
* (User/RegistrationForm.vue). `submit()` reports the outcome; the
|
|
19
|
+
* form decides how to show it (toast or inline).
|
|
20
|
+
*/
|
|
21
|
+
export function useRegistrationForm(options: { allowGuest: boolean }) {
|
|
22
|
+
const config = useRuntimeConfig();
|
|
23
|
+
// Where to go after a successful registration is the caller's decision: the
|
|
24
|
+
// registration page sends the visitor to the account, the checkout continues
|
|
25
|
+
// with the order.
|
|
26
|
+
const { register } = useUser();
|
|
27
|
+
|
|
28
|
+
const state = reactive({
|
|
29
|
+
accountType: "private" as "private" | "business",
|
|
30
|
+
salutationId: "",
|
|
31
|
+
firstName: "",
|
|
32
|
+
lastName: "",
|
|
33
|
+
email: "",
|
|
34
|
+
guest: options.allowGuest,
|
|
35
|
+
password: "",
|
|
36
|
+
passwordConfirm: "",
|
|
37
|
+
acceptedDataProtection: false,
|
|
38
|
+
isShippingAddressDifferent: false,
|
|
39
|
+
storefrontUrl: config.public.shopware.devStorefrontUrl,
|
|
40
|
+
billingAddress: {
|
|
41
|
+
company: "",
|
|
42
|
+
department: "",
|
|
43
|
+
salutationId: "",
|
|
44
|
+
firstName: "",
|
|
45
|
+
lastName: "",
|
|
46
|
+
phoneNumber: "",
|
|
47
|
+
additionalAddressLine1: "",
|
|
48
|
+
street: "",
|
|
49
|
+
zipcode: "",
|
|
50
|
+
city: "",
|
|
51
|
+
countryId: config.public.site.countryId,
|
|
52
|
+
},
|
|
53
|
+
shippingAddress: {
|
|
54
|
+
company: "",
|
|
55
|
+
department: "",
|
|
56
|
+
salutationId: "",
|
|
57
|
+
firstName: "",
|
|
58
|
+
lastName: "",
|
|
59
|
+
phoneNumber: "",
|
|
60
|
+
additionalAddressLine1: "",
|
|
61
|
+
street: "",
|
|
62
|
+
zipcode: "",
|
|
63
|
+
city: "",
|
|
64
|
+
countryId: config.public.site.countryId,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const schema = computed(() => createRegistrationSchema(state));
|
|
69
|
+
|
|
70
|
+
// The API payload keeps the negated `guest` flag, the form asks the positive
|
|
71
|
+
// question: a guest order is the default, creating an account is the opt-in.
|
|
72
|
+
const createAccount = computed({
|
|
73
|
+
get: () => !state.guest,
|
|
74
|
+
set: (value: boolean) => {
|
|
75
|
+
state.guest = !value;
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* With double opt-in enabled in Shopware the customer stays inactive until the
|
|
81
|
+
* confirmation link is clicked, so there is no session to continue with.
|
|
82
|
+
*/
|
|
83
|
+
function needsEmailConfirmation(customer: Schemas["Customer"] | undefined) {
|
|
84
|
+
return !!customer?.doubleOptInRegistration && !customer?.active;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const billingAddressFields = ref();
|
|
88
|
+
const shippingAddressFields = ref();
|
|
89
|
+
|
|
90
|
+
async function submit(data: RegistrationSchema): Promise<RegistrationResult> {
|
|
91
|
+
billingAddressFields.value?.flushPendingCheck();
|
|
92
|
+
if (state.isShippingAddressDifferent) {
|
|
93
|
+
shippingAddressFields.value?.flushPendingCheck();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const registrationData = { ...data };
|
|
97
|
+
|
|
98
|
+
if (
|
|
99
|
+
!registrationData.billingAddress.firstName &&
|
|
100
|
+
registrationData.firstName
|
|
101
|
+
) {
|
|
102
|
+
registrationData.billingAddress.firstName = registrationData.firstName;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (
|
|
106
|
+
!registrationData.billingAddress.lastName &&
|
|
107
|
+
registrationData.lastName
|
|
108
|
+
) {
|
|
109
|
+
registrationData.billingAddress.lastName = registrationData.lastName;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!state.isShippingAddressDifferent) {
|
|
113
|
+
delete registrationData.shippingAddress;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (registrationData.guest) {
|
|
117
|
+
delete registrationData.password;
|
|
118
|
+
delete registrationData.passwordConfirm;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
const customer: Schemas["Customer"] | undefined =
|
|
123
|
+
// @ts-expect-error - password is required in the API type but not for guests
|
|
124
|
+
await register(registrationData);
|
|
125
|
+
return {
|
|
126
|
+
ok: true,
|
|
127
|
+
data: registrationData as unknown as RegistrationSchema,
|
|
128
|
+
customer,
|
|
129
|
+
needsConfirmation: needsEmailConfirmation(customer),
|
|
130
|
+
};
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.error("Registration failed:", error);
|
|
133
|
+
let message = "Bitte versuchen Sie es erneut.";
|
|
134
|
+
if (error instanceof ApiClientError) {
|
|
135
|
+
const errors = error.details?.errors;
|
|
136
|
+
if (Array.isArray(errors) && errors.length > 0) {
|
|
137
|
+
message = errors
|
|
138
|
+
.map((e) => e.detail || e.title)
|
|
139
|
+
.filter(Boolean)
|
|
140
|
+
.join("\n");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return { ok: false, message };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const accountTypes = [
|
|
148
|
+
{ label: "Privatkunde", value: "private" as const },
|
|
149
|
+
{ label: "Geschäftskunde", value: "business" as const },
|
|
150
|
+
];
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
state,
|
|
154
|
+
schema,
|
|
155
|
+
createAccount,
|
|
156
|
+
billingAddressFields,
|
|
157
|
+
shippingAddressFields,
|
|
158
|
+
accountTypes,
|
|
159
|
+
submit,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shares the current page (#411): the native share sheet where the browser
|
|
3
|
-
* has one (phones: WhatsApp, messages …), otherwise the link is copied
|
|
4
|
-
*
|
|
3
|
+
* has one (phones: WhatsApp, messages …), otherwise the link is copied.
|
|
4
|
+
* `canShare` is false during SSR and the first render,
|
|
5
5
|
* so the button's icon does not cause a hydration mismatch.
|
|
6
6
|
*
|
|
7
7
|
* With a `productNumber`, a completed share or copy is tracked in Matomo
|
|
8
8
|
* together with the shared path (`useTrackEvent().trackShare`).
|
|
9
9
|
*/
|
|
10
10
|
export function useShareLink() {
|
|
11
|
-
const toast = useToast();
|
|
12
11
|
const { trackShare } = useTrackEvent();
|
|
13
12
|
const canShare = ref(false);
|
|
14
13
|
|
|
@@ -43,17 +42,8 @@ export function useShareLink() {
|
|
|
43
42
|
try {
|
|
44
43
|
await navigator.clipboard.writeText(url);
|
|
45
44
|
track("copy");
|
|
46
|
-
toast.add({
|
|
47
|
-
title: "Link kopiert",
|
|
48
|
-
icon: "i-lucide-check",
|
|
49
|
-
color: "success",
|
|
50
|
-
});
|
|
51
45
|
} catch {
|
|
52
|
-
|
|
53
|
-
title: "Link konnte nicht kopiert werden",
|
|
54
|
-
description: url,
|
|
55
|
-
color: "error",
|
|
56
|
-
});
|
|
46
|
+
// clipboard blocked (permissions, insecure context): nothing to copy
|
|
57
47
|
}
|
|
58
48
|
}
|
|
59
49
|
|
|
@@ -26,3 +26,16 @@ export function useSortingSelection(
|
|
|
26
26
|
|
|
27
27
|
return { currentSorting };
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
/** Store API sortings as options of `SbSelect` (#445). */
|
|
31
|
+
export function toSortingOptions(
|
|
32
|
+
orders:
|
|
33
|
+
| { key: string; label?: string; translated?: { label?: string } }[]
|
|
34
|
+
| null
|
|
35
|
+
| undefined,
|
|
36
|
+
) {
|
|
37
|
+
return (orders ?? []).map((order) => ({
|
|
38
|
+
value: order.key,
|
|
39
|
+
label: order.translated?.label ?? order.label ?? order.key,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type PresetInfo = {
|
|
2
|
+
menuView: "bon" | "bonPhoto" | "listPhoto";
|
|
3
|
+
colorMode: "light" | "dark";
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The active style preset (#439, #445): `runtimeConfig.public.shopBite
|
|
8
|
+
* .themePreset` (`NUXT_PUBLIC_SHOP_BITE_THEME_PRESET`), by default the
|
|
9
|
+
* `shopBite.preset` of the build, else `trattoria`. modules/theme.ts puts
|
|
10
|
+
* the menu view and colour mode of every preset into the runtime config.
|
|
11
|
+
*/
|
|
12
|
+
export function useThemePreset() {
|
|
13
|
+
const shopBite = useRuntimeConfig().public.shopBite as
|
|
14
|
+
| { themePreset?: string; themePresets?: Record<string, PresetInfo> }
|
|
15
|
+
| undefined;
|
|
16
|
+
const presets = shopBite?.themePresets ?? {};
|
|
17
|
+
const configured = shopBite?.themePreset ?? "";
|
|
18
|
+
const preset = Object.hasOwn(presets, configured) ? configured : "trattoria";
|
|
19
|
+
const { menuView, colorMode } = presets[preset] ?? {
|
|
20
|
+
menuView: "bon",
|
|
21
|
+
colorMode: "light",
|
|
22
|
+
};
|
|
23
|
+
return { preset, menuView, colorMode };
|
|
24
|
+
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
export function useVoucherCode() {
|
|
2
2
|
const { cart, addPromotionCode, appliedPromotionCodes, removeItem } =
|
|
3
3
|
useCart();
|
|
4
|
-
const toast = useToast();
|
|
5
4
|
|
|
6
5
|
const voucherCode = ref("");
|
|
7
6
|
const voucherLoading = ref(false);
|
|
7
|
+
// shown at the field (#445), no toast
|
|
8
|
+
const voucherError = ref<string | null>(null);
|
|
9
|
+
const INVALID = "Der Gutscheincode ist ungültig oder abgelaufen.";
|
|
8
10
|
|
|
9
11
|
async function applyVoucher() {
|
|
10
12
|
const code = voucherCode.value.trim();
|
|
11
13
|
if (!code || voucherLoading.value) return;
|
|
12
14
|
voucherLoading.value = true;
|
|
15
|
+
voucherError.value = null;
|
|
13
16
|
try {
|
|
14
17
|
await addPromotionCode(code);
|
|
15
18
|
const errors = cart.value?.errors ?? {};
|
|
@@ -17,25 +20,12 @@ export function useVoucherCode() {
|
|
|
17
20
|
(e) => (e as { promotionCode?: string }).promotionCode === code,
|
|
18
21
|
) as { translatedMessage?: string } | undefined;
|
|
19
22
|
if (promotionError) {
|
|
20
|
-
|
|
21
|
-
title: "Gutschein ungültig",
|
|
22
|
-
description:
|
|
23
|
-
promotionError.translatedMessage ??
|
|
24
|
-
"Der eingegebene Gutscheincode ist ungültig oder abgelaufen.",
|
|
25
|
-
color: "error",
|
|
26
|
-
icon: "i-lucide-x-circle",
|
|
27
|
-
});
|
|
23
|
+
voucherError.value = promotionError.translatedMessage ?? INVALID;
|
|
28
24
|
} else {
|
|
29
25
|
voucherCode.value = "";
|
|
30
26
|
}
|
|
31
27
|
} catch {
|
|
32
|
-
|
|
33
|
-
title: "Gutschein ungültig",
|
|
34
|
-
description:
|
|
35
|
-
"Der eingegebene Gutscheincode ist ungültig oder abgelaufen.",
|
|
36
|
-
color: "error",
|
|
37
|
-
icon: "i-lucide-x-circle",
|
|
38
|
-
});
|
|
28
|
+
voucherError.value = INVALID;
|
|
39
29
|
} finally {
|
|
40
30
|
voucherLoading.value = false;
|
|
41
31
|
}
|
|
@@ -44,6 +34,7 @@ export function useVoucherCode() {
|
|
|
44
34
|
return {
|
|
45
35
|
voucherCode,
|
|
46
36
|
voucherLoading,
|
|
37
|
+
voucherError,
|
|
47
38
|
applyVoucher,
|
|
48
39
|
appliedPromotionCodes,
|
|
49
40
|
removeItem,
|
|
@@ -2,7 +2,6 @@ import type { Schemas } from "#shopware";
|
|
|
2
2
|
|
|
3
3
|
export function useWishlistActions() {
|
|
4
4
|
const { addProducts, refreshCart } = useCart();
|
|
5
|
-
const toast = useToast();
|
|
6
5
|
const { triggerProductAdded } = useProductEvents();
|
|
7
6
|
const { clearWishlist } = useWishlist();
|
|
8
7
|
const { trackAddToCart: trackAddToCartEvent } = useTrackEvent();
|
|
@@ -15,12 +14,6 @@ export function useWishlistActions() {
|
|
|
15
14
|
try {
|
|
16
15
|
isLoading.value = true;
|
|
17
16
|
clearWishlist();
|
|
18
|
-
toast.add({
|
|
19
|
-
title: "Merkliste geleert",
|
|
20
|
-
description: "Alle Produkte wurden von der Merkliste entfernt.",
|
|
21
|
-
icon: "i-lucide-trash",
|
|
22
|
-
color: "neutral",
|
|
23
|
-
});
|
|
24
17
|
} finally {
|
|
25
18
|
isLoading.value = false;
|
|
26
19
|
}
|
|
@@ -33,12 +26,6 @@ export function useWishlistActions() {
|
|
|
33
26
|
// Check if this is a base product with variants
|
|
34
27
|
const isBaseProduct = product.childCount && product.childCount > 0;
|
|
35
28
|
if (isBaseProduct) {
|
|
36
|
-
toast.add({
|
|
37
|
-
title: "Variante erforderlich",
|
|
38
|
-
description: `${product.translated.name} hat Varianten. Bitte wähle eine spezifische Variante aus.`,
|
|
39
|
-
icon: "i-lucide-alert-circle",
|
|
40
|
-
color: "warning",
|
|
41
|
-
});
|
|
42
29
|
return;
|
|
43
30
|
}
|
|
44
31
|
|
|
@@ -55,21 +42,8 @@ export function useWishlistActions() {
|
|
|
55
42
|
|
|
56
43
|
triggerProductAdded();
|
|
57
44
|
trackAddToCartEvent(product, 1);
|
|
58
|
-
|
|
59
|
-
toast.add({
|
|
60
|
-
title: "In den Warenkorb gelegt",
|
|
61
|
-
description: `${product.translated.name} wurde hinzugefügt.`,
|
|
62
|
-
icon: "i-lucide-shopping-cart",
|
|
63
|
-
color: "primary",
|
|
64
|
-
});
|
|
65
45
|
} catch (error) {
|
|
66
46
|
console.error("[wishlist][addSingleItemToCart] Error details:", error);
|
|
67
|
-
toast.add({
|
|
68
|
-
title: "Fehler",
|
|
69
|
-
description: "Produkt konnte nicht hinzugefügt werden.",
|
|
70
|
-
icon: "i-lucide-alert-circle",
|
|
71
|
-
color: "error",
|
|
72
|
-
});
|
|
73
47
|
} finally {
|
|
74
48
|
addingItemId.value = null;
|
|
75
49
|
}
|
|
@@ -91,12 +65,6 @@ export function useWishlistActions() {
|
|
|
91
65
|
});
|
|
92
66
|
|
|
93
67
|
if (addableProducts.length === 0) {
|
|
94
|
-
toast.add({
|
|
95
|
-
title: "Keine Produkte hinzugefügt",
|
|
96
|
-
description: "Bitte wähle zuerst Varianten für deine Produkte aus.",
|
|
97
|
-
icon: "i-lucide-alert-circle",
|
|
98
|
-
color: "warning",
|
|
99
|
-
});
|
|
100
68
|
return;
|
|
101
69
|
}
|
|
102
70
|
|
|
@@ -110,27 +78,8 @@ export function useWishlistActions() {
|
|
|
110
78
|
await refreshCart(newCart);
|
|
111
79
|
|
|
112
80
|
triggerProductAdded();
|
|
113
|
-
|
|
114
|
-
const skippedCount = products.length - addableProducts.length;
|
|
115
|
-
const successMessage =
|
|
116
|
-
skippedCount > 0
|
|
117
|
-
? `${addableProducts.length} Produkte hinzugefügt. ${skippedCount} Produkt(e) übersprungen (Varianten müssen einzeln ausgewählt werden).`
|
|
118
|
-
: `${addableProducts.length} Produkte wurden in den Warenkorb gelegt.`;
|
|
119
|
-
|
|
120
|
-
toast.add({
|
|
121
|
-
title: "Produkte hinzugefügt",
|
|
122
|
-
description: successMessage,
|
|
123
|
-
icon: "i-lucide-shopping-cart",
|
|
124
|
-
color: "primary",
|
|
125
|
-
});
|
|
126
81
|
} catch (error) {
|
|
127
82
|
console.error("[wishlist][addAllItemsToCart] Error:", error);
|
|
128
|
-
toast.add({
|
|
129
|
-
title: "Fehler",
|
|
130
|
-
description: "Produkte konnten nicht hinzugefügt werden.",
|
|
131
|
-
icon: "i-lucide-alert-circle",
|
|
132
|
-
color: "error",
|
|
133
|
-
});
|
|
134
83
|
} finally {
|
|
135
84
|
isAddingToCart.value = false;
|
|
136
85
|
}
|
package/app/error.vue
CHANGED
|
@@ -22,15 +22,37 @@ useSeoMeta({
|
|
|
22
22
|
|
|
23
23
|
<template>
|
|
24
24
|
<NuxtLayout>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
<!-- error.vue replaces app.vue, so the error page brings its own
|
|
26
|
+
header and footer -->
|
|
27
|
+
<div>
|
|
28
|
+
<Header />
|
|
29
|
+
<main
|
|
30
|
+
id="inhalt"
|
|
31
|
+
class="mx-auto flex w-full max-w-2xl flex-col items-start gap-4 px-4 pt-12 pb-20 font-body text-sb-ink sm:px-6"
|
|
32
|
+
>
|
|
33
|
+
<p class="text-sm font-bold tracking-wide text-sb-accent uppercase">
|
|
34
|
+
Fehler {{ statusCode }}
|
|
35
|
+
</p>
|
|
36
|
+
<h1 class="font-display text-4xl leading-tight sm:text-5xl">
|
|
37
|
+
{{
|
|
38
|
+
statusCode === 404
|
|
39
|
+
? "Diese Seite gibt es nicht"
|
|
40
|
+
: "Da ist etwas schiefgelaufen"
|
|
41
|
+
}}
|
|
42
|
+
</h1>
|
|
43
|
+
<p class="text-lg">
|
|
44
|
+
{{
|
|
45
|
+
statusCode === 404
|
|
46
|
+
? "Vielleicht hat sich die Adresse geändert. Unsere Speisekarte finden Sie hier:"
|
|
47
|
+
: "Bitte laden Sie die Seite neu oder versuchen Sie es gleich noch einmal."
|
|
48
|
+
}}
|
|
49
|
+
</p>
|
|
50
|
+
<div class="flex flex-wrap gap-3">
|
|
51
|
+
<SbButton to="/speisekarte/">Zur Speisekarte</SbButton>
|
|
52
|
+
<SbButton variant="secondary" to="/">Zur Startseite</SbButton>
|
|
53
|
+
</div>
|
|
54
|
+
</main>
|
|
55
|
+
<Footer />
|
|
34
56
|
</div>
|
|
35
57
|
</NuxtLayout>
|
|
36
58
|
</template>
|
package/app/layouts/account.vue
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { NavigationMenuItem } from "@nuxt/ui";
|
|
3
2
|
import { useUser } from "@shopware/composables";
|
|
4
|
-
const
|
|
3
|
+
const route = useRoute();
|
|
4
|
+
|
|
5
|
+
// Account navigation (#445).
|
|
6
|
+
const links = [
|
|
7
|
+
{ label: "Übersicht", to: "/konto" },
|
|
8
|
+
{ label: "Bestellungen", to: "/konto/bestellungen" },
|
|
9
|
+
{ label: "Profil", to: "/konto/profil" },
|
|
10
|
+
{ label: "Adressen", to: "/konto/adressen" },
|
|
11
|
+
];
|
|
12
|
+
const isCurrent = (to: string) =>
|
|
13
|
+
to === "/konto"
|
|
14
|
+
? route.path === to
|
|
15
|
+
: route.path === to ||
|
|
16
|
+
route.path.startsWith(`${to}/`) ||
|
|
17
|
+
(to === "/konto/bestellungen" &&
|
|
18
|
+
route.path.startsWith("/konto/bestellung/"));
|
|
5
19
|
const { isLoggedIn, logout } = useUser();
|
|
6
20
|
|
|
7
21
|
onMounted(() => {
|
|
@@ -18,56 +32,37 @@ watch(isLoggedIn, (newValue) => {
|
|
|
18
32
|
|
|
19
33
|
const logoutHandler = () => {
|
|
20
34
|
logout();
|
|
21
|
-
toast.add({
|
|
22
|
-
title: "Tschüss!",
|
|
23
|
-
description: "Erfolreich abgemeldet.",
|
|
24
|
-
color: "success",
|
|
25
|
-
});
|
|
26
35
|
};
|
|
27
|
-
|
|
28
|
-
const items = ref<NavigationMenuItem[][]>([
|
|
29
|
-
[
|
|
30
|
-
{
|
|
31
|
-
label: "Übersicht",
|
|
32
|
-
icon: "i-lucide-grip",
|
|
33
|
-
to: "/konto",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: "Bestellungen",
|
|
37
|
-
icon: "i-lucide-book-open",
|
|
38
|
-
to: "/konto/bestellungen",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
label: "Persönliches Profil",
|
|
42
|
-
icon: "i-lucide-user",
|
|
43
|
-
to: "/konto/profil",
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
label: "Adressen",
|
|
47
|
-
icon: "i-lucide-house",
|
|
48
|
-
to: "/konto/adressen",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
label: "Abmelden",
|
|
52
|
-
icon: "i-lucide-log-out",
|
|
53
|
-
onSelect: logoutHandler,
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
]);
|
|
57
36
|
</script>
|
|
58
37
|
<template>
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
38
|
+
<div
|
|
39
|
+
class="mx-auto w-full max-w-(--sb-container) px-4 pt-8 pb-16 font-body text-sb-ink sm:px-6 sm:pt-12 lg:grid lg:grid-cols-[200px_minmax(0,1fr)] lg:gap-12 lg:px-8"
|
|
40
|
+
>
|
|
41
|
+
<nav aria-label="Kundenkonto" class="mb-8 lg:mb-0">
|
|
42
|
+
<ul
|
|
43
|
+
class="-mx-4 flex gap-2 overflow-x-auto px-4 pb-1 lg:sticky lg:top-24 lg:mx-0 lg:flex-col lg:overflow-visible lg:px-0"
|
|
44
|
+
>
|
|
45
|
+
<li v-for="link in links" :key="link.to" class="shrink-0">
|
|
46
|
+
<NuxtLink
|
|
47
|
+
:to="link.to"
|
|
48
|
+
:aria-current="isCurrent(link.to) ? 'page' : undefined"
|
|
49
|
+
class="flex min-h-11 items-center rounded-sb-control px-4 font-semibold whitespace-nowrap hover:bg-sb-muted focus-visible:outline-3 focus-visible:outline-sb-focus aria-[current=page]:bg-sb-primary-tint aria-[current=page]:text-sb-primary-ink"
|
|
50
|
+
>{{ link.label }}</NuxtLink
|
|
51
|
+
>
|
|
52
|
+
</li>
|
|
53
|
+
<li class="shrink-0 lg:mt-4 lg:border-t lg:border-sb-line lg:pt-4">
|
|
54
|
+
<button
|
|
55
|
+
type="button"
|
|
56
|
+
class="flex min-h-11 w-full items-center rounded-sb-control px-4 font-semibold whitespace-nowrap text-sb-ink-muted hover:bg-sb-muted focus-visible:outline-3 focus-visible:outline-sb-focus"
|
|
57
|
+
@click="logoutHandler"
|
|
58
|
+
>
|
|
59
|
+
Abmelden
|
|
60
|
+
</button>
|
|
61
|
+
</li>
|
|
62
|
+
</ul>
|
|
63
|
+
</nav>
|
|
64
|
+
<div class="min-w-0">
|
|
70
65
|
<slot />
|
|
71
|
-
</
|
|
72
|
-
</
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
73
68
|
</template>
|
package/app/layouts/default.vue
CHANGED
package/app/layouts/listing.vue
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
<script setup lang="ts"></script>
|
|
2
|
-
|
|
3
1
|
<template>
|
|
4
|
-
<
|
|
5
|
-
<div class="sticky top-16
|
|
2
|
+
<div>
|
|
3
|
+
<div class="sticky top-16 z-20 sm:top-20 lg:hidden">
|
|
6
4
|
<NavigationMobileTop />
|
|
7
5
|
</div>
|
|
8
6
|
<slot />
|
|
9
|
-
</
|
|
7
|
+
</div>
|
|
10
8
|
</template>
|
package/app/pages/[...all].vue
CHANGED
|
@@ -50,12 +50,16 @@ if (page.value) {
|
|
|
50
50
|
</script>
|
|
51
51
|
|
|
52
52
|
<template>
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
<div
|
|
54
|
+
v-if="page"
|
|
55
|
+
class="mx-auto w-full max-w-3xl px-4 pt-8 pb-16 font-body text-sb-ink sm:px-6 sm:pt-12"
|
|
56
|
+
>
|
|
57
|
+
<ContentRenderer :value="page" class="content content-preset" />
|
|
58
|
+
</div>
|
|
59
|
+
|
|
56
60
|
<div v-else-if="categoryId">
|
|
57
61
|
<!-- the listing layout's category bar, without switching layouts -->
|
|
58
|
-
<div class="sticky top-16
|
|
62
|
+
<div class="sticky top-16 z-20 sm:top-20 lg:hidden">
|
|
59
63
|
<NavigationMobileTop />
|
|
60
64
|
</div>
|
|
61
65
|
<CategoryListing :id="categoryId" :key="categoryId" />
|