@shopbite-de/storefront 1.31.3 → 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 (185) hide show
  1. package/.github/workflows/ci.yaml +54 -0
  2. package/CLAUDE.md +23 -8
  3. package/app/app.vue +10 -6
  4. package/app/assets/css/main.css +100 -61
  5. package/app/components/AddToWishlist.vue +15 -25
  6. package/app/components/Address/Card.vue +6 -11
  7. package/app/components/Address/Detail.vue +23 -23
  8. package/app/components/Address/Fields.vue +175 -73
  9. package/app/components/Address/Form.vue +107 -106
  10. package/app/components/Cart/Bar.vue +6 -9
  11. package/app/components/Cart/Item.vue +48 -63
  12. package/app/components/Cart/QuickView.vue +38 -25
  13. package/app/components/Cart/Upsell.vue +24 -62
  14. package/app/components/Category/Breadcrumb.vue +29 -3
  15. package/app/components/Category/FilterGroup.vue +20 -41
  16. package/app/components/Category/Listing.vue +100 -130
  17. package/app/components/Category/SearchInput.vue +22 -19
  18. package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
  19. package/app/components/Checkout/LoginOrRegister.vue +28 -29
  20. package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
  21. package/app/components/Checkout/Summary.vue +90 -60
  22. package/app/components/Checkout/VoucherInput.vue +40 -27
  23. package/app/components/Contact/Form.vue +164 -192
  24. package/app/components/DemoBanner.vue +5 -5
  25. package/app/components/Footer/StoreStatus.vue +2 -2
  26. package/app/components/Footer.vue +125 -57
  27. package/app/components/Header.vue +283 -18
  28. package/app/components/Home/Categories.vue +116 -0
  29. package/app/components/Home/Facts.vue +71 -0
  30. package/app/components/Home/Faq.vue +34 -16
  31. package/app/components/Home/Hero.vue +172 -0
  32. package/app/components/Home/Highlights.vue +29 -37
  33. package/app/components/Home/Restaurant.vue +102 -0
  34. package/app/components/Menu/BonCard.vue +180 -0
  35. package/app/components/Menu/CartPanel.vue +24 -0
  36. package/app/components/Menu/CategoryIndex.vue +54 -0
  37. package/app/components/Menu/OrderMode.vue +20 -0
  38. package/app/components/Menu/SectionHeader.vue +38 -0
  39. package/app/components/Navigation/MobileTop.vue +23 -15
  40. package/app/components/Order/Confirmation.vue +119 -0
  41. package/app/components/Order/Detail.vue +80 -88
  42. package/app/components/Product/CardSkeleton.vue +8 -12
  43. package/app/components/Product/Configurator.vue +8 -16
  44. package/app/components/Product/CrossSelling.vue +75 -83
  45. package/app/components/Product/DeselectIngredient.vue +17 -22
  46. package/app/components/Product/Detail.vue +35 -27
  47. package/app/components/Product/QuickView.vue +80 -51
  48. package/app/components/SalesChannelSwitch.vue +14 -28
  49. package/app/components/Sb/Button.vue +70 -0
  50. package/app/components/Sb/Checkbox.vue +73 -0
  51. package/app/components/Sb/Chip.vue +51 -0
  52. package/app/components/Sb/ChoiceGroup.vue +82 -0
  53. package/app/components/Sb/ConfirmDialog.vue +60 -0
  54. package/app/components/Sb/Field.vue +77 -0
  55. package/app/components/Sb/Icon.vue +66 -0
  56. package/app/components/Sb/IconButton.vue +55 -0
  57. package/app/components/Sb/Input.vue +23 -0
  58. package/app/components/Sb/SegmentedControl.vue +34 -0
  59. package/app/components/Sb/Select.vue +49 -0
  60. package/app/components/Sb/Sheet.vue +83 -0
  61. package/app/components/Sb/Stars.vue +60 -0
  62. package/app/components/Sb/StatusPill.vue +38 -0
  63. package/app/components/Sb/Stepper.vue +72 -0
  64. package/app/components/User/AccountHeader.vue +16 -0
  65. package/app/components/User/AuthPanel.vue +41 -0
  66. package/app/components/User/Detail.vue +32 -29
  67. package/app/components/User/LoginForm.vue +92 -98
  68. package/app/components/User/RegistrationForm.vue +285 -249
  69. package/app/components/Wishlist.vue +55 -155
  70. package/app/composables/useCartMutations.ts +9 -27
  71. package/app/composables/useCheckoutMethodGuard.ts +2 -24
  72. package/app/composables/useContactForm.ts +66 -0
  73. package/app/composables/useHomeMenuCategories.ts +41 -0
  74. package/app/composables/useNavigation.ts +10 -2
  75. package/app/composables/useOrderMode.ts +65 -0
  76. package/app/composables/useRegistrationForm.ts +161 -0
  77. package/app/composables/useRestaurantSchema.ts +1 -1
  78. package/app/composables/useShareLink.ts +3 -13
  79. package/app/composables/useSortingSelection.ts +13 -0
  80. package/app/composables/useThemePreset.ts +15 -0
  81. package/app/composables/useVoucherCode.ts +7 -16
  82. package/app/composables/useWishlistActions.ts +0 -51
  83. package/app/error.vue +31 -9
  84. package/app/layouts/account.vue +45 -50
  85. package/app/layouts/default.vue +2 -3
  86. package/app/layouts/listing.vue +3 -5
  87. package/app/pages/[...all].vue +8 -4
  88. package/app/pages/account/recover/password/index.vue +113 -80
  89. package/app/pages/anmelden.vue +11 -10
  90. package/app/pages/bestellung/[id]/erfolg.vue +1 -15
  91. package/app/pages/bestellung/[id]/fehler.vue +63 -51
  92. package/app/pages/bestellung/[id]/index.vue +3 -85
  93. package/app/pages/bestellung/kasse.vue +29 -0
  94. package/app/pages/bestellung.vue +8 -60
  95. package/app/pages/index.vue +12 -52
  96. package/app/pages/kontakt.vue +27 -7
  97. package/app/pages/konto/adressen.vue +106 -102
  98. package/app/pages/konto/bestellung/[id].vue +9 -43
  99. package/app/pages/konto/bestellungen.vue +55 -33
  100. package/app/pages/konto/index.vue +47 -62
  101. package/app/pages/konto/profil.vue +162 -100
  102. package/app/pages/maintenance.vue +8 -6
  103. package/app/pages/merkliste.vue +7 -8
  104. package/app/pages/passwort-vergessen.vue +92 -75
  105. package/app/pages/registrierung/bestaetigen.vue +20 -48
  106. package/app/pages/registrierung/index.vue +16 -7
  107. package/app/pages/suche.vue +94 -95
  108. package/app/plugins/theme-preset.ts +9 -0
  109. package/app/utils/highlight.ts +25 -0
  110. package/app/utils/product.ts +9 -0
  111. package/app/validation/registrationSchema.ts +1 -1
  112. package/modules/theme.ts +115 -0
  113. package/nuxt.config.ts +27 -15
  114. package/package.json +6 -8
  115. package/playwright.config.ts +11 -0
  116. package/server/api/listing/[categoryId].get.ts +3 -0
  117. package/shared/theme/presets.ts +303 -0
  118. package/test/a11y/presets.test.ts +225 -0
  119. package/test/nuxt/AccountPagesPreset.test.ts +191 -0
  120. package/test/nuxt/AuthPagesPreset.test.ts +87 -0
  121. package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
  122. package/test/nuxt/CartItem.test.ts +18 -3
  123. package/test/nuxt/CartUpsell.test.ts +1 -2
  124. package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
  125. package/test/nuxt/CheckoutOnePage.test.ts +115 -0
  126. package/test/nuxt/CheckoutSummary.test.ts +6 -6
  127. package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
  128. package/test/nuxt/ContactFormPreset.test.ts +115 -0
  129. package/test/nuxt/FooterStoreStatus.test.ts +2 -2
  130. package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
  131. package/test/nuxt/HomeFaq.test.ts +3 -2
  132. package/test/nuxt/MenuBonCard.test.ts +122 -0
  133. package/test/nuxt/OrderPagesPreset.test.ts +132 -0
  134. package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
  135. package/test/nuxt/ProductCrossSelling.test.ts +2 -1
  136. package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
  137. package/test/nuxt/ProductSheetPreset.test.ts +105 -0
  138. package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
  139. package/test/nuxt/RegistrationForm.test.ts +89 -270
  140. package/test/nuxt/SbBaseComponents.test.ts +170 -0
  141. package/test/nuxt/SbStars.test.ts +25 -0
  142. package/test/nuxt/useCartMutations.test.ts +3 -17
  143. package/test/nuxt/useCartUpsell.test.ts +1 -1
  144. package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
  145. package/test/nuxt/useShareLink.test.ts +1 -9
  146. package/test/nuxt/useWishlistActions.test.ts +3 -26
  147. package/test/unit/highlight.spec.ts +31 -0
  148. package/test/unit/product.spec.ts +12 -0
  149. package/test/unit/themePresets.spec.ts +61 -0
  150. package/app/app.config.ts +0 -19
  151. package/app/components/AnimatedSection.vue +0 -74
  152. package/app/components/BottomNavi.vue +0 -70
  153. package/app/components/Category/Header.vue +0 -48
  154. package/app/components/Checkout/PaymentMethod.vue +0 -30
  155. package/app/components/Checkout/ShippingMethod.vue +0 -30
  156. package/app/components/Cta.vue +0 -30
  157. package/app/components/Feature/Card.vue +0 -121
  158. package/app/components/Features.vue +0 -42
  159. package/app/components/Footer/Contact.vue +0 -82
  160. package/app/components/Header/Body.vue +0 -82
  161. package/app/components/Header/Right.vue +0 -187
  162. package/app/components/Header/Title.vue +0 -10
  163. package/app/components/Hero.vue +0 -233
  164. package/app/components/Home/MenuCategories.vue +0 -148
  165. package/app/components/ImageGallery.vue +0 -63
  166. package/app/components/Loading.vue +0 -29
  167. package/app/components/Navigation/DesktopLeft.vue +0 -39
  168. package/app/components/Product/Card.vue +0 -177
  169. package/app/components/Product/CardCompact.vue +0 -72
  170. package/app/components/Product/CardDietBadges.vue +0 -43
  171. package/app/components/Product/CardIngredients.vue +0 -35
  172. package/app/components/Product/CardKitchen.vue +0 -34
  173. package/app/components/Product/SearchBar.vue +0 -95
  174. package/app/components/PublicAnnouncement.vue +0 -17
  175. package/app/pages/bestellung/bestaetigen.vue +0 -16
  176. package/app/pages/bestellung/warenkorb.vue +0 -49
  177. package/app/pages/bestellung/zahlung-versand.vue +0 -25
  178. package/test/nuxt/AddressFields.test.ts +0 -222
  179. package/test/nuxt/AnimatedSection.test.ts +0 -67
  180. package/test/nuxt/ContactForm.test.ts +0 -207
  181. package/test/nuxt/FooterContact.test.ts +0 -102
  182. package/test/nuxt/HeaderRight.test.ts +0 -142
  183. package/test/nuxt/Hero.test.ts +0 -126
  184. package/test/nuxt/HomeMenuCategories.test.ts +0 -94
  185. package/test/nuxt/LoginForm.test.ts +0 -159
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import { useUser } from "@shopware/composables";
3
- import type { FormSubmitEvent } from "@nuxt/ui";
4
3
  import * as z from "zod";
5
4
 
6
5
  definePageMeta({
@@ -15,16 +14,8 @@ const { apiClient } = useShopwareContext();
15
14
  const loading = ref(true);
16
15
  const { user, refreshUser, updatePersonalInfo, updateEmail, logout } =
17
16
  useUser();
18
- const toast = useToast();
19
17
  const open = ref(false);
20
18
 
21
- const schema = z.object({
22
- email: z.string().email("Keine gültige Emailadresse"),
23
- firstName: z.string().min(1),
24
- lastName: z.string().min(1),
25
- });
26
- type Schema = z.output<typeof schema>;
27
-
28
19
  function initializeFormState() {
29
20
  return reactive({
30
21
  email: user.value?.email,
@@ -52,117 +43,188 @@ async function handlePersonalInfoUpdate(firstName: string, lastName: string) {
52
43
  });
53
44
  }
54
45
 
55
- function showSuccessMessage(message: string) {
56
- toast.add({
57
- title: message,
58
- color: "success",
59
- });
60
- }
61
-
62
- function showErrorMessage(title: string, description: string) {
63
- toast.add({
64
- title,
65
- description,
66
- icon: "i-lucide-x",
67
- color: "error" as const,
46
+ onMounted(async () => {
47
+ await refreshUser();
48
+ Object.assign(state, {
49
+ email: user.value?.email,
50
+ firstName: user.value?.firstName,
51
+ lastName: user.value?.lastName,
68
52
  });
69
- }
53
+ loading.value = false;
54
+ });
70
55
 
71
- async function onSubmit(event: FormSubmitEvent<Schema>) {
56
+ // Validation, result and errors in the page (#445).
57
+ const schema = z.object({
58
+ firstName: z.string().min(1, "Bitte geben Sie Ihren Vornamen an."),
59
+ lastName: z.string().min(1, "Bitte geben Sie Ihren Nachnamen an."),
60
+ email: z.string().email("Bitte geben Sie eine gültige E-Mail-Adresse ein."),
61
+ });
62
+ type Schema = z.output<typeof schema>;
63
+ const errors = ref<Partial<Record<keyof Schema, string>>>({});
64
+ const saveResult = ref<"saved" | "failed" | null>(null);
65
+ const saving = ref(false);
66
+ const deleting = ref(false);
67
+ const deleteFailed = ref(false);
68
+ const resultBox = ref<HTMLElement | null>(null);
69
+ const form = ref<HTMLFormElement | null>(null);
70
+
71
+ async function onSubmit() {
72
+ saveResult.value = null;
73
+ const parsed = schema.safeParse(state);
74
+ if (!parsed.success) {
75
+ const next: typeof errors.value = {};
76
+ for (const issue of parsed.error.issues) {
77
+ const key = issue.path[0] as keyof Schema;
78
+ next[key] ??= issue.message;
79
+ }
80
+ errors.value = next;
81
+ await nextTick();
82
+ form.value?.querySelector<HTMLElement>('[aria-invalid="true"]')?.focus();
83
+ return;
84
+ }
85
+ errors.value = {};
86
+ saving.value = true;
72
87
  try {
73
- loading.value = true;
74
- const eventData = event.data;
75
-
76
- await handleEmailUpdate(eventData.email);
77
- await handlePersonalInfoUpdate(eventData.firstName, eventData.lastName);
88
+ await handleEmailUpdate(parsed.data.email);
89
+ await handlePersonalInfoUpdate(parsed.data.firstName, parsed.data.lastName);
78
90
  await refreshUser();
79
-
80
- showSuccessMessage("Erfolgreich gespeichert");
91
+ saveResult.value = "saved";
81
92
  } catch (error) {
82
93
  console.error("Profile update error:", error);
83
- showErrorMessage("Fehler!", "Bitte versuchen Sie es später erneut.");
94
+ saveResult.value = "failed";
84
95
  } finally {
85
- loading.value = false;
96
+ saving.value = false;
86
97
  }
98
+ await nextTick();
99
+ resultBox.value?.focus();
87
100
  }
88
101
 
89
- async function deleteCustomerAccount() {
90
- await apiClient.invoke("deleteCustomer delete /account/customer");
91
- toast.add({
92
- title: "Tschüss!",
93
- icon: "i-lucide-check",
94
- color: "success" as const,
95
- });
96
- await logout();
97
- navigateTo("/");
98
- }
99
-
100
- async function onDeleteProfile() {
102
+ async function onDelete() {
103
+ deleting.value = true;
104
+ deleteFailed.value = false;
101
105
  try {
102
- await deleteCustomerAccount();
106
+ await apiClient.invoke("deleteCustomer delete /account/customer");
107
+ await logout();
108
+ open.value = false;
109
+ navigateTo("/");
103
110
  } catch (error) {
104
111
  console.error("Customer delete error:", error);
105
- showErrorMessage("Fehler!", "Bitte versuchen Sie es später erneut.");
112
+ deleteFailed.value = true;
113
+ } finally {
114
+ deleting.value = false;
106
115
  }
107
116
  }
108
-
109
- onMounted(async () => {
110
- await refreshUser();
111
- loading.value = false;
112
- });
113
117
  </script>
114
118
 
115
119
  <template>
116
- <UContainer>
117
- <UPageHeader
118
- headline="KONTO"
119
- title="Mein Profil"
120
- description="Ändere hier deine prerönlichen Daten."
121
- />
122
- <UPageBody v-if="!loading">
123
- <UForm
124
- :schema="schema"
125
- :state="state"
126
- class="space-y-4"
127
- @submit="onSubmit"
128
- @error="(error) => console.log('Form validation error:', error)"
120
+ <div class="font-body text-sb-ink">
121
+ <UserAccountHeader title="Profil" />
122
+ <p v-if="loading" role="status" class="text-sb-ink-muted">
123
+ Profil wird geladen …
124
+ </p>
125
+ <template v-else>
126
+ <form
127
+ ref="form"
128
+ novalidate
129
+ class="flex max-w-xl flex-col gap-4 rounded-sb-card border border-sb-line bg-sb-surface p-6"
130
+ @submit.prevent="onSubmit"
129
131
  >
130
- <UFormField label="Vorname" name="firstName">
131
- <UInput v-model="state.firstName" type="text" class="w-full" />
132
- </UFormField>
133
- <UFormField label="Nachname" name="lastName">
134
- <UInput v-model="state.lastName" type="text" class="w-full" />
135
- </UFormField>
136
- <UFormField label="Emailadresse" name="email">
137
- <UInput v-model="state.email" type="email" class="w-full" />
138
- </UFormField>
139
- <div class="flex flex-row justify-between">
140
- <UButton label="Speichern" type="submit" />
141
- <UButton label="Konto löschen" color="error" @click="open = !open" />
132
+ <div
133
+ v-if="saveResult"
134
+ ref="resultBox"
135
+ :role="saveResult === 'saved' ? 'status' : 'alert'"
136
+ tabindex="-1"
137
+ :class="[
138
+ 'rounded-sb-control p-4 text-sm',
139
+ saveResult === 'saved'
140
+ ? 'bg-sb-primary-tint text-sb-primary-ink'
141
+ : 'border-[1.5px] border-sb-danger',
142
+ ]"
143
+ >
144
+ <template v-if="saveResult === 'saved'"
145
+ >Ihre Änderungen sind gespeichert.</template
146
+ >
147
+ <template v-else>
148
+ <strong class="block">Speichern fehlgeschlagen.</strong>
149
+ Bitte versuchen Sie es später noch einmal.
150
+ </template>
142
151
  </div>
143
- </UForm>
144
- <UModal
152
+ <SbField
153
+ v-slot="{ id, describedBy, invalid }"
154
+ label="Vorname"
155
+ :error="errors.firstName"
156
+ >
157
+ <SbInput
158
+ :id="id"
159
+ v-model="state.firstName"
160
+ name="firstName"
161
+ autocomplete="given-name"
162
+ :aria-describedby="describedBy"
163
+ :invalid="invalid"
164
+ />
165
+ </SbField>
166
+ <SbField
167
+ v-slot="{ id, describedBy, invalid }"
168
+ label="Nachname"
169
+ :error="errors.lastName"
170
+ >
171
+ <SbInput
172
+ :id="id"
173
+ v-model="state.lastName"
174
+ name="lastName"
175
+ autocomplete="family-name"
176
+ :aria-describedby="describedBy"
177
+ :invalid="invalid"
178
+ />
179
+ </SbField>
180
+ <SbField
181
+ v-slot="{ id, describedBy, invalid }"
182
+ label="E-Mail"
183
+ :error="errors.email"
184
+ >
185
+ <SbInput
186
+ :id="id"
187
+ v-model="state.email"
188
+ name="email"
189
+ type="email"
190
+ autocomplete="email"
191
+ :aria-describedby="describedBy"
192
+ :invalid="invalid"
193
+ />
194
+ </SbField>
195
+ <SbButton type="submit" size="lg" :loading="saving" class="self-start"
196
+ >Speichern</SbButton
197
+ >
198
+ </form>
199
+ <section
200
+ aria-labelledby="konto-loeschen"
201
+ class="mt-10 flex max-w-xl flex-col items-start gap-3 border-t border-sb-line pt-6"
202
+ >
203
+ <h2 id="konto-loeschen" class="font-display text-xl">
204
+ Kundenkonto löschen
205
+ </h2>
206
+ <p class="text-sb-ink-muted">
207
+ Löscht Ihr Kundenkonto mit Adressen und Merkliste. Bestellungen
208
+ bleiben für die gesetzliche Aufbewahrung gespeichert.
209
+ </p>
210
+ <SbButton variant="secondary" @click="open = true"
211
+ >Konto löschen</SbButton
212
+ >
213
+ </section>
214
+ <SbConfirmDialog
215
+ v-if="open"
145
216
  v-model:open="open"
146
- title="Konto löschen"
147
- description="Ihre Daten werden unwiederruflich gelöscht."
148
- :ui="{ footer: 'justify-end' }"
217
+ title="Kundenkonto löschen?"
218
+ description="Das lässt sich nicht rückgängig machen. Sie werden danach abgemeldet."
219
+ confirm-label="Endgültig löschen"
220
+ :loading="deleting"
221
+ @confirm="onDelete"
149
222
  >
150
- <template #body>
151
- <p>
152
- Löscht unwiederuflich ihr Kundenkonto zusammen mit Ihren Adressen,
153
- Merklisten und verknüpften Daten.
154
- </p>
155
- </template>
156
- <template #footer="{ close }">
157
- <UButton
158
- label="Abbrechen"
159
- color="neutral"
160
- variant="outline"
161
- @click="close"
162
- />
163
- <UButton label="Löschen" color="error" @click="onDeleteProfile" />
164
- </template>
165
- </UModal>
166
- </UPageBody>
167
- </UContainer>
223
+ <p v-if="deleteFailed" role="alert" class="text-sm font-semibold">
224
+ Das Konto konnte nicht gelöscht werden. Bitte versuchen Sie es später
225
+ noch einmal.
226
+ </p>
227
+ </SbConfirmDialog>
228
+ </template>
229
+ </div>
168
230
  </template>
@@ -5,12 +5,14 @@ useSeoMeta({
5
5
  </script>
6
6
 
7
7
  <template>
8
- <div class="min-h-screen flex items-center justify-center p-6 text-center">
9
- <div>
10
- <h1 class="text-3xl font-semibold mb-3">Wartungsmodus</h1>
11
- <p class="text-gray-600">
12
- Der Shop ist vorübergehend nicht verfügbar. Bitte versuchen Sie es
13
- später erneut.
8
+ <div
9
+ class="flex min-h-[60vh] items-center justify-center p-6 font-body text-sb-ink"
10
+ >
11
+ <div class="flex max-w-xl flex-col gap-3 text-center">
12
+ <h1 class="font-display text-4xl leading-tight">Gleich wieder da</h1>
13
+ <p class="text-lg text-sb-ink-muted">
14
+ Der Shop ist vorübergehend nicht erreichbar. Bitte versuchen Sie es in
15
+ ein paar Minuten noch einmal.
14
16
  </p>
15
17
  </div>
16
18
  </div>
@@ -5,13 +5,12 @@ useSeoMeta({
5
5
  </script>
6
6
 
7
7
  <template>
8
- <UContainer>
9
- <UPageSection
10
- title="Merkliste"
11
- description="Verwalte deine Lieblingsprodukte."
12
- icon="i-lucide-heart"
8
+ <div class="mx-auto w-full max-w-3xl px-4 pt-8 pb-16 sm:px-6 sm:pt-12">
9
+ <h1
10
+ class="mb-6 font-display text-4xl leading-tight text-sb-ink sm:text-5xl"
13
11
  >
14
- <Wishlist :show-menu-button="true" :use-grid-layout="true" />
15
- </UPageSection>
16
- </UContainer>
12
+ Merkliste
13
+ </h1>
14
+ <Wishlist :show-menu-button="true" />
15
+ </div>
17
16
  </template>
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import * as z from "zod";
3
- import type { FormSubmitEvent } from "@nuxt/ui";
4
3
 
5
4
  useHead({
6
5
  title: "Passwort vergessen",
@@ -10,95 +9,113 @@ useHead({
10
9
  ],
11
10
  });
12
11
 
13
- // Constants
14
- const SUCCESS_TOAST_CONFIG = {
15
- title: "Erfolgreich abgesendet!",
16
- description: "Bitte überprüfen Sie Ihre Postfach.",
17
- icon: "i-lucide-check",
18
- color: "success" as const,
19
- duration: 0,
20
- close: true,
21
- };
22
-
23
- const ERROR_TOAST_CONFIG = {
24
- title: "Fehler beim Senden",
25
- icon: "i-lucide-x",
26
- description: "Bitte versuchen Sie es später erneut.",
27
- color: "error" as const,
28
- };
29
-
30
12
  const { apiClient } = useShopwareContext();
31
- const toast = useToast();
32
13
 
33
14
  const schema = z.object({
34
15
  email: z.string().email("Ungültige E-Mail-Adresse"),
35
16
  });
36
17
 
37
- type Schema = z.output<typeof schema>;
38
-
39
- const fields = [
40
- {
41
- name: "email",
42
- type: "text" as const,
43
- label: "Email",
44
- placeholder: "Email-Adresse eingeben",
45
- required: true,
46
- },
47
- ];
48
-
49
- // Extract toast creation functions
50
- function showSuccessToast(): void {
51
- toast.add(SUCCESS_TOAST_CONFIG);
18
+ async function sendRecoveryMail(email: string) {
19
+ await apiClient.invoke("sendRecoveryMail post /account/recovery-password", {
20
+ body: {
21
+ email,
22
+ storefrontUrl: useRuntimeConfig().public.storeUrl,
23
+ },
24
+ });
52
25
  }
53
26
 
54
- function showErrorToast(): void {
55
- toast.add(ERROR_TOAST_CONFIG);
56
- }
27
+ // Errors and the result show in the form (#445).
28
+ const email = ref("");
29
+ const emailError = ref<string>();
30
+ const result = ref<"sent" | "failed" | null>(null);
31
+ const sending = ref(false);
32
+ const resultBox = ref<HTMLElement | null>(null);
57
33
 
58
- async function handlePasswordRecovery(payload: FormSubmitEvent<Schema>) {
34
+ async function onSubmit() {
35
+ result.value = null;
36
+ const parsed = schema.safeParse({ email: email.value });
37
+ if (!parsed.success) {
38
+ emailError.value = "Bitte geben Sie eine gültige E-Mail-Adresse ein.";
39
+ return;
40
+ }
41
+ emailError.value = undefined;
42
+ sending.value = true;
59
43
  try {
60
- await apiClient.invoke("sendRecoveryMail post /account/recovery-password", {
61
- body: {
62
- email: payload.data.email,
63
- storefrontUrl: useRuntimeConfig().public.storeUrl,
64
- },
65
- });
66
- showSuccessToast();
44
+ await sendRecoveryMail(parsed.data.email);
45
+ result.value = "sent";
67
46
  } catch (error) {
68
- showErrorToast();
69
47
  console.error("Password recovery error:", error);
48
+ result.value = "failed";
49
+ } finally {
50
+ sending.value = false;
70
51
  }
52
+ await nextTick();
53
+ resultBox.value?.focus();
71
54
  }
72
55
  </script>
73
56
  <template>
74
- <UContainer class="max-w-xl mx-auto mt-18">
75
- <UAuthForm
76
- :schema="schema"
77
- title="Password vergessen"
78
- icon="i-lucide-shield-user"
79
- :fields="fields"
80
- :submit="{
81
- label: 'Senden',
82
- }"
83
- @submit="handlePasswordRecovery"
57
+ <UserAuthPanel title="Passwort vergessen">
58
+ <template #intro>
59
+ <p>
60
+ Geben Sie die E-Mail-Adresse Ihres Kundenkontos ein. Gibt es dazu ein
61
+ Konto, bekommen Sie in den nächsten Minuten eine E-Mail mit einem Link
62
+ für ein neues Passwort.
63
+ </p>
64
+ </template>
65
+ <div
66
+ v-if="result === 'sent'"
67
+ ref="resultBox"
68
+ role="status"
69
+ tabindex="-1"
70
+ class="flex flex-col gap-2"
71
+ >
72
+ <strong>E-Mail ist unterwegs</strong>
73
+ <p>
74
+ Bitte schauen Sie in Ihr Postfach, auch in den Spam-Ordner. Der Link ist
75
+ nur begrenzt gültig.
76
+ </p>
77
+ </div>
78
+ <form
79
+ v-else
80
+ novalidate
81
+ class="flex flex-col gap-4"
82
+ @submit.prevent="onSubmit"
84
83
  >
85
- <template #description>
86
- <p>
87
- Geben Sie Ihre E-Mail-Adresse ein um Ihr Passwort zurück zusetzten.
88
- </p>
89
- <p>
90
- Wenn Sie bei uns ein Kundenkonto mit dieser Adresse angelegt haben
91
- bekommen Sie in den nächsten Minuten eine E-Mail zugesendet mit
92
- weiteren Anweisungen.
93
- </p>
94
- </template>
95
- <template #footer>
96
- Beim absenden stimmst du unseren
97
- <ULink to="datenschutz" class="text-primary font-medium"
98
- >Datenschutzbestimmungen</ULink
99
- >
100
- zu.
101
- </template>
102
- </UAuthForm>
103
- </UContainer>
84
+ <div
85
+ v-if="result === 'failed'"
86
+ ref="resultBox"
87
+ role="alert"
88
+ tabindex="-1"
89
+ class="rounded-sb-control border-[1.5px] border-sb-danger p-4 text-sm"
90
+ >
91
+ <strong class="block">Die E-Mail konnte nicht gesendet werden.</strong>
92
+ Bitte versuchen Sie es später noch einmal.
93
+ </div>
94
+ <SbField
95
+ v-slot="{ id, describedBy, invalid }"
96
+ label="E-Mail"
97
+ :error="emailError"
98
+ >
99
+ <SbInput
100
+ :id="id"
101
+ v-model="email"
102
+ name="email"
103
+ type="email"
104
+ autocomplete="email"
105
+ :aria-describedby="describedBy"
106
+ :invalid="invalid"
107
+ />
108
+ </SbField>
109
+ <SbButton type="submit" size="lg" block :loading="sending"
110
+ >Link senden</SbButton
111
+ >
112
+ </form>
113
+ <template #footer>
114
+ <NuxtLink
115
+ to="/anmelden"
116
+ class="font-semibold text-sb-primary-ink underline underline-offset-4"
117
+ >Zurück zur Anmeldung</NuxtLink
118
+ >
119
+ </template>
120
+ </UserAuthPanel>
104
121
  </template>
@@ -6,7 +6,6 @@ useSeoMeta({
6
6
  });
7
7
 
8
8
  const route = useRoute();
9
- const toast = useToast();
10
9
 
11
10
  const { apiClient } = useShopwareContext();
12
11
  const { refreshSessionContext } = useSessionContext();
@@ -17,19 +16,15 @@ type ConfirmError = "invalid" | "already-confirmed";
17
16
 
18
17
  const error = ref<ConfirmError | null>(null);
19
18
 
20
- const errorMessages: Record<
21
- ConfirmError,
22
- { title: string; description: string }
23
- > = {
19
+ const messages: Record<ConfirmError, { title: string; description: string }> = {
24
20
  invalid: {
25
21
  title: "Bestätigung fehlgeschlagen",
26
22
  description:
27
- "Der Bestätigungslink ist ungültig oder unvollständig. Bitte öffne den Link aus der Bestätigungs-E-Mail erneut oder kontaktiere uns.",
23
+ "Der Bestätigungslink ist ungültig oder unvollständig. Bitte öffnen Sie den Link aus der E-Mail noch einmal oder schreiben Sie uns.",
28
24
  },
29
25
  "already-confirmed": {
30
26
  title: "Konto bereits bestätigt",
31
- description:
32
- "Dein Konto ist schon bestätigt. Du kannst dich jetzt anmelden.",
27
+ description: "Ihr Konto ist schon bestätigt. Sie können sich anmelden.",
33
28
  },
34
29
  };
35
30
 
@@ -67,11 +62,6 @@ async function confirmRegistration() {
67
62
  await refreshSessionContext();
68
63
  refreshCart();
69
64
  mergeWishlistProducts();
70
- toast.add({
71
- title: "Bestätigung erfolgreich!",
72
- description: "Willkommen, dein Konto ist jetzt aktiv.",
73
- color: "success",
74
- });
75
65
  await navigateTo({ path: "/konto" });
76
66
  }
77
67
 
@@ -81,41 +71,23 @@ confirmRegistration();
81
71
  </script>
82
72
 
83
73
  <template>
84
- <UContainer>
85
- <div class="max-w-xl mx-auto mt-16">
86
- <div
87
- v-if="!error"
88
- class="flex items-center justify-center gap-2 text-muted"
89
- role="status"
90
- >
91
- <UIcon name="i-lucide-loader-circle" class="size-5 animate-spin" />
92
- Registrierung wird bestätigt …
74
+ <UserAuthPanel title="Registrierung bestätigen">
75
+ <p v-if="!error" role="status">Registrierung wird bestätigt …</p>
76
+ <div
77
+ v-else
78
+ :role="error === 'invalid' ? 'alert' : 'status'"
79
+ class="flex flex-col items-start gap-4"
80
+ >
81
+ <p>
82
+ <strong class="block">{{ messages[error].title }}</strong>
83
+ {{ messages[error].description }}
84
+ </p>
85
+ <div class="flex flex-wrap gap-3">
86
+ <SbButton to="/anmelden">Zur Anmeldung</SbButton>
87
+ <SbButton v-if="error === 'invalid'" variant="secondary" to="/kontakt"
88
+ >Kontakt</SbButton
89
+ >
93
90
  </div>
94
- <UAlert
95
- v-else
96
- :color="error === 'already-confirmed' ? 'info' : 'error'"
97
- variant="subtle"
98
- :icon="
99
- error === 'already-confirmed'
100
- ? 'i-lucide-circle-check'
101
- : 'i-lucide-circle-alert'
102
- "
103
- :title="errorMessages[error].title"
104
- :description="errorMessages[error].description"
105
- :actions="[
106
- { label: 'Zur Anmeldung', to: '/anmelden', color: 'neutral' },
107
- ...(error === 'invalid'
108
- ? [
109
- {
110
- label: 'Kontakt',
111
- to: '/kontakt',
112
- color: 'neutral' as const,
113
- variant: 'outline' as const,
114
- },
115
- ]
116
- : []),
117
- ]"
118
- />
119
91
  </div>
120
- </UContainer>
92
+ </UserAuthPanel>
121
93
  </template>
@@ -33,15 +33,24 @@ function onRegistrationSuccess(
33
33
  </script>
34
34
 
35
35
  <template>
36
- <UPageSection
37
- class="max-w-2xl mx-auto"
38
- headline="KONTO"
39
- title="Registrieren"
40
- description="Erstelle dein Kundenkonto."
41
- >
36
+ <UserAuthPanel title="Registrieren" wide>
37
+ <template #intro>
38
+ <p>
39
+ Mit einem Kundenkonto bestellen Sie schneller, Ihre Adressen sind
40
+ gespeichert.
41
+ </p>
42
+ </template>
42
43
  <UserRegistrationForm
43
44
  :allow-guest="false"
44
45
  @registration-success="onRegistrationSuccess"
45
46
  />
46
- </UPageSection>
47
+ <template #footer>
48
+ Schon registriert?
49
+ <NuxtLink
50
+ to="/anmelden"
51
+ class="font-semibold text-sb-primary-ink underline underline-offset-4"
52
+ >Anmelden</NuxtLink
53
+ >
54
+ </template>
55
+ </UserAuthPanel>
47
56
  </template>