@revenexx/cover 0.22.0 → 0.23.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 (113) hide show
  1. package/app/api/categories.ts +1 -0
  2. package/app/api/offers.ts +1 -0
  3. package/app/app.config.ts +13 -0
  4. package/app/components/OgImage/CoverPage.takumi.vue +37 -0
  5. package/app/components/RevenexxForm.vue +21 -6
  6. package/app/components/account/approvals/AccountPendingApprovals.vue +19 -1
  7. package/app/components/account/approvals/AccountPendingOrderDetail.vue +3 -0
  8. package/app/components/account/carts/AccountCartsTable.vue +11 -1
  9. package/app/components/account/orderlists/AccountOrderListDetail.vue +32 -3
  10. package/app/components/account/organization/AccountOrganization.vue +1 -1
  11. package/app/components/auth/AuthForgotPasswordPanel.vue +7 -2
  12. package/app/components/auth/AuthLoginPanel.vue +23 -8
  13. package/app/components/auth/AuthRegisterTeaser.vue +1 -1
  14. package/app/components/cart/position/CartPosition.vue +11 -4
  15. package/app/components/cart/quickadd/CartQuickAdd.vue +4 -2
  16. package/app/components/cart/recommend/CartRecommendCard.vue +1 -0
  17. package/app/components/cart/switcher/CartSwitcher.vue +1 -0
  18. package/app/components/cart/view/CartListHeader.vue +5 -0
  19. package/app/components/cart/view/CartSummaryPanel.vue +20 -8
  20. package/app/components/cart/view/CartView.vue +4 -2
  21. package/app/components/checkout/onepage/CheckoutGate.vue +4 -2
  22. package/app/components/checkout/onepage/CheckoutGuestDetailsSection.vue +2 -1
  23. package/app/components/checkout/onepage/CheckoutPaymentSection.vue +1 -1
  24. package/app/components/checkout/onepage/CheckoutSummarySection.vue +8 -0
  25. package/app/components/checkout/return/CheckoutPaymentReturn.vue +7 -0
  26. package/app/components/layout/footer/Footer.vue +21 -4
  27. package/app/components/layout/header/AppBar.vue +5 -2
  28. package/app/components/layout/header/LocaleSwitcher.vue +7 -9
  29. package/app/components/layout/header/MobileMenu.vue +4 -1
  30. package/app/components/product/detail/ProductDetailAddToCart.vue +17 -11
  31. package/app/components/product/detail/ProductDetailImageGallery.vue +101 -8
  32. package/app/components/product/detail/ProductDetailVariantRow.vue +84 -4
  33. package/app/components/product/detail/ProductDetailVariants.vue +75 -11
  34. package/app/components/product/detail/ProductDetailView.vue +64 -69
  35. package/app/components/punchout/action/PunchoutTransferAction.vue +4 -3
  36. package/app/composables/useAuthStore.ts +21 -4
  37. package/app/composables/useCategories.ts +24 -0
  38. package/app/composables/useCategoryAnswer.ts +30 -0
  39. package/app/composables/useCategorySeo.ts +62 -0
  40. package/app/composables/useDefaultUiLanguage.ts +14 -0
  41. package/app/composables/useOgImageReady.ts +16 -0
  42. package/app/composables/useProductAnswer.ts +121 -0
  43. package/app/composables/useProductLocales.ts +21 -10
  44. package/app/composables/useProductSeo.ts +145 -0
  45. package/app/composables/usePunchoutVisit.ts +36 -1
  46. package/app/composables/useRouteSubject.ts +23 -3
  47. package/app/composables/useSeoContext.ts +164 -0
  48. package/app/composables/useSeoHead.ts +189 -0
  49. package/app/composables/useSeoRules.ts +23 -0
  50. package/app/interfaces/punchout.ts +11 -0
  51. package/app/interfaces/seo.ts +48 -0
  52. package/app/layouts/default.vue +2 -8
  53. package/app/layouts/focus.vue +3 -1
  54. package/app/middleware/punchout-exits.global.ts +25 -0
  55. package/app/payments/psp/novalnet.ts +25 -3
  56. package/app/payments/psp/novalnetStyle.ts +186 -0
  57. package/app/plugins/punchout-links.client.ts +46 -0
  58. package/app/shared/categoryTree.ts +7 -0
  59. package/app/shared/locale.ts +8 -0
  60. package/app/shared/productLocales.ts +62 -1
  61. package/app/shared/punchoutExits.ts +156 -0
  62. package/app/shared/seoRules.ts +297 -0
  63. package/app/shared/structuredData.ts +104 -0
  64. package/i18n/locales/de/account.json +4 -0
  65. package/i18n/locales/de/common.json +6 -0
  66. package/i18n/locales/de/pages.json +109 -0
  67. package/i18n/locales/de/punchout.json +3 -0
  68. package/i18n/locales/en/account.json +4 -0
  69. package/i18n/locales/en/common.json +6 -0
  70. package/i18n/locales/en/pages.json +109 -0
  71. package/i18n/locales/en/punchout.json +3 -0
  72. package/nuxt.config.ts +140 -1
  73. package/package.json +10 -3
  74. package/server/api/auth/otp.post.ts +4 -8
  75. package/server/api/auth/otp.put.ts +20 -11
  76. package/server/api/categories/[slug]/exists.get.ts +28 -0
  77. package/server/api/offers/guest.get.ts +53 -0
  78. package/server/api/orders/index.post.ts +18 -11
  79. package/server/api/payment/methods.post.ts +2 -33
  80. package/server/api/product/[id]/locales.get.ts +9 -3
  81. package/server/data/product-detail.json +0 -20
  82. package/server/dev/errorHandler.ts +9 -5
  83. package/server/dev/typesense/autoSeed.ts +63 -0
  84. package/server/dev/typesense/seed.ts +4 -43
  85. package/server/dev/typesense/seedProducts.ts +87 -0
  86. package/server/interfaces/category.ts +5 -0
  87. package/server/interfaces/product.ts +13 -6
  88. package/server/interfaces/punchout.ts +20 -1
  89. package/server/middleware/missing-media.ts +2 -2
  90. package/server/middleware/punchout-exits.ts +45 -0
  91. package/server/middleware/punchout-visit-csp.ts +35 -0
  92. package/server/plugins/previewHostNoindex.ts +21 -0
  93. package/server/plugins/punchout-cookies.ts +48 -0
  94. package/server/plugins/seoSiteConfig.ts +62 -0
  95. package/server/routes/punchout/start.get.ts +7 -0
  96. package/server/routes/robots.txt.ts +21 -0
  97. package/server/services/ApiCategoryService.ts +6 -0
  98. package/server/services/ApiProductService.ts +2 -2
  99. package/server/services/LocalFileCategoryService.ts +6 -0
  100. package/server/utils/liveCatalog.ts +83 -18
  101. package/server/utils/livePrices.ts +12 -3
  102. package/server/utils/locale.ts +3 -8
  103. package/server/utils/offerService.ts +8 -3
  104. package/server/utils/paymentOptions.ts +49 -0
  105. package/server/utils/promotionsService.ts +25 -0
  106. package/server/utils/punchoutFrame.ts +131 -0
  107. package/server/utils/punchoutOrder.ts +40 -0
  108. package/server/utils/punchoutVisit.ts +41 -8
  109. package/server/utils/revenexxSdk.ts +7 -1
  110. package/server/utils/seoRequestHost.ts +21 -0
  111. package/server/utils/storefrontMessages.ts +5 -5
  112. package/server/utils/storefrontSeoRules.ts +298 -0
  113. package/server/middleware/punchout-hand-back-csp.ts +0 -17
@@ -0,0 +1,109 @@
1
+ {
2
+ "pages": {
3
+ "search": {
4
+ "title": "Suche"
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
+ }
@@ -40,6 +40,9 @@
40
40
  "readOnly": {
41
41
  "hint": "Diese Anforderung wurde nur zur Ansicht geöffnet und kann hier nicht geändert werden.",
42
42
  "badge": "Nur zur Ansicht"
43
+ },
44
+ "orderAndTransfer": {
45
+ "hint": "Nach der Bestellung gehen Warenkorb und Bestellung im selben Schritt an Ihre Handwerkersoftware zurück."
43
46
  }
44
47
  }
45
48
  }
@@ -537,6 +537,10 @@
537
537
  "title": "No order lists",
538
538
  "description": "Create your first order list via “Add”."
539
539
  },
540
+ "noPositions": {
541
+ "title": "No positions yet",
542
+ "description": "Add articles from a product page or from the cart — via “Add to order list”."
543
+ },
540
544
  "saveTo": {
541
545
  "button": "Add to order list",
542
546
  "onLists": "On {count} list | On {count} lists",
@@ -129,5 +129,11 @@
129
129
  "privacy": "Privacy policy",
130
130
  "terms": "Terms of service",
131
131
  "cookies": "Cookie policy"
132
+ },
133
+ "seo": {
134
+ "ogImage": {
135
+ "product": "Product",
136
+ "category": "Category"
137
+ }
132
138
  }
133
139
  }
@@ -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
+ }
@@ -40,6 +40,9 @@
40
40
  "readOnly": {
41
41
  "hint": "This requisition was opened for viewing only and cannot be changed here.",
42
42
  "badge": "View only"
43
+ },
44
+ "orderAndTransfer": {
45
+ "hint": "After the order, the cart and its order go back to your trade software in the same step."
43
46
  }
44
47
  }
45
48
  }
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), dev server only.
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.22.0",
3
+ "version": "0.23.0",
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.4.8",
61
- "nuxt": "^4.4.2"
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 answer carries the platform's user id, which the confirm call needs beside
5
- * the code the buyer types. That id is not a secret — the code is, and it only
6
- * ever goes to the address.
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
- /** Turn a mailed code into a session. */
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?.trim();
9
- const secret = body?.secret?.trim();
10
- if (!userId || !secret) {
11
- throw createError({ statusCode: 400, message: "userId and secret required" });
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.customersAuthOtpConfirm({
16
- userId,
17
- secret,
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
+ });