@revenexx/cover 0.1.22 → 0.1.24
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/components/cart/item/CartItem.vue +5 -3
- package/app/components/cart/position/CartPosition.vue +5 -3
- package/app/components/layout/footer/Footer.vue +7 -5
- package/app/components/layout/header/MainNav.vue +10 -3
- package/app/components/layout/header/TopBar.vue +3 -2
- package/app/composables/useProductUrl.ts +5 -5
- package/app/composables/useProducts.ts +22 -4
- package/package.json +2 -2
- package/server/api/orders/index.post.ts +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { productApi } from "../../../api/product";
|
|
3
|
-
import {
|
|
3
|
+
import { categoryProductPath, getPriceWithOptionalTax } from "../../../composables/useProducts";
|
|
4
4
|
import type { CartItem } from "../../../interfaces/cart-item";
|
|
5
5
|
import type { ProductDetail } from "../../../interfaces/product-detail";
|
|
6
6
|
|
|
@@ -72,11 +72,13 @@ async function loadFallbackSlugs() {
|
|
|
72
72
|
const detailUrl = computed(() => {
|
|
73
73
|
const categorySlug = props.item.categorySlug ?? fallbackCategorySlug.value;
|
|
74
74
|
const subcategorySlug = props.item.subcategorySlug ?? fallbackSubcategorySlug.value;
|
|
75
|
-
|
|
75
|
+
// Link as long as we have at least a category; the subcategory is optional
|
|
76
|
+
// (the detail route tolerates any category depth).
|
|
77
|
+
if (!categorySlug) {
|
|
76
78
|
return null;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
return localePath(
|
|
81
|
+
return localePath(categoryProductPath([categorySlug, subcategorySlug], props.item));
|
|
80
82
|
});
|
|
81
83
|
const inputValue = ref(String(props.item.quantity));
|
|
82
84
|
const confirmOpen = ref(false);
|
|
@@ -4,7 +4,7 @@ const featureOrderLists = computed(() =>
|
|
|
4
4
|
((useAppConfig().features ?? {}) as Record<string, boolean>).orderLists !== false,
|
|
5
5
|
);
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { categoryProductPath } from "../../../composables/useProducts";
|
|
8
8
|
import type { CalculatedCartLine } from "../../../interfaces/cart-calculation";
|
|
9
9
|
import type { CartItem } from "../../../interfaces/cart-item";
|
|
10
10
|
import { CART_MAX_QUANTITY } from "../../../interfaces/cart-item";
|
|
@@ -35,11 +35,13 @@ const { formatCurrency } = useCartSummaryFormatting();
|
|
|
35
35
|
const lineKey = computed(() => cart.keyOf(props.item));
|
|
36
36
|
|
|
37
37
|
const detailUrl = computed(() => {
|
|
38
|
-
|
|
38
|
+
// Link as long as we have at least a category; the subcategory is optional
|
|
39
|
+
// (the detail route tolerates any category depth).
|
|
40
|
+
if (!props.item.categorySlug) {
|
|
39
41
|
return null;
|
|
40
42
|
}
|
|
41
43
|
return localePath(
|
|
42
|
-
|
|
44
|
+
categoryProductPath([props.item.categorySlug, props.item.subcategorySlug], props.item),
|
|
43
45
|
);
|
|
44
46
|
});
|
|
45
47
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { footerLinks as defaultFooterLinks, legalLinks as defaultLegalLinks, shopContact } from "../../../config/navigation";
|
|
3
3
|
|
|
4
|
-
// Consumers
|
|
5
|
-
//
|
|
6
|
-
//
|
|
4
|
+
// Consumers replace the footer columns / legal links, in priority order:
|
|
5
|
+
// per-request live menus (useState, e.g. the Blokkli theme from the pages app)
|
|
6
|
+
// → app.config override → the layer defaults (demo's full sitemap).
|
|
7
7
|
const appConfig = useAppConfig();
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const liveFooterLinks = useState<{ heading: string; links: { label: string; to: string }[] }[] | null>("cover:nav:footerLinks", () => null);
|
|
9
|
+
const liveLegalLinks = useState<{ label: string; to: string }[] | null>("cover:nav:legalLinks", () => null);
|
|
10
|
+
const footerLinks = computed(() => liveFooterLinks.value ?? (appConfig.footerLinks as typeof defaultFooterLinks | undefined) ?? defaultFooterLinks);
|
|
11
|
+
const legalLinks = computed(() => liveLegalLinks.value ?? (appConfig.legalLinks as typeof defaultLegalLinks | undefined) ?? defaultLegalLinks);
|
|
10
12
|
|
|
11
13
|
const { icon } = useIcons();
|
|
12
14
|
const localePath = useLocalePath();
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { mainNavigation as defaultMainNav, mainNavigationSecondary as defaultSecondaryNav } from "../../../config/navigation";
|
|
3
3
|
|
|
4
|
-
//
|
|
4
|
+
// Navigation source, in priority order:
|
|
5
|
+
// 1. per-request useState — a theme that publishes LIVE menus (e.g. the Blokkli
|
|
6
|
+
// theme reading the pages app; request-scoped, so multi-tenant safe)
|
|
7
|
+
// 2. app.config override — a theme's shipped/baked defaults
|
|
8
|
+
// 3. the layer's built-in defaults
|
|
9
|
+
// A theme that sets none of these (custom-theme, demo-shop) keeps the defaults.
|
|
5
10
|
const appConfig = useAppConfig();
|
|
6
|
-
const
|
|
7
|
-
const
|
|
11
|
+
const liveMain = useState<typeof defaultMainNav | null>("cover:nav:mainNavigation", () => null);
|
|
12
|
+
const liveSecondary = useState<typeof defaultSecondaryNav | null>("cover:nav:mainNavigationSecondary", () => null);
|
|
13
|
+
const mainNavigation = computed(() => liveMain.value ?? (appConfig.mainNavigation as typeof defaultMainNav | undefined) ?? defaultMainNav);
|
|
14
|
+
const mainNavigationSecondary = computed(() => liveSecondary.value ?? (appConfig.mainNavigationSecondary as typeof defaultSecondaryNav | undefined) ?? defaultSecondaryNav);
|
|
8
15
|
|
|
9
16
|
const { t } = useI18n();
|
|
10
17
|
const localePath = useLocalePath();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { topbarQuickLinks as defaultQuickLinks, topbarUsps } from "../../../config/navigation";
|
|
3
3
|
|
|
4
|
-
//
|
|
4
|
+
// Source priority: per-request live menus (useState) → app.config → defaults.
|
|
5
5
|
const appConfig = useAppConfig();
|
|
6
|
-
const
|
|
6
|
+
const liveQuickLinks = useState<typeof defaultQuickLinks | null>("cover:nav:topbarQuickLinks", () => null);
|
|
7
|
+
const topbarQuickLinks = computed(() => liveQuickLinks.value ?? (appConfig.topbarQuickLinks as typeof defaultQuickLinks | undefined) ?? defaultQuickLinks);
|
|
7
8
|
|
|
8
9
|
const { icon } = useIcons();
|
|
9
10
|
const { t } = useI18n();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { Product } from "../composables/useProducts";
|
|
2
|
-
import {
|
|
2
|
+
import { categoryProductPath } from "../composables/useProducts";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Generate a localized product URL with the current locale prefix.
|
|
6
6
|
* Replaces the plain `productUrl()` function to support i18n routing.
|
|
7
|
+
* Tolerates any category depth and never emits a literal "undefined" segment.
|
|
7
8
|
*/
|
|
8
9
|
export function useProductUrl(product: Product) {
|
|
9
10
|
const localePath = useLocalePath();
|
|
10
11
|
|
|
11
|
-
const url = computed(() =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
12
|
+
const url = computed(() =>
|
|
13
|
+
localePath(categoryProductPath([product.categorySlug, product.subcategorySlug], product)),
|
|
14
|
+
);
|
|
15
15
|
|
|
16
16
|
return url;
|
|
17
17
|
}
|
|
@@ -87,11 +87,29 @@ export function parseProductIdFromSlug(slug: string): string {
|
|
|
87
87
|
return slug.split("-")[0] ?? "";
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Build a product detail path that tolerates ANY category depth.
|
|
92
|
+
*
|
|
93
|
+
* The detail route is `/category/<…category path>/product/<slug>` where the
|
|
94
|
+
* category path may be one, two or more segments. Empty / nullish / literal
|
|
95
|
+
* "undefined" segments are dropped, so a product with no subcategory yields
|
|
96
|
+
* `/category/<cat>/product/<slug>` instead of the broken
|
|
97
|
+
* `/category/<cat>/undefined/product/<slug>`. When no category segment is known
|
|
98
|
+
* a single placeholder keeps the URL shape valid (the page only needs the slug).
|
|
99
|
+
*/
|
|
100
|
+
export function categoryProductPath(
|
|
101
|
+
categorySegments: Array<string | null | undefined>,
|
|
102
|
+
product: Pick<Product, "id" | "name">,
|
|
103
|
+
): string {
|
|
104
|
+
const cats = categorySegments.filter(
|
|
105
|
+
(s): s is string => Boolean(s) && s !== "undefined",
|
|
106
|
+
);
|
|
107
|
+
const prefix = cats.length > 0 ? cats.join("/") : "_";
|
|
108
|
+
return `/category/${prefix}/product/${slugify(product as Product)}`;
|
|
109
|
+
}
|
|
110
|
+
|
|
93
111
|
export function productUrl(product: Product): string {
|
|
94
|
-
return
|
|
112
|
+
return categoryProductPath([product.categorySlug, product.subcategorySlug], product);
|
|
95
113
|
}
|
|
96
114
|
|
|
97
115
|
export const useProducts = (
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revenexx/cover",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Cover
|
|
3
|
+
"version": "0.1.24",
|
|
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",
|
|
7
7
|
"license": "MIT",
|
|
@@ -382,8 +382,10 @@ export default defineEventHandler(async (event) => {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
// The payment dimension of the live order follows the payment outcome.
|
|
385
|
+
// The payments app's terminal "paid" state is `captured` (PSP auto/
|
|
386
|
+
// manual capture); `succeeded`/`paid` are accepted as synonyms.
|
|
385
387
|
if (liveOrderUuid && livePaymentStatus) {
|
|
386
|
-
const mapped =
|
|
388
|
+
const mapped = ["captured", "succeeded", "paid"].includes(livePaymentStatus)
|
|
387
389
|
? OrderPaymentStatus.Paid
|
|
388
390
|
: livePaymentStatus === "authorized" ? OrderPaymentStatus.Authorized : OrderPaymentStatus.Pending;
|
|
389
391
|
try {
|