@revenexx/cover 0.19.0 → 0.21.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.
- package/app/api/marketing.ts +24 -0
- package/app/app.config.ts +22 -0
- package/app/components/account/approvals/AccountPendingApprovals.vue +54 -13
- package/app/components/account/approvals/AccountPendingOrderDetail.vue +156 -0
- package/app/components/account/loyalty/AccountLoyalty.vue +205 -0
- package/app/components/account/orders/AccountOrderContents.vue +142 -0
- package/app/components/account/orders/AccountOrderDetail.vue +16 -178
- package/app/components/account/orders/AccountOrderHead.vue +79 -0
- package/app/components/account/orders/AccountOrderPay.vue +13 -3
- package/app/components/account/orders/AccountOrdersTable.vue +2 -0
- package/app/components/cart/position/CartPosition.vue +6 -6
- package/app/components/cart/view/CartSummaryPanel.vue +4 -0
- package/app/components/checkout/onepage/CheckoutPaymentSection.vue +20 -8
- package/app/components/checkout/onepage/CheckoutSummarySection.vue +4 -0
- package/app/components/checkout/return/CheckoutPaymentReturn.vue +209 -0
- package/app/components/loyalty/hint/LoyaltyPerkHint.vue +28 -0
- package/app/components/newsletter/confirm/NewsletterConfirmation.vue +54 -0
- package/app/components/newsletter/preferences/NewsletterPreferenceCentre.vue +183 -0
- package/app/components/newsletter/state/NewsletterLinkRefusal.vue +45 -0
- package/app/components/review/form/ReviewForm.vue +211 -0
- package/app/composables/useAccountDashboard.ts +1 -0
- package/app/composables/useCampaignAttribution.ts +120 -0
- package/app/composables/useCheckoutOnePage.ts +80 -7
- package/app/composables/useLoyaltyAccount.ts +79 -0
- package/app/composables/useMarketingConsent.ts +49 -0
- package/app/composables/usePendingApprovals.ts +11 -3
- package/app/composables/usePspCheckout.ts +130 -29
- package/app/config/colorRamp.ts +55 -0
- package/app/config/navigation.ts +1 -1
- package/app/config/quickActions.ts +1 -0
- package/app/interfaces/account/approvals.ts +34 -1
- package/app/interfaces/account/order-list.ts +8 -1
- package/app/interfaces/cart-calculation.ts +7 -1
- package/app/interfaces/cart-item.ts +12 -0
- package/app/interfaces/payment.ts +22 -0
- package/app/pages/account/points.vue +26 -0
- package/app/pages/checkout/payment-return.vue +17 -0
- package/app/pages/newsletter/confirm/[token].vue +23 -0
- package/app/pages/newsletter/preferences/[token].vue +24 -0
- package/app/pages/review/[token].vue +23 -0
- package/app/payments/psp/novalnet.ts +255 -0
- package/app/payments/psp/registry.ts +7 -3
- package/app/payments/psp/rules.ts +99 -0
- package/app/payments/psp/stripe.ts +6 -2
- package/app/payments/psp/types.ts +72 -6
- package/app/plugins/campaign-attribution.client.ts +47 -0
- package/app/shared/campaignAttribution.ts +281 -0
- package/app/shared/personalisation.ts +107 -0
- package/app/shared/pspReturn.ts +62 -0
- package/i18n/locales/de/account.json +20 -5
- package/i18n/locales/de/cart.json +4 -2
- package/i18n/locales/de/checkout.json +32 -0
- package/i18n/locales/de/editor.json +10 -0
- package/i18n/locales/de/marketing.json +71 -0
- package/i18n/locales/en/account.json +20 -5
- package/i18n/locales/en/cart.json +4 -2
- package/i18n/locales/en/checkout.json +32 -0
- package/i18n/locales/en/editor.json +10 -0
- package/i18n/locales/en/marketing.json +71 -0
- package/package.json +3 -2
- package/server/api/account/orders/[id]/pay.post.ts +47 -7
- package/server/api/account/pending-approvals/index.get.ts +16 -12
- package/server/api/account/pending-approvals/orders/[number]/approve.post.ts +6 -0
- package/server/api/account/pending-approvals/orders/[number]/reject.post.ts +6 -0
- package/server/api/account/pending-approvals/orders/[number].get.ts +15 -0
- package/server/api/campaigns/touches.post.ts +42 -0
- package/server/api/cart/attribution.put.ts +31 -0
- package/server/api/checkout/payment-return.post.ts +30 -0
- package/server/api/loyalty/account.get.ts +27 -0
- package/server/api/newsletter/confirm/[token].post.ts +21 -0
- package/server/api/newsletter/preferences/[token].get.ts +14 -0
- package/server/api/newsletter/preferences/[token].post.ts +36 -0
- package/server/api/orders/index.post.ts +47 -12
- package/server/api/payment/methods.post.ts +19 -9
- package/server/api/payment/psp-config.get.ts +5 -4
- package/server/api/reviews/requests/[token].get.ts +14 -0
- package/server/api/reviews/submit/[token].post.ts +31 -0
- package/server/interfaces/cart.ts +6 -0
- package/server/interfaces/marketing.ts +150 -0
- package/server/services/ApiCartService.ts +22 -0
- package/server/services/ApiMarketingService.ts +292 -0
- package/server/services/ApiProductService.ts +6 -2
- package/server/services/MockCartCalculationService.ts +29 -0
- package/server/services/MockMarketingService.ts +178 -0
- package/server/utils/cartItemHints.ts +29 -0
- package/server/utils/checkoutSession.ts +16 -0
- package/server/utils/liveCatalog.ts +244 -31
- package/server/utils/liveOrders.ts +33 -0
- package/server/utils/marketingService.ts +63 -0
- package/server/utils/orderAttribution.ts +65 -0
- package/server/utils/orderPayment.ts +79 -0
- package/server/utils/pendingApprovals.ts +157 -2
- package/server/utils/personalisationViewer.ts +28 -0
- package/server/utils/pspConfig.ts +125 -13
- package/server/utils/pspReturn.ts +267 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { AccountOrder } from "../../../interfaces/account/order-list";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What an order holds and where it goes: the positions with their totals, the
|
|
6
|
+
* addresses, the payment method and the tracking. Read-only, shared by the
|
|
7
|
+
* buyer's own order page and the approver's view (RAD-229).
|
|
8
|
+
*/
|
|
9
|
+
defineProps<{
|
|
10
|
+
order: AccountOrder;
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const { icon } = useIcons();
|
|
14
|
+
const { t } = useI18n();
|
|
15
|
+
const { formatCurrency } = useCartSummaryFormatting();
|
|
16
|
+
|
|
17
|
+
/* Addresses arrive as " · "-joined lines. */
|
|
18
|
+
const addressLines = (value: string): string[] => value.split(" · ");
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<div class="space-y-6">
|
|
23
|
+
<!-- Positions -->
|
|
24
|
+
<section class="border border-(--ui-border) rounded-xl overflow-hidden">
|
|
25
|
+
<h2 class="px-4 sm:px-5 py-3 text-sm font-semibold text-highlighted bg-elevated/60 border-b border-(--ui-border)">
|
|
26
|
+
{{ t('orders.positionsTitle') }}
|
|
27
|
+
</h2>
|
|
28
|
+
<ul class="divide-y divide-(--ui-border) px-4 sm:px-5">
|
|
29
|
+
<li
|
|
30
|
+
v-for="position in order.positions"
|
|
31
|
+
:key="position.id"
|
|
32
|
+
class="flex items-center gap-3 py-3"
|
|
33
|
+
>
|
|
34
|
+
<span
|
|
35
|
+
class="w-14 h-14 shrink-0 flex items-center justify-center rounded-lg
|
|
36
|
+
bg-elevated/60 ring-1 ring-(--ui-border) p-1.5"
|
|
37
|
+
>
|
|
38
|
+
<ProductMediaImage
|
|
39
|
+
:src="position.image ?? ''"
|
|
40
|
+
:alt="position.name"
|
|
41
|
+
/>
|
|
42
|
+
</span>
|
|
43
|
+
<div class="min-w-0 flex-1">
|
|
44
|
+
<p class="text-sm font-medium text-highlighted md:truncate">
|
|
45
|
+
{{ position.name }}
|
|
46
|
+
</p>
|
|
47
|
+
<p class="text-xs text-muted">
|
|
48
|
+
{{ position.sku }} · {{ position.quantity }}× {{ formatCurrency(position.unitPrice) }}
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
<span class="text-sm tabular-nums text-highlighted shrink-0">
|
|
52
|
+
{{ formatCurrency(position.lineTotal) }}
|
|
53
|
+
</span>
|
|
54
|
+
</li>
|
|
55
|
+
</ul>
|
|
56
|
+
<div class="px-4 sm:px-5 py-3 border-t border-(--ui-border) text-sm">
|
|
57
|
+
<div
|
|
58
|
+
v-if="order.subtotal !== undefined"
|
|
59
|
+
class="flex justify-between py-0.5 text-highlighted"
|
|
60
|
+
>
|
|
61
|
+
<span>{{ t('orders.card.subtotal') }}</span>
|
|
62
|
+
<span class="tabular-nums">{{ formatCurrency(order.subtotal) }}</span>
|
|
63
|
+
</div>
|
|
64
|
+
<div
|
|
65
|
+
v-if="order.shipping !== undefined"
|
|
66
|
+
class="flex justify-between py-0.5 text-highlighted"
|
|
67
|
+
>
|
|
68
|
+
<span>{{ t('orders.card.shipping') }}</span>
|
|
69
|
+
<span class="tabular-nums">{{ formatCurrency(order.shipping) }}</span>
|
|
70
|
+
</div>
|
|
71
|
+
<div
|
|
72
|
+
v-if="order.tax !== undefined"
|
|
73
|
+
class="flex justify-between py-0.5 text-muted"
|
|
74
|
+
>
|
|
75
|
+
<span>{{ t('orders.card.tax') }}</span>
|
|
76
|
+
<span class="tabular-nums">{{ formatCurrency(order.tax) }}</span>
|
|
77
|
+
</div>
|
|
78
|
+
<div
|
|
79
|
+
class="flex justify-between pt-2 mt-1 border-t border-(--ui-border)
|
|
80
|
+
font-semibold text-highlighted"
|
|
81
|
+
>
|
|
82
|
+
<span>{{ t('orders.card.total') }}</span>
|
|
83
|
+
<span class="tabular-nums">{{ formatCurrency(order.total) }}</span>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</section>
|
|
87
|
+
|
|
88
|
+
<!-- Delivery & payment -->
|
|
89
|
+
<section class="border border-(--ui-border) rounded-xl overflow-hidden">
|
|
90
|
+
<h2 class="px-4 sm:px-5 py-3 text-sm font-semibold text-highlighted bg-elevated/60 border-b border-(--ui-border)">
|
|
91
|
+
{{ t('orders.detail.infoTitle') }}
|
|
92
|
+
</h2>
|
|
93
|
+
<dl class="grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-6 p-4 sm:p-5 text-sm">
|
|
94
|
+
<div v-if="order.deliveryAddress">
|
|
95
|
+
<dt class="font-medium text-highlighted">
|
|
96
|
+
{{ t('orders.deliveryAddress') }}
|
|
97
|
+
</dt>
|
|
98
|
+
<dd class="mt-2 text-muted">
|
|
99
|
+
<span
|
|
100
|
+
v-for="line in addressLines(order.deliveryAddress)"
|
|
101
|
+
:key="line"
|
|
102
|
+
class="block"
|
|
103
|
+
>{{ line }}</span>
|
|
104
|
+
</dd>
|
|
105
|
+
</div>
|
|
106
|
+
<div v-if="order.billingAddress">
|
|
107
|
+
<dt class="font-medium text-highlighted">
|
|
108
|
+
{{ t('orders.detail.billingAddress') }}
|
|
109
|
+
</dt>
|
|
110
|
+
<dd class="mt-2 text-muted">
|
|
111
|
+
<span
|
|
112
|
+
v-for="line in addressLines(order.billingAddress)"
|
|
113
|
+
:key="line"
|
|
114
|
+
class="block"
|
|
115
|
+
>{{ line }}</span>
|
|
116
|
+
</dd>
|
|
117
|
+
</div>
|
|
118
|
+
<div v-if="order.paymentMethod">
|
|
119
|
+
<dt class="font-medium text-highlighted">
|
|
120
|
+
{{ t('orders.detail.paymentMethodLabel') }}
|
|
121
|
+
</dt>
|
|
122
|
+
<dd class="mt-2 text-muted flex items-center gap-2">
|
|
123
|
+
<UIcon
|
|
124
|
+
:name="icon('payment')"
|
|
125
|
+
class="size-4 text-dimmed"
|
|
126
|
+
/>
|
|
127
|
+
{{ t(`paymentMethods.${order.paymentMethod}`) }}
|
|
128
|
+
</dd>
|
|
129
|
+
</div>
|
|
130
|
+
<div v-if="order.tracking">
|
|
131
|
+
<dt class="font-medium text-highlighted">
|
|
132
|
+
{{ t('orders.detail.trackingTitle') }}
|
|
133
|
+
</dt>
|
|
134
|
+
<dd class="mt-2 text-muted">
|
|
135
|
+
<span class="block">{{ order.tracking.carrier }}</span>
|
|
136
|
+
<span class="block tabular-nums">{{ order.tracking.trackingNumber }}</span>
|
|
137
|
+
</dd>
|
|
138
|
+
</div>
|
|
139
|
+
</dl>
|
|
140
|
+
</section>
|
|
141
|
+
</div>
|
|
142
|
+
</template>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { accountApi } from "../../../api/account";
|
|
3
3
|
import { withdrawalPath } from "../../../config/navigation";
|
|
4
|
-
import type { AccountOrder, AccountOrderMessage
|
|
4
|
+
import type { AccountOrder, AccountOrderMessage } from "../../../interfaces/account/order-list";
|
|
5
5
|
|
|
6
|
+
import AccountOrderContents from "./AccountOrderContents.vue";
|
|
7
|
+
import AccountOrderHead from "./AccountOrderHead.vue";
|
|
6
8
|
import AccountOrderPay from "./AccountOrderPay.vue";
|
|
7
9
|
|
|
8
10
|
/**
|
|
@@ -25,7 +27,6 @@ const { t, d } = useI18n();
|
|
|
25
27
|
const { to } = useAppUrl();
|
|
26
28
|
const toast = useToast();
|
|
27
29
|
const cart = useCartStore();
|
|
28
|
-
const { formatCurrency } = useCartSummaryFormatting();
|
|
29
30
|
|
|
30
31
|
const { data: order, status, error, refresh } = useFetch<AccountOrder>(
|
|
31
32
|
`/api/account/orders/${props.orderId}`,
|
|
@@ -115,20 +116,6 @@ async function submitCancel(): Promise<void> {
|
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
const statusColors: Record<AccountOrderStatus, "info" | "warning" | "primary" | "success" | "error"> = {
|
|
119
|
-
"processing": "info",
|
|
120
|
-
"approval-pending": "warning",
|
|
121
|
-
"shipped": "primary",
|
|
122
|
-
"delivered": "success",
|
|
123
|
-
"cancelled": "error",
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const paymentColors: Record<AccountOrderPaymentStatus, "warning" | "success" | "neutral"> = {
|
|
127
|
-
open: "warning",
|
|
128
|
-
paid: "success",
|
|
129
|
-
refunded: "neutral",
|
|
130
|
-
};
|
|
131
|
-
|
|
132
119
|
const formatDate = (value: string) => {
|
|
133
120
|
const parsed = new Date(value);
|
|
134
121
|
return Number.isNaN(parsed.getTime()) ? value : d(parsed, { dateStyle: "medium" });
|
|
@@ -161,8 +148,6 @@ const milestoneDate = (step: string): string | undefined => {
|
|
|
161
148
|
return milestone?.date ? formatDate(milestone.date) : undefined;
|
|
162
149
|
};
|
|
163
150
|
|
|
164
|
-
/* ---- addresses (seeded as " · "-joined lines) ------------------------- */
|
|
165
|
-
const addressLines = (value: string): string[] => value.split(" · ");
|
|
166
151
|
|
|
167
152
|
async function copyTracking(): Promise<void> {
|
|
168
153
|
if (!order.value?.tracking) {
|
|
@@ -305,48 +290,18 @@ async function submitReturn(): Promise<void> {
|
|
|
305
290
|
v-else
|
|
306
291
|
class="space-y-6"
|
|
307
292
|
>
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
</div>
|
|
321
|
-
<div v-if="order.orderNumber">
|
|
322
|
-
<p class="text-xs text-muted">
|
|
323
|
-
{{ t('orders.card.yourOrderNumber') }}
|
|
324
|
-
</p>
|
|
325
|
-
<p class="text-sm font-medium text-highlighted">
|
|
326
|
-
{{ order.orderNumber }}
|
|
327
|
-
</p>
|
|
328
|
-
</div>
|
|
329
|
-
<div>
|
|
330
|
-
<p class="text-xs text-muted">
|
|
331
|
-
{{ t('orders.card.total') }}
|
|
332
|
-
</p>
|
|
333
|
-
<p class="text-sm font-semibold text-highlighted tabular-nums">
|
|
334
|
-
{{ formatCurrency(order.total) }}
|
|
335
|
-
</p>
|
|
336
|
-
</div>
|
|
337
|
-
<div class="flex items-center gap-2 ms-auto">
|
|
338
|
-
<UBadge
|
|
339
|
-
:color="statusColors[order.status]"
|
|
340
|
-
variant="subtle"
|
|
341
|
-
:label="t(`orders.status.${order.status}`)"
|
|
342
|
-
/>
|
|
343
|
-
<UBadge
|
|
344
|
-
:color="paymentColors[order.paymentStatus]"
|
|
345
|
-
variant="outline"
|
|
346
|
-
:label="t(`orders.payment.${order.paymentStatus}`)"
|
|
347
|
-
/>
|
|
348
|
-
</div>
|
|
349
|
-
</div>
|
|
293
|
+
<AccountOrderHead :order="order" />
|
|
294
|
+
|
|
295
|
+
<!-- Somebody who may approve said no (RAD-229): the reason is the one
|
|
296
|
+
thing the requester learns, so it stands where they look first. -->
|
|
297
|
+
<UAlert
|
|
298
|
+
v-if="order.status === 'rejected'"
|
|
299
|
+
color="error"
|
|
300
|
+
variant="soft"
|
|
301
|
+
:icon="icon('close')"
|
|
302
|
+
:title="t('orders.rejected.title')"
|
|
303
|
+
:description="order.rejection?.reason"
|
|
304
|
+
/>
|
|
350
305
|
|
|
351
306
|
<UAlert
|
|
352
307
|
v-if="order.status === 'approval-pending' && order.approvers?.length"
|
|
@@ -446,124 +401,7 @@ async function submitReturn(): Promise<void> {
|
|
|
446
401
|
</div>
|
|
447
402
|
</section>
|
|
448
403
|
|
|
449
|
-
|
|
450
|
-
<section class="border border-(--ui-border) rounded-xl overflow-hidden">
|
|
451
|
-
<h2 class="px-4 sm:px-5 py-3 text-sm font-semibold text-highlighted bg-elevated/60 border-b border-(--ui-border)">
|
|
452
|
-
{{ t('orders.positionsTitle') }}
|
|
453
|
-
</h2>
|
|
454
|
-
<ul class="divide-y divide-(--ui-border) px-4 sm:px-5">
|
|
455
|
-
<li
|
|
456
|
-
v-for="position in order.positions"
|
|
457
|
-
:key="position.id"
|
|
458
|
-
class="flex items-center gap-3 py-3"
|
|
459
|
-
>
|
|
460
|
-
<span
|
|
461
|
-
class="w-14 h-14 shrink-0 flex items-center justify-center rounded-lg
|
|
462
|
-
bg-elevated/60 ring-1 ring-(--ui-border) p-1.5"
|
|
463
|
-
>
|
|
464
|
-
<ProductMediaImage
|
|
465
|
-
:src="position.image ?? ''"
|
|
466
|
-
:alt="position.name"
|
|
467
|
-
/>
|
|
468
|
-
</span>
|
|
469
|
-
<div class="min-w-0 flex-1">
|
|
470
|
-
<p class="text-sm font-medium text-highlighted md:truncate">
|
|
471
|
-
{{ position.name }}
|
|
472
|
-
</p>
|
|
473
|
-
<p class="text-xs text-muted">
|
|
474
|
-
{{ position.sku }} · {{ position.quantity }}× {{ formatCurrency(position.unitPrice) }}
|
|
475
|
-
</p>
|
|
476
|
-
</div>
|
|
477
|
-
<span class="text-sm tabular-nums text-highlighted shrink-0">
|
|
478
|
-
{{ formatCurrency(position.lineTotal) }}
|
|
479
|
-
</span>
|
|
480
|
-
</li>
|
|
481
|
-
</ul>
|
|
482
|
-
<div class="px-4 sm:px-5 py-3 border-t border-(--ui-border) text-sm">
|
|
483
|
-
<div
|
|
484
|
-
v-if="order.subtotal !== undefined"
|
|
485
|
-
class="flex justify-between py-0.5 text-highlighted"
|
|
486
|
-
>
|
|
487
|
-
<span>{{ t('orders.card.subtotal') }}</span>
|
|
488
|
-
<span class="tabular-nums">{{ formatCurrency(order.subtotal) }}</span>
|
|
489
|
-
</div>
|
|
490
|
-
<div
|
|
491
|
-
v-if="order.shipping !== undefined"
|
|
492
|
-
class="flex justify-between py-0.5 text-highlighted"
|
|
493
|
-
>
|
|
494
|
-
<span>{{ t('orders.card.shipping') }}</span>
|
|
495
|
-
<span class="tabular-nums">{{ formatCurrency(order.shipping) }}</span>
|
|
496
|
-
</div>
|
|
497
|
-
<div
|
|
498
|
-
v-if="order.tax !== undefined"
|
|
499
|
-
class="flex justify-between py-0.5 text-muted"
|
|
500
|
-
>
|
|
501
|
-
<span>{{ t('orders.card.tax') }}</span>
|
|
502
|
-
<span class="tabular-nums">{{ formatCurrency(order.tax) }}</span>
|
|
503
|
-
</div>
|
|
504
|
-
<div
|
|
505
|
-
class="flex justify-between pt-2 mt-1 border-t border-(--ui-border)
|
|
506
|
-
font-semibold text-highlighted"
|
|
507
|
-
>
|
|
508
|
-
<span>{{ t('orders.card.total') }}</span>
|
|
509
|
-
<span class="tabular-nums">{{ formatCurrency(order.total) }}</span>
|
|
510
|
-
</div>
|
|
511
|
-
</div>
|
|
512
|
-
</section>
|
|
513
|
-
|
|
514
|
-
<!-- Delivery & payment -->
|
|
515
|
-
<section class="border border-(--ui-border) rounded-xl overflow-hidden">
|
|
516
|
-
<h2 class="px-4 sm:px-5 py-3 text-sm font-semibold text-highlighted bg-elevated/60 border-b border-(--ui-border)">
|
|
517
|
-
{{ t('orders.detail.infoTitle') }}
|
|
518
|
-
</h2>
|
|
519
|
-
<dl class="grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-6 p-4 sm:p-5 text-sm">
|
|
520
|
-
<div v-if="order.deliveryAddress">
|
|
521
|
-
<dt class="font-medium text-highlighted">
|
|
522
|
-
{{ t('orders.deliveryAddress') }}
|
|
523
|
-
</dt>
|
|
524
|
-
<dd class="mt-2 text-muted">
|
|
525
|
-
<span
|
|
526
|
-
v-for="line in addressLines(order.deliveryAddress)"
|
|
527
|
-
:key="line"
|
|
528
|
-
class="block"
|
|
529
|
-
>{{ line }}</span>
|
|
530
|
-
</dd>
|
|
531
|
-
</div>
|
|
532
|
-
<div v-if="order.billingAddress">
|
|
533
|
-
<dt class="font-medium text-highlighted">
|
|
534
|
-
{{ t('orders.detail.billingAddress') }}
|
|
535
|
-
</dt>
|
|
536
|
-
<dd class="mt-2 text-muted">
|
|
537
|
-
<span
|
|
538
|
-
v-for="line in addressLines(order.billingAddress)"
|
|
539
|
-
:key="line"
|
|
540
|
-
class="block"
|
|
541
|
-
>{{ line }}</span>
|
|
542
|
-
</dd>
|
|
543
|
-
</div>
|
|
544
|
-
<div v-if="order.paymentMethod">
|
|
545
|
-
<dt class="font-medium text-highlighted">
|
|
546
|
-
{{ t('orders.detail.paymentMethodLabel') }}
|
|
547
|
-
</dt>
|
|
548
|
-
<dd class="mt-2 text-muted flex items-center gap-2">
|
|
549
|
-
<UIcon
|
|
550
|
-
:name="icon('payment')"
|
|
551
|
-
class="size-4 text-dimmed"
|
|
552
|
-
/>
|
|
553
|
-
{{ t(`paymentMethods.${order.paymentMethod}`) }}
|
|
554
|
-
</dd>
|
|
555
|
-
</div>
|
|
556
|
-
<div v-if="order.tracking">
|
|
557
|
-
<dt class="font-medium text-highlighted">
|
|
558
|
-
{{ t('orders.detail.trackingTitle') }}
|
|
559
|
-
</dt>
|
|
560
|
-
<dd class="mt-2 text-muted">
|
|
561
|
-
<span class="block">{{ order.tracking.carrier }}</span>
|
|
562
|
-
<span class="block tabular-nums">{{ order.tracking.trackingNumber }}</span>
|
|
563
|
-
</dd>
|
|
564
|
-
</div>
|
|
565
|
-
</dl>
|
|
566
|
-
</section>
|
|
404
|
+
<AccountOrderContents :order="order" />
|
|
567
405
|
|
|
568
406
|
<!-- Existing returns -->
|
|
569
407
|
<section
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { AccountOrder, AccountOrderStatus, AccountOrderPaymentStatus } from "../../../interfaces/account/order-list";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The facts an order is recognised by: when, the buyer's own number, what it
|
|
6
|
+
* comes to, and where it stands. Shared by the buyer's own order page and the
|
|
7
|
+
* approver's view of a colleague's (RAD-229), which must read the same.
|
|
8
|
+
*/
|
|
9
|
+
defineProps<{
|
|
10
|
+
order: AccountOrder;
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const { t, d } = useI18n();
|
|
14
|
+
const { formatCurrency } = useCartSummaryFormatting();
|
|
15
|
+
|
|
16
|
+
const statusColors: Record<AccountOrderStatus, "info" | "warning" | "primary" | "success" | "error"> = {
|
|
17
|
+
"processing": "info",
|
|
18
|
+
"approval-pending": "warning",
|
|
19
|
+
"shipped": "primary",
|
|
20
|
+
"delivered": "success",
|
|
21
|
+
"cancelled": "error",
|
|
22
|
+
"rejected": "error",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const paymentColors: Record<AccountOrderPaymentStatus, "warning" | "success" | "neutral"> = {
|
|
26
|
+
open: "warning",
|
|
27
|
+
paid: "success",
|
|
28
|
+
refunded: "neutral",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const formatDate = (value: string) => {
|
|
32
|
+
const parsed = new Date(value);
|
|
33
|
+
return Number.isNaN(parsed.getTime()) ? value : d(parsed, { dateStyle: "medium" });
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div
|
|
39
|
+
class="border border-(--ui-border) rounded-xl p-4 sm:p-5
|
|
40
|
+
flex flex-wrap items-center gap-x-8 gap-y-3"
|
|
41
|
+
>
|
|
42
|
+
<div>
|
|
43
|
+
<p class="text-xs text-muted">
|
|
44
|
+
{{ t('orders.card.date') }}
|
|
45
|
+
</p>
|
|
46
|
+
<p class="text-sm font-medium text-highlighted">
|
|
47
|
+
{{ formatDate(order.date) }}
|
|
48
|
+
</p>
|
|
49
|
+
</div>
|
|
50
|
+
<div v-if="order.orderNumber">
|
|
51
|
+
<p class="text-xs text-muted">
|
|
52
|
+
{{ t('orders.card.yourOrderNumber') }}
|
|
53
|
+
</p>
|
|
54
|
+
<p class="text-sm font-medium text-highlighted">
|
|
55
|
+
{{ order.orderNumber }}
|
|
56
|
+
</p>
|
|
57
|
+
</div>
|
|
58
|
+
<div>
|
|
59
|
+
<p class="text-xs text-muted">
|
|
60
|
+
{{ t('orders.card.total') }}
|
|
61
|
+
</p>
|
|
62
|
+
<p class="text-sm font-semibold text-highlighted tabular-nums">
|
|
63
|
+
{{ formatCurrency(order.total) }}
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="flex items-center gap-2 ms-auto">
|
|
67
|
+
<UBadge
|
|
68
|
+
:color="statusColors[order.status]"
|
|
69
|
+
variant="subtle"
|
|
70
|
+
:label="t(`orders.status.${order.status}`)"
|
|
71
|
+
/>
|
|
72
|
+
<UBadge
|
|
73
|
+
:color="paymentColors[order.paymentStatus]"
|
|
74
|
+
variant="outline"
|
|
75
|
+
:label="t(`orders.payment.${order.paymentStatus}`)"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
@@ -69,8 +69,10 @@ async function syncCardField(): Promise<void> {
|
|
|
69
69
|
try {
|
|
70
70
|
await psp.mount(cardEl.value, option.value);
|
|
71
71
|
}
|
|
72
|
-
catch
|
|
73
|
-
|
|
72
|
+
catch {
|
|
73
|
+
// The field did not come up and the provider has no page to fall
|
|
74
|
+
// back to: say so in words, not the loader's error.
|
|
75
|
+
cardError.value = t("onepage.payment.cardFieldUnavailable");
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
else {
|
|
@@ -93,9 +95,10 @@ onBeforeUnmount(() => psp.destroy());
|
|
|
93
95
|
async function pay(): Promise<void> {
|
|
94
96
|
paying.value = true;
|
|
95
97
|
try {
|
|
98
|
+
// Where the provider returns the buyer is built by the BFF (FE-5): the
|
|
99
|
+
// return page confirms the payment and lands on the confirmation.
|
|
96
100
|
const body: Record<string, unknown> = {
|
|
97
101
|
idempotencyKey: attempt.value,
|
|
98
|
-
returnUrl: window.location.href,
|
|
99
102
|
};
|
|
100
103
|
if (psp.hasActive()) {
|
|
101
104
|
const instrument = await psp.tokenize();
|
|
@@ -178,9 +181,16 @@ async function pay(): Promise<void> {
|
|
|
178
181
|
>
|
|
179
182
|
<label class="block text-sm font-medium text-muted">{{ t('onepage.payment.cardDetails') }}</label>
|
|
180
183
|
<div
|
|
184
|
+
v-show="!psp.hostedFallback.value"
|
|
181
185
|
ref="cardEl"
|
|
182
186
|
class="w-full p-3 rounded-lg border border-(--ui-border) bg-(--ui-bg)"
|
|
183
187
|
/>
|
|
188
|
+
<p
|
|
189
|
+
v-if="psp.hostedFallback.value"
|
|
190
|
+
class="text-sm text-muted"
|
|
191
|
+
>
|
|
192
|
+
{{ t('onepage.payment.cardOnProviderPage') }}
|
|
193
|
+
</p>
|
|
184
194
|
<p
|
|
185
195
|
v-if="cardError"
|
|
186
196
|
class="text-sm text-error-500"
|
|
@@ -32,6 +32,7 @@ const statusColors: Record<AccountOrderStatus, "info" | "warning" | "primary" |
|
|
|
32
32
|
"shipped": "primary",
|
|
33
33
|
"delivered": "success",
|
|
34
34
|
"cancelled": "error",
|
|
35
|
+
"rejected": "error",
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
const paymentColors: Record<AccountOrderPaymentStatus, "warning" | "success" | "neutral"> = {
|
|
@@ -67,6 +68,7 @@ const ORDER_STATUSES: AccountOrderStatus[] = [
|
|
|
67
68
|
"shipped",
|
|
68
69
|
"delivered",
|
|
69
70
|
"cancelled",
|
|
71
|
+
"rejected",
|
|
70
72
|
];
|
|
71
73
|
|
|
72
74
|
const filterItems = computed(() => [
|
|
@@ -76,11 +76,11 @@ const {
|
|
|
76
76
|
apply: next => cart.updateQuantityByKey(lineKey.value, next),
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
// A position nobody can order reads as a warning,
|
|
80
|
-
// too
|
|
81
|
-
// Everything else is a note.
|
|
79
|
+
// A position nobody can order reads as a warning, one missing a cost centre
|
|
80
|
+
// too, and one whose unit was switched: the buyer has to act on or check each
|
|
81
|
+
// before ordering. Everything else is a note.
|
|
82
82
|
const hintColor = (type: string) =>
|
|
83
|
-
type === "missing-cost-center" || type === "not-orderable"
|
|
83
|
+
type === "missing-cost-center" || type === "not-orderable" || type === "unit-changed"
|
|
84
84
|
? "warning" as const
|
|
85
85
|
: "info" as const;
|
|
86
86
|
</script>
|
|
@@ -96,8 +96,8 @@ const hintColor = (type: string) =>
|
|
|
96
96
|
class="mb-3 space-y-1.5"
|
|
97
97
|
>
|
|
98
98
|
<UAlert
|
|
99
|
-
v-for="hint in line.hints"
|
|
100
|
-
:key="hint.type"
|
|
99
|
+
v-for="(hint, index) in line.hints"
|
|
100
|
+
:key="`${hint.type}-${index}`"
|
|
101
101
|
:color="hintColor(hint.type)"
|
|
102
102
|
variant="soft"
|
|
103
103
|
:icon="icon(hintColor(hint.type) === 'warning' ? 'warning' : 'info')"
|
|
@@ -3,6 +3,7 @@ import CartApprovalsPanel from "./CartApprovalsPanel.vue";
|
|
|
3
3
|
import CartWorkflowPickerModal from "../actions/CartWorkflowPickerModal.vue";
|
|
4
4
|
import PunchoutTransferAction from "../../punchout/action/PunchoutTransferAction.vue";
|
|
5
5
|
import CartQuoteRequestModal from "../quote/CartQuoteRequestModal.vue";
|
|
6
|
+
import LoyaltyPerkHint from "../../loyalty/hint/LoyaltyPerkHint.vue";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Cart summary 2.0: the calculated totals block in document order, the
|
|
@@ -206,6 +207,9 @@ const trustItems = computed(() => {
|
|
|
206
207
|
</template>
|
|
207
208
|
</div>
|
|
208
209
|
|
|
210
|
+
<!-- The perks of the buyer's loyalty tier (RAD-293) -->
|
|
211
|
+
<LoyaltyPerkHint class="print:hidden" />
|
|
212
|
+
|
|
209
213
|
<!-- What this cart has not earned yet. Nearest first, because the top of
|
|
210
214
|
a list is what a buyer acts on. -->
|
|
211
215
|
<div
|
|
@@ -6,7 +6,7 @@ import { cartEcommerce } from "../../../shared/themeEvents";
|
|
|
6
6
|
|
|
7
7
|
const { icon } = useIcons();
|
|
8
8
|
const { t, locale } = useI18n();
|
|
9
|
-
const { form, profile, profileLoading, fieldErrors, validateField } = useCheckoutOnePage();
|
|
9
|
+
const { form, profile, profileLoading, fieldErrors, validateField, pspMountDetails } = useCheckoutOnePage();
|
|
10
10
|
const cartStore = useCartStore();
|
|
11
11
|
|
|
12
12
|
// "What can THIS buyer pay with?" — the BFF resolves it (live: payments
|
|
@@ -111,9 +111,14 @@ const showCostCenter = computed(() =>
|
|
|
111
111
|
form.value.paymentMethod === "cost_center"
|
|
112
112
|
&& (profile.value?.costCenters.length ?? 0) > 0);
|
|
113
113
|
|
|
114
|
-
// PSP card entry (Stripe Elements, …). The provider's
|
|
115
|
-
// when a PSP card method is selected; the registry
|
|
116
|
-
// one, so this is
|
|
114
|
+
// PSP card entry (Stripe Elements, Novalnet's card iframe, …). The provider's
|
|
115
|
+
// secure field is mounted when a PSP card method is selected; the registry and
|
|
116
|
+
// the provider's checkout mode decide which one needs a field, so this is
|
|
117
|
+
// generic. THEME CONTRACT (FE-5): a theme overriding this section keeps
|
|
118
|
+
// `psp.mount(cardEl, option, pspMountDetails())` — the third argument is
|
|
119
|
+
// optional (without it the field is told the cart total only) — and may show
|
|
120
|
+
// `psp.hostedFallback` (the field could not be used; the buyer pays on the
|
|
121
|
+
// provider's page instead).
|
|
117
122
|
const psp = usePspCheckout();
|
|
118
123
|
const selectedOption = computed<PaymentOption | null>(() =>
|
|
119
124
|
paymentOptions.value.find(o => o.method === form.value.paymentMethod) ?? null);
|
|
@@ -126,10 +131,12 @@ async function syncCardField(): Promise<void> {
|
|
|
126
131
|
await nextTick();
|
|
127
132
|
if (needsCardField.value && cardEl.value && selectedOption.value) {
|
|
128
133
|
try {
|
|
129
|
-
await psp.mount(cardEl.value, selectedOption.value);
|
|
134
|
+
await psp.mount(cardEl.value, selectedOption.value, pspMountDetails());
|
|
130
135
|
}
|
|
131
|
-
catch
|
|
132
|
-
|
|
136
|
+
catch {
|
|
137
|
+
// The field did not come up and the provider has no page to fall
|
|
138
|
+
// back to: say so in words, not the loader's error.
|
|
139
|
+
cardError.value = t("onepage.payment.cardFieldUnavailable");
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
else {
|
|
@@ -263,7 +270,12 @@ if (import.meta.client) {
|
|
|
263
270
|
<!-- PSP secure card field (mounted client-side by the provider) -->
|
|
264
271
|
<div v-if="needsCardField" class="space-y-1.5">
|
|
265
272
|
<label class="block text-sm font-medium text-muted">{{ t('onepage.payment.cardDetails') }}</label>
|
|
266
|
-
<div
|
|
273
|
+
<div
|
|
274
|
+
v-show="!psp.hostedFallback.value"
|
|
275
|
+
ref="cardEl"
|
|
276
|
+
class="w-full sm:max-w-sm p-3 rounded-lg border border-(--ui-border) bg-(--ui-bg)"
|
|
277
|
+
/>
|
|
278
|
+
<p v-if="psp.hostedFallback.value" class="text-sm text-muted">{{ t('onepage.payment.cardOnProviderPage') }}</p>
|
|
267
279
|
<p v-if="cardError" class="text-sm text-error-500">{{ cardError }}</p>
|
|
268
280
|
</div>
|
|
269
281
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import CartApprovalsPanel from "../../cart/view/CartApprovalsPanel.vue";
|
|
3
|
+
import LoyaltyPerkHint from "../../loyalty/hint/LoyaltyPerkHint.vue";
|
|
3
4
|
|
|
4
5
|
const { icon } = useIcons();
|
|
5
6
|
const { getImage } = useProductImage();
|
|
@@ -66,6 +67,9 @@ async function handlePlaceOrder() {
|
|
|
66
67
|
</h2>
|
|
67
68
|
<USeparator />
|
|
68
69
|
|
|
70
|
+
<!-- The perks of the buyer's loyalty tier (RAD-293) -->
|
|
71
|
+
<LoyaltyPerkHint />
|
|
72
|
+
|
|
69
73
|
<!-- Submit error -->
|
|
70
74
|
<UAlert
|
|
71
75
|
v-if="submitError"
|