@revenexx/cover 0.21.2 → 0.22.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/app/api/categories.ts +1 -0
- package/app/api/offers.ts +1 -0
- package/app/app.config.ts +18 -0
- package/app/components/OgImage/CoverPage.takumi.vue +37 -0
- package/app/components/RevenexxForm.vue +21 -6
- package/app/components/account/approvals/AccountPendingApprovals.vue +19 -1
- package/app/components/account/approvals/AccountPendingOrderDetail.vue +3 -0
- package/app/components/account/carts/AccountCartsTable.vue +11 -1
- package/app/components/account/orderlists/AccountOrderListDetail.vue +32 -3
- package/app/components/account/organization/AccountOrganization.vue +1 -1
- package/app/components/auth/AuthForgotPasswordPanel.vue +7 -2
- package/app/components/auth/AuthLoginPanel.vue +23 -8
- package/app/components/auth/AuthRegisterTeaser.vue +1 -1
- package/app/components/cart/position/CartPosition.vue +11 -4
- package/app/components/cart/quickadd/CartQuickAdd.vue +4 -2
- package/app/components/cart/recommend/CartRecommendCard.vue +1 -0
- package/app/components/cart/switcher/CartSwitcher.vue +1 -0
- package/app/components/cart/view/CartListHeader.vue +5 -0
- package/app/components/cart/view/CartSummaryPanel.vue +7 -2
- package/app/components/cart/view/CartView.vue +4 -2
- package/app/components/checkout/onepage/CheckoutDeliverySection.vue +3 -0
- package/app/components/checkout/onepage/CheckoutGate.vue +4 -2
- package/app/components/checkout/onepage/CheckoutGuestDetailsSection.vue +2 -1
- package/app/components/checkout/onepage/CheckoutPaymentSection.vue +1 -1
- package/app/components/layout/header/LocaleSwitcher.vue +7 -9
- package/app/components/product/detail/ProductDetailAddToCart.vue +17 -11
- package/app/components/product/detail/ProductDetailImageGallery.vue +101 -8
- package/app/components/product/detail/ProductDetailVariantRow.vue +84 -4
- package/app/components/product/detail/ProductDetailVariants.vue +75 -11
- package/app/components/product/detail/ProductDetailView.vue +64 -69
- package/app/components/ui/forms/FormKitDatePicker.vue +8 -2
- package/app/composables/useAuthStore.ts +21 -4
- package/app/composables/useCategories.ts +24 -0
- package/app/composables/useCategoryAnswer.ts +30 -0
- package/app/composables/useCategorySeo.ts +62 -0
- package/app/composables/useCheckoutOnePage.ts +15 -4
- package/app/composables/useDefaultUiLanguage.ts +14 -0
- package/app/composables/useOgImageReady.ts +16 -0
- package/app/composables/useProductAnswer.ts +121 -0
- package/app/composables/useProductLocales.ts +21 -10
- package/app/composables/useProductSeo.ts +145 -0
- package/app/composables/useRouteSubject.ts +23 -3
- package/app/composables/useSeoContext.ts +164 -0
- package/app/composables/useSeoHead.ts +189 -0
- package/app/composables/useSeoRules.ts +23 -0
- package/app/formkit.config.ts +1 -1
- package/app/interfaces/seo.ts +48 -0
- package/app/layouts/default.vue +2 -8
- package/app/layouts/focus.vue +3 -1
- package/app/payments/psp/novalnet.ts +25 -3
- package/app/payments/psp/novalnetStyle.ts +186 -0
- package/app/shared/categoryTree.ts +7 -0
- package/app/shared/locale.ts +8 -0
- package/app/shared/productLocales.ts +62 -1
- package/app/shared/requestedDate.ts +49 -0
- package/app/shared/seoRules.ts +297 -0
- package/app/shared/structuredData.ts +104 -0
- package/i18n/locales/de/account.json +4 -0
- package/i18n/locales/de/checkout.json +1 -0
- package/i18n/locales/de/common.json +6 -0
- package/i18n/locales/de/pages.json +109 -0
- package/i18n/locales/en/account.json +4 -0
- package/i18n/locales/en/checkout.json +1 -0
- package/i18n/locales/en/common.json +6 -0
- package/i18n/locales/en/pages.json +109 -0
- package/nuxt.config.ts +140 -1
- package/package.json +10 -3
- package/server/api/auth/otp.post.ts +4 -8
- package/server/api/auth/otp.put.ts +20 -11
- package/server/api/categories/[slug]/exists.get.ts +28 -0
- package/server/api/offers/guest.get.ts +53 -0
- package/server/api/orders/index.post.ts +18 -12
- package/server/api/payment/methods.post.ts +2 -33
- package/server/api/product/[id]/locales.get.ts +9 -3
- package/server/data/product-detail.json +0 -20
- package/server/dev/errorHandler.ts +9 -5
- package/server/dev/typesense/autoSeed.ts +63 -0
- package/server/dev/typesense/seed.ts +4 -43
- package/server/dev/typesense/seedProducts.ts +87 -0
- package/server/interfaces/category.ts +5 -0
- package/server/interfaces/product.ts +13 -6
- package/server/middleware/missing-media.ts +2 -2
- package/server/plugins/previewHostNoindex.ts +21 -0
- package/server/plugins/seoSiteConfig.ts +62 -0
- package/server/routes/robots.txt.ts +21 -0
- package/server/services/ApiCategoryService.ts +6 -0
- package/server/services/ApiProductService.ts +2 -2
- package/server/services/LocalFileCategoryService.ts +6 -0
- package/server/utils/liveCatalog.ts +83 -18
- package/server/utils/livePrices.ts +12 -3
- package/server/utils/locale.ts +3 -8
- package/server/utils/offerService.ts +8 -3
- package/server/utils/paymentOptions.ts +49 -0
- package/server/utils/promotionsService.ts +25 -0
- package/server/utils/revenexxSdk.ts +7 -1
- package/server/utils/seoRequestHost.ts +21 -0
- package/server/utils/storefrontMessages.ts +5 -5
- package/server/utils/storefrontSeoRules.ts +298 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pages": {
|
|
3
|
+
"search": {
|
|
4
|
+
"title": "Search"
|
|
5
|
+
},
|
|
6
|
+
"cart": {
|
|
7
|
+
"title": "@:cart.page.title"
|
|
8
|
+
},
|
|
9
|
+
"checkout": {
|
|
10
|
+
"title": "@:onepage.title"
|
|
11
|
+
},
|
|
12
|
+
"checkout-confirmation": {
|
|
13
|
+
"title": "@:cart.page.steps.success"
|
|
14
|
+
},
|
|
15
|
+
"login": {
|
|
16
|
+
"title": "@:auth.login.submit"
|
|
17
|
+
},
|
|
18
|
+
"login-link": {
|
|
19
|
+
"title": "@:auth.magicLink.title"
|
|
20
|
+
},
|
|
21
|
+
"callback": {
|
|
22
|
+
"title": "@:forms.callback.title"
|
|
23
|
+
},
|
|
24
|
+
"register": {
|
|
25
|
+
"title": "@:auth.register.title"
|
|
26
|
+
},
|
|
27
|
+
"forgot-password": {
|
|
28
|
+
"title": "@:auth.forgotPassword.title"
|
|
29
|
+
},
|
|
30
|
+
"reset-password": {
|
|
31
|
+
"title": "@:auth.resetPassword.title"
|
|
32
|
+
},
|
|
33
|
+
"contact": {
|
|
34
|
+
"title": "@:forms.contact.title"
|
|
35
|
+
},
|
|
36
|
+
"price-request": {
|
|
37
|
+
"title": "@:forms.priceRequest.title"
|
|
38
|
+
},
|
|
39
|
+
"account": {
|
|
40
|
+
"title": "@:header.account"
|
|
41
|
+
},
|
|
42
|
+
"account-section": {
|
|
43
|
+
"title": "@:header.account"
|
|
44
|
+
},
|
|
45
|
+
"account-addresses": {
|
|
46
|
+
"title": "@:addresses.title"
|
|
47
|
+
},
|
|
48
|
+
"account-approvals": {
|
|
49
|
+
"title": "@:governance.approvals.title"
|
|
50
|
+
},
|
|
51
|
+
"account-approvals-orders-number": {
|
|
52
|
+
"title": "@:governance.approvals.title"
|
|
53
|
+
},
|
|
54
|
+
"account-carts": {
|
|
55
|
+
"title": "@:cart.multi.page.title"
|
|
56
|
+
},
|
|
57
|
+
"account-cost-centers": {
|
|
58
|
+
"title": "@:governance.costCenters.title"
|
|
59
|
+
},
|
|
60
|
+
"account-cost-centers-id": {
|
|
61
|
+
"title": "@:governance.costCenters.title"
|
|
62
|
+
},
|
|
63
|
+
"account-direct-order": {
|
|
64
|
+
"title": "@:directOrder.title"
|
|
65
|
+
},
|
|
66
|
+
"account-order-lists": {
|
|
67
|
+
"title": "@:orderLists.title"
|
|
68
|
+
},
|
|
69
|
+
"account-order-lists-id": {
|
|
70
|
+
"title": "@:orderLists.title"
|
|
71
|
+
},
|
|
72
|
+
"account-orders": {
|
|
73
|
+
"title": "@:orders.title"
|
|
74
|
+
},
|
|
75
|
+
"account-orders-id": {
|
|
76
|
+
"title": "@:orders.title"
|
|
77
|
+
},
|
|
78
|
+
"account-organization": {
|
|
79
|
+
"title": "@:organization.title"
|
|
80
|
+
},
|
|
81
|
+
"account-preferences": {
|
|
82
|
+
"title": "@:preferences.title"
|
|
83
|
+
},
|
|
84
|
+
"account-profile": {
|
|
85
|
+
"title": "@:profile.title"
|
|
86
|
+
},
|
|
87
|
+
"account-quotes": {
|
|
88
|
+
"title": "@:quotes.title"
|
|
89
|
+
},
|
|
90
|
+
"account-quotes-id": {
|
|
91
|
+
"title": "@:quotes.title"
|
|
92
|
+
},
|
|
93
|
+
"account-requisitions": {
|
|
94
|
+
"title": "@:governance.requisitions.title"
|
|
95
|
+
},
|
|
96
|
+
"account-requisitions-id": {
|
|
97
|
+
"title": "@:governance.requisitions.title"
|
|
98
|
+
},
|
|
99
|
+
"account-team": {
|
|
100
|
+
"title": "@:team.title"
|
|
101
|
+
},
|
|
102
|
+
"account-workflows": {
|
|
103
|
+
"title": "@:governance.workflows.title"
|
|
104
|
+
},
|
|
105
|
+
"account-workflows-id": {
|
|
106
|
+
"title": "@:governance.workflows.title"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
package/nuxt.config.ts
CHANGED
|
@@ -21,6 +21,76 @@ function layerLocaleFiles(code: string): string[] {
|
|
|
21
21
|
.map(f => `${code}/${f}`);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* The paths of the seo rules' fixed page types (PE-1235), with their robots
|
|
26
|
+
* rule as defaultSeoRules() in app/shared/seoRules.ts states it. They are the
|
|
27
|
+
* same for every tenant — the service does not let them change — so
|
|
28
|
+
* build-time route rules cover them on every page, whether it calls
|
|
29
|
+
* useSeoContext() or not.
|
|
30
|
+
*/
|
|
31
|
+
const FIXED_PAGE_ROBOTS: Readonly<Record<string, string>> = {
|
|
32
|
+
"cart": "noindex, nofollow",
|
|
33
|
+
"checkout": "noindex, nofollow",
|
|
34
|
+
"checkout/**": "noindex, nofollow",
|
|
35
|
+
"login": "noindex, nofollow",
|
|
36
|
+
"login/**": "noindex, nofollow",
|
|
37
|
+
"register": "noindex, nofollow",
|
|
38
|
+
"forgot-password": "noindex, nofollow",
|
|
39
|
+
"reset-password": "noindex, nofollow",
|
|
40
|
+
"account": "noindex, nofollow",
|
|
41
|
+
"account/**": "noindex, nofollow",
|
|
42
|
+
"search": "noindex, follow",
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Route rules for the fixed page types, unprefixed and under each of the
|
|
47
|
+
* app's locale codes — not under `/*`, which would also match the first
|
|
48
|
+
* segment of any other path (`/category/account`). Covers both prefix
|
|
49
|
+
* strategies: `prefix` (demo shop) and `prefix_except_default` (themes).
|
|
50
|
+
*/
|
|
51
|
+
function addFixedPageRobots(): void {
|
|
52
|
+
const nuxt = useNuxt();
|
|
53
|
+
const i18n = (nuxt.options as { i18n?: { locales?: (string | { code: string })[] } }).i18n;
|
|
54
|
+
const codes = new Set((i18n?.locales ?? []).map(locale => (typeof locale === "string" ? locale : locale.code)));
|
|
55
|
+
for (const [path, robots] of Object.entries(FIXED_PAGE_ROBOTS)) {
|
|
56
|
+
for (const prefix of ["", ...[...codes].map(code => `/${code}`)]) {
|
|
57
|
+
const route = `${prefix}/${path}`;
|
|
58
|
+
nuxt.options.routeRules[route] = { ...nuxt.options.routeRules[route], robots };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* SEO settings a theme must not turn around (PE-1235).
|
|
65
|
+
*
|
|
66
|
+
* A theme's nuxt.config wins over this layer's, so a theme could switch
|
|
67
|
+
* robots.txt or the robots module off, or add a sitemap module — and then
|
|
68
|
+
* answer for files the seo service owns, drop meta robots, or lower-case
|
|
69
|
+
* the canonical of a product whose id holds capitals. Checked once every
|
|
70
|
+
* module is installed, by the names the modules give themselves, so a
|
|
71
|
+
* module listed as a tuple, imported as an object or brought in by
|
|
72
|
+
* another (@nuxtjs/seo brings the sitemap) is caught as well; a build
|
|
73
|
+
* that contradicts the platform fails here. Called from `modules:done`.
|
|
74
|
+
*/
|
|
75
|
+
function assertSeoConfiguration(): void {
|
|
76
|
+
const nuxt = useNuxt();
|
|
77
|
+
const options = nuxt.options as typeof nuxt.options & {
|
|
78
|
+
robots?: { enabled?: boolean; robotsTxt?: boolean };
|
|
79
|
+
seo?: { canonicalLowercase?: boolean };
|
|
80
|
+
};
|
|
81
|
+
const installed = new Set(options._installedModules.map(entry => entry.meta?.name).filter(Boolean));
|
|
82
|
+
const forbidden = ["@nuxtjs/sitemap", "@nuxtjs/seo"].filter(name => installed.has(name));
|
|
83
|
+
const contradictions = [
|
|
84
|
+
options.robots?.enabled === false && "robots.enabled must not be false: pages take meta robots from the seo rules",
|
|
85
|
+
options.robots?.robotsTxt !== false && "robots.robotsTxt must stay false: the seo service serves robots.txt",
|
|
86
|
+
options.seo?.canonicalLowercase !== false && "seo.canonicalLowercase must stay false: product ids may hold capitals",
|
|
87
|
+
...forbidden.map(name => `${name} must not be installed: the seo service serves the sitemaps`),
|
|
88
|
+
].filter((message): message is string => Boolean(message));
|
|
89
|
+
if (contradictions.length > 0) {
|
|
90
|
+
throw new Error(`@revenexx/cover SEO configuration:\n- ${contradictions.join("\n- ")}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
24
94
|
/**
|
|
25
95
|
* Cover design system — Nuxt layer.
|
|
26
96
|
*
|
|
@@ -68,13 +138,66 @@ export default defineNuxtConfig({
|
|
|
68
138
|
// the tag manager reads at runtime (it never imports it). Without tenant
|
|
69
139
|
// credentials both fail closed — no banner, no tag — so a consumer that is
|
|
70
140
|
// not a deployed Site (the docs website) renders exactly as before.
|
|
141
|
+
//
|
|
142
|
+
// SEO (PE-1235): Nuxt SEO's modules one by one, set per request from the
|
|
143
|
+
// domain's seo rules (server/plugins/seoSiteConfig.ts). Not @nuxtjs/seo,
|
|
144
|
+
// which would bring the sitemap too: robots.txt, sitemaps and llms.txt come
|
|
145
|
+
// from the seo service through the edge (ADR-0116), so no theme serves them.
|
|
146
|
+
// The result of the spike behind this is docs/concepts/spike-nuxt-seo.md.
|
|
147
|
+
// nuxt-og-image (PE-1237) renders the link preview card of a page without a
|
|
148
|
+
// picture of its own, with Takumi (app/components/OgImage/). nuxt-schema-org
|
|
149
|
+
// (PE-1103) writes the JSON-LD: a WebSite and WebPage on every page, the
|
|
150
|
+
// Organization from the rules (useSeoHead), Product and BreadcrumbList from
|
|
151
|
+
// the product and category pages.
|
|
71
152
|
modules: [
|
|
72
153
|
"@formkit/nuxt",
|
|
73
154
|
"@nuxt/scripts",
|
|
74
155
|
"@revenexx/consent-manager-nuxt",
|
|
75
156
|
"@revenexx/tag-manager-nuxt",
|
|
157
|
+
"nuxt-site-config",
|
|
158
|
+
"nuxt-seo-utils",
|
|
159
|
+
"nuxt-schema-org",
|
|
160
|
+
"@nuxtjs/robots",
|
|
161
|
+
"nuxt-og-image",
|
|
76
162
|
],
|
|
77
163
|
|
|
164
|
+
// Broken links while developing; a production build has no use for it.
|
|
165
|
+
$development: {
|
|
166
|
+
modules: ["nuxt-link-checker"],
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
robots: {
|
|
170
|
+
// The seo service serves robots.txt through the edge. The module keeps
|
|
171
|
+
// meta robots and X-Robots-Tag per page.
|
|
172
|
+
robotsTxt: false,
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
ogImage: {
|
|
176
|
+
defaults: {
|
|
177
|
+
// The size Facebook, LinkedIn and X crop to; the module's own is 1200×600.
|
|
178
|
+
height: 630,
|
|
179
|
+
// A card shows a type and a site name, which change rarely, and any
|
|
180
|
+
// change makes a new URL; the rendered PNG is kept per Site instance.
|
|
181
|
+
cacheMaxAgeSeconds: 60 * 60 * 24,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
seo: {
|
|
186
|
+
// A product id may hold capitals, and the edge only lowercases a path
|
|
187
|
+
// when the domain's rules say so (G3).
|
|
188
|
+
canonicalLowercase: false,
|
|
189
|
+
// Only the fallback; the page's canonical follows the domain's rules
|
|
190
|
+
// (seoCanonicalUrl): `page` from 2, unless the rules strip it.
|
|
191
|
+
canonicalQueryWhitelist: ["page"],
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
// nuxt-seo-utils adds Unhead's Vite plugin, which rewrites every
|
|
195
|
+
// useSeoMeta() into useHead() at build time — and the component tests'
|
|
196
|
+
// useSeoMeta mocks would no longer see the calls. Builds keep it; it changes
|
|
197
|
+
// how the head is written, not what is in it. (The module's own
|
|
198
|
+
// `treeShakeUseSeoMeta: false` loses to Nuxt's default for this option.)
|
|
199
|
+
unhead: process.env.VITEST ? { vite: false } : {},
|
|
200
|
+
|
|
78
201
|
formkit: {
|
|
79
202
|
// autoImport's build-time transform produces conflicting sourcemaps in
|
|
80
203
|
// production builds (rollup "Multiple conflicting contents") — use the
|
|
@@ -119,6 +242,9 @@ export default defineNuxtConfig({
|
|
|
119
242
|
typesensePort: 8108,
|
|
120
243
|
typesenseProtocol: "http",
|
|
121
244
|
typesenseApiKey: "xyz",
|
|
245
|
+
// Dev server only: seed the local index on startup when the products
|
|
246
|
+
// collection is missing (server/dev/typesense/autoSeed.ts).
|
|
247
|
+
typesenseAutoSeed: true,
|
|
122
248
|
// HMAC secret for the stateless checkout session tokens — override
|
|
123
249
|
// via NUXT_CHECKOUT_SESSION_SECRET in multi-tenant deployments.
|
|
124
250
|
checkoutSessionSecret: "",
|
|
@@ -185,8 +311,14 @@ export default defineNuxtConfig({
|
|
|
185
311
|
},
|
|
186
312
|
|
|
187
313
|
hooks: {
|
|
314
|
+
/** Before any module reads the route rules (@nuxtjs/robots among them). */
|
|
315
|
+
"modules:before": () => {
|
|
316
|
+
addFixedPageRobots();
|
|
317
|
+
},
|
|
318
|
+
|
|
188
319
|
/**
|
|
189
|
-
* Local Typesense maintenance (seed/drop/health
|
|
320
|
+
* Local Typesense maintenance (seed/drop/health routes and the startup
|
|
321
|
+
* auto-seed), dev server only.
|
|
190
322
|
*
|
|
191
323
|
* They act on the local demo index without any auth, so they must not
|
|
192
324
|
* exist in a build: they live outside server/api and are only
|
|
@@ -208,6 +340,11 @@ export default defineNuxtConfig({
|
|
|
208
340
|
handler: resolve(currentDir, `server/dev/typesense/${name}.ts`),
|
|
209
341
|
})),
|
|
210
342
|
];
|
|
343
|
+
// An empty local index means a demo shop without products.
|
|
344
|
+
nitroConfig.plugins = [
|
|
345
|
+
...(nitroConfig.plugins ?? []),
|
|
346
|
+
resolve(currentDir, "server/dev/typesense/autoSeed.ts"),
|
|
347
|
+
];
|
|
211
348
|
},
|
|
212
349
|
|
|
213
350
|
/**
|
|
@@ -236,6 +373,8 @@ export default defineNuxtConfig({
|
|
|
236
373
|
localeStrategy: i18n?.strategy ?? "no_prefix",
|
|
237
374
|
defaultLocale: i18n?.defaultLocale ?? "",
|
|
238
375
|
};
|
|
376
|
+
|
|
377
|
+
assertSeoConfiguration();
|
|
239
378
|
},
|
|
240
379
|
},
|
|
241
380
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revenexx/cover",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "Cover — revenexx design system for Nuxt. Distributed as a Nuxt layer: generic UI components, theming tokens and stores shared by the demo shop, custom storefronts and the Blokkli theme.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
@@ -43,11 +43,18 @@
|
|
|
43
43
|
"@iconify-json/lucide": "^1.2.111",
|
|
44
44
|
"@internationalized/date": "^3.12.0",
|
|
45
45
|
"@nuxt/scripts": "^1.3.0",
|
|
46
|
+
"@nuxtjs/robots": "7.0.2",
|
|
46
47
|
"@revenexx/consent-manager-nuxt": "^0.1.0",
|
|
47
48
|
"@revenexx/sdk": "^0.5.0",
|
|
48
49
|
"@revenexx/storage-model-viewer": "^0.3.0",
|
|
49
50
|
"@revenexx/tag-manager-nuxt": "^0.1.0",
|
|
51
|
+
"@takumi-rs/core": "2.19.0",
|
|
50
52
|
"@vueuse/core": "^14.3.0",
|
|
53
|
+
"nuxt-link-checker": "6.0.1",
|
|
54
|
+
"nuxt-og-image": "7.0.7",
|
|
55
|
+
"nuxt-schema-org": "7.0.1",
|
|
56
|
+
"nuxt-seo-utils": "9.0.1",
|
|
57
|
+
"nuxt-site-config": "5.0.3",
|
|
51
58
|
"typesense": "^3.0.5"
|
|
52
59
|
},
|
|
53
60
|
"peerDependencies": {
|
|
@@ -57,8 +64,8 @@
|
|
|
57
64
|
"vue-i18n": "^11.0.0 || ^10.0.0"
|
|
58
65
|
},
|
|
59
66
|
"devDependencies": {
|
|
60
|
-
"@nuxt/kit": "^4.
|
|
61
|
-
"nuxt": "^4.
|
|
67
|
+
"@nuxt/kit": "^4.6.3",
|
|
68
|
+
"nuxt": "^4.6.3"
|
|
62
69
|
},
|
|
63
70
|
"publishConfig": {
|
|
64
71
|
"registry": "https://registry.npmjs.org",
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Ask for a sign-in code.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* An address nobody holds gets the same answer with no id, so the form looks
|
|
9
|
-
* identical either way: a code typed without one fails at the confirm step with
|
|
10
|
-
* the same message a wrong code gets. Answering differently would turn this into
|
|
11
|
-
* a way of asking who has an account.
|
|
4
|
+
* The code is confirmed with the same address (`PUT /api/auth/otp`). Since
|
|
5
|
+
* customers 5.0 the answer carries no user id, for any address, so it cannot be
|
|
6
|
+
* used to ask who has an account; an older customers app still answers one,
|
|
7
|
+
* which is passed on for its confirm call while it does.
|
|
12
8
|
*/
|
|
13
9
|
export default defineEventHandler(async (event): Promise<{ sent: true; userId?: string }> => {
|
|
14
10
|
const body = await readBody<{ email?: string }>(event).catch(() => ({} as { email?: string }));
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import type { AuthLoginResult } from "../../interfaces/auth";
|
|
2
2
|
import type { PasswordlessConfirm } from "../../utils/passwordlessSignIn";
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Turn a mailed code into a session.
|
|
6
|
+
*
|
|
7
|
+
* The code is confirmed with the address it was asked for: since customers 5.0
|
|
8
|
+
* the code request answers no user, so `email` is what names the buyer. A
|
|
9
|
+
* `userId` an older customers app answered goes along as `user_id` while it
|
|
10
|
+
* still does; each version reads the one it knows and ignores the other.
|
|
11
|
+
* Raw call, because the generated `customersAuthOtpConfirm()` refuses to send
|
|
12
|
+
* without a user id.
|
|
13
|
+
*/
|
|
5
14
|
export default defineEventHandler(async (event): Promise<AuthLoginResult> => {
|
|
6
|
-
const body = await readBody<{ userId?: string; secret?: string }>(event)
|
|
7
|
-
.catch(() => ({} as { userId?: string; secret?: string }));
|
|
8
|
-
const userId = body?.userId
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
const body = await readBody<{ userId?: string; email?: string; secret?: string }>(event)
|
|
16
|
+
.catch(() => ({} as { userId?: string; email?: string; secret?: string }));
|
|
17
|
+
const userId = typeof body?.userId === "string" ? body.userId.trim() : "";
|
|
18
|
+
const email = typeof body?.email === "string" ? body.email.trim() : "";
|
|
19
|
+
const secret = typeof body?.secret === "string" ? body.secret.trim() : "";
|
|
20
|
+
if ((!email && !userId) || !secret) {
|
|
21
|
+
throw createError({ statusCode: 400, message: "email and secret required" });
|
|
12
22
|
}
|
|
13
23
|
|
|
14
24
|
try {
|
|
15
|
-
const answer = await useRevenexxSdk().customers
|
|
16
|
-
userId,
|
|
17
|
-
|
|
18
|
-
}) as unknown as PasswordlessConfirm;
|
|
25
|
+
const answer = await useRevenexxSdk().call<PasswordlessConfirm>("PUT", "/v1/customers/auth/otp", {
|
|
26
|
+
body: { secret, ...(email ? { email } : {}), ...(userId ? { user_id: userId } : {}) },
|
|
27
|
+
});
|
|
19
28
|
return completeSignIn(event, answer.session, answer.contact, "", answer.permissions);
|
|
20
29
|
}
|
|
21
30
|
catch (err) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a category URL names a category the catalogue has (PE-1236): the
|
|
3
|
+
* category page and a removed product's 301 ask before they answer. Not a
|
|
4
|
+
* 404 for a missing one, so the caller can tell "no such category" from a
|
|
5
|
+
* catalogue that could not be read (a 5xx).
|
|
6
|
+
*
|
|
7
|
+
* `?subcategory=` names the second URL segment, which must lie below the
|
|
8
|
+
* category.
|
|
9
|
+
*/
|
|
10
|
+
export default defineEventHandler(async (event): Promise<{ exists: boolean }> => {
|
|
11
|
+
// The client encodes the slug (categoriesApi.exists); h3 decodes a route
|
|
12
|
+
// param only when asked, and `küche` must not arrive as `k%C3%BCche`.
|
|
13
|
+
const slug = getRouterParam(event, "slug", { decode: true });
|
|
14
|
+
if (!slug) {
|
|
15
|
+
throw createError({ status: 400, message: "Missing slug" });
|
|
16
|
+
}
|
|
17
|
+
const { subcategory } = getQuery(event);
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const exists = await getCategoryService(event)
|
|
21
|
+
.hasCategory(slug, typeof subcategory === "string" && subcategory ? subcategory : undefined);
|
|
22
|
+
return { exists };
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
getLogService().error("Service error: categories/exists", { slug, ...toErrorContext(err) });
|
|
26
|
+
throw createError({ statusCode: 500, message: "Internal server error" });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Offer } from "../../interfaces/offer";
|
|
2
|
+
|
|
3
|
+
/** What the structured data reads of an offer; stock records stay out of the page payload. */
|
|
4
|
+
type GuestOffer = Pick<Offer, "prices" | "isOutOfStock">;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* How long a product page's render waits for the public price. The offer is an
|
|
8
|
+
* ERP-grade call the buyer-facing page never waits for; the structured data
|
|
9
|
+
* (PE-1103) has to, so it gets a budget and goes without a price beyond it.
|
|
10
|
+
*/
|
|
11
|
+
const GUEST_OFFER_TIMEOUT_MS = 300;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The offer a guest gets for one product — what the product's structured data
|
|
15
|
+
* publishes (PE-1103, K4): the price the prices app answers for nobody, never
|
|
16
|
+
* the signed-in buyer's own. `offer` is null when it took too long or failed,
|
|
17
|
+
* which the page renders as a product without a price, like "on request".
|
|
18
|
+
* Only the prices and whether it is out of stock: the answer ends up in every
|
|
19
|
+
* product page's payload.
|
|
20
|
+
*/
|
|
21
|
+
export default defineEventHandler(async (event): Promise<{ offer: GuestOffer | null }> => {
|
|
22
|
+
const query = getQuery(event);
|
|
23
|
+
const id = typeof query.id === "string" ? query.id : "";
|
|
24
|
+
const sku = typeof query.sku === "string" && query.sku ? query.sku : undefined;
|
|
25
|
+
if (!id) {
|
|
26
|
+
throw createError({ statusCode: 400, statusMessage: "id is required" });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
30
|
+
const late = new Promise<"late">((resolve) => {
|
|
31
|
+
timer = setTimeout(() => resolve("late"), GUEST_OFFER_TIMEOUT_MS);
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
const offer = await Promise.race([
|
|
35
|
+
getOffers(event, [{ id, ...(sku ? { sku } : {}) }], { guest: true }).then(offers => offers.get(id) ?? null),
|
|
36
|
+
late,
|
|
37
|
+
]);
|
|
38
|
+
if (offer === "late") {
|
|
39
|
+
// Not an error, but not "no price" either: a product page without
|
|
40
|
+
// its offer in the structured data, which only shows here.
|
|
41
|
+
getLogService().warn("Guest offer: no answer within the budget", { id, budgetMs: GUEST_OFFER_TIMEOUT_MS });
|
|
42
|
+
return { offer: null };
|
|
43
|
+
}
|
|
44
|
+
return { offer: offer ? { prices: offer.prices, isOutOfStock: offer.isOutOfStock } : null };
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
getLogService().error("Service error: guest offer", toErrorContext(err));
|
|
48
|
+
return { offer: null };
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
clearTimeout(timer);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { pspReturnUrl, rememberPspReturn } from "../../utils/pspReturn";
|
|
16
16
|
import { placeOrderWithAttribution } from "../../utils/orderAttribution";
|
|
17
17
|
import { sanitizeAttribution } from "../../../app/shared/campaignAttribution";
|
|
18
|
+
import { calendarToday, earliestRequestedDate, requiredRequestedDate } from "../../../app/shared/requestedDate";
|
|
18
19
|
|
|
19
20
|
// Method codes are generic — live mode validates them against the
|
|
20
21
|
// payments app; the demo-only methods keep their extra fields.
|
|
@@ -345,17 +346,7 @@ export default defineEventHandler(async (event) => {
|
|
|
345
346
|
tax_rate: linePrices[index]!.taxRate,
|
|
346
347
|
})),
|
|
347
348
|
});
|
|
348
|
-
let discounts = (promo?.applied ?? [])
|
|
349
|
-
promotion_id: a.promotion_id,
|
|
350
|
-
promotion_name: a.promotion_name,
|
|
351
|
-
...(a.voucher_code ? { voucher_code: a.voucher_code } : {}),
|
|
352
|
-
...(a.value_type ? { value_type: a.value_type } : {}),
|
|
353
|
-
...(a.percent != null ? { percent: a.percent } : {}),
|
|
354
|
-
...(a.line_position != null
|
|
355
|
-
? { placement: "line" as const, line_position: a.line_position }
|
|
356
|
-
: { placement: "head" as const }),
|
|
357
|
-
amount: a.amount,
|
|
358
|
-
}));
|
|
349
|
+
let discounts = orderDiscounts(promo?.applied ?? []);
|
|
359
350
|
|
|
360
351
|
// The cart this order came out of. The promotions app keys its
|
|
361
352
|
// redemption ledger on it, so without it a reservation has
|
|
@@ -449,7 +440,7 @@ export default defineEventHandler(async (event) => {
|
|
|
449
440
|
...(body.deliveryNote ? { delivery_note: body.deliveryNote } : {}),
|
|
450
441
|
...(body.orderNote ? { order_note: body.orderNote } : {}),
|
|
451
442
|
...(body.partialDelivery !== undefined ? { partial_delivery: body.partialDelivery } : {}),
|
|
452
|
-
...(body.requestedDate ? { requested_date: body.requestedDate } : {}),
|
|
443
|
+
...(requestedDateOf(body.requestedDate) ? { requested_date: requestedDateOf(body.requestedDate) } : {}),
|
|
453
444
|
},
|
|
454
445
|
};
|
|
455
446
|
|
|
@@ -768,3 +759,18 @@ export default defineEventHandler(async (event) => {
|
|
|
768
759
|
throw createError({ statusCode: 500, message: "Internal server error" });
|
|
769
760
|
}
|
|
770
761
|
});
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* The requested delivery date the order goes out with. Where the storefront
|
|
765
|
+
* requires one (`checkout.requestedDateRequired`) the BFF does not trust the
|
|
766
|
+
* browser to have sent it: a missing, malformed or too early date becomes the
|
|
767
|
+
* earliest day the merchant can deliver, in the merchant's time zone.
|
|
768
|
+
*/
|
|
769
|
+
function requestedDateOf(given: string | undefined): string | undefined {
|
|
770
|
+
const checkout = (useAppConfig() as { checkout?: { requestedDateRequired?: boolean; earliestDeliveryDays?: number } }).checkout;
|
|
771
|
+
if (!checkout?.requestedDateRequired) {
|
|
772
|
+
return given || undefined;
|
|
773
|
+
}
|
|
774
|
+
const earliest = earliestRequestedDate(Number(checkout.earliestDeliveryDays ?? 0), calendarToday("Europe/Berlin"));
|
|
775
|
+
return requiredRequestedDate(given, earliest);
|
|
776
|
+
}
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import type { PaymentOption } from "../../../app/interfaces/payment";
|
|
2
2
|
import type { Locale } from "../../utils/locale";
|
|
3
|
-
import { type
|
|
4
|
-
|
|
5
|
-
/** Eligible method row of the payments app. */
|
|
6
|
-
interface ApiEligibleMethod {
|
|
7
|
-
code: string;
|
|
8
|
-
name: string;
|
|
9
|
-
labels: Record<string, string> | null;
|
|
10
|
-
description: string | null;
|
|
11
|
-
kind: string;
|
|
12
|
-
provider: string | null;
|
|
13
|
-
fee: number;
|
|
14
|
-
fee_type: "none" | "fixed" | "percent";
|
|
15
|
-
currency: string;
|
|
16
|
-
position: number;
|
|
17
|
-
/** How a PSP method takes the instrument (RAD-364); null for self-managed ones. */
|
|
18
|
-
checkout?: ApiMethodCheckout | null;
|
|
19
|
-
}
|
|
3
|
+
import { type ApiEligibleMethod, paymentOptionOf } from "../../utils/paymentOptions";
|
|
20
4
|
|
|
21
5
|
/**
|
|
22
6
|
* The checkout's payment question — "what can THIS buyer pay with?".
|
|
@@ -47,22 +31,7 @@ export default defineEventHandler(async (event) => {
|
|
|
47
31
|
currency,
|
|
48
32
|
}) as unknown as { methods: ApiEligibleMethod[] };
|
|
49
33
|
|
|
50
|
-
const options: PaymentOption[] = methods.map(
|
|
51
|
-
const checkout = paymentCheckoutOf(m.checkout);
|
|
52
|
-
// The checkout block names the provider the payment would actually go
|
|
53
|
-
// to (method → default → fallback provider); it wins over the row's.
|
|
54
|
-
const provider = checkout?.provider ?? m.provider;
|
|
55
|
-
return {
|
|
56
|
-
method: m.code,
|
|
57
|
-
label: m.labels?.[locale] ?? m.name,
|
|
58
|
-
...(m.description ? { description: m.description } : {}),
|
|
59
|
-
fee: m.fee,
|
|
60
|
-
feeType: m.fee_type,
|
|
61
|
-
kind: m.kind,
|
|
62
|
-
...(provider ? { provider } : {}),
|
|
63
|
-
...(checkout ? { checkout } : {}),
|
|
64
|
-
};
|
|
65
|
-
});
|
|
34
|
+
const options: PaymentOption[] = methods.map(m => paymentOptionOf(m, locale));
|
|
66
35
|
|
|
67
36
|
return {
|
|
68
37
|
managed: true,
|
|
@@ -8,6 +8,11 @@ export interface ProductLocalesResponse {
|
|
|
8
8
|
* on any other page.
|
|
9
9
|
*/
|
|
10
10
|
locales: string[] | null;
|
|
11
|
+
/**
|
|
12
|
+
* The product's name in each of `locales`, for the slug of a link into
|
|
13
|
+
* that language (PE-1236); `null` when the names are not known.
|
|
14
|
+
*/
|
|
15
|
+
names: Record<string, string> | null;
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
/** A locale code as the storefront writes it (`de`, `en-US`). */
|
|
@@ -44,14 +49,15 @@ export default defineEventHandler(async (event): Promise<ProductLocalesResponse>
|
|
|
44
49
|
|
|
45
50
|
const service = getProductService(event);
|
|
46
51
|
if (!service.getProductLanguages) {
|
|
47
|
-
return { locales: null };
|
|
52
|
+
return { locales: null, names: null };
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
try {
|
|
51
|
-
|
|
56
|
+
const { languages, names } = await service.getProductLanguages(id, requested);
|
|
57
|
+
return { locales: languages, names };
|
|
52
58
|
}
|
|
53
59
|
catch (err) {
|
|
54
60
|
getLogService().warn("Product locales lookup failed", { id, ...toErrorContext(err) });
|
|
55
|
-
return { locales: null };
|
|
61
|
+
return { locales: null, names: null };
|
|
56
62
|
}
|
|
57
63
|
});
|
|
@@ -2174,11 +2174,6 @@
|
|
|
2174
2174
|
"type": "main",
|
|
2175
2175
|
"priority": 1,
|
|
2176
2176
|
"url": "6984-1.png"
|
|
2177
|
-
},
|
|
2178
|
-
{
|
|
2179
|
-
"type": "main",
|
|
2180
|
-
"priority": 2,
|
|
2181
|
-
"url": "6984-2.png"
|
|
2182
2177
|
}
|
|
2183
2178
|
],
|
|
2184
2179
|
"attributes": [
|
|
@@ -2284,11 +2279,6 @@
|
|
|
2284
2279
|
"type": "main",
|
|
2285
2280
|
"priority": 1,
|
|
2286
2281
|
"url": "6985-1.png"
|
|
2287
|
-
},
|
|
2288
|
-
{
|
|
2289
|
-
"type": "main",
|
|
2290
|
-
"priority": 2,
|
|
2291
|
-
"url": "6985-2.png"
|
|
2292
2282
|
}
|
|
2293
2283
|
],
|
|
2294
2284
|
"attributes": [
|
|
@@ -2393,16 +2383,6 @@
|
|
|
2393
2383
|
"type": "main",
|
|
2394
2384
|
"priority": 1,
|
|
2395
2385
|
"url": "6986-1.png"
|
|
2396
|
-
},
|
|
2397
|
-
{
|
|
2398
|
-
"type": "main",
|
|
2399
|
-
"priority": 2,
|
|
2400
|
-
"url": "6986-2.png"
|
|
2401
|
-
},
|
|
2402
|
-
{
|
|
2403
|
-
"type": "main",
|
|
2404
|
-
"priority": 3,
|
|
2405
|
-
"url": "6986-3.png"
|
|
2406
2386
|
}
|
|
2407
2387
|
],
|
|
2408
2388
|
"attributes": [
|