@revenexx/cover 0.2.31 → 0.2.32
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.
|
@@ -61,13 +61,27 @@ const deliveryOptions = computed<DeliveryOption[]>(() =>
|
|
|
61
61
|
?? (liveShipping.value ? [] : profile.value?.availableDeliveryMethods)
|
|
62
62
|
?? []);
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Keep the SELECTION inside the offered list — the order is rejected outright
|
|
66
|
+
* if it is not (`422 Delivery method 'standard' is not available for this
|
|
67
|
+
* order`), and nothing on the page reveals that the invisible form value and
|
|
68
|
+
* the visible list disagree.
|
|
69
|
+
*
|
|
70
|
+
* Watching the options alone was not enough, because the selection has a
|
|
71
|
+
* second source. `initFromProfile` seeds the form from the checkout profile,
|
|
72
|
+
* whose `defaultDeliveryMethod` is the DEMO "standard" on a tenant whose
|
|
73
|
+
* shipping app answers `zone-deutschland` — so the form could be re-seeded
|
|
74
|
+
* with a dead method after the list had already settled, and the watcher never
|
|
75
|
+
* ran again because the list itself had not changed. Both sources are watched,
|
|
76
|
+
* and `immediate` covers the third case: a list that is already complete when
|
|
77
|
+
* this section mounts (the SSR payload, or the shared `useFetch` key resolved
|
|
78
|
+
* on an earlier visit) never "changes" at all.
|
|
79
|
+
*/
|
|
80
|
+
watch([deliveryOptions, () => form.value.deliveryMethod], ([options, selected]) => {
|
|
81
|
+
if (options.length && !options.some(o => o.method === selected)) {
|
|
68
82
|
form.value.deliveryMethod = rates.value?.defaultMethod ?? options[0]!.method;
|
|
69
83
|
}
|
|
70
|
-
});
|
|
84
|
+
}, { immediate: true });
|
|
71
85
|
</script>
|
|
72
86
|
|
|
73
87
|
<template>
|
|
@@ -52,13 +52,19 @@ const paymentOptions = computed<PaymentOption[]>(() =>
|
|
|
52
52
|
?? (livePayments.value ? [] : profile.value?.availablePaymentMethods)
|
|
53
53
|
?? []);
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The same reconciliation the delivery section does, for the same reason: a
|
|
57
|
+
* selection outside the offered list is rejected by the orders app, and the
|
|
58
|
+
* profile's `defaultPaymentMethod` is demo data on a live tenant. It only
|
|
59
|
+
* escaped notice here because that demo default is "invoice", which most
|
|
60
|
+
* merchants happen to offer — the eligibility list is the authority, not the
|
|
61
|
+
* coincidence.
|
|
62
|
+
*/
|
|
63
|
+
watch([paymentOptions, () => form.value.paymentMethod], ([options, selected]) => {
|
|
64
|
+
if (options.length && !options.some(o => o.method === selected)) {
|
|
59
65
|
form.value.paymentMethod = eligible.value?.defaultMethod ?? options[0]!.method;
|
|
60
66
|
}
|
|
61
|
-
});
|
|
67
|
+
}, { immediate: true });
|
|
62
68
|
|
|
63
69
|
const formatFee = (option: PaymentOption): string | null => {
|
|
64
70
|
if (!option.fee || option.fee <= 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revenexx/cover",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.32",
|
|
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",
|