@viur/shop-components 0.15.3 → 0.15.4
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/package.json +1 -1
- package/src/composables/payment.js +14 -0
package/package.json
CHANGED
|
@@ -54,6 +54,20 @@ export const usePayment = defineStore("usePaymentStore", () => {
|
|
|
54
54
|
options.push(currentOption)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
// Sort: SORT_FIRST providers on top, SORT_LAST at the bottom, rest unchanged
|
|
58
|
+
const SORT_FIRST = ["unzer-paylater_invoice"]
|
|
59
|
+
const SORT_LAST = ["unzer-paypal", "amazonpay"]
|
|
60
|
+
|
|
61
|
+
options.sort((a, b) => {
|
|
62
|
+
const weight = (key) => {
|
|
63
|
+
const firstIdx = SORT_FIRST.indexOf(key)
|
|
64
|
+
if (firstIdx !== -1) return -SORT_FIRST.length + firstIdx
|
|
65
|
+
const lastIdx = SORT_LAST.indexOf(key)
|
|
66
|
+
if (lastIdx !== -1) return 1 + lastIdx
|
|
67
|
+
return 0
|
|
68
|
+
}
|
|
69
|
+
return weight(a.paymenttype) - weight(b.paymenttype)
|
|
70
|
+
})
|
|
57
71
|
|
|
58
72
|
return options
|
|
59
73
|
}
|