@easypayment/medusa-payment-paypal 0.9.0 → 0.9.3
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.
|
@@ -68,19 +68,20 @@ async function adminFetch$2(path, opts = {}) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
const DEFAULT_FORM$1 = {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
requireInstantPayment: false,
|
|
75
|
-
sendItemDetails: true,
|
|
76
|
-
invoicePrefix: "WC-",
|
|
77
|
-
creditCardStatementName: "PayPal"
|
|
71
|
+
enabled: true,
|
|
72
|
+
title: "Credit or Debit Card",
|
|
73
|
+
threeDS: "when_required"
|
|
78
74
|
};
|
|
79
75
|
function mergeWithDefaults$1(saved) {
|
|
80
76
|
if (!saved) return { ...DEFAULT_FORM$1 };
|
|
81
77
|
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
82
78
|
return { ...DEFAULT_FORM$1, ...Object.fromEntries(entries) };
|
|
83
79
|
}
|
|
80
|
+
const THREE_DS_OPTIONS = [
|
|
81
|
+
{ value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
|
|
82
|
+
{ value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
|
|
83
|
+
{ value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
|
|
84
|
+
];
|
|
84
85
|
function SectionCard$2({ title, description, right, children }) {
|
|
85
86
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
86
87
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
|
|
@@ -102,7 +103,8 @@ function FieldRow$2({ label, hint, children }) {
|
|
|
102
103
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12 md:col-span-8", children })
|
|
103
104
|
] });
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function AdvancedCardPaymentsTab() {
|
|
107
|
+
var _a, _b;
|
|
106
108
|
const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM$1 }));
|
|
107
109
|
const [loading, setLoading] = react.useState(false);
|
|
108
110
|
const [saving, setSaving] = react.useState(false);
|
|
@@ -116,7 +118,7 @@ function AdditionalSettingsTab() {
|
|
|
116
118
|
setLoading(true);
|
|
117
119
|
const json = await adminFetch$2("/admin/paypal/settings");
|
|
118
120
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
119
|
-
const saved = payload == null ? void 0 : payload.
|
|
121
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
120
122
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
|
|
121
123
|
} catch {
|
|
122
124
|
} finally {
|
|
@@ -127,15 +129,17 @@ function AdditionalSettingsTab() {
|
|
|
127
129
|
async function onSave() {
|
|
128
130
|
try {
|
|
129
131
|
setSaving(true);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
const json = await adminFetch$2("/admin/paypal/settings", {
|
|
133
|
+
method: "POST",
|
|
134
|
+
body: { advanced_card_payments: form }
|
|
135
|
+
});
|
|
132
136
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
133
|
-
const saved = payload == null ? void 0 : payload.
|
|
137
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
134
138
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
|
|
135
139
|
setToast({ type: "success", message: "Settings saved" });
|
|
136
140
|
window.setTimeout(() => setToast(null), 2500);
|
|
137
141
|
} catch (e) {
|
|
138
|
-
setToast({ type: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
|
|
142
|
+
setToast({ type: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
|
|
139
143
|
window.setTimeout(() => setToast(null), 3500);
|
|
140
144
|
} finally {
|
|
141
145
|
setSaving(false);
|
|
@@ -148,33 +152,22 @@ function AdditionalSettingsTab() {
|
|
|
148
152
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
149
153
|
SectionCard$2,
|
|
150
154
|
{
|
|
151
|
-
title: "
|
|
152
|
-
description: "
|
|
155
|
+
title: "Advanced Card Payments",
|
|
156
|
+
description: "Control card checkout settings and 3D Secure behavior.",
|
|
153
157
|
right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
154
158
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
155
159
|
loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
|
|
156
160
|
] }),
|
|
157
161
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
158
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "
|
|
159
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
160
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
161
|
-
] }) }),
|
|
162
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Brand Name", children: /* @__PURE__ */ jsxRuntime.jsx("input", { value: form.brandName, onChange: (e) => setForm((p) => ({ ...p, brandName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) }),
|
|
163
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Landing Page", children: /* @__PURE__ */ jsxRuntime.jsxs("select", { value: form.landingPage, onChange: (e) => setForm((p) => ({ ...p, landingPage: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
|
|
164
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "no_preference", children: "No Preference" }),
|
|
165
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "login", children: "Login" }),
|
|
166
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "billing", children: "Billing" })
|
|
167
|
-
] }) }),
|
|
168
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Instant Payments", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.requireInstantPayment, onChange: (e) => setForm((p) => ({ ...p, requireInstantPayment: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
|
|
171
|
-
] }) }),
|
|
172
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Send Item Details", hint: "Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
173
|
-
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.sendItemDetails, onChange: (e) => setForm((p) => ({ ...p, sendItemDetails: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
174
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
|
|
162
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Enable/Disable", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.enabled, onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
164
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
|
|
175
165
|
] }) }),
|
|
176
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "
|
|
177
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "
|
|
166
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Title", children: /* @__PURE__ */ jsxRuntime.jsx("input", { value: form.title, onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "Credit or Debit Card" }) }),
|
|
167
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
168
|
+
/* @__PURE__ */ jsxRuntime.jsx("select", { value: form.threeDS, onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value)) }),
|
|
169
|
+
((_a = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _a.hint) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-ui-fg-subtle", children: (_b = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _b.hint }) : null
|
|
170
|
+
] }) })
|
|
178
171
|
] })
|
|
179
172
|
}
|
|
180
173
|
)
|
|
@@ -214,20 +207,19 @@ async function adminFetch$1(path, opts = {}) {
|
|
|
214
207
|
}
|
|
215
208
|
}
|
|
216
209
|
const DEFAULT_FORM = {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
210
|
+
paymentAction: "capture",
|
|
211
|
+
brandName: "PayPal",
|
|
212
|
+
landingPage: "no_preference",
|
|
213
|
+
requireInstantPayment: false,
|
|
214
|
+
sendItemDetails: true,
|
|
215
|
+
invoicePrefix: "WC-",
|
|
216
|
+
creditCardStatementName: "PayPal"
|
|
220
217
|
};
|
|
221
218
|
function mergeWithDefaults(saved) {
|
|
222
219
|
if (!saved) return { ...DEFAULT_FORM };
|
|
223
220
|
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
224
221
|
return { ...DEFAULT_FORM, ...Object.fromEntries(entries) };
|
|
225
222
|
}
|
|
226
|
-
const THREE_DS_OPTIONS = [
|
|
227
|
-
{ value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
|
|
228
|
-
{ value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
|
|
229
|
-
{ value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
|
|
230
|
-
];
|
|
231
223
|
function SectionCard$1({ title, description, right, children }) {
|
|
232
224
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
233
225
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
|
|
@@ -249,8 +241,7 @@ function FieldRow$1({ label, hint, children }) {
|
|
|
249
241
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12 md:col-span-8", children })
|
|
250
242
|
] });
|
|
251
243
|
}
|
|
252
|
-
function
|
|
253
|
-
var _a, _b;
|
|
244
|
+
function AdditionalSettingsTab() {
|
|
254
245
|
const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM }));
|
|
255
246
|
const [loading, setLoading] = react.useState(false);
|
|
256
247
|
const [saving, setSaving] = react.useState(false);
|
|
@@ -264,7 +255,7 @@ function AdvancedCardPaymentsTab() {
|
|
|
264
255
|
setLoading(true);
|
|
265
256
|
const json = await adminFetch$1("/admin/paypal/settings");
|
|
266
257
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
267
|
-
const saved = payload == null ? void 0 : payload.
|
|
258
|
+
const saved = payload == null ? void 0 : payload.additional_settings;
|
|
268
259
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
269
260
|
} catch {
|
|
270
261
|
} finally {
|
|
@@ -275,17 +266,15 @@ function AdvancedCardPaymentsTab() {
|
|
|
275
266
|
async function onSave() {
|
|
276
267
|
try {
|
|
277
268
|
setSaving(true);
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
body: { advanced_card_payments: form }
|
|
281
|
-
});
|
|
269
|
+
setToast(null);
|
|
270
|
+
const json = await adminFetch$1("/admin/paypal/settings", { method: "POST", body: { additional_settings: form } });
|
|
282
271
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
283
|
-
const saved = payload == null ? void 0 : payload.
|
|
272
|
+
const saved = payload == null ? void 0 : payload.additional_settings;
|
|
284
273
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
285
274
|
setToast({ type: "success", message: "Settings saved" });
|
|
286
275
|
window.setTimeout(() => setToast(null), 2500);
|
|
287
276
|
} catch (e) {
|
|
288
|
-
setToast({ type: "error", message:
|
|
277
|
+
setToast({ type: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
|
|
289
278
|
window.setTimeout(() => setToast(null), 3500);
|
|
290
279
|
} finally {
|
|
291
280
|
setSaving(false);
|
|
@@ -298,27 +287,41 @@ function AdvancedCardPaymentsTab() {
|
|
|
298
287
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
299
288
|
SectionCard$1,
|
|
300
289
|
{
|
|
301
|
-
title: "
|
|
302
|
-
description: "
|
|
290
|
+
title: "Additional Settings",
|
|
291
|
+
description: "These settings control checkout behavior and PayPal experience.",
|
|
303
292
|
right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
304
293
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
305
294
|
loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
|
|
306
295
|
] }),
|
|
307
296
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
308
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "
|
|
309
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
310
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
297
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Payment action", children: /* @__PURE__ */ jsxRuntime.jsxs("select", { value: form.paymentAction, onChange: (e) => setForm((p) => ({ ...p, paymentAction: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
|
|
298
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "capture", children: "Capture" }),
|
|
299
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorize", children: "Authorize" })
|
|
311
300
|
] }) }),
|
|
312
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "
|
|
313
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "
|
|
314
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
315
|
-
|
|
316
|
-
|
|
301
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Brand Name", children: /* @__PURE__ */ jsxRuntime.jsx("input", { value: form.brandName, onChange: (e) => setForm((p) => ({ ...p, brandName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) }),
|
|
302
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Landing Page", children: /* @__PURE__ */ jsxRuntime.jsxs("select", { value: form.landingPage, onChange: (e) => setForm((p) => ({ ...p, landingPage: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
|
|
303
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "no_preference", children: "No Preference" }),
|
|
304
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "login", children: "Login" }),
|
|
305
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "billing", children: "Billing" })
|
|
306
|
+
] }) }),
|
|
307
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Instant Payments", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
308
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.requireInstantPayment, onChange: (e) => setForm((p) => ({ ...p, requireInstantPayment: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
309
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
|
|
310
|
+
] }) }),
|
|
311
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Send Item Details", hint: "Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
312
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.sendItemDetails, onChange: (e) => setForm((p) => ({ ...p, sendItemDetails: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
313
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
|
|
314
|
+
] }) }),
|
|
315
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Invoice prefix", children: /* @__PURE__ */ jsxRuntime.jsx("input", { value: form.invoicePrefix, onChange: (e) => setForm((p) => ({ ...p, invoicePrefix: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "WC-" }) }),
|
|
316
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Credit Card Statement Name", children: /* @__PURE__ */ jsxRuntime.jsx("input", { value: form.creditCardStatementName, onChange: (e) => setForm((p) => ({ ...p, creditCardStatementName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) })
|
|
317
317
|
] })
|
|
318
318
|
}
|
|
319
319
|
)
|
|
320
320
|
] }) });
|
|
321
321
|
}
|
|
322
|
+
function PayPalApplePayPage() {
|
|
323
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
324
|
+
}
|
|
322
325
|
const config = adminSdk.defineRouteConfig({
|
|
323
326
|
label: "PayPal Connection",
|
|
324
327
|
hide: true
|
|
@@ -915,9 +918,6 @@ function PayPalConnectionPage() {
|
|
|
915
918
|
function PayPalGooglePayPage() {
|
|
916
919
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
917
920
|
}
|
|
918
|
-
function PayPalApplePayPage() {
|
|
919
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
920
|
-
}
|
|
921
921
|
function PayPalPayLaterMessagingPage() {
|
|
922
922
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
923
923
|
}
|
|
@@ -1201,13 +1201,17 @@ const routeModule = {
|
|
|
1201
1201
|
Component: PayPalSettingsIndexRoute,
|
|
1202
1202
|
path: "/settings/paypal"
|
|
1203
1203
|
},
|
|
1204
|
+
{
|
|
1205
|
+
Component: AdvancedCardPaymentsTab,
|
|
1206
|
+
path: "/settings/paypal/advanced-card-payments"
|
|
1207
|
+
},
|
|
1204
1208
|
{
|
|
1205
1209
|
Component: AdditionalSettingsTab,
|
|
1206
1210
|
path: "/settings/paypal/additional-settings"
|
|
1207
1211
|
},
|
|
1208
1212
|
{
|
|
1209
|
-
Component:
|
|
1210
|
-
path: "/settings/paypal/
|
|
1213
|
+
Component: PayPalApplePayPage,
|
|
1214
|
+
path: "/settings/paypal/apple-pay"
|
|
1211
1215
|
},
|
|
1212
1216
|
{
|
|
1213
1217
|
Component: PayPalConnectionPage,
|
|
@@ -1217,10 +1221,6 @@ const routeModule = {
|
|
|
1217
1221
|
Component: PayPalGooglePayPage,
|
|
1218
1222
|
path: "/settings/paypal/google-pay"
|
|
1219
1223
|
},
|
|
1220
|
-
{
|
|
1221
|
-
Component: PayPalApplePayPage,
|
|
1222
|
-
path: "/settings/paypal/apple-pay"
|
|
1223
|
-
},
|
|
1224
1224
|
{
|
|
1225
1225
|
Component: PayPalPayLaterMessagingPage,
|
|
1226
1226
|
path: "/settings/paypal/pay-later-messaging"
|
|
@@ -67,19 +67,20 @@ async function adminFetch$2(path, opts = {}) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
const DEFAULT_FORM$1 = {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
requireInstantPayment: false,
|
|
74
|
-
sendItemDetails: true,
|
|
75
|
-
invoicePrefix: "WC-",
|
|
76
|
-
creditCardStatementName: "PayPal"
|
|
70
|
+
enabled: true,
|
|
71
|
+
title: "Credit or Debit Card",
|
|
72
|
+
threeDS: "when_required"
|
|
77
73
|
};
|
|
78
74
|
function mergeWithDefaults$1(saved) {
|
|
79
75
|
if (!saved) return { ...DEFAULT_FORM$1 };
|
|
80
76
|
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
81
77
|
return { ...DEFAULT_FORM$1, ...Object.fromEntries(entries) };
|
|
82
78
|
}
|
|
79
|
+
const THREE_DS_OPTIONS = [
|
|
80
|
+
{ value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
|
|
81
|
+
{ value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
|
|
82
|
+
{ value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
|
|
83
|
+
];
|
|
83
84
|
function SectionCard$2({ title, description, right, children }) {
|
|
84
85
|
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
85
86
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
|
|
@@ -101,7 +102,8 @@ function FieldRow$2({ label, hint, children }) {
|
|
|
101
102
|
/* @__PURE__ */ jsx("div", { className: "col-span-12 md:col-span-8", children })
|
|
102
103
|
] });
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
+
function AdvancedCardPaymentsTab() {
|
|
106
|
+
var _a, _b;
|
|
105
107
|
const [form, setForm] = useState(() => ({ ...DEFAULT_FORM$1 }));
|
|
106
108
|
const [loading, setLoading] = useState(false);
|
|
107
109
|
const [saving, setSaving] = useState(false);
|
|
@@ -115,7 +117,7 @@ function AdditionalSettingsTab() {
|
|
|
115
117
|
setLoading(true);
|
|
116
118
|
const json = await adminFetch$2("/admin/paypal/settings");
|
|
117
119
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
118
|
-
const saved = payload == null ? void 0 : payload.
|
|
120
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
119
121
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
|
|
120
122
|
} catch {
|
|
121
123
|
} finally {
|
|
@@ -126,15 +128,17 @@ function AdditionalSettingsTab() {
|
|
|
126
128
|
async function onSave() {
|
|
127
129
|
try {
|
|
128
130
|
setSaving(true);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
const json = await adminFetch$2("/admin/paypal/settings", {
|
|
132
|
+
method: "POST",
|
|
133
|
+
body: { advanced_card_payments: form }
|
|
134
|
+
});
|
|
131
135
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
132
|
-
const saved = payload == null ? void 0 : payload.
|
|
136
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
133
137
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
|
|
134
138
|
setToast({ type: "success", message: "Settings saved" });
|
|
135
139
|
window.setTimeout(() => setToast(null), 2500);
|
|
136
140
|
} catch (e) {
|
|
137
|
-
setToast({ type: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
|
|
141
|
+
setToast({ type: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
|
|
138
142
|
window.setTimeout(() => setToast(null), 3500);
|
|
139
143
|
} finally {
|
|
140
144
|
setSaving(false);
|
|
@@ -147,33 +151,22 @@ function AdditionalSettingsTab() {
|
|
|
147
151
|
/* @__PURE__ */ jsx(
|
|
148
152
|
SectionCard$2,
|
|
149
153
|
{
|
|
150
|
-
title: "
|
|
151
|
-
description: "
|
|
154
|
+
title: "Advanced Card Payments",
|
|
155
|
+
description: "Control card checkout settings and 3D Secure behavior.",
|
|
152
156
|
right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
153
157
|
/* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
154
158
|
loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
|
|
155
159
|
] }),
|
|
156
160
|
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
157
|
-
/* @__PURE__ */ jsx(FieldRow$2, { label: "
|
|
158
|
-
/* @__PURE__ */ jsx("
|
|
159
|
-
/* @__PURE__ */ jsx("
|
|
160
|
-
] }) }),
|
|
161
|
-
/* @__PURE__ */ jsx(FieldRow$2, { label: "Brand Name", children: /* @__PURE__ */ jsx("input", { value: form.brandName, onChange: (e) => setForm((p) => ({ ...p, brandName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) }),
|
|
162
|
-
/* @__PURE__ */ jsx(FieldRow$2, { label: "Landing Page", children: /* @__PURE__ */ jsxs("select", { value: form.landingPage, onChange: (e) => setForm((p) => ({ ...p, landingPage: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
|
|
163
|
-
/* @__PURE__ */ jsx("option", { value: "no_preference", children: "No Preference" }),
|
|
164
|
-
/* @__PURE__ */ jsx("option", { value: "login", children: "Login" }),
|
|
165
|
-
/* @__PURE__ */ jsx("option", { value: "billing", children: "Billing" })
|
|
166
|
-
] }) }),
|
|
167
|
-
/* @__PURE__ */ jsx(FieldRow$2, { label: "Instant Payments", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
168
|
-
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.requireInstantPayment, onChange: (e) => setForm((p) => ({ ...p, requireInstantPayment: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
169
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
|
|
170
|
-
] }) }),
|
|
171
|
-
/* @__PURE__ */ jsx(FieldRow$2, { label: "Send Item Details", hint: "Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
172
|
-
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.sendItemDetails, onChange: (e) => setForm((p) => ({ ...p, sendItemDetails: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
173
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
|
|
161
|
+
/* @__PURE__ */ jsx(FieldRow$2, { label: "Enable/Disable", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
162
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.enabled, onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
163
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
|
|
174
164
|
] }) }),
|
|
175
|
-
/* @__PURE__ */ jsx(FieldRow$2, { label: "
|
|
176
|
-
/* @__PURE__ */ jsx(FieldRow$2, { label: "
|
|
165
|
+
/* @__PURE__ */ jsx(FieldRow$2, { label: "Title", children: /* @__PURE__ */ jsx("input", { value: form.title, onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "Credit or Debit Card" }) }),
|
|
166
|
+
/* @__PURE__ */ jsx(FieldRow$2, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
167
|
+
/* @__PURE__ */ jsx("select", { value: form.threeDS, onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value)) }),
|
|
168
|
+
((_a = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _a.hint) ? /* @__PURE__ */ jsx("div", { className: "text-xs text-ui-fg-subtle", children: (_b = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _b.hint }) : null
|
|
169
|
+
] }) })
|
|
177
170
|
] })
|
|
178
171
|
}
|
|
179
172
|
)
|
|
@@ -213,20 +206,19 @@ async function adminFetch$1(path, opts = {}) {
|
|
|
213
206
|
}
|
|
214
207
|
}
|
|
215
208
|
const DEFAULT_FORM = {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
209
|
+
paymentAction: "capture",
|
|
210
|
+
brandName: "PayPal",
|
|
211
|
+
landingPage: "no_preference",
|
|
212
|
+
requireInstantPayment: false,
|
|
213
|
+
sendItemDetails: true,
|
|
214
|
+
invoicePrefix: "WC-",
|
|
215
|
+
creditCardStatementName: "PayPal"
|
|
219
216
|
};
|
|
220
217
|
function mergeWithDefaults(saved) {
|
|
221
218
|
if (!saved) return { ...DEFAULT_FORM };
|
|
222
219
|
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
223
220
|
return { ...DEFAULT_FORM, ...Object.fromEntries(entries) };
|
|
224
221
|
}
|
|
225
|
-
const THREE_DS_OPTIONS = [
|
|
226
|
-
{ value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
|
|
227
|
-
{ value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
|
|
228
|
-
{ value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
|
|
229
|
-
];
|
|
230
222
|
function SectionCard$1({ title, description, right, children }) {
|
|
231
223
|
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
232
224
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
|
|
@@ -248,8 +240,7 @@ function FieldRow$1({ label, hint, children }) {
|
|
|
248
240
|
/* @__PURE__ */ jsx("div", { className: "col-span-12 md:col-span-8", children })
|
|
249
241
|
] });
|
|
250
242
|
}
|
|
251
|
-
function
|
|
252
|
-
var _a, _b;
|
|
243
|
+
function AdditionalSettingsTab() {
|
|
253
244
|
const [form, setForm] = useState(() => ({ ...DEFAULT_FORM }));
|
|
254
245
|
const [loading, setLoading] = useState(false);
|
|
255
246
|
const [saving, setSaving] = useState(false);
|
|
@@ -263,7 +254,7 @@ function AdvancedCardPaymentsTab() {
|
|
|
263
254
|
setLoading(true);
|
|
264
255
|
const json = await adminFetch$1("/admin/paypal/settings");
|
|
265
256
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
266
|
-
const saved = payload == null ? void 0 : payload.
|
|
257
|
+
const saved = payload == null ? void 0 : payload.additional_settings;
|
|
267
258
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
268
259
|
} catch {
|
|
269
260
|
} finally {
|
|
@@ -274,17 +265,15 @@ function AdvancedCardPaymentsTab() {
|
|
|
274
265
|
async function onSave() {
|
|
275
266
|
try {
|
|
276
267
|
setSaving(true);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
body: { advanced_card_payments: form }
|
|
280
|
-
});
|
|
268
|
+
setToast(null);
|
|
269
|
+
const json = await adminFetch$1("/admin/paypal/settings", { method: "POST", body: { additional_settings: form } });
|
|
281
270
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
282
|
-
const saved = payload == null ? void 0 : payload.
|
|
271
|
+
const saved = payload == null ? void 0 : payload.additional_settings;
|
|
283
272
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
284
273
|
setToast({ type: "success", message: "Settings saved" });
|
|
285
274
|
window.setTimeout(() => setToast(null), 2500);
|
|
286
275
|
} catch (e) {
|
|
287
|
-
setToast({ type: "error", message:
|
|
276
|
+
setToast({ type: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
|
|
288
277
|
window.setTimeout(() => setToast(null), 3500);
|
|
289
278
|
} finally {
|
|
290
279
|
setSaving(false);
|
|
@@ -297,27 +286,41 @@ function AdvancedCardPaymentsTab() {
|
|
|
297
286
|
/* @__PURE__ */ jsx(
|
|
298
287
|
SectionCard$1,
|
|
299
288
|
{
|
|
300
|
-
title: "
|
|
301
|
-
description: "
|
|
289
|
+
title: "Additional Settings",
|
|
290
|
+
description: "These settings control checkout behavior and PayPal experience.",
|
|
302
291
|
right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
303
292
|
/* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
304
293
|
loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
|
|
305
294
|
] }),
|
|
306
295
|
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
307
|
-
/* @__PURE__ */ jsx(FieldRow$1, { label: "
|
|
308
|
-
/* @__PURE__ */ jsx("
|
|
309
|
-
/* @__PURE__ */ jsx("
|
|
296
|
+
/* @__PURE__ */ jsx(FieldRow$1, { label: "Payment action", children: /* @__PURE__ */ jsxs("select", { value: form.paymentAction, onChange: (e) => setForm((p) => ({ ...p, paymentAction: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
|
|
297
|
+
/* @__PURE__ */ jsx("option", { value: "capture", children: "Capture" }),
|
|
298
|
+
/* @__PURE__ */ jsx("option", { value: "authorize", children: "Authorize" })
|
|
310
299
|
] }) }),
|
|
311
|
-
/* @__PURE__ */ jsx(FieldRow$1, { label: "
|
|
312
|
-
/* @__PURE__ */ jsx(FieldRow$1, { label: "
|
|
313
|
-
/* @__PURE__ */ jsx("
|
|
314
|
-
|
|
315
|
-
|
|
300
|
+
/* @__PURE__ */ jsx(FieldRow$1, { label: "Brand Name", children: /* @__PURE__ */ jsx("input", { value: form.brandName, onChange: (e) => setForm((p) => ({ ...p, brandName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) }),
|
|
301
|
+
/* @__PURE__ */ jsx(FieldRow$1, { label: "Landing Page", children: /* @__PURE__ */ jsxs("select", { value: form.landingPage, onChange: (e) => setForm((p) => ({ ...p, landingPage: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
|
|
302
|
+
/* @__PURE__ */ jsx("option", { value: "no_preference", children: "No Preference" }),
|
|
303
|
+
/* @__PURE__ */ jsx("option", { value: "login", children: "Login" }),
|
|
304
|
+
/* @__PURE__ */ jsx("option", { value: "billing", children: "Billing" })
|
|
305
|
+
] }) }),
|
|
306
|
+
/* @__PURE__ */ jsx(FieldRow$1, { label: "Instant Payments", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
307
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.requireInstantPayment, onChange: (e) => setForm((p) => ({ ...p, requireInstantPayment: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
308
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
|
|
309
|
+
] }) }),
|
|
310
|
+
/* @__PURE__ */ jsx(FieldRow$1, { label: "Send Item Details", hint: "Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
311
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.sendItemDetails, onChange: (e) => setForm((p) => ({ ...p, sendItemDetails: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
312
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
|
|
313
|
+
] }) }),
|
|
314
|
+
/* @__PURE__ */ jsx(FieldRow$1, { label: "Invoice prefix", children: /* @__PURE__ */ jsx("input", { value: form.invoicePrefix, onChange: (e) => setForm((p) => ({ ...p, invoicePrefix: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "WC-" }) }),
|
|
315
|
+
/* @__PURE__ */ jsx(FieldRow$1, { label: "Credit Card Statement Name", children: /* @__PURE__ */ jsx("input", { value: form.creditCardStatementName, onChange: (e) => setForm((p) => ({ ...p, creditCardStatementName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) })
|
|
316
316
|
] })
|
|
317
317
|
}
|
|
318
318
|
)
|
|
319
319
|
] }) });
|
|
320
320
|
}
|
|
321
|
+
function PayPalApplePayPage() {
|
|
322
|
+
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
323
|
+
}
|
|
321
324
|
const config = defineRouteConfig({
|
|
322
325
|
label: "PayPal Connection",
|
|
323
326
|
hide: true
|
|
@@ -914,9 +917,6 @@ function PayPalConnectionPage() {
|
|
|
914
917
|
function PayPalGooglePayPage() {
|
|
915
918
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
916
919
|
}
|
|
917
|
-
function PayPalApplePayPage() {
|
|
918
|
-
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
919
|
-
}
|
|
920
920
|
function PayPalPayLaterMessagingPage() {
|
|
921
921
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
922
922
|
}
|
|
@@ -1200,13 +1200,17 @@ const routeModule = {
|
|
|
1200
1200
|
Component: PayPalSettingsIndexRoute,
|
|
1201
1201
|
path: "/settings/paypal"
|
|
1202
1202
|
},
|
|
1203
|
+
{
|
|
1204
|
+
Component: AdvancedCardPaymentsTab,
|
|
1205
|
+
path: "/settings/paypal/advanced-card-payments"
|
|
1206
|
+
},
|
|
1203
1207
|
{
|
|
1204
1208
|
Component: AdditionalSettingsTab,
|
|
1205
1209
|
path: "/settings/paypal/additional-settings"
|
|
1206
1210
|
},
|
|
1207
1211
|
{
|
|
1208
|
-
Component:
|
|
1209
|
-
path: "/settings/paypal/
|
|
1212
|
+
Component: PayPalApplePayPage,
|
|
1213
|
+
path: "/settings/paypal/apple-pay"
|
|
1210
1214
|
},
|
|
1211
1215
|
{
|
|
1212
1216
|
Component: PayPalConnectionPage,
|
|
@@ -1216,10 +1220,6 @@ const routeModule = {
|
|
|
1216
1220
|
Component: PayPalGooglePayPage,
|
|
1217
1221
|
path: "/settings/paypal/google-pay"
|
|
1218
1222
|
},
|
|
1219
|
-
{
|
|
1220
|
-
Component: PayPalApplePayPage,
|
|
1221
|
-
path: "/settings/paypal/apple-pay"
|
|
1222
|
-
},
|
|
1223
1223
|
{
|
|
1224
1224
|
Component: PayPalPayLaterMessagingPage,
|
|
1225
1225
|
path: "/settings/paypal/pay-later-messaging"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easypayment/medusa-payment-paypal",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "PayPal integration for Medusa v2",
|
|
5
5
|
"author": "EasyPayment Plugins",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "medusa plugin:build",
|
|
38
38
|
"develop": "medusa plugin:develop",
|
|
39
|
-
"
|
|
39
|
+
"prepublishOnly": "npm run build"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@medusajs/admin-sdk": "2.12.5",
|
|
@@ -56,6 +56,11 @@
|
|
|
56
56
|
"@medusajs/ui": "^4.0.0",
|
|
57
57
|
"@medusajs/icons": "^2.12.0"
|
|
58
58
|
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@medusajs/admin-sdk": { "optional": true },
|
|
61
|
+
"@medusajs/ui": { "optional": true },
|
|
62
|
+
"@medusajs/icons": { "optional": true }
|
|
63
|
+
},
|
|
59
64
|
"publishConfig": {
|
|
60
65
|
"access": "public"
|
|
61
66
|
},
|