@revenexx/cover 0.22.0 → 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 +13 -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/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/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/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/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/seoRules.ts +297 -0
- package/app/shared/structuredData.ts +104 -0
- package/i18n/locales/de/account.json +4 -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/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 +1 -11
- 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,104 @@
|
|
|
1
|
+
import type { Offer } from "../composables/useOffers";
|
|
2
|
+
import { getBaseUnitPrice, getPriceWithOptionalTax } from "../composables/useProducts";
|
|
3
|
+
import type { ProductDetailAttribute } from "../interfaces/product-detail";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The parts of a product's Schema.org data that follow shop rules rather than
|
|
7
|
+
* the catalogue (PE-1103). Pure, so the rules are tested without a page.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** What a guest's offer says: the tier map and whether the item can be ordered. */
|
|
11
|
+
export type GuestOfferInput = Readonly<Pick<Offer, "prices" | "isOutOfStock">>;
|
|
12
|
+
|
|
13
|
+
// A type, not an interface: nuxt-schema-org's Offer has an index signature,
|
|
14
|
+
// which only a type literal satisfies.
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
16
|
+
export type StructuredOffer = {
|
|
17
|
+
price: string;
|
|
18
|
+
priceCurrency: string;
|
|
19
|
+
availability: "InStock" | "OutOfStock";
|
|
20
|
+
priceSpecification: {
|
|
21
|
+
"@type": "UnitPriceSpecification";
|
|
22
|
+
"price": string;
|
|
23
|
+
"priceCurrency": string;
|
|
24
|
+
"valueAddedTaxIncluded": boolean;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The `offers` of a product, or undefined for none (K4, PE-1047): a price only
|
|
30
|
+
* from the guest's offer, net or gross as the page shows it, in the currency it
|
|
31
|
+
* shows. No price (on request, refused to strangers, too slow) or the domain's
|
|
32
|
+
* opt-out gives no offer at all, never an offer without a price.
|
|
33
|
+
*/
|
|
34
|
+
export function structuredOffer(input: {
|
|
35
|
+
readonly offer: GuestOfferInput | null | undefined;
|
|
36
|
+
/** The domain's rules allow prices in the structured data (`structured_data.prices`). */
|
|
37
|
+
readonly pricesAllowed: boolean;
|
|
38
|
+
readonly currency: string;
|
|
39
|
+
readonly taxRate: number;
|
|
40
|
+
readonly taxIncludedPrices: boolean;
|
|
41
|
+
}): StructuredOffer | undefined {
|
|
42
|
+
if (!input.pricesAllowed || !input.offer || !input.currency) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
// The price of one unit at the smallest quantity, as the product page shows it.
|
|
46
|
+
const unitPrice = getBaseUnitPrice([...input.offer.prices]);
|
|
47
|
+
if (unitPrice === null || unitPrice <= 0) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const price = getPriceWithOptionalTax(unitPrice, input.taxRate, input.taxIncludedPrices).toFixed(2);
|
|
51
|
+
return {
|
|
52
|
+
price,
|
|
53
|
+
priceCurrency: input.currency,
|
|
54
|
+
availability: input.offer.isOutOfStock ? "OutOfStock" : "InStock",
|
|
55
|
+
priceSpecification: {
|
|
56
|
+
"@type": "UnitPriceSpecification",
|
|
57
|
+
"price": price,
|
|
58
|
+
"priceCurrency": input.currency,
|
|
59
|
+
"valueAddedTaxIncluded": input.taxIncludedPrices,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The product's specifications as Schema.org `additionalProperty`, empty ones left out. */
|
|
65
|
+
export function structuredProperties(attributes: readonly ProductDetailAttribute[]): { "@type": "PropertyValue"; name: string; value: string }[] {
|
|
66
|
+
return attributes
|
|
67
|
+
.filter(attribute => attribute.name?.trim() && attribute.value?.trim())
|
|
68
|
+
.map(attribute => ({ "@type": "PropertyValue", "name": attribute.name.trim(), "value": attribute.value.trim() }));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** One entry of an accordion: its label and its HTML content. */
|
|
72
|
+
export interface FaqItemInput {
|
|
73
|
+
readonly label?: unknown;
|
|
74
|
+
readonly content?: unknown;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The questions of an accordion marked as FAQ (PE-1327), for `defineQuestion`:
|
|
79
|
+
* the label as the question, the content as the answer. Google reads a small
|
|
80
|
+
* set of HTML tags in an answer (`p`, `a`, lists, emphasis), so the content
|
|
81
|
+
* stays as authored. An entry without a question or without answer text (an
|
|
82
|
+
* empty paragraph counts as none) is left out.
|
|
83
|
+
*/
|
|
84
|
+
export function faqQuestions(items: readonly FaqItemInput[]): { name: string; acceptedAnswer: string }[] {
|
|
85
|
+
return items.flatMap((item) => {
|
|
86
|
+
const name = typeof item.label === "string" ? item.label.trim() : "";
|
|
87
|
+
const answer = typeof item.content === "string" ? item.content.trim() : "";
|
|
88
|
+
return name && plainText(answer) ? [{ name, acceptedAnswer: answer }] : [];
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Authored HTML as plain text, for meta tags and for telling an empty answer
|
|
94
|
+
* from a real one: tags become spaces, so do non-breaking spaces however the
|
|
95
|
+
* editor wrote them (` `, ` `, ` `, the character itself), and
|
|
96
|
+
* whitespace collapses.
|
|
97
|
+
*/
|
|
98
|
+
export function plainText(html: string): string {
|
|
99
|
+
return html
|
|
100
|
+
.replace(/<[^>]*>/g, " ")
|
|
101
|
+
.replace(/&(?:nbsp|#160|#x0*a0);/gi, " ")
|
|
102
|
+
.replace(/\s+/g, " ")
|
|
103
|
+
.trim();
|
|
104
|
+
}
|
|
@@ -537,6 +537,10 @@
|
|
|
537
537
|
"title": "Keine Bestelllisten",
|
|
538
538
|
"description": "Legen Sie Ihre erste Bestellliste über „Hinzufügen“ an."
|
|
539
539
|
},
|
|
540
|
+
"noPositions": {
|
|
541
|
+
"title": "Noch keine Positionen",
|
|
542
|
+
"description": "Artikel kommen von der Produktseite oder aus dem Warenkorb auf diese Liste — über „Auf Bestellliste“."
|
|
543
|
+
},
|
|
540
544
|
"saveTo": {
|
|
541
545
|
"button": "Auf Bestellliste",
|
|
542
546
|
"onLists": "Auf {count} Liste | Auf {count} Listen",
|
|
@@ -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
|
+
}
|
|
@@ -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",
|
|
@@ -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.22.
|
|
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) {
|