@revenexx/cover 0.1.15 → 0.1.17
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/orders/AccountOrderDetail.vue +29 -6
- package/app/interfaces/account/order-list.ts +7 -1
- package/app/middleware/account-auth.global.ts +24 -0
- package/app/middleware/checkout-guard.ts +11 -0
- package/app/middleware/guest-only.ts +9 -0
- package/app/plugins/safari-keyboard-nav.client.ts +10 -0
- package/i18n/locales/de/account.json +6 -3
- package/i18n/locales/en/account.json +6 -3
- package/package.json +1 -1
- package/server/utils/liveOrders.ts +6 -0
|
@@ -296,12 +296,35 @@ async function orderAgain(): Promise<void> {
|
|
|
296
296
|
</span>
|
|
297
297
|
</li>
|
|
298
298
|
</ul>
|
|
299
|
-
<div
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
299
|
+
<div class="px-4 sm:px-5 py-3 border-t border-(--ui-border) text-sm">
|
|
300
|
+
<div
|
|
301
|
+
v-if="order.subtotal !== undefined"
|
|
302
|
+
class="flex justify-between py-0.5 text-highlighted"
|
|
303
|
+
>
|
|
304
|
+
<span>{{ t('orders.card.subtotal') }}</span>
|
|
305
|
+
<span class="tabular-nums">{{ formatCurrency(order.subtotal) }}</span>
|
|
306
|
+
</div>
|
|
307
|
+
<div
|
|
308
|
+
v-if="order.shipping !== undefined"
|
|
309
|
+
class="flex justify-between py-0.5 text-highlighted"
|
|
310
|
+
>
|
|
311
|
+
<span>{{ t('orders.card.shipping') }}</span>
|
|
312
|
+
<span class="tabular-nums">{{ formatCurrency(order.shipping) }}</span>
|
|
313
|
+
</div>
|
|
314
|
+
<div
|
|
315
|
+
v-if="order.tax !== undefined"
|
|
316
|
+
class="flex justify-between py-0.5 text-muted"
|
|
317
|
+
>
|
|
318
|
+
<span>{{ t('orders.card.tax') }}</span>
|
|
319
|
+
<span class="tabular-nums">{{ formatCurrency(order.tax) }}</span>
|
|
320
|
+
</div>
|
|
321
|
+
<div
|
|
322
|
+
class="flex justify-between pt-2 mt-1 border-t border-(--ui-border)
|
|
323
|
+
font-semibold text-highlighted"
|
|
324
|
+
>
|
|
325
|
+
<span>{{ t('orders.card.total') }}</span>
|
|
326
|
+
<span class="tabular-nums">{{ formatCurrency(order.total) }}</span>
|
|
327
|
+
</div>
|
|
305
328
|
</div>
|
|
306
329
|
</section>
|
|
307
330
|
|
|
@@ -24,7 +24,13 @@ export interface AccountOrder {
|
|
|
24
24
|
readonly date: string;
|
|
25
25
|
readonly status: AccountOrderStatus;
|
|
26
26
|
readonly paymentStatus: AccountOrderPaymentStatus;
|
|
27
|
-
/** Net
|
|
27
|
+
/** Net goods subtotal (excl. shipping and tax). Live orders only. */
|
|
28
|
+
readonly subtotal?: number;
|
|
29
|
+
/** Shipping cost (net). Live orders only. */
|
|
30
|
+
readonly shipping?: number;
|
|
31
|
+
/** Tax amount included in the total. Live orders only. */
|
|
32
|
+
readonly tax?: number;
|
|
33
|
+
/** Gross order total (incl. shipping and tax) — the amount charged. */
|
|
28
34
|
readonly total: number;
|
|
29
35
|
readonly currency: string;
|
|
30
36
|
/** Customer's own order/PO number from the checkout. */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default defineNuxtRouteMiddleware(async (to) => {
|
|
2
|
+
const routeName = typeof to.name === "string" ? to.name : "";
|
|
3
|
+
const isAccountRoute = routeName.startsWith("account");
|
|
4
|
+
|
|
5
|
+
if (!isAccountRoute) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Resolve the session against the BFF like guest-only and checkout-guard
|
|
10
|
+
// do. The auth store's user is not hydrated during SSR, so store-based
|
|
11
|
+
// checks would bounce signed-in users to /login — and guest-only would
|
|
12
|
+
// bounce them straight back, looping the request.
|
|
13
|
+
const headers = useRequestHeaders(["cookie"]);
|
|
14
|
+
const user = await $fetch<{ $id: string } | null>("/api/auth/me", { headers }).catch(() => null);
|
|
15
|
+
if (user) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const localePath = useLocalePath();
|
|
20
|
+
return navigateTo(localePath({
|
|
21
|
+
path: "/login",
|
|
22
|
+
query: { redirect: to.fullPath },
|
|
23
|
+
}));
|
|
24
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default defineNuxtRouteMiddleware(() => {
|
|
2
|
+
const localePath = useLocalePath();
|
|
3
|
+
|
|
4
|
+
// Authentication is handled on the page itself (checkout gate with
|
|
5
|
+
// login + guest ordering per organization flags) — the guard only
|
|
6
|
+
// ensures there is something to check out.
|
|
7
|
+
const cartHasItems = useCookie("cover-cart-has-items");
|
|
8
|
+
if (!cartHasItems.value) {
|
|
9
|
+
return navigateTo(localePath("cart"));
|
|
10
|
+
}
|
|
11
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default defineNuxtRouteMiddleware(async () => {
|
|
2
|
+
const localePath = useLocalePath();
|
|
3
|
+
|
|
4
|
+
const headers = useRequestHeaders(["cookie"]);
|
|
5
|
+
const user = await $fetch<{ $id: string } | null>("/api/auth/me", { headers }).catch(() => null);
|
|
6
|
+
if (user) {
|
|
7
|
+
return navigateTo(localePath("/account"));
|
|
8
|
+
}
|
|
9
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
2
|
+
const patch = () => {
|
|
3
|
+
void nextTick(() => {
|
|
4
|
+
document.querySelectorAll("[data-slot=\"link\"]:not([tabindex]), button[role=\"combobox\"]:not([tabindex])").forEach((el) => {
|
|
5
|
+
el.setAttribute("tabindex", "0");
|
|
6
|
+
});
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
nuxtApp.hook("page:finish", patch);
|
|
10
|
+
});
|
|
@@ -67,8 +67,11 @@
|
|
|
67
67
|
"date": "Datum",
|
|
68
68
|
"shippingStatus": "Versandstatus",
|
|
69
69
|
"paymentStatus": "Zahlungsstatus",
|
|
70
|
-
"total": "
|
|
71
|
-
"yourOrderNumber": "Ihre Bestellnummer"
|
|
70
|
+
"total": "Gesamtbetrag",
|
|
71
|
+
"yourOrderNumber": "Ihre Bestellnummer",
|
|
72
|
+
"subtotal": "Warenwert",
|
|
73
|
+
"shipping": "Versandkosten",
|
|
74
|
+
"tax": "MwSt."
|
|
72
75
|
},
|
|
73
76
|
"status": {
|
|
74
77
|
"processing": "In Bearbeitung",
|
|
@@ -113,7 +116,7 @@
|
|
|
113
116
|
"id": "Bestellung",
|
|
114
117
|
"date": "Datum",
|
|
115
118
|
"positions": "Positionen",
|
|
116
|
-
"total": "
|
|
119
|
+
"total": "Gesamtbetrag",
|
|
117
120
|
"status": "Status",
|
|
118
121
|
"payment": "Zahlung"
|
|
119
122
|
}
|
|
@@ -67,8 +67,11 @@
|
|
|
67
67
|
"date": "Date",
|
|
68
68
|
"shippingStatus": "Shipping status",
|
|
69
69
|
"paymentStatus": "Payment status",
|
|
70
|
-
"total": "Total
|
|
71
|
-
"yourOrderNumber": "Your order number"
|
|
70
|
+
"total": "Total",
|
|
71
|
+
"yourOrderNumber": "Your order number",
|
|
72
|
+
"subtotal": "Subtotal",
|
|
73
|
+
"shipping": "Shipping",
|
|
74
|
+
"tax": "VAT"
|
|
72
75
|
},
|
|
73
76
|
"status": {
|
|
74
77
|
"processing": "Processing",
|
|
@@ -113,7 +116,7 @@
|
|
|
113
116
|
"id": "Order",
|
|
114
117
|
"date": "Date",
|
|
115
118
|
"positions": "Items",
|
|
116
|
-
"total": "Total
|
|
119
|
+
"total": "Total",
|
|
117
120
|
"status": "Status",
|
|
118
121
|
"payment": "Payment"
|
|
119
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revenexx/cover",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
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",
|
|
@@ -29,6 +29,9 @@ export interface LiveOrder {
|
|
|
29
29
|
payment_status: string;
|
|
30
30
|
fulfillment_status: string;
|
|
31
31
|
currency: string;
|
|
32
|
+
subtotal: number;
|
|
33
|
+
shipping_total: number;
|
|
34
|
+
tax_total: number;
|
|
32
35
|
grand_total: number;
|
|
33
36
|
billing_address: Record<string, unknown> | null;
|
|
34
37
|
shipping_address: Record<string, unknown> | null;
|
|
@@ -113,6 +116,9 @@ export function mapLiveOrderToAccount(order: LiveOrder): AccountOrder {
|
|
|
113
116
|
date: day(placed),
|
|
114
117
|
status: mapStatus(order),
|
|
115
118
|
paymentStatus: mapPaymentStatus(order.payment_status),
|
|
119
|
+
subtotal: Number(order.subtotal),
|
|
120
|
+
shipping: Number(order.shipping_total),
|
|
121
|
+
tax: Number(order.tax_total),
|
|
116
122
|
total: Number(order.grand_total),
|
|
117
123
|
currency: order.currency,
|
|
118
124
|
...(order.customer_order_number ? { orderNumber: order.customer_order_number } : {}),
|