@revenexx/cover 0.2.17 → 0.2.19
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/account/address/AccountAddressView.vue +433 -0
- package/app/components/account/dashboard/AccountDashboard.vue +10 -330
- package/app/components/account/dashboard/AccountDashboardBudgets.vue +71 -0
- package/app/components/account/dashboard/AccountDashboardGreeting.vue +17 -0
- package/app/components/account/dashboard/AccountDashboardKpis.vue +71 -0
- package/app/components/account/dashboard/AccountDashboardQuickActions.vue +36 -0
- package/app/components/account/dashboard/AccountDashboardRecentOrders.vue +70 -0
- package/app/components/account/dashboard/AccountDashboardRequisitions.vue +60 -0
- package/app/components/account/profile/AccountPasswordForm.vue +155 -0
- package/app/components/account/profile/AccountProfileForm.vue +159 -0
- package/app/components/auth/AuthLoginTeaser.vue +1 -1
- package/app/components/auth/AuthRegisterPanel.vue +123 -119
- package/app/components/cart/position/CartPosition.vue +26 -17
- package/app/components/cart/recommend/CartReorderStrip.vue +27 -12
- package/app/components/cart/view/CartView.vue +1 -8
- package/app/components/checkout/confirmation/CheckoutConfirmationActions.vue +52 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationHero.vue +41 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationNextSteps.vue +60 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationOrderRecap.vue +102 -0
- package/app/components/checkout/confirmation/CheckoutConfirmationView.vue +30 -265
- package/app/components/listing/ListingActiveFilters.vue +59 -0
- package/app/components/listing/ListingFilterBar.vue +24 -0
- package/app/components/listing/ListingFilterDrawer.vue +72 -0
- package/app/components/listing/ListingFilterRail.vue +23 -0
- package/app/components/listing/ListingResults.vue +88 -0
- package/app/components/listing/ListingToolbar.vue +46 -0
- package/app/components/listing/ListingView.vue +14 -204
- package/app/components/product/detail/ProductDetailIdentity.vue +44 -0
- package/app/components/product/detail/ProductDetailPrice.vue +39 -0
- package/app/components/search/filter/SearchFacets.vue +12 -102
- package/app/components/search/filter/SearchFacetsBar.vue +161 -0
- package/app/composables/useAccountDashboard.ts +112 -0
- package/app/composables/useCategoryListing.ts +92 -0
- package/app/composables/useCheckoutConfirmation.ts +63 -0
- package/app/composables/useFacetFilters.ts +122 -0
- package/app/composables/useProduct.ts +11 -0
- package/app/composables/useProductListing.ts +5 -1
- package/app/composables/useSearchListing.ts +71 -0
- package/app/interfaces/checkout.ts +27 -0
- package/i18n/locales/de/auth.json +1 -1
- package/i18n/locales/de/editor.json +33 -0
- package/i18n/locales/en/editor.json +33 -0
- package/package.json +1 -1
- package/server/data/media/60794300.jpg +0 -0
- package/server/data/media/aussen-rueckwaertsdrehen.jpg +0 -0
- package/server/data/media/bohrtiefe-8.jpg +0 -0
- package/server/data/media/dummy-brw-image.png +0 -0
- package/server/data/media/feindrehen.jpg +0 -0
- package/server/data/media/header-aktuelles.jpg +0 -0
- package/server/data/media/sternsiebeinsatz-gr-3-000028480.stp +19039 -0
- package/server/data/media/zaehnezahl-z4.jpg +0 -0
- package/server/data/media/zaehnezahl-z6.jpg +0 -0
- package/server/services/ApiProductService.ts +4 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Requisition } from "../interfaces/b2b";
|
|
2
|
+
import type { AccountOrderStatus } from "../interfaces/account/order-list";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared data and derived state for the account dashboard widgets. Each widget
|
|
6
|
+
* block calls this composable; the underlying `useFetch` calls dedupe by key,
|
|
7
|
+
* so the data is loaded once regardless of how many widgets are on the page.
|
|
8
|
+
*/
|
|
9
|
+
export const useAccountDashboard = () => {
|
|
10
|
+
const { t, d } = useI18n();
|
|
11
|
+
const auth = useAuthStore();
|
|
12
|
+
const { orders, status: ordersStatus } = useAccountOrders();
|
|
13
|
+
const { costCenters, status: contextStatus } = useB2BContext();
|
|
14
|
+
const { formatCurrency } = useCartSummaryFormatting();
|
|
15
|
+
|
|
16
|
+
const { data: requisitions, status: requisitionsStatus } = useFetch<Requisition[]>(
|
|
17
|
+
"/api/account/requisitions",
|
|
18
|
+
{ key: "account-requisitions", default: () => [] },
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/* ---- per-widget pending flags ---------------------------------------- */
|
|
22
|
+
const ordersPending = computed(() => ordersStatus.value === "pending");
|
|
23
|
+
const contextPending = computed(() => contextStatus.value === "pending");
|
|
24
|
+
const requisitionsPending = computed(() => requisitionsStatus.value === "pending");
|
|
25
|
+
|
|
26
|
+
/* ---- KPIs ------------------------------------------------------------ */
|
|
27
|
+
const OPEN_STATUSES: AccountOrderStatus[] = ["processing", "approval-pending", "shipped"];
|
|
28
|
+
|
|
29
|
+
const openOrdersCount = computed(() =>
|
|
30
|
+
orders.value.filter(order => OPEN_STATUSES.includes(order.status)).length);
|
|
31
|
+
|
|
32
|
+
const awaitingApprovalCount = computed(() =>
|
|
33
|
+
orders.value.filter(order => order.status === "approval-pending").length
|
|
34
|
+
+ requisitions.value.filter(requisition => requisition.status === "open").length);
|
|
35
|
+
|
|
36
|
+
const spend30 = computed(() => {
|
|
37
|
+
const cutoff = Date.now() - 30 * 24 * 60 * 60 * 1000;
|
|
38
|
+
return orders.value
|
|
39
|
+
.filter(order => order.status !== "cancelled" && new Date(order.date).getTime() >= cutoff)
|
|
40
|
+
.reduce((sum, order) => sum + order.total, 0);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const budgetedCostCenters = computed(() =>
|
|
44
|
+
costCenters.value.filter(cc =>
|
|
45
|
+
cc.limit?.totalBudget !== undefined && cc.limit.availableBudget !== undefined));
|
|
46
|
+
|
|
47
|
+
const budgetUtilization = computed(() => {
|
|
48
|
+
const total = budgetedCostCenters.value.reduce((sum, cc) => sum + (cc.limit?.totalBudget ?? 0), 0);
|
|
49
|
+
if (!total) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const available = budgetedCostCenters.value.reduce((sum, cc) => sum + (cc.limit?.availableBudget ?? 0), 0);
|
|
53
|
+
return Math.round(((total - available) / total) * 100);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/* ---- lists ------------------------------------------------------------ */
|
|
57
|
+
const recentOrders = computed(() => orders.value.slice(0, 5));
|
|
58
|
+
|
|
59
|
+
const openRequisitions = computed(() =>
|
|
60
|
+
requisitions.value.filter(requisition => requisition.status === "open").slice(0, 4));
|
|
61
|
+
|
|
62
|
+
const statusColors: Record<AccountOrderStatus, "info" | "warning" | "primary" | "success" | "error"> = {
|
|
63
|
+
"processing": "info",
|
|
64
|
+
"approval-pending": "warning",
|
|
65
|
+
"shipped": "primary",
|
|
66
|
+
"delivered": "success",
|
|
67
|
+
"cancelled": "error",
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const utilization = (used: number, total: number): number =>
|
|
71
|
+
total > 0 ? Math.min(100, Math.round((used / total) * 100)) : 0;
|
|
72
|
+
|
|
73
|
+
const budgetBars = computed(() =>
|
|
74
|
+
budgetedCostCenters.value.map((cc) => {
|
|
75
|
+
const total = cc.limit?.totalBudget ?? 0;
|
|
76
|
+
const available = cc.limit?.availableBudget ?? 0;
|
|
77
|
+
return { id: cc.id, label: cc.label, total, available, used: utilization(total - available, total) };
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
const formatDate = (value: string): string => {
|
|
81
|
+
const parsed = new Date(value);
|
|
82
|
+
return Number.isNaN(parsed.getTime()) ? value : d(parsed, { dateStyle: "medium" });
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/* ---- quick actions ----------------------------------------------------- */
|
|
86
|
+
const quickActions = [
|
|
87
|
+
{ to: "/account/direct-order", labelKey: "directOrder.title", token: "direct-order" },
|
|
88
|
+
{ to: "/account/orders", labelKey: "account.nav.orders", token: "orders" },
|
|
89
|
+
{ to: "/account/order-lists", labelKey: "account.nav.orderLists", token: "order-list" },
|
|
90
|
+
{ to: "/account/requisitions", labelKey: "account.nav.requisitions", token: "check" },
|
|
91
|
+
{ to: "/account/cost-centers", labelKey: "account.nav.costCenters", token: "briefcase" },
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
t,
|
|
96
|
+
auth,
|
|
97
|
+
formatCurrency,
|
|
98
|
+
formatDate,
|
|
99
|
+
statusColors,
|
|
100
|
+
quickActions,
|
|
101
|
+
ordersPending,
|
|
102
|
+
contextPending,
|
|
103
|
+
requisitionsPending,
|
|
104
|
+
openOrdersCount,
|
|
105
|
+
awaitingApprovalCount,
|
|
106
|
+
spend30,
|
|
107
|
+
budgetUtilization,
|
|
108
|
+
recentOrders,
|
|
109
|
+
openRequisitions,
|
|
110
|
+
budgetBars,
|
|
111
|
+
};
|
|
112
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
2
|
+
|
|
3
|
+
export interface CategoryListingOptions {
|
|
4
|
+
/** Resolved category slug the listing is pinned to. */
|
|
5
|
+
readonly categorySlug: () => string;
|
|
6
|
+
/** Resolved subcategory slug, or undefined on the category root. */
|
|
7
|
+
readonly subcategorySlug: () => string | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The category page engine: wraps useProductListing pinned to a category (and
|
|
12
|
+
* optional subcategory) via fixedFilters, and adds the category-page chrome data
|
|
13
|
+
* — resolved category/subcategory, page title, breadcrumb, and the in-category
|
|
14
|
+
* search synced to `?q`. The locked `category` wrapper block calls this once and
|
|
15
|
+
* provides the result; the category widget blocks inject it instead of rebuilding.
|
|
16
|
+
*/
|
|
17
|
+
export const useCategoryListing = (options: CategoryListingOptions) => {
|
|
18
|
+
const route = useRoute();
|
|
19
|
+
const router = useRouter();
|
|
20
|
+
const { t } = useI18n();
|
|
21
|
+
const localePath = useLocalePath();
|
|
22
|
+
|
|
23
|
+
const categorySlug = computed(() => options.categorySlug());
|
|
24
|
+
const subcategorySlug = computed(() => options.subcategorySlug());
|
|
25
|
+
|
|
26
|
+
const { categories } = useCategories();
|
|
27
|
+
const category = computed(() =>
|
|
28
|
+
categories.value.find(c => c.slug === categorySlug.value),
|
|
29
|
+
);
|
|
30
|
+
const subcategory = computed(() =>
|
|
31
|
+
category.value?.subcategories.find(s => s.slug === subcategorySlug.value),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Search within the category — synced to ?q like the search page.
|
|
35
|
+
const q = computed(() => (route.query.q as string) ?? "");
|
|
36
|
+
const searchInput = ref(q.value);
|
|
37
|
+
const pushQuery = useDebounceFn(() => {
|
|
38
|
+
void router.replace({
|
|
39
|
+
query: { ...route.query, q: searchInput.value.trim() || undefined, page: undefined },
|
|
40
|
+
});
|
|
41
|
+
}, 350);
|
|
42
|
+
watch(q, (val) => {
|
|
43
|
+
searchInput.value = val;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const listing = useProductListing({
|
|
47
|
+
key: "category",
|
|
48
|
+
query: () => q.value,
|
|
49
|
+
allowEmptyQuery: true,
|
|
50
|
+
fixedFilters: () => ({
|
|
51
|
+
categorySlug: [categorySlug.value],
|
|
52
|
+
...(subcategorySlug.value ? { subcategorySlug: [subcategorySlug.value] } : {}),
|
|
53
|
+
}),
|
|
54
|
+
// The category itself is fixed; subcategories remain filterable on the
|
|
55
|
+
// category root, manufacturers and availability everywhere.
|
|
56
|
+
facetFields: subcategorySlug.value
|
|
57
|
+
? ["manufacturer", "available"]
|
|
58
|
+
: ["subcategory", "manufacturer", "available"],
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const title = computed(() =>
|
|
62
|
+
subcategorySlug.value
|
|
63
|
+
? (subcategory.value?.label ?? subcategorySlug.value)
|
|
64
|
+
: (category.value?.label ?? categorySlug.value),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const breadcrumb = computed(() => {
|
|
68
|
+
const items: { label: string; to?: string }[] = [
|
|
69
|
+
{ label: t("nav.home"), to: localePath("/") },
|
|
70
|
+
];
|
|
71
|
+
if (subcategorySlug.value) {
|
|
72
|
+
items.push({
|
|
73
|
+
label: category.value?.label ?? categorySlug.value,
|
|
74
|
+
to: localePath(`/category/${categorySlug.value}`),
|
|
75
|
+
});
|
|
76
|
+
items.push({ label: subcategory.value?.label ?? subcategorySlug.value });
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
items.push({ label: category.value?.label ?? categorySlug.value });
|
|
80
|
+
}
|
|
81
|
+
return items;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
listing,
|
|
86
|
+
category, subcategory, categorySlug, subcategorySlug,
|
|
87
|
+
title, breadcrumb,
|
|
88
|
+
q, searchInput, pushQuery,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type CategoryListing = ReturnType<typeof useCategoryListing>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { AccountOrder } from "../interfaces/account/order-list";
|
|
2
|
+
import type { Requisition } from "../interfaces/b2b";
|
|
3
|
+
import type { ConfirmationRecap, ConfirmationType } from "../interfaces/checkout";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Loads the order/requisition recap for the checkout thank-you page.
|
|
7
|
+
* Signed-in customers get the full recap (positions, addresses, payment,
|
|
8
|
+
* total); guests get `null` (the hero-only view). Returns `null` on any
|
|
9
|
+
* fetch failure so the page degrades gracefully.
|
|
10
|
+
*/
|
|
11
|
+
export function useCheckoutConfirmation(recordId: string, type: ConfirmationType) {
|
|
12
|
+
// Forwards the auth cookie during SSR — plain $fetch would lose it.
|
|
13
|
+
const requestFetch = useRequestFetch();
|
|
14
|
+
|
|
15
|
+
const { data: recap } = useAsyncData<ConfirmationRecap | null>(
|
|
16
|
+
`checkout-confirmation:${recordId}`,
|
|
17
|
+
async () => {
|
|
18
|
+
try {
|
|
19
|
+
if (type === "requisition") {
|
|
20
|
+
const requisition = await requestFetch<Requisition>(`/api/account/requisitions/${recordId}`);
|
|
21
|
+
const address = requisition.deliveryAddress;
|
|
22
|
+
return {
|
|
23
|
+
lines: requisition.items.map(item => ({
|
|
24
|
+
id: item.id,
|
|
25
|
+
name: item.name,
|
|
26
|
+
...(item.image ? { image: item.image } : {}),
|
|
27
|
+
sku: item.sku,
|
|
28
|
+
quantity: item.quantity,
|
|
29
|
+
unitPrice: item.price,
|
|
30
|
+
lineTotal: Math.round(item.price * item.quantity * 100) / 100,
|
|
31
|
+
})),
|
|
32
|
+
total: requisition.totalValue,
|
|
33
|
+
deliveryLines: address
|
|
34
|
+
? [address.company, address.street, `${address.postalCode} ${address.city}`.trim()].filter(Boolean)
|
|
35
|
+
: [],
|
|
36
|
+
billingLines: [],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const order = await requestFetch<AccountOrder>(`/api/account/orders/${recordId}`);
|
|
40
|
+
return {
|
|
41
|
+
lines: order.positions.map(position => ({
|
|
42
|
+
id: position.id,
|
|
43
|
+
name: position.name,
|
|
44
|
+
...(position.image ? { image: position.image } : {}),
|
|
45
|
+
sku: position.sku,
|
|
46
|
+
quantity: position.quantity,
|
|
47
|
+
unitPrice: position.unitPrice,
|
|
48
|
+
lineTotal: position.lineTotal,
|
|
49
|
+
})),
|
|
50
|
+
total: order.total,
|
|
51
|
+
deliveryLines: order.deliveryAddress?.split(" · ") ?? [],
|
|
52
|
+
billingLines: order.billingAddress?.split(" · ") ?? [],
|
|
53
|
+
...(order.paymentMethod ? { paymentMethod: order.paymentMethod } : {}),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return { recap };
|
|
63
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
2
|
+
|
|
3
|
+
import type { PriceRange, SearchFacet } from "../interfaces/search-facets";
|
|
4
|
+
|
|
5
|
+
interface FacetFiltersProps {
|
|
6
|
+
readonly facets: SearchFacet[];
|
|
7
|
+
readonly modelValue: Record<string, string[]>;
|
|
8
|
+
readonly priceRange: PriceRange;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface FacetFiltersCallbacks {
|
|
12
|
+
readonly setFilters: (value: Record<string, string[]>) => void;
|
|
13
|
+
readonly setPriceRange: (value: PriceRange) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const FACET_VALUE_KEY_MAP: Record<string, Record<string, string>> = {
|
|
17
|
+
available: {
|
|
18
|
+
true: "search.filters.values.inStock",
|
|
19
|
+
false: "search.filters.values.outOfStock",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Shared facet-filter logic for the vertical panel (SearchFacets) and the
|
|
25
|
+
* horizontal bar (SearchFacetsBar): value toggling, active counts, localized
|
|
26
|
+
* facet/value labels and the debounced price range. Presentation and open-state
|
|
27
|
+
* stay in the components; this owns the interaction + i18n only. Callers pass a
|
|
28
|
+
* reactive `props` object and callbacks that forward to their own emits.
|
|
29
|
+
*/
|
|
30
|
+
export function useFacetFilters(props: FacetFiltersProps, callbacks: FacetFiltersCallbacks) {
|
|
31
|
+
const { t } = useI18n();
|
|
32
|
+
const facetMeta = useFacetMeta();
|
|
33
|
+
|
|
34
|
+
const visibleFacets = computed(() => props.facets.filter(f => f.counts.length > 0));
|
|
35
|
+
|
|
36
|
+
const hasActiveFilters = computed(() =>
|
|
37
|
+
Object.values(props.modelValue).some(v => v.length > 0)
|
|
38
|
+
|| props.priceRange.min !== undefined
|
|
39
|
+
|| props.priceRange.max !== undefined,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
function activeCount(field: string): number {
|
|
43
|
+
return props.modelValue[field]?.length ?? 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function isChecked(field: string, value: string): boolean {
|
|
47
|
+
return props.modelValue[field]?.includes(value) ?? false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function toggle(field: string, value: string) {
|
|
51
|
+
const current = props.modelValue[field] ?? [];
|
|
52
|
+
const next = current.includes(value)
|
|
53
|
+
? current.filter(v => v !== value)
|
|
54
|
+
: [...current, value];
|
|
55
|
+
callbacks.setFilters({ ...props.modelValue, [field]: next });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function clearAll() {
|
|
59
|
+
callbacks.setFilters({});
|
|
60
|
+
callbacks.setPriceRange({});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function facetLabel(fieldName: string): string {
|
|
64
|
+
// Per-tenant dynamic facets come from the Products app's is_filterable
|
|
65
|
+
// attributes — labels live in the attribute meta, not the i18n bundle.
|
|
66
|
+
// Spine facets keep the i18n key path.
|
|
67
|
+
if (fieldName.startsWith("attrs.")) {
|
|
68
|
+
return facetMeta.label(fieldName.slice(6));
|
|
69
|
+
}
|
|
70
|
+
return t(`search.filters.facets.${fieldName}`, fieldName);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function facetValueLabel(fieldName: string, value: string): string {
|
|
74
|
+
// Dynamic facet values: select-attribute options carry their own labels
|
|
75
|
+
// map (de/en); the doc stores the raw option code. Look up the localized
|
|
76
|
+
// label via the meta cache.
|
|
77
|
+
if (fieldName.startsWith("attrs.")) {
|
|
78
|
+
return facetMeta.valueLabel(fieldName.slice(6), value);
|
|
79
|
+
}
|
|
80
|
+
const key = FACET_VALUE_KEY_MAP[fieldName]?.[value];
|
|
81
|
+
return key ? t(key) : value;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* ---- price range (euros, debounced) ------------------------------- */
|
|
85
|
+
const localPriceMin = ref<number | undefined>(props.priceRange.min);
|
|
86
|
+
const localPriceMax = ref<number | undefined>(props.priceRange.max);
|
|
87
|
+
|
|
88
|
+
watch(
|
|
89
|
+
() => props.priceRange,
|
|
90
|
+
(val) => {
|
|
91
|
+
localPriceMin.value = val.min;
|
|
92
|
+
localPriceMax.value = val.max;
|
|
93
|
+
},
|
|
94
|
+
{ deep: true },
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const emitPrice = useDebounceFn(() => {
|
|
98
|
+
callbacks.setPriceRange({
|
|
99
|
+
min: typeof localPriceMin.value === "number" && !isNaN(localPriceMin.value)
|
|
100
|
+
? localPriceMin.value
|
|
101
|
+
: undefined,
|
|
102
|
+
max: typeof localPriceMax.value === "number" && !isNaN(localPriceMax.value)
|
|
103
|
+
? localPriceMax.value
|
|
104
|
+
: undefined,
|
|
105
|
+
});
|
|
106
|
+
}, 400);
|
|
107
|
+
|
|
108
|
+
function onPriceChange() {
|
|
109
|
+
void emitPrice();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const priceActive = computed(() =>
|
|
113
|
+
props.priceRange.min !== undefined || props.priceRange.max !== undefined,
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
visibleFacets, hasActiveFilters,
|
|
118
|
+
activeCount, isChecked, toggle, clearAll,
|
|
119
|
+
facetLabel, facetValueLabel,
|
|
120
|
+
localPriceMin, localPriceMax, onPriceChange, priceActive,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -13,10 +13,21 @@ import type {
|
|
|
13
13
|
export const useProductDetail = (id: MaybeRefOrGetter<string>) => {
|
|
14
14
|
const { public: { locale, taxIncludedPrices } } = useRuntimeConfig();
|
|
15
15
|
const currency = useDisplayCurrency();
|
|
16
|
+
const { locale: activeLocale } = useI18n();
|
|
16
17
|
|
|
17
18
|
const { data: detail, status, error, refresh } = useFetch<ProductDetail | null>(
|
|
18
19
|
() => productApi.detail(toValue(id)),
|
|
19
20
|
{
|
|
21
|
+
// The BFF resolves the locale from `x-locale` first. Without this
|
|
22
|
+
// header it falls through to the browser's Accept-Language, so a
|
|
23
|
+
// German browser saw German product text on the /en pages while the
|
|
24
|
+
// UI and <html lang> had already switched.
|
|
25
|
+
headers: computed(() => ({ "x-locale": activeLocale.value })),
|
|
26
|
+
// An explicit key: without one this fetch's result is not carried
|
|
27
|
+
// in the SSR payload, so the client refetches on hydration and
|
|
28
|
+
// renders "product not found" over a correctly server-rendered page
|
|
29
|
+
// until it resolves.
|
|
30
|
+
key: () => `product-detail:${toValue(id)}`,
|
|
20
31
|
default: () => null,
|
|
21
32
|
},
|
|
22
33
|
);
|
|
@@ -36,7 +36,7 @@ export interface ListingResponse {
|
|
|
36
36
|
export function useProductListing(options: ProductListingOptions) {
|
|
37
37
|
const route = useRoute();
|
|
38
38
|
const router = useRouter();
|
|
39
|
-
const { t } = useI18n();
|
|
39
|
+
const { t, locale } = useI18n();
|
|
40
40
|
const { productsPerPage } = useRuntimeConfig().public;
|
|
41
41
|
|
|
42
42
|
// Static facets (configured by the calling page) plus dynamic
|
|
@@ -135,6 +135,10 @@ export function useProductListing(options: ProductListingOptions) {
|
|
|
135
135
|
key: `listing:${options.key}`,
|
|
136
136
|
method: "POST",
|
|
137
137
|
body: requestBody,
|
|
138
|
+
// Same reason as useProductDetail: the search route filters the
|
|
139
|
+
// index by locale, and without this header it uses the browser's
|
|
140
|
+
// Accept-Language instead of the locale the visitor selected.
|
|
141
|
+
headers: computed(() => ({ "x-locale": locale.value })),
|
|
138
142
|
immediate: false,
|
|
139
143
|
watch: false,
|
|
140
144
|
},
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
2
|
+
|
|
3
|
+
export interface SearchListingOptions {
|
|
4
|
+
/** The full-text search value the listing searches for. */
|
|
5
|
+
readonly query: () => string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The search page engine: wraps useProductListing across the whole catalog for a
|
|
10
|
+
* full-text query, and exposes the same shape as useCategoryListing (a
|
|
11
|
+
* ListingContext) so the shared `listing_*` widgets work unchanged. There is no
|
|
12
|
+
* category/subcategory here (those resolve to undefined). The locked `search`
|
|
13
|
+
* wrapper block calls this once and provides the result.
|
|
14
|
+
*/
|
|
15
|
+
export const useSearchListing = (options: SearchListingOptions) => {
|
|
16
|
+
const route = useRoute();
|
|
17
|
+
const router = useRouter();
|
|
18
|
+
const { t } = useI18n();
|
|
19
|
+
const localePath = useLocalePath();
|
|
20
|
+
|
|
21
|
+
const query = computed(() => options.query());
|
|
22
|
+
|
|
23
|
+
// No category context on the search page — kept for shape parity with
|
|
24
|
+
// useCategoryListing so the shared listing widgets (incl. the header) work.
|
|
25
|
+
const category = computed(() => undefined);
|
|
26
|
+
const subcategory = computed(() => undefined);
|
|
27
|
+
const categorySlug = computed(() => "");
|
|
28
|
+
const subcategorySlug = computed(() => undefined);
|
|
29
|
+
|
|
30
|
+
// Mirrors the in-category search box mechanics for parity with the header
|
|
31
|
+
// widget; the listing query is prop-driven, so this only reflects the term.
|
|
32
|
+
const q = computed(() => query.value);
|
|
33
|
+
const searchInput = ref(q.value);
|
|
34
|
+
const pushQuery = useDebounceFn(() => {
|
|
35
|
+
void router.replace({
|
|
36
|
+
query: { ...route.query, q: searchInput.value.trim() || undefined, page: undefined },
|
|
37
|
+
});
|
|
38
|
+
}, 350);
|
|
39
|
+
watch(q, (val) => {
|
|
40
|
+
searchInput.value = val;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const listing = useProductListing({
|
|
44
|
+
key: "search",
|
|
45
|
+
query: () => query.value,
|
|
46
|
+
facetFields: ["category", "subcategory", "manufacturer", "available"],
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const title = computed(() =>
|
|
50
|
+
query.value
|
|
51
|
+
? t("search.results.title", { query: query.value })
|
|
52
|
+
: t("search.results.initialTitle"),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const breadcrumb = computed(() => {
|
|
56
|
+
const items: { label: string; to?: string }[] = [
|
|
57
|
+
{ label: t("nav.home"), to: localePath("/") },
|
|
58
|
+
];
|
|
59
|
+
items.push({ label: query.value || t("search.results.initialTitle") });
|
|
60
|
+
return items;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
listing,
|
|
65
|
+
category, subcategory, categorySlug, subcategorySlug,
|
|
66
|
+
title, breadcrumb,
|
|
67
|
+
q, searchInput, pushQuery,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type SearchListing = ReturnType<typeof useSearchListing>;
|
|
@@ -19,6 +19,33 @@ export interface CheckoutProfile {
|
|
|
19
19
|
defaultDeliveryMethod: DeliveryMethod;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* The three outcomes the checkout can produce, driving the confirmation
|
|
24
|
+
* screen's copy, icons and detail link: a plain order, an order awaiting
|
|
25
|
+
* approval, or a requisition.
|
|
26
|
+
*/
|
|
27
|
+
export type ConfirmationType = "order" | "approval" | "requisition";
|
|
28
|
+
|
|
29
|
+
/** A single position on the confirmation recap. */
|
|
30
|
+
export interface ConfirmationLine {
|
|
31
|
+
id: number;
|
|
32
|
+
name: string;
|
|
33
|
+
image?: string;
|
|
34
|
+
sku: string;
|
|
35
|
+
quantity: number;
|
|
36
|
+
unitPrice: number;
|
|
37
|
+
lineTotal: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The order/requisition recap shown to signed-in customers on the thank-you page. */
|
|
41
|
+
export interface ConfirmationRecap {
|
|
42
|
+
lines: ConfirmationLine[];
|
|
43
|
+
total: number;
|
|
44
|
+
deliveryLines: string[];
|
|
45
|
+
billingLines: string[];
|
|
46
|
+
paymentMethod?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
22
49
|
export interface CheckoutOnePageForm {
|
|
23
50
|
shippingAddressId: string;
|
|
24
51
|
billingSameAsShipping: boolean;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"passwordConfirmPlaceholder": "Passwort wiederholen",
|
|
16
16
|
"firstName": "Vorname",
|
|
17
17
|
"lastName": "Nachname",
|
|
18
|
-
"company": "
|
|
18
|
+
"company": "Firma",
|
|
19
19
|
"companyHint": "Optional – Ihr Unternehmen oder Ihre Organisation",
|
|
20
20
|
"acceptTerms": "Ich akzeptiere die AGB",
|
|
21
21
|
"acceptTermsDescription": "Mit der Erstellung eines Kontos stimmen Sie unseren AGB und der Datenschutzerklärung zu. (Demo-Hinweis – es wird kein tatsächlicher Vertrag geschlossen.)"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"editor": {
|
|
3
|
+
"provider": {
|
|
4
|
+
"editLabel": "Seite bearbeiten"
|
|
5
|
+
},
|
|
6
|
+
"appearance": {
|
|
7
|
+
"colorScheme": {
|
|
8
|
+
"title": "Farbschema"
|
|
9
|
+
},
|
|
10
|
+
"layout": {
|
|
11
|
+
"title": "Layout"
|
|
12
|
+
},
|
|
13
|
+
"corners": {
|
|
14
|
+
"heading": "Ecken",
|
|
15
|
+
"rounded": "Abgerundet",
|
|
16
|
+
"squared": "Eckig"
|
|
17
|
+
},
|
|
18
|
+
"spacing": {
|
|
19
|
+
"heading": "Abstände",
|
|
20
|
+
"compact": "Kompakt",
|
|
21
|
+
"comfortable": "Komfortabel",
|
|
22
|
+
"spacious": "Großzügig"
|
|
23
|
+
},
|
|
24
|
+
"font": {
|
|
25
|
+
"heading": "Schrift",
|
|
26
|
+
"default": "Standard",
|
|
27
|
+
"serif": "Serif",
|
|
28
|
+
"mono": "Monospace",
|
|
29
|
+
"geometric": "Geometrisch"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"editor": {
|
|
3
|
+
"provider": {
|
|
4
|
+
"editLabel": "Edit page"
|
|
5
|
+
},
|
|
6
|
+
"appearance": {
|
|
7
|
+
"colorScheme": {
|
|
8
|
+
"title": "Color scheme"
|
|
9
|
+
},
|
|
10
|
+
"layout": {
|
|
11
|
+
"title": "Layout"
|
|
12
|
+
},
|
|
13
|
+
"corners": {
|
|
14
|
+
"heading": "Corners",
|
|
15
|
+
"rounded": "Rounded",
|
|
16
|
+
"squared": "Squared"
|
|
17
|
+
},
|
|
18
|
+
"spacing": {
|
|
19
|
+
"heading": "Spacing",
|
|
20
|
+
"compact": "Compact",
|
|
21
|
+
"comfortable": "Comfortable",
|
|
22
|
+
"spacious": "Spacious"
|
|
23
|
+
},
|
|
24
|
+
"font": {
|
|
25
|
+
"heading": "Font",
|
|
26
|
+
"default": "Default",
|
|
27
|
+
"serif": "Serif",
|
|
28
|
+
"mono": "Monospace",
|
|
29
|
+
"geometric": "Geometric"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revenexx/cover",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"description": "Cover \u2014 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",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|