@easypayment/medusa-payment-paypal 1.1.0 → 1.1.2

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.
Files changed (65) hide show
  1. package/.medusa/server/src/admin/index.js +73 -73
  2. package/.medusa/server/src/admin/index.mjs +73 -73
  3. package/.medusa/server/src/api/hooks/paypal/onboard-return/route.d.ts +16 -0
  4. package/.medusa/server/src/api/hooks/paypal/onboard-return/route.d.ts.map +1 -0
  5. package/.medusa/server/src/api/hooks/paypal/onboard-return/route.js +20 -0
  6. package/.medusa/server/src/api/hooks/paypal/onboard-return/route.js.map +1 -0
  7. package/.medusa/server/src/api/hooks/paypal/webhook/route.d.ts +18 -0
  8. package/.medusa/server/src/api/hooks/paypal/webhook/route.d.ts.map +1 -0
  9. package/.medusa/server/src/api/hooks/paypal/webhook/route.js +22 -0
  10. package/.medusa/server/src/api/hooks/paypal/webhook/route.js.map +1 -0
  11. package/.medusa/server/src/api/middlewares.d.ts.map +1 -1
  12. package/.medusa/server/src/api/middlewares.js +9 -0
  13. package/.medusa/server/src/api/middlewares.js.map +1 -1
  14. package/.medusa/server/src/api/store/paypal/config/route.d.ts.map +1 -1
  15. package/.medusa/server/src/api/store/paypal/config/route.js +8 -0
  16. package/.medusa/server/src/api/store/paypal/config/route.js.map +1 -1
  17. package/.medusa/server/src/api/store/paypal/create-order/route.d.ts.map +1 -1
  18. package/.medusa/server/src/api/store/paypal/create-order/route.js +53 -4
  19. package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
  20. package/.medusa/server/src/api/store/paypal-complete/route.js +1 -1
  21. package/.medusa/server/src/api/store/paypal-complete/route.js.map +1 -1
  22. package/.medusa/server/src/api/utils/rate-limit.d.ts.map +1 -1
  23. package/.medusa/server/src/api/utils/rate-limit.js +11 -2
  24. package/.medusa/server/src/api/utils/rate-limit.js.map +1 -1
  25. package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts +32 -3
  26. package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts.map +1 -1
  27. package/.medusa/server/src/modules/paypal/payment-provider/base-provider.js +47 -0
  28. package/.medusa/server/src/modules/paypal/payment-provider/base-provider.js.map +1 -1
  29. package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts.map +1 -1
  30. package/.medusa/server/src/modules/paypal/payment-provider/card-service.js +172 -117
  31. package/.medusa/server/src/modules/paypal/payment-provider/card-service.js.map +1 -1
  32. package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
  33. package/.medusa/server/src/modules/paypal/payment-provider/service.js +132 -126
  34. package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
  35. package/.medusa/server/src/modules/paypal/service.d.ts +5 -0
  36. package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
  37. package/.medusa/server/src/modules/paypal/service.js +82 -1
  38. package/.medusa/server/src/modules/paypal/service.js.map +1 -1
  39. package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts +10 -0
  40. package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts.map +1 -1
  41. package/.medusa/server/src/modules/paypal/utils/credential-resolver.js +39 -0
  42. package/.medusa/server/src/modules/paypal/utils/credential-resolver.js.map +1 -1
  43. package/.medusa/server/src/modules/paypal/utils/paypal-fetch.d.ts.map +1 -1
  44. package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js +45 -28
  45. package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js.map +1 -1
  46. package/.medusa/server/src/modules/paypal/webhook-processor.d.ts +11 -0
  47. package/.medusa/server/src/modules/paypal/webhook-processor.d.ts.map +1 -1
  48. package/.medusa/server/src/modules/paypal/webhook-processor.js +85 -7
  49. package/.medusa/server/src/modules/paypal/webhook-processor.js.map +1 -1
  50. package/CHANGELOG.md +73 -0
  51. package/package.json +4 -5
  52. package/src/api/hooks/paypal/onboard-return/route.ts +15 -0
  53. package/src/api/hooks/paypal/webhook/route.ts +17 -0
  54. package/src/api/middlewares.ts +9 -0
  55. package/src/api/store/paypal/config/route.ts +8 -0
  56. package/src/api/store/paypal/create-order/route.ts +64 -4
  57. package/src/api/store/paypal-complete/route.ts +1 -1
  58. package/src/api/utils/rate-limit.ts +11 -2
  59. package/src/modules/paypal/payment-provider/base-provider.ts +52 -0
  60. package/src/modules/paypal/payment-provider/card-service.ts +193 -136
  61. package/src/modules/paypal/payment-provider/service.ts +137 -156
  62. package/src/modules/paypal/service.ts +98 -1
  63. package/src/modules/paypal/utils/credential-resolver.ts +36 -0
  64. package/src/modules/paypal/utils/paypal-fetch.ts +58 -29
  65. package/src/modules/paypal/webhook-processor.ts +94 -8
@@ -134,20 +134,22 @@ async function adminFetch(path, opts = {}) {
134
134
  }
135
135
  }
136
136
  const DEFAULT_FORM$1 = {
137
- paymentAction: "capture",
138
- brandName: "PayPal",
139
- landingPage: "no_preference",
140
- requireInstantPayment: false,
141
- sendItemDetails: true,
142
- invoicePrefix: "PP-",
143
- creditCardStatementName: "PayPal"
137
+ enabled: true,
138
+ title: "Credit or Debit Card",
139
+ threeDS: "when_required"
144
140
  };
145
141
  function mergeWithDefaults$1(saved) {
146
142
  if (!saved) return { ...DEFAULT_FORM$1 };
147
143
  const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
148
144
  return { ...DEFAULT_FORM$1, ...Object.fromEntries(entries) };
149
145
  }
150
- function AdditionalSettingsTab() {
146
+ const THREE_DS_OPTIONS = [
147
+ { value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
148
+ { value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
149
+ { value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
150
+ ];
151
+ function AdvancedCardPaymentsTab() {
152
+ var _a, _b;
151
153
  const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM$1 }));
152
154
  const [loading, setLoading] = react.useState(false);
153
155
  const [saving, setSaving] = react.useState(false);
@@ -162,7 +164,7 @@ function AdditionalSettingsTab() {
162
164
  setLoading(true);
163
165
  const json = await adminFetch("/admin/paypal/settings");
164
166
  const payload = (json == null ? void 0 : json.data) ?? json;
165
- const saved = payload == null ? void 0 : payload.additional_settings;
167
+ const saved = payload == null ? void 0 : payload.advanced_card_payments;
166
168
  if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
167
169
  } catch {
168
170
  } finally {
@@ -173,14 +175,16 @@ function AdditionalSettingsTab() {
173
175
  async function onSave() {
174
176
  try {
175
177
  setSaving(true);
176
- setToast(null);
177
- const json = await adminFetch("/admin/paypal/settings", { method: "POST", body: { additional_settings: form } });
178
+ const json = await adminFetch("/admin/paypal/settings", {
179
+ method: "POST",
180
+ body: { advanced_card_payments: form }
181
+ });
178
182
  const payload = (json == null ? void 0 : json.data) ?? json;
179
- const saved = payload == null ? void 0 : payload.additional_settings;
183
+ const saved = payload == null ? void 0 : payload.advanced_card_payments;
180
184
  if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
181
185
  setToast({ kind: "success", message: "Settings saved" });
182
186
  } catch (e) {
183
- setToast({ kind: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
187
+ setToast({ kind: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
184
188
  } finally {
185
189
  setSaving(false);
186
190
  }
@@ -192,55 +196,42 @@ function AdditionalSettingsTab() {
192
196
  /* @__PURE__ */ jsxRuntime.jsx(
193
197
  SectionCard,
194
198
  {
195
- title: "Additional Settings",
196
- description: "These settings control checkout behavior and PayPal experience.",
199
+ title: "Advanced Card Payments",
200
+ description: "Control card checkout settings and 3D Secure behavior.",
197
201
  right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
198
202
  /* @__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" }),
199
203
  loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
200
204
  ] }),
201
205
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
202
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Payment action", htmlFor: "as-payment-action", children: /* @__PURE__ */ jsxRuntime.jsxs("select", { id: "as-payment-action", 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: [
203
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "capture", children: "Capture" }),
204
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorize", children: "Authorize" })
205
- ] }) }),
206
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Brand Name", htmlFor: "as-brand-name", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "as-brand-name", 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" }) }),
207
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Landing Page", htmlFor: "as-landing-page", children: /* @__PURE__ */ jsxRuntime.jsxs("select", { id: "as-landing-page", 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: [
208
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "no_preference", children: "No Preference" }),
209
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "login", children: "Login" }),
210
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "billing", children: "Billing" })
211
- ] }) }),
212
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Instant Payments", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
213
- /* @__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" }),
214
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
215
- ] }) }),
216
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { 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: [
217
- /* @__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" }),
218
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
206
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
207
+ /* @__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" }),
208
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
219
209
  ] }) }),
220
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Invoice prefix", htmlFor: "as-invoice-prefix", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "as-invoice-prefix", 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: "PP-" }) }),
221
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Credit Card Statement Name", htmlFor: "as-cc-statement", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "as-cc-statement", 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" }) })
210
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "acp-title", 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" }) }),
211
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", htmlFor: "acp-threeds", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
212
+ /* @__PURE__ */ jsxRuntime.jsx("select", { id: "acp-threeds", 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)) }),
213
+ ((_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
214
+ ] }) })
222
215
  ] })
223
216
  }
224
217
  )
225
218
  ] }) });
226
219
  }
227
220
  const DEFAULT_FORM = {
228
- enabled: true,
229
- title: "Credit or Debit Card",
230
- threeDS: "when_required"
221
+ paymentAction: "capture",
222
+ brandName: "PayPal",
223
+ landingPage: "no_preference",
224
+ requireInstantPayment: false,
225
+ sendItemDetails: true,
226
+ invoicePrefix: "PP-",
227
+ creditCardStatementName: "PayPal"
231
228
  };
232
229
  function mergeWithDefaults(saved) {
233
230
  if (!saved) return { ...DEFAULT_FORM };
234
231
  const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
235
232
  return { ...DEFAULT_FORM, ...Object.fromEntries(entries) };
236
233
  }
237
- const THREE_DS_OPTIONS = [
238
- { value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
239
- { value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
240
- { value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
241
- ];
242
- function AdvancedCardPaymentsTab() {
243
- var _a, _b;
234
+ function AdditionalSettingsTab() {
244
235
  const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM }));
245
236
  const [loading, setLoading] = react.useState(false);
246
237
  const [saving, setSaving] = react.useState(false);
@@ -255,7 +246,7 @@ function AdvancedCardPaymentsTab() {
255
246
  setLoading(true);
256
247
  const json = await adminFetch("/admin/paypal/settings");
257
248
  const payload = (json == null ? void 0 : json.data) ?? json;
258
- const saved = payload == null ? void 0 : payload.advanced_card_payments;
249
+ const saved = payload == null ? void 0 : payload.additional_settings;
259
250
  if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
260
251
  } catch {
261
252
  } finally {
@@ -266,16 +257,14 @@ function AdvancedCardPaymentsTab() {
266
257
  async function onSave() {
267
258
  try {
268
259
  setSaving(true);
269
- const json = await adminFetch("/admin/paypal/settings", {
270
- method: "POST",
271
- body: { advanced_card_payments: form }
272
- });
260
+ setToast(null);
261
+ const json = await adminFetch("/admin/paypal/settings", { method: "POST", body: { additional_settings: form } });
273
262
  const payload = (json == null ? void 0 : json.data) ?? json;
274
- const saved = payload == null ? void 0 : payload.advanced_card_payments;
263
+ const saved = payload == null ? void 0 : payload.additional_settings;
275
264
  if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
276
265
  setToast({ kind: "success", message: "Settings saved" });
277
266
  } catch (e) {
278
- setToast({ kind: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
267
+ setToast({ kind: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
279
268
  } finally {
280
269
  setSaving(false);
281
270
  }
@@ -287,27 +276,44 @@ function AdvancedCardPaymentsTab() {
287
276
  /* @__PURE__ */ jsxRuntime.jsx(
288
277
  SectionCard,
289
278
  {
290
- title: "Advanced Card Payments",
291
- description: "Control card checkout settings and 3D Secure behavior.",
279
+ title: "Additional Settings",
280
+ description: "These settings control checkout behavior and PayPal experience.",
292
281
  right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
293
282
  /* @__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" }),
294
283
  loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
295
284
  ] }),
296
285
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
297
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
298
- /* @__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" }),
299
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
286
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Payment action", htmlFor: "as-payment-action", children: /* @__PURE__ */ jsxRuntime.jsxs("select", { id: "as-payment-action", 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: [
287
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "capture", children: "Capture" }),
288
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorize", children: "Authorize" })
300
289
  ] }) }),
301
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "acp-title", 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" }) }),
302
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", htmlFor: "acp-threeds", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
303
- /* @__PURE__ */ jsxRuntime.jsx("select", { id: "acp-threeds", 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)) }),
304
- ((_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
305
- ] }) })
290
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Brand Name", htmlFor: "as-brand-name", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "as-brand-name", 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" }) }),
291
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Landing Page", htmlFor: "as-landing-page", children: /* @__PURE__ */ jsxRuntime.jsxs("select", { id: "as-landing-page", 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: [
292
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "no_preference", children: "No Preference" }),
293
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "login", children: "Login" }),
294
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "billing", children: "Billing" })
295
+ ] }) }),
296
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Instant Payments", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
297
+ /* @__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" }),
298
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
299
+ ] }) }),
300
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { 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: [
301
+ /* @__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" }),
302
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
303
+ ] }) }),
304
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Invoice prefix", htmlFor: "as-invoice-prefix", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "as-invoice-prefix", 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: "PP-" }) }),
305
+ /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Credit Card Statement Name", htmlFor: "as-cc-statement", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "as-cc-statement", 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" }) })
306
306
  ] })
307
307
  }
308
308
  )
309
309
  ] }) });
310
310
  }
311
+ function PayPalApplePayPage() {
312
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
313
+ }
314
+ function PayPalGooglePayPage() {
315
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
316
+ }
311
317
  const config = adminSdk.defineRouteConfig({
312
318
  label: "PayPal Connection"
313
319
  });
@@ -1025,12 +1031,6 @@ function PayPalConnectionPage() {
1025
1031
  ` })
1026
1032
  ] });
1027
1033
  }
1028
- function PayPalApplePayPage() {
1029
- return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
1030
- }
1031
- function PayPalGooglePayPage() {
1032
- return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
1033
- }
1034
1034
  function PayPalPayLaterMessagingPage() {
1035
1035
  return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
1036
1036
  }
@@ -1248,17 +1248,13 @@ const routeModule = {
1248
1248
  Component: PayPalSettingsIndexRoute,
1249
1249
  path: "/settings/paypal"
1250
1250
  },
1251
- {
1252
- Component: AdditionalSettingsTab,
1253
- path: "/settings/paypal/additional-settings"
1254
- },
1255
1251
  {
1256
1252
  Component: AdvancedCardPaymentsTab,
1257
1253
  path: "/settings/paypal/advanced-card-payments"
1258
1254
  },
1259
1255
  {
1260
- Component: PayPalConnectionPage,
1261
- path: "/settings/paypal/connection"
1256
+ Component: AdditionalSettingsTab,
1257
+ path: "/settings/paypal/additional-settings"
1262
1258
  },
1263
1259
  {
1264
1260
  Component: PayPalApplePayPage,
@@ -1268,6 +1264,10 @@ const routeModule = {
1268
1264
  Component: PayPalGooglePayPage,
1269
1265
  path: "/settings/paypal/google-pay"
1270
1266
  },
1267
+ {
1268
+ Component: PayPalConnectionPage,
1269
+ path: "/settings/paypal/connection"
1270
+ },
1271
1271
  {
1272
1272
  Component: PayPalPayLaterMessagingPage,
1273
1273
  path: "/settings/paypal/pay-later-messaging"
@@ -133,20 +133,22 @@ async function adminFetch(path, opts = {}) {
133
133
  }
134
134
  }
135
135
  const DEFAULT_FORM$1 = {
136
- paymentAction: "capture",
137
- brandName: "PayPal",
138
- landingPage: "no_preference",
139
- requireInstantPayment: false,
140
- sendItemDetails: true,
141
- invoicePrefix: "PP-",
142
- creditCardStatementName: "PayPal"
136
+ enabled: true,
137
+ title: "Credit or Debit Card",
138
+ threeDS: "when_required"
143
139
  };
144
140
  function mergeWithDefaults$1(saved) {
145
141
  if (!saved) return { ...DEFAULT_FORM$1 };
146
142
  const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
147
143
  return { ...DEFAULT_FORM$1, ...Object.fromEntries(entries) };
148
144
  }
149
- function AdditionalSettingsTab() {
145
+ const THREE_DS_OPTIONS = [
146
+ { value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
147
+ { value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
148
+ { value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
149
+ ];
150
+ function AdvancedCardPaymentsTab() {
151
+ var _a, _b;
150
152
  const [form, setForm] = useState(() => ({ ...DEFAULT_FORM$1 }));
151
153
  const [loading, setLoading] = useState(false);
152
154
  const [saving, setSaving] = useState(false);
@@ -161,7 +163,7 @@ function AdditionalSettingsTab() {
161
163
  setLoading(true);
162
164
  const json = await adminFetch("/admin/paypal/settings");
163
165
  const payload = (json == null ? void 0 : json.data) ?? json;
164
- const saved = payload == null ? void 0 : payload.additional_settings;
166
+ const saved = payload == null ? void 0 : payload.advanced_card_payments;
165
167
  if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
166
168
  } catch {
167
169
  } finally {
@@ -172,14 +174,16 @@ function AdditionalSettingsTab() {
172
174
  async function onSave() {
173
175
  try {
174
176
  setSaving(true);
175
- setToast(null);
176
- const json = await adminFetch("/admin/paypal/settings", { method: "POST", body: { additional_settings: form } });
177
+ const json = await adminFetch("/admin/paypal/settings", {
178
+ method: "POST",
179
+ body: { advanced_card_payments: form }
180
+ });
177
181
  const payload = (json == null ? void 0 : json.data) ?? json;
178
- const saved = payload == null ? void 0 : payload.additional_settings;
182
+ const saved = payload == null ? void 0 : payload.advanced_card_payments;
179
183
  if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
180
184
  setToast({ kind: "success", message: "Settings saved" });
181
185
  } catch (e) {
182
- setToast({ kind: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
186
+ setToast({ kind: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
183
187
  } finally {
184
188
  setSaving(false);
185
189
  }
@@ -191,55 +195,42 @@ function AdditionalSettingsTab() {
191
195
  /* @__PURE__ */ jsx(
192
196
  SectionCard,
193
197
  {
194
- title: "Additional Settings",
195
- description: "These settings control checkout behavior and PayPal experience.",
198
+ title: "Advanced Card Payments",
199
+ description: "Control card checkout settings and 3D Secure behavior.",
196
200
  right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
197
201
  /* @__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" }),
198
202
  loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
199
203
  ] }),
200
204
  children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
201
- /* @__PURE__ */ jsx(FieldRow, { label: "Payment action", htmlFor: "as-payment-action", children: /* @__PURE__ */ jsxs("select", { id: "as-payment-action", 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: [
202
- /* @__PURE__ */ jsx("option", { value: "capture", children: "Capture" }),
203
- /* @__PURE__ */ jsx("option", { value: "authorize", children: "Authorize" })
204
- ] }) }),
205
- /* @__PURE__ */ jsx(FieldRow, { label: "Brand Name", htmlFor: "as-brand-name", children: /* @__PURE__ */ jsx("input", { id: "as-brand-name", 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" }) }),
206
- /* @__PURE__ */ jsx(FieldRow, { label: "Landing Page", htmlFor: "as-landing-page", children: /* @__PURE__ */ jsxs("select", { id: "as-landing-page", 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: [
207
- /* @__PURE__ */ jsx("option", { value: "no_preference", children: "No Preference" }),
208
- /* @__PURE__ */ jsx("option", { value: "login", children: "Login" }),
209
- /* @__PURE__ */ jsx("option", { value: "billing", children: "Billing" })
210
- ] }) }),
211
- /* @__PURE__ */ jsx(FieldRow, { label: "Instant Payments", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
212
- /* @__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" }),
213
- /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
214
- ] }) }),
215
- /* @__PURE__ */ jsx(FieldRow, { 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: [
216
- /* @__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" }),
217
- /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
205
+ /* @__PURE__ */ jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
206
+ /* @__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" }),
207
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
218
208
  ] }) }),
219
- /* @__PURE__ */ jsx(FieldRow, { label: "Invoice prefix", htmlFor: "as-invoice-prefix", children: /* @__PURE__ */ jsx("input", { id: "as-invoice-prefix", 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: "PP-" }) }),
220
- /* @__PURE__ */ jsx(FieldRow, { label: "Credit Card Statement Name", htmlFor: "as-cc-statement", children: /* @__PURE__ */ jsx("input", { id: "as-cc-statement", 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" }) })
209
+ /* @__PURE__ */ jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsx("input", { id: "acp-title", 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" }) }),
210
+ /* @__PURE__ */ jsx(FieldRow, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", htmlFor: "acp-threeds", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
211
+ /* @__PURE__ */ jsx("select", { id: "acp-threeds", 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)) }),
212
+ ((_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
213
+ ] }) })
221
214
  ] })
222
215
  }
223
216
  )
224
217
  ] }) });
225
218
  }
226
219
  const DEFAULT_FORM = {
227
- enabled: true,
228
- title: "Credit or Debit Card",
229
- threeDS: "when_required"
220
+ paymentAction: "capture",
221
+ brandName: "PayPal",
222
+ landingPage: "no_preference",
223
+ requireInstantPayment: false,
224
+ sendItemDetails: true,
225
+ invoicePrefix: "PP-",
226
+ creditCardStatementName: "PayPal"
230
227
  };
231
228
  function mergeWithDefaults(saved) {
232
229
  if (!saved) return { ...DEFAULT_FORM };
233
230
  const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
234
231
  return { ...DEFAULT_FORM, ...Object.fromEntries(entries) };
235
232
  }
236
- const THREE_DS_OPTIONS = [
237
- { value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
238
- { value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
239
- { value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
240
- ];
241
- function AdvancedCardPaymentsTab() {
242
- var _a, _b;
233
+ function AdditionalSettingsTab() {
243
234
  const [form, setForm] = useState(() => ({ ...DEFAULT_FORM }));
244
235
  const [loading, setLoading] = useState(false);
245
236
  const [saving, setSaving] = useState(false);
@@ -254,7 +245,7 @@ function AdvancedCardPaymentsTab() {
254
245
  setLoading(true);
255
246
  const json = await adminFetch("/admin/paypal/settings");
256
247
  const payload = (json == null ? void 0 : json.data) ?? json;
257
- const saved = payload == null ? void 0 : payload.advanced_card_payments;
248
+ const saved = payload == null ? void 0 : payload.additional_settings;
258
249
  if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
259
250
  } catch {
260
251
  } finally {
@@ -265,16 +256,14 @@ function AdvancedCardPaymentsTab() {
265
256
  async function onSave() {
266
257
  try {
267
258
  setSaving(true);
268
- const json = await adminFetch("/admin/paypal/settings", {
269
- method: "POST",
270
- body: { advanced_card_payments: form }
271
- });
259
+ setToast(null);
260
+ const json = await adminFetch("/admin/paypal/settings", { method: "POST", body: { additional_settings: form } });
272
261
  const payload = (json == null ? void 0 : json.data) ?? json;
273
- const saved = payload == null ? void 0 : payload.advanced_card_payments;
262
+ const saved = payload == null ? void 0 : payload.additional_settings;
274
263
  if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
275
264
  setToast({ kind: "success", message: "Settings saved" });
276
265
  } catch (e) {
277
- setToast({ kind: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
266
+ setToast({ kind: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
278
267
  } finally {
279
268
  setSaving(false);
280
269
  }
@@ -286,27 +275,44 @@ function AdvancedCardPaymentsTab() {
286
275
  /* @__PURE__ */ jsx(
287
276
  SectionCard,
288
277
  {
289
- title: "Advanced Card Payments",
290
- description: "Control card checkout settings and 3D Secure behavior.",
278
+ title: "Additional Settings",
279
+ description: "These settings control checkout behavior and PayPal experience.",
291
280
  right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
292
281
  /* @__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" }),
293
282
  loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
294
283
  ] }),
295
284
  children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
296
- /* @__PURE__ */ jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
297
- /* @__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" }),
298
- /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
285
+ /* @__PURE__ */ jsx(FieldRow, { label: "Payment action", htmlFor: "as-payment-action", children: /* @__PURE__ */ jsxs("select", { id: "as-payment-action", 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: [
286
+ /* @__PURE__ */ jsx("option", { value: "capture", children: "Capture" }),
287
+ /* @__PURE__ */ jsx("option", { value: "authorize", children: "Authorize" })
299
288
  ] }) }),
300
- /* @__PURE__ */ jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsx("input", { id: "acp-title", 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" }) }),
301
- /* @__PURE__ */ jsx(FieldRow, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", htmlFor: "acp-threeds", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
302
- /* @__PURE__ */ jsx("select", { id: "acp-threeds", 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)) }),
303
- ((_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
304
- ] }) })
289
+ /* @__PURE__ */ jsx(FieldRow, { label: "Brand Name", htmlFor: "as-brand-name", children: /* @__PURE__ */ jsx("input", { id: "as-brand-name", 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" }) }),
290
+ /* @__PURE__ */ jsx(FieldRow, { label: "Landing Page", htmlFor: "as-landing-page", children: /* @__PURE__ */ jsxs("select", { id: "as-landing-page", 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: [
291
+ /* @__PURE__ */ jsx("option", { value: "no_preference", children: "No Preference" }),
292
+ /* @__PURE__ */ jsx("option", { value: "login", children: "Login" }),
293
+ /* @__PURE__ */ jsx("option", { value: "billing", children: "Billing" })
294
+ ] }) }),
295
+ /* @__PURE__ */ jsx(FieldRow, { label: "Instant Payments", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
296
+ /* @__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" }),
297
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
298
+ ] }) }),
299
+ /* @__PURE__ */ jsx(FieldRow, { 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: [
300
+ /* @__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" }),
301
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
302
+ ] }) }),
303
+ /* @__PURE__ */ jsx(FieldRow, { label: "Invoice prefix", htmlFor: "as-invoice-prefix", children: /* @__PURE__ */ jsx("input", { id: "as-invoice-prefix", 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: "PP-" }) }),
304
+ /* @__PURE__ */ jsx(FieldRow, { label: "Credit Card Statement Name", htmlFor: "as-cc-statement", children: /* @__PURE__ */ jsx("input", { id: "as-cc-statement", 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" }) })
305
305
  ] })
306
306
  }
307
307
  )
308
308
  ] }) });
309
309
  }
310
+ function PayPalApplePayPage() {
311
+ return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
312
+ }
313
+ function PayPalGooglePayPage() {
314
+ return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
315
+ }
310
316
  const config = defineRouteConfig({
311
317
  label: "PayPal Connection"
312
318
  });
@@ -1024,12 +1030,6 @@ function PayPalConnectionPage() {
1024
1030
  ` })
1025
1031
  ] });
1026
1032
  }
1027
- function PayPalApplePayPage() {
1028
- return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
1029
- }
1030
- function PayPalGooglePayPage() {
1031
- return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
1032
- }
1033
1033
  function PayPalPayLaterMessagingPage() {
1034
1034
  return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
1035
1035
  }
@@ -1247,17 +1247,13 @@ const routeModule = {
1247
1247
  Component: PayPalSettingsIndexRoute,
1248
1248
  path: "/settings/paypal"
1249
1249
  },
1250
- {
1251
- Component: AdditionalSettingsTab,
1252
- path: "/settings/paypal/additional-settings"
1253
- },
1254
1250
  {
1255
1251
  Component: AdvancedCardPaymentsTab,
1256
1252
  path: "/settings/paypal/advanced-card-payments"
1257
1253
  },
1258
1254
  {
1259
- Component: PayPalConnectionPage,
1260
- path: "/settings/paypal/connection"
1255
+ Component: AdditionalSettingsTab,
1256
+ path: "/settings/paypal/additional-settings"
1261
1257
  },
1262
1258
  {
1263
1259
  Component: PayPalApplePayPage,
@@ -1267,6 +1263,10 @@ const routeModule = {
1267
1263
  Component: PayPalGooglePayPage,
1268
1264
  path: "/settings/paypal/google-pay"
1269
1265
  },
1266
+ {
1267
+ Component: PayPalConnectionPage,
1268
+ path: "/settings/paypal/connection"
1269
+ },
1270
1270
  {
1271
1271
  Component: PayPalPayLaterMessagingPage,
1272
1272
  path: "/settings/paypal/pay-later-messaging"
@@ -0,0 +1,16 @@
1
+ /**
2
+ * PayPal onboarding `return_url` under the `/hooks` namespace.
3
+ *
4
+ * PayPal redirects the onboarding popup here as a plain top-level browser
5
+ * navigation, which carries no `x-publishable-api-key` header — and Medusa's
6
+ * store publishable-key middleware rejects every `/store/*` request without
7
+ * that header before the handler runs. Hosting the return bridge under
8
+ * `/hooks` (no publishable-key guard) lets the popup complete the credential
9
+ * exchange and close itself.
10
+ *
11
+ * The legacy `/store/paypal/onboard-return` route is kept for deployments
12
+ * whose edge injects the key; both paths share this exact handler. Newly
13
+ * generated onboarding links point at `/hooks/paypal/onboard-return`.
14
+ */
15
+ export { GET } from "../../../store/paypal/onboard-return/route";
16
+ //# sourceMappingURL=route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/hooks/paypal/onboard-return/route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,4CAA4C,CAAA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET = void 0;
4
+ /**
5
+ * PayPal onboarding `return_url` under the `/hooks` namespace.
6
+ *
7
+ * PayPal redirects the onboarding popup here as a plain top-level browser
8
+ * navigation, which carries no `x-publishable-api-key` header — and Medusa's
9
+ * store publishable-key middleware rejects every `/store/*` request without
10
+ * that header before the handler runs. Hosting the return bridge under
11
+ * `/hooks` (no publishable-key guard) lets the popup complete the credential
12
+ * exchange and close itself.
13
+ *
14
+ * The legacy `/store/paypal/onboard-return` route is kept for deployments
15
+ * whose edge injects the key; both paths share this exact handler. Newly
16
+ * generated onboarding links point at `/hooks/paypal/onboard-return`.
17
+ */
18
+ var route_1 = require("../../../store/paypal/onboard-return/route");
19
+ Object.defineProperty(exports, "GET", { enumerable: true, get: function () { return route_1.GET; } });
20
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/hooks/paypal/onboard-return/route.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,oEAAgE;AAAvD,4FAAA,GAAG,OAAA"}