@mundogamernetwork/shared-ui 1.1.7 → 1.1.9
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.
|
@@ -154,7 +154,6 @@ async function handleCheckout() {
|
|
|
154
154
|
padding: 16px;
|
|
155
155
|
background: var(--body-bg-card, #fff);
|
|
156
156
|
border: 1px solid var(--inactive, #f3f4f6);
|
|
157
|
-
border-radius: 8px;
|
|
158
157
|
}
|
|
159
158
|
|
|
160
159
|
&__actions {
|
|
@@ -198,7 +197,6 @@ async function handleCheckout() {
|
|
|
198
197
|
width: 100%;
|
|
199
198
|
height: 48px;
|
|
200
199
|
border: none;
|
|
201
|
-
border-radius: 8px;
|
|
202
200
|
background: #4f46e5;
|
|
203
201
|
color: #fff;
|
|
204
202
|
font-size: 15px;
|
|
@@ -41,7 +41,6 @@ function handleInput(e: Event) {
|
|
|
41
41
|
width: 100%;
|
|
42
42
|
padding: 16px;
|
|
43
43
|
border: 1px solid #f59e0b;
|
|
44
|
-
border-radius: 8px;
|
|
45
44
|
background: rgba(245, 158, 11, 0.05);
|
|
46
45
|
|
|
47
46
|
&__info {
|
|
@@ -76,7 +75,6 @@ function handleInput(e: Event) {
|
|
|
76
75
|
width: 100%;
|
|
77
76
|
padding: 10px 12px;
|
|
78
77
|
border: 1px solid var(--inactive, #d1d5db);
|
|
79
|
-
border-radius: 6px;
|
|
80
78
|
font-size: 14px;
|
|
81
79
|
background: var(--body-bg-card, #fff);
|
|
82
80
|
color: var(--active, #111827);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { onMounted, watch } from "vue";
|
|
3
3
|
import { usePaymentMethods } from "../../composables/usePaymentMethods";
|
|
4
|
+
import MgPaymentMethods from "../ui/MgPaymentMethods.vue";
|
|
4
5
|
import type { AxiosInstance } from "axios";
|
|
5
6
|
|
|
6
7
|
const props = defineProps<{
|
|
7
8
|
httpService: AxiosInstance;
|
|
8
9
|
context?: "checkout" | "subscription";
|
|
9
10
|
modelValue?: string;
|
|
11
|
+
theme?: string;
|
|
10
12
|
}>();
|
|
11
13
|
|
|
12
14
|
const emit = defineEmits<{
|
|
@@ -42,18 +44,21 @@ function select(name: string) {
|
|
|
42
44
|
selectedMethod.value = name.toLowerCase();
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
// Canonical numeric ids consumed by <MgPaymentMethods> inline SVG logos.
|
|
48
|
+
// PayPal = 2, Stripe = 3 (matches api-main + useConfirmation).
|
|
49
|
+
function getMethodId(m: { id: number; name: string }): number {
|
|
50
|
+
const key = name2key(m.name);
|
|
51
|
+
if (key === "paypal") return 2;
|
|
52
|
+
if (key === "stripe") return 3;
|
|
53
|
+
return m.id;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function name2key(name: string): string {
|
|
57
|
+
return (name ?? "").toLowerCase();
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
function getLabel(name: string): string {
|
|
56
|
-
const key = name
|
|
61
|
+
const key = name2key(name);
|
|
57
62
|
const labels: Record<string, string> = {
|
|
58
63
|
paypal: "PayPal",
|
|
59
64
|
stripe: "Stripe",
|
|
@@ -82,11 +87,9 @@ function getLabel(name: string): string {
|
|
|
82
87
|
:class="{ 'mg-payment-method--active': selectedMethod === method.name.toLowerCase() }"
|
|
83
88
|
@click="select(method.name)"
|
|
84
89
|
>
|
|
85
|
-
<
|
|
86
|
-
:
|
|
87
|
-
|
|
88
|
-
class="mg-payment-method__logo"
|
|
89
|
-
/>
|
|
90
|
+
<span class="mg-payment-method__logo">
|
|
91
|
+
<MgPaymentMethods :method="getMethodId(method)" :theme="theme" />
|
|
92
|
+
</span>
|
|
90
93
|
<span class="mg-payment-method__label">{{ getLabel(method.name) }}</span>
|
|
91
94
|
</button>
|
|
92
95
|
</div>
|
|
@@ -119,7 +122,6 @@ function getLabel(name: string): string {
|
|
|
119
122
|
gap: 8px;
|
|
120
123
|
padding: 12px 16px;
|
|
121
124
|
border: 2px solid var(--inactive, #e5e7eb);
|
|
122
|
-
border-radius: 8px;
|
|
123
125
|
background: transparent;
|
|
124
126
|
cursor: pointer;
|
|
125
127
|
transition: all 0.2s ease;
|
|
@@ -151,7 +153,6 @@ function getLabel(name: string): string {
|
|
|
151
153
|
|
|
152
154
|
.skeleton-block {
|
|
153
155
|
background: var(--inactive, #e5e7eb);
|
|
154
|
-
border-radius: 8px;
|
|
155
156
|
animation: pulse 1.5s ease-in-out infinite;
|
|
156
157
|
}
|
|
157
158
|
|
|
@@ -143,7 +143,6 @@ onUnmounted(() => {
|
|
|
143
143
|
align-items: center;
|
|
144
144
|
padding: 24px;
|
|
145
145
|
border: 1px solid var(--inactive, #e5e7eb);
|
|
146
|
-
border-radius: 12px;
|
|
147
146
|
background: var(--body-bg-card, #fff);
|
|
148
147
|
|
|
149
148
|
&__header {
|
|
@@ -191,7 +190,6 @@ onUnmounted(() => {
|
|
|
191
190
|
gap: 8px;
|
|
192
191
|
padding: 10px 20px;
|
|
193
192
|
border: 1px solid #4f46e5;
|
|
194
|
-
border-radius: 8px;
|
|
195
193
|
background: transparent;
|
|
196
194
|
color: #4f46e5;
|
|
197
195
|
font-size: 14px;
|
|
@@ -32,9 +32,10 @@ export function usePaymentMethods(httpService: AxiosInstance) {
|
|
|
32
32
|
} catch (e: any) {
|
|
33
33
|
// Fallback: if endpoint doesn't exist yet (404), provide default methods
|
|
34
34
|
console.warn("[usePaymentMethods] Endpoint not available, using fallback:", e?.response?.status);
|
|
35
|
+
// Canonical IDs (api-main): PayPal = 2, Stripe = 3
|
|
35
36
|
methods.value = [
|
|
36
|
-
{ id:
|
|
37
|
-
{ id:
|
|
37
|
+
{ id: 2, name: "paypal" },
|
|
38
|
+
{ id: 3, name: "stripe" },
|
|
38
39
|
];
|
|
39
40
|
if (methods.value.length > 0 && !selectedMethod.value) {
|
|
40
41
|
selectedMethod.value = methods.value[0].name.toLowerCase();
|