@easypayment/medusa-paypal 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +724 -724
- package/.medusa/server/src/admin/index.mjs +724 -724
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js +31 -9
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js.map +1 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js +33 -16
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.js +2 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts +3 -2
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js +23 -1
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js.map +1 -1
- package/.medusa/server/src/providers/paypal/index.d.ts +2 -9
- package/.medusa/server/src/providers/paypal/index.d.ts.map +1 -1
- package/.medusa/server/src/providers/paypal/index.js +6 -8
- package/.medusa/server/src/providers/paypal/index.js.map +1 -1
- package/.medusa/server/src/providers/paypal_card/index.d.ts +2 -9
- package/.medusa/server/src/providers/paypal_card/index.d.ts.map +1 -1
- package/.medusa/server/src/providers/paypal_card/index.js +6 -8
- package/.medusa/server/src/providers/paypal_card/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/admin/payment-collections/[id]/payment-sessions/route.ts +37 -10
- package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +41 -18
- package/src/modules/paypal/payment-provider/card-service.ts +1 -1
- package/src/modules/paypal/payment-provider/service.ts +1036 -1035
- package/src/modules/paypal/utils/provider-ids.ts +29 -0
- package/src/providers/paypal/index.ts +6 -9
- package/src/providers/paypal_card/index.ts +6 -9
|
@@ -336,395 +336,101 @@ function AdditionalSettingsTab() {
|
|
|
336
336
|
)
|
|
337
337
|
] }) });
|
|
338
338
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
title: "Credit or Debit Card",
|
|
342
|
-
disabledCards: [],
|
|
343
|
-
threeDS: "when_required",
|
|
344
|
-
cardSaveEnabled: false
|
|
345
|
-
};
|
|
346
|
-
function mergeWithDefaults(saved) {
|
|
347
|
-
if (!saved) return { ...DEFAULT_FORM };
|
|
348
|
-
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
349
|
-
return {
|
|
350
|
-
...DEFAULT_FORM,
|
|
351
|
-
...Object.fromEntries(entries)
|
|
352
|
-
};
|
|
339
|
+
function PayPalApplePayPage() {
|
|
340
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
353
341
|
}
|
|
354
|
-
const
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
342
|
+
const config = adminSdk.defineRouteConfig({
|
|
343
|
+
label: "PayPal Connection",
|
|
344
|
+
hide: true
|
|
345
|
+
});
|
|
346
|
+
if (typeof window !== "undefined") {
|
|
347
|
+
const preloadHref = "https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js";
|
|
348
|
+
const existingPreload = document.head.querySelector(
|
|
349
|
+
`link[rel="preload"][href="${preloadHref}"]`
|
|
350
|
+
);
|
|
351
|
+
if (!existingPreload) {
|
|
352
|
+
const preloadLink = document.createElement("link");
|
|
353
|
+
preloadLink.rel = "preload";
|
|
354
|
+
preloadLink.href = preloadHref;
|
|
355
|
+
preloadLink.as = "script";
|
|
356
|
+
document.head.appendChild(preloadLink);
|
|
357
|
+
}
|
|
358
|
+
const existingScript = document.getElementById(
|
|
359
|
+
"paypal-partner-js"
|
|
360
|
+
);
|
|
361
|
+
if (!existingScript) {
|
|
362
|
+
const ppScript = document.createElement("script");
|
|
363
|
+
ppScript.id = "paypal-partner-js";
|
|
364
|
+
ppScript.src = preloadHref;
|
|
365
|
+
ppScript.async = true;
|
|
366
|
+
document.head.appendChild(ppScript);
|
|
378
367
|
}
|
|
379
|
-
];
|
|
380
|
-
function cx$1(...parts) {
|
|
381
|
-
return parts.filter(Boolean).join(" ");
|
|
382
368
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
369
|
+
const SERVICE_URL = "/admin/paypal/onboarding-link";
|
|
370
|
+
const CACHE_KEY = "pp_onboard_cache";
|
|
371
|
+
const RELOAD_KEY = "pp_onboard_reloaded_once";
|
|
372
|
+
const CACHE_EXPIRY = 10 * 60 * 1e3;
|
|
373
|
+
const ONBOARDING_COMPLETE_ENDPOINT = "/admin/paypal/onboard-complete";
|
|
374
|
+
const STATUS_ENDPOINT = "/admin/paypal/status";
|
|
375
|
+
const SAVE_CREDENTIALS_ENDPOINT = "/admin/paypal/save-credentials";
|
|
376
|
+
const DISCONNECT_ENDPOINT = "/admin/paypal/disconnect";
|
|
377
|
+
let cachedUrl = null;
|
|
378
|
+
if (typeof window !== "undefined") {
|
|
379
|
+
try {
|
|
380
|
+
const cached = localStorage.getItem(CACHE_KEY);
|
|
381
|
+
if (cached) {
|
|
382
|
+
const data = JSON.parse(cached);
|
|
383
|
+
if ((/* @__PURE__ */ new Date()).getTime() - data.ts < CACHE_EXPIRY) {
|
|
384
|
+
cachedUrl = data.url;
|
|
397
385
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
title,
|
|
403
|
-
description,
|
|
404
|
-
right,
|
|
405
|
-
children
|
|
406
|
-
}) {
|
|
407
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
408
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
|
|
409
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
410
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: title }),
|
|
411
|
-
description ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-sm text-ui-fg-subtle", children: description }) : null
|
|
412
|
-
] }),
|
|
413
|
-
right
|
|
414
|
-
] }),
|
|
415
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children })
|
|
416
|
-
] });
|
|
417
|
-
}
|
|
418
|
-
function FieldRow$1({
|
|
419
|
-
label,
|
|
420
|
-
hint,
|
|
421
|
-
children
|
|
422
|
-
}) {
|
|
423
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 items-start gap-4 py-3", children: [
|
|
424
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
|
|
425
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-ui-fg-base", children: label }),
|
|
426
|
-
hint ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: hint }) : null
|
|
427
|
-
] }),
|
|
428
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12 md:col-span-8", children })
|
|
429
|
-
] });
|
|
386
|
+
}
|
|
387
|
+
} catch (e) {
|
|
388
|
+
console.error("Cache read error:", e);
|
|
389
|
+
}
|
|
430
390
|
}
|
|
431
|
-
function
|
|
432
|
-
|
|
433
|
-
const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM }));
|
|
434
|
-
const [loading, setLoading] = react.useState(false);
|
|
435
|
-
const [saving, setSaving] = react.useState(false);
|
|
436
|
-
const [toast, setToast] = react.useState(null);
|
|
437
|
-
const didInit = react.useRef(false);
|
|
391
|
+
function PayPalConnectionPage() {
|
|
392
|
+
const [env, setEnv] = react.useState("sandbox");
|
|
438
393
|
react.useEffect(() => {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
const r = await fetch("/admin/paypal/settings", {
|
|
445
|
-
credentials: "include",
|
|
446
|
-
headers: { "Accept": "application/json" }
|
|
447
|
-
});
|
|
448
|
-
if (!r.ok) return;
|
|
449
|
-
const json = await r.json();
|
|
450
|
-
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
451
|
-
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
452
|
-
if (saved && typeof saved === "object") {
|
|
453
|
-
setForm(mergeWithDefaults(saved));
|
|
454
|
-
}
|
|
455
|
-
} finally {
|
|
456
|
-
setLoading(false);
|
|
457
|
-
}
|
|
458
|
-
})();
|
|
394
|
+
fetch("/admin/paypal/environment", { method: "GET" }).then((r) => r.json()).then((d) => {
|
|
395
|
+
const v = (d == null ? void 0 : d.environment) === "live" ? "live" : "sandbox";
|
|
396
|
+
setEnv(v);
|
|
397
|
+
}).catch(() => {
|
|
398
|
+
});
|
|
459
399
|
}, []);
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
setToast({ type: "success", message: "Settings saved" });
|
|
485
|
-
window.setTimeout(() => setToast(null), 2500);
|
|
486
|
-
} finally {
|
|
487
|
-
setSaving(false);
|
|
400
|
+
const [connState, setConnState] = react.useState("loading");
|
|
401
|
+
const [error, setError] = react.useState(null);
|
|
402
|
+
const [finalUrl, setFinalUrl] = react.useState("");
|
|
403
|
+
const [showManual, setShowManual] = react.useState(false);
|
|
404
|
+
const [clientId, setClientId] = react.useState("");
|
|
405
|
+
const [secret, setSecret] = react.useState("");
|
|
406
|
+
const [merchantId, setMerchantId] = react.useState("");
|
|
407
|
+
const [statusInfo, setStatusInfo] = react.useState(null);
|
|
408
|
+
const [onboardingInProgress, setOnboardingInProgress] = react.useState(false);
|
|
409
|
+
const initLoaderRef = react.useRef(null);
|
|
410
|
+
const paypalButtonRef = react.useRef(null);
|
|
411
|
+
const errorLogRef = react.useRef(null);
|
|
412
|
+
const runIdRef = react.useRef(0);
|
|
413
|
+
const currentRunId = react.useRef(0);
|
|
414
|
+
const ppBtnMeasureRef = react.useRef(null);
|
|
415
|
+
const [ppBtnWidth, setPpBtnWidth] = react.useState(null);
|
|
416
|
+
const canSaveManual = react.useMemo(() => {
|
|
417
|
+
return clientId.trim().length > 0 && secret.trim().length > 0;
|
|
418
|
+
}, [clientId, secret]);
|
|
419
|
+
const maskValue = react.useCallback((value, visibleChars = 4) => {
|
|
420
|
+
if (!value) return "";
|
|
421
|
+
if (value.length <= visibleChars) {
|
|
422
|
+
return "•".repeat(value.length);
|
|
488
423
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
500
|
-
function removeDisabledCard(value) {
|
|
501
|
-
setForm((prev) => ({
|
|
502
|
-
...prev,
|
|
503
|
-
disabledCards: prev.disabledCards.filter((v) => v !== value)
|
|
504
|
-
}));
|
|
505
|
-
}
|
|
506
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
507
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
|
|
508
|
-
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
509
|
-
toast ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
510
|
-
"div",
|
|
511
|
-
{
|
|
512
|
-
className: "fixed right-6 top-6 z-50 rounded-md border border-ui-border-base bg-ui-bg-base px-4 py-3 text-sm shadow-lg",
|
|
513
|
-
role: "status",
|
|
514
|
-
"aria-live": "polite",
|
|
515
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: toast.type === "success" ? "text-ui-fg-base" : "text-ui-fg-error", children: toast.message })
|
|
516
|
-
}
|
|
517
|
-
) : null,
|
|
518
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
519
|
-
SectionCard$1,
|
|
520
|
-
{
|
|
521
|
-
title: "Advanced Card Payments",
|
|
522
|
-
description: "Control card checkout settings, 3D Secure behavior, and card saving.",
|
|
523
|
-
right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
524
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
525
|
-
"button",
|
|
526
|
-
{
|
|
527
|
-
type: "button",
|
|
528
|
-
onClick: onSave,
|
|
529
|
-
disabled: saving || loading,
|
|
530
|
-
className: "rounded-md bg-ui-button-neutral px-4 py-2 text-sm font-medium text-ui-fg-on-color shadow-sm hover:opacity-90 disabled:opacity-60",
|
|
531
|
-
children: saving ? "Saving..." : "Save settings"
|
|
532
|
-
}
|
|
533
|
-
),
|
|
534
|
-
loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
|
|
535
|
-
] }),
|
|
536
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
537
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Enable/Disable", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
538
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
539
|
-
"input",
|
|
540
|
-
{
|
|
541
|
-
type: "checkbox",
|
|
542
|
-
checked: form.enabled,
|
|
543
|
-
onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })),
|
|
544
|
-
className: "h-4 w-4 rounded border-ui-border-base"
|
|
545
|
-
}
|
|
546
|
-
),
|
|
547
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
|
|
548
|
-
] }) }),
|
|
549
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Title", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
550
|
-
"input",
|
|
551
|
-
{
|
|
552
|
-
value: form.title,
|
|
553
|
-
onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })),
|
|
554
|
-
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",
|
|
555
|
-
placeholder: "Credit or Debit Card"
|
|
556
|
-
}
|
|
557
|
-
) }),
|
|
558
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
559
|
-
FieldRow$1,
|
|
560
|
-
{
|
|
561
|
-
label: "Disable specific credit cards",
|
|
562
|
-
hint: "Select card brands to hide from the card form.",
|
|
563
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
564
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: form.disabledCards.length ? form.disabledCards.map((v) => {
|
|
565
|
-
var _a2;
|
|
566
|
-
const label = ((_a2 = CARD_BRANDS.find((b) => b.value === v)) == null ? void 0 : _a2.label) ?? v;
|
|
567
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Pill$1, { onRemove: () => removeDisabledCard(v), children: label }, v);
|
|
568
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No card brands disabled." }) }),
|
|
569
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base p-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-2 md:grid-cols-2", children: CARD_BRANDS.map((b) => {
|
|
570
|
-
const checked = disabledSet.has(b.value);
|
|
571
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
572
|
-
"label",
|
|
573
|
-
{
|
|
574
|
-
className: cx$1(
|
|
575
|
-
"flex items-center gap-2 rounded-md p-2",
|
|
576
|
-
"hover:bg-ui-bg-subtle"
|
|
577
|
-
),
|
|
578
|
-
children: [
|
|
579
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
580
|
-
"input",
|
|
581
|
-
{
|
|
582
|
-
type: "checkbox",
|
|
583
|
-
checked,
|
|
584
|
-
onChange: () => toggleDisabledCard(b.value),
|
|
585
|
-
className: "h-4 w-4 rounded border-ui-border-base"
|
|
586
|
-
}
|
|
587
|
-
),
|
|
588
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: b.label })
|
|
589
|
-
]
|
|
590
|
-
},
|
|
591
|
-
b.value
|
|
592
|
-
);
|
|
593
|
-
}) }) })
|
|
594
|
-
] })
|
|
595
|
-
}
|
|
596
|
-
),
|
|
597
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
598
|
-
FieldRow$1,
|
|
599
|
-
{
|
|
600
|
-
label: "Contingency for 3D Secure",
|
|
601
|
-
hint: "Choose when 3D Secure should be triggered during card payments.",
|
|
602
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
603
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
604
|
-
"select",
|
|
605
|
-
{
|
|
606
|
-
value: form.threeDS,
|
|
607
|
-
onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })),
|
|
608
|
-
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",
|
|
609
|
-
children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value))
|
|
610
|
-
}
|
|
611
|
-
),
|
|
612
|
-
((_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
|
|
613
|
-
] })
|
|
614
|
-
}
|
|
615
|
-
),
|
|
616
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Card Save Enabled", hint: "Allow customers to save a card at checkout for future use.", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
617
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
618
|
-
"input",
|
|
619
|
-
{
|
|
620
|
-
type: "checkbox",
|
|
621
|
-
checked: form.cardSaveEnabled,
|
|
622
|
-
onChange: (e) => setForm((p) => ({ ...p, cardSaveEnabled: e.target.checked })),
|
|
623
|
-
className: "h-4 w-4 rounded border-ui-border-base"
|
|
624
|
-
}
|
|
625
|
-
),
|
|
626
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable card saving at checkout" })
|
|
627
|
-
] }) })
|
|
628
|
-
] })
|
|
629
|
-
}
|
|
630
|
-
)
|
|
631
|
-
] }) });
|
|
632
|
-
}
|
|
633
|
-
function PayPalApplePayPage() {
|
|
634
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
635
|
-
}
|
|
636
|
-
const config = adminSdk.defineRouteConfig({
|
|
637
|
-
label: "PayPal Connection",
|
|
638
|
-
hide: true
|
|
639
|
-
});
|
|
640
|
-
if (typeof window !== "undefined") {
|
|
641
|
-
const preloadHref = "https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js";
|
|
642
|
-
const existingPreload = document.head.querySelector(
|
|
643
|
-
`link[rel="preload"][href="${preloadHref}"]`
|
|
644
|
-
);
|
|
645
|
-
if (!existingPreload) {
|
|
646
|
-
const preloadLink = document.createElement("link");
|
|
647
|
-
preloadLink.rel = "preload";
|
|
648
|
-
preloadLink.href = preloadHref;
|
|
649
|
-
preloadLink.as = "script";
|
|
650
|
-
document.head.appendChild(preloadLink);
|
|
651
|
-
}
|
|
652
|
-
const existingScript = document.getElementById(
|
|
653
|
-
"paypal-partner-js"
|
|
654
|
-
);
|
|
655
|
-
if (!existingScript) {
|
|
656
|
-
const ppScript = document.createElement("script");
|
|
657
|
-
ppScript.id = "paypal-partner-js";
|
|
658
|
-
ppScript.src = preloadHref;
|
|
659
|
-
ppScript.async = true;
|
|
660
|
-
document.head.appendChild(ppScript);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
const SERVICE_URL = "/admin/paypal/onboarding-link";
|
|
664
|
-
const CACHE_KEY = "pp_onboard_cache";
|
|
665
|
-
const RELOAD_KEY = "pp_onboard_reloaded_once";
|
|
666
|
-
const CACHE_EXPIRY = 10 * 60 * 1e3;
|
|
667
|
-
const ONBOARDING_COMPLETE_ENDPOINT = "/admin/paypal/onboard-complete";
|
|
668
|
-
const STATUS_ENDPOINT = "/admin/paypal/status";
|
|
669
|
-
const SAVE_CREDENTIALS_ENDPOINT = "/admin/paypal/save-credentials";
|
|
670
|
-
const DISCONNECT_ENDPOINT = "/admin/paypal/disconnect";
|
|
671
|
-
let cachedUrl = null;
|
|
672
|
-
if (typeof window !== "undefined") {
|
|
673
|
-
try {
|
|
674
|
-
const cached = localStorage.getItem(CACHE_KEY);
|
|
675
|
-
if (cached) {
|
|
676
|
-
const data = JSON.parse(cached);
|
|
677
|
-
if ((/* @__PURE__ */ new Date()).getTime() - data.ts < CACHE_EXPIRY) {
|
|
678
|
-
cachedUrl = data.url;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
} catch (e) {
|
|
682
|
-
console.error("Cache read error:", e);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
function PayPalConnectionPage() {
|
|
686
|
-
const [env, setEnv] = react.useState("sandbox");
|
|
687
|
-
react.useEffect(() => {
|
|
688
|
-
fetch("/admin/paypal/environment", { method: "GET" }).then((r) => r.json()).then((d) => {
|
|
689
|
-
const v = (d == null ? void 0 : d.environment) === "live" ? "live" : "sandbox";
|
|
690
|
-
setEnv(v);
|
|
691
|
-
}).catch(() => {
|
|
692
|
-
});
|
|
693
|
-
}, []);
|
|
694
|
-
const [connState, setConnState] = react.useState("loading");
|
|
695
|
-
const [error, setError] = react.useState(null);
|
|
696
|
-
const [finalUrl, setFinalUrl] = react.useState("");
|
|
697
|
-
const [showManual, setShowManual] = react.useState(false);
|
|
698
|
-
const [clientId, setClientId] = react.useState("");
|
|
699
|
-
const [secret, setSecret] = react.useState("");
|
|
700
|
-
const [merchantId, setMerchantId] = react.useState("");
|
|
701
|
-
const [statusInfo, setStatusInfo] = react.useState(null);
|
|
702
|
-
const [onboardingInProgress, setOnboardingInProgress] = react.useState(false);
|
|
703
|
-
const initLoaderRef = react.useRef(null);
|
|
704
|
-
const paypalButtonRef = react.useRef(null);
|
|
705
|
-
const errorLogRef = react.useRef(null);
|
|
706
|
-
const runIdRef = react.useRef(0);
|
|
707
|
-
const currentRunId = react.useRef(0);
|
|
708
|
-
const ppBtnMeasureRef = react.useRef(null);
|
|
709
|
-
const [ppBtnWidth, setPpBtnWidth] = react.useState(null);
|
|
710
|
-
const canSaveManual = react.useMemo(() => {
|
|
711
|
-
return clientId.trim().length > 0 && secret.trim().length > 0;
|
|
712
|
-
}, [clientId, secret]);
|
|
713
|
-
const maskValue = react.useCallback((value, visibleChars = 4) => {
|
|
714
|
-
if (!value) return "";
|
|
715
|
-
if (value.length <= visibleChars) {
|
|
716
|
-
return "•".repeat(value.length);
|
|
717
|
-
}
|
|
718
|
-
return `${"•".repeat(Math.max(0, value.length - visibleChars))}${value.slice(
|
|
719
|
-
-visibleChars
|
|
720
|
-
)}`;
|
|
721
|
-
}, []);
|
|
722
|
-
const fetchFreshLink = react.useCallback(
|
|
723
|
-
(runId) => {
|
|
724
|
-
if (initLoaderRef.current) {
|
|
725
|
-
const loaderText = initLoaderRef.current.querySelector("#loader-text");
|
|
726
|
-
if (loaderText)
|
|
727
|
-
loaderText.textContent = "Generating onboarding session...";
|
|
424
|
+
return `${"•".repeat(Math.max(0, value.length - visibleChars))}${value.slice(
|
|
425
|
+
-visibleChars
|
|
426
|
+
)}`;
|
|
427
|
+
}, []);
|
|
428
|
+
const fetchFreshLink = react.useCallback(
|
|
429
|
+
(runId) => {
|
|
430
|
+
if (initLoaderRef.current) {
|
|
431
|
+
const loaderText = initLoaderRef.current.querySelector("#loader-text");
|
|
432
|
+
if (loaderText)
|
|
433
|
+
loaderText.textContent = "Generating onboarding session...";
|
|
728
434
|
}
|
|
729
435
|
fetch(SERVICE_URL, {
|
|
730
436
|
method: "POST",
|
|
@@ -931,371 +637,668 @@ function PayPalConnectionPage() {
|
|
|
931
637
|
});
|
|
932
638
|
setShowManual(false);
|
|
933
639
|
try {
|
|
934
|
-
localStorage.removeItem(CACHE_KEY);
|
|
935
|
-
localStorage.removeItem(RELOAD_KEY);
|
|
936
|
-
} catch {
|
|
640
|
+
localStorage.removeItem(CACHE_KEY);
|
|
641
|
+
localStorage.removeItem(RELOAD_KEY);
|
|
642
|
+
} catch {
|
|
643
|
+
}
|
|
644
|
+
} catch (e) {
|
|
645
|
+
console.error(e);
|
|
646
|
+
setConnState("error");
|
|
647
|
+
setError((e == null ? void 0 : e.message) || "Failed to save credentials.");
|
|
648
|
+
} finally {
|
|
649
|
+
setOnboardingInProgress(false);
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
const handleDisconnect = async () => {
|
|
653
|
+
if (onboardingInProgress) return;
|
|
654
|
+
if (!window.confirm("Disconnect PayPal for this environment?")) return;
|
|
655
|
+
setOnboardingInProgress(true);
|
|
656
|
+
setConnState("loading");
|
|
657
|
+
setError(null);
|
|
658
|
+
setFinalUrl("");
|
|
659
|
+
setShowManual(false);
|
|
660
|
+
try {
|
|
661
|
+
const res = await fetch(DISCONNECT_ENDPOINT, {
|
|
662
|
+
method: "POST",
|
|
663
|
+
headers: { "content-type": "application/json" },
|
|
664
|
+
body: JSON.stringify({ environment: env })
|
|
665
|
+
});
|
|
666
|
+
if (!res.ok) {
|
|
667
|
+
const t = await res.text().catch(() => "");
|
|
668
|
+
throw new Error(t || `Disconnect failed (${res.status})`);
|
|
669
|
+
}
|
|
670
|
+
try {
|
|
671
|
+
localStorage.removeItem(CACHE_KEY);
|
|
672
|
+
localStorage.removeItem(RELOAD_KEY);
|
|
673
|
+
} catch {
|
|
674
|
+
}
|
|
675
|
+
currentRunId.current = ++runIdRef.current;
|
|
676
|
+
const runId = currentRunId.current;
|
|
677
|
+
fetchFreshLink(runId);
|
|
678
|
+
} catch (e) {
|
|
679
|
+
console.error(e);
|
|
680
|
+
setConnState("error");
|
|
681
|
+
setError((e == null ? void 0 : e.message) || "Failed to disconnect.");
|
|
682
|
+
} finally {
|
|
683
|
+
setOnboardingInProgress(false);
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
const handleEnvChange = async (e) => {
|
|
687
|
+
const next = e.target.value;
|
|
688
|
+
setEnv(next);
|
|
689
|
+
cachedUrl = null;
|
|
690
|
+
try {
|
|
691
|
+
await fetch("/admin/paypal/environment", {
|
|
692
|
+
method: "POST",
|
|
693
|
+
headers: { "content-type": "application/json" },
|
|
694
|
+
body: JSON.stringify({ environment: next })
|
|
695
|
+
});
|
|
696
|
+
} catch {
|
|
697
|
+
}
|
|
698
|
+
try {
|
|
699
|
+
localStorage.removeItem(CACHE_KEY);
|
|
700
|
+
localStorage.removeItem(RELOAD_KEY);
|
|
701
|
+
} catch {
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6", children: [
|
|
705
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
706
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold", children: "PayPal Gateway By Easy Payment" }),
|
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
708
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base p-4 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-y-6 md:grid-cols-[260px_1fr] md:items-start", children: [
|
|
709
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium pt-2", children: "Environment" }),
|
|
710
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-xl", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
711
|
+
"select",
|
|
712
|
+
{
|
|
713
|
+
value: env,
|
|
714
|
+
onChange: handleEnvChange,
|
|
715
|
+
disabled: onboardingInProgress,
|
|
716
|
+
className: "w-full rounded-md border border-ui-border-base bg-transparent px-3 py-2 text-sm",
|
|
717
|
+
children: [
|
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "sandbox", children: "Sandbox (Test Mode)" }),
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "live", children: "Live (Production)" })
|
|
720
|
+
]
|
|
721
|
+
}
|
|
722
|
+
) }),
|
|
723
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium pt-2", children: env === "sandbox" ? "Connect to PayPal Sandbox" : "Connect to PayPal Live" }),
|
|
724
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-xl", children: connState === "connected" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
725
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-green-600 bg-green-50 p-3 rounded border border-green-200", children: [
|
|
726
|
+
"✅ Successfully connected to PayPal!",
|
|
727
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
728
|
+
"a",
|
|
729
|
+
{
|
|
730
|
+
"data-paypal-button": "true",
|
|
731
|
+
"data-paypal-onboard-complete": "onboardingCallback",
|
|
732
|
+
href: "#",
|
|
733
|
+
style: { display: "none" },
|
|
734
|
+
children: "PayPal"
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
] }),
|
|
738
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 rounded-md border border-ui-border-base bg-ui-bg-subtle p-3 text-xs text-ui-fg-subtle", children: [
|
|
739
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-ui-fg-base", children: "Connected PayPal account" }),
|
|
740
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1", children: [
|
|
741
|
+
"Email:",
|
|
742
|
+
" ",
|
|
743
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-ui-fg-base", children: (statusInfo == null ? void 0 : statusInfo.seller_email) || "Unavailable" })
|
|
744
|
+
] })
|
|
745
|
+
] }),
|
|
746
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
747
|
+
"button",
|
|
748
|
+
{
|
|
749
|
+
type: "button",
|
|
750
|
+
onClick: handleDisconnect,
|
|
751
|
+
disabled: onboardingInProgress,
|
|
752
|
+
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm font-medium hover:bg-ui-bg-subtle disabled:opacity-50 disabled:cursor-not-allowed",
|
|
753
|
+
children: "Disconnect"
|
|
754
|
+
}
|
|
755
|
+
) })
|
|
756
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
757
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
758
|
+
"div",
|
|
759
|
+
{
|
|
760
|
+
ref: initLoaderRef,
|
|
761
|
+
id: "init-loader",
|
|
762
|
+
className: `status-msg mb-4 ${connState !== "loading" ? "hidden" : "block"}`,
|
|
763
|
+
children: [
|
|
764
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "loader inline-block align-middle mr-2" }),
|
|
765
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { id: "loader-text", className: "text-sm", children: onboardingInProgress ? "Configuring connection to PayPal…" : "Checking connection..." })
|
|
766
|
+
]
|
|
767
|
+
}
|
|
768
|
+
),
|
|
769
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${connState === "ready" ? "block" : "hidden"}`, children: [
|
|
770
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
771
|
+
"a",
|
|
772
|
+
{
|
|
773
|
+
ref: (node) => {
|
|
774
|
+
paypalButtonRef.current = node;
|
|
775
|
+
ppBtnMeasureRef.current = node;
|
|
776
|
+
},
|
|
777
|
+
id: "paypal-button",
|
|
778
|
+
"data-paypal-button": "true",
|
|
779
|
+
href: finalUrl || "#",
|
|
780
|
+
"data-paypal-onboard-complete": "onboardingCallback",
|
|
781
|
+
onClick: handleConnectClick,
|
|
782
|
+
className: "btn-paypal",
|
|
783
|
+
style: {
|
|
784
|
+
borderRadius: "50px",
|
|
785
|
+
textDecoration: "none",
|
|
786
|
+
display: "inline-block",
|
|
787
|
+
fontWeight: "bold",
|
|
788
|
+
border: "none",
|
|
789
|
+
cursor: onboardingInProgress ? "not-allowed" : "pointer",
|
|
790
|
+
opacity: onboardingInProgress ? 0.6 : 1,
|
|
791
|
+
pointerEvents: onboardingInProgress ? "none" : "auto"
|
|
792
|
+
},
|
|
793
|
+
children: "Connect to PayPal"
|
|
794
|
+
}
|
|
795
|
+
),
|
|
796
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
797
|
+
"div",
|
|
798
|
+
{
|
|
799
|
+
className: "mt-2",
|
|
800
|
+
style: {
|
|
801
|
+
width: ppBtnWidth ? `${ppBtnWidth}px` : "auto",
|
|
802
|
+
marginTop: "20px",
|
|
803
|
+
marginBottom: "10px"
|
|
804
|
+
},
|
|
805
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-ui-fg-muted leading-none", children: "OR" }) })
|
|
806
|
+
}
|
|
807
|
+
),
|
|
808
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
809
|
+
"button",
|
|
810
|
+
{
|
|
811
|
+
type: "button",
|
|
812
|
+
onClick: () => setShowManual(!showManual),
|
|
813
|
+
disabled: onboardingInProgress,
|
|
814
|
+
className: "text-sm text-ui-fg-interactive underline whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed",
|
|
815
|
+
children: "Click here to insert credentials manually"
|
|
816
|
+
}
|
|
817
|
+
) })
|
|
818
|
+
] }),
|
|
819
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${connState === "ready" ? "hidden" : "block"} mt-3`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
820
|
+
"button",
|
|
821
|
+
{
|
|
822
|
+
type: "button",
|
|
823
|
+
onClick: () => setShowManual(!showManual),
|
|
824
|
+
disabled: onboardingInProgress,
|
|
825
|
+
className: "text-sm text-ui-fg-interactive underline whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed",
|
|
826
|
+
children: "Click here to insert credentials manually"
|
|
827
|
+
}
|
|
828
|
+
) }),
|
|
829
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
830
|
+
"div",
|
|
831
|
+
{
|
|
832
|
+
ref: errorLogRef,
|
|
833
|
+
id: "error-log",
|
|
834
|
+
className: `mt-4 text-left text-xs bg-red-50 text-red-600 p-3 border border-red-200 rounded ${connState === "error" && error ? "block" : "hidden"}`,
|
|
835
|
+
children: error
|
|
836
|
+
}
|
|
837
|
+
)
|
|
838
|
+
] }) }),
|
|
839
|
+
showManual && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "md:col-span-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-[260px] max-w-xl mt-4 grid grid-cols-1 gap-3 md:grid-cols-2", children: [
|
|
840
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
841
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Client ID" }),
|
|
842
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
+
"input",
|
|
844
|
+
{
|
|
845
|
+
type: "text",
|
|
846
|
+
value: clientId,
|
|
847
|
+
onChange: (e) => setClientId(e.target.value),
|
|
848
|
+
disabled: onboardingInProgress,
|
|
849
|
+
className: "rounded-md border border-ui-border-base bg-transparent px-3 py-2 text-sm disabled:opacity-50",
|
|
850
|
+
placeholder: env === "sandbox" ? "Sandbox Client ID" : "Live Client ID"
|
|
851
|
+
}
|
|
852
|
+
)
|
|
853
|
+
] }),
|
|
854
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Client Secret" }),
|
|
856
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
857
|
+
"input",
|
|
858
|
+
{
|
|
859
|
+
type: "password",
|
|
860
|
+
value: secret,
|
|
861
|
+
onChange: (e) => setSecret(e.target.value),
|
|
862
|
+
disabled: onboardingInProgress,
|
|
863
|
+
className: "rounded-md border border-ui-border-base bg-transparent px-3 py-2 text-sm disabled:opacity-50",
|
|
864
|
+
placeholder: env === "sandbox" ? "Sandbox Secret" : "Live Secret"
|
|
865
|
+
}
|
|
866
|
+
)
|
|
867
|
+
] }),
|
|
868
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:col-span-2", children: [
|
|
869
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Merchant ID (optional)" }),
|
|
870
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
871
|
+
"input",
|
|
872
|
+
{
|
|
873
|
+
type: "text",
|
|
874
|
+
value: merchantId,
|
|
875
|
+
onChange: (e) => setMerchantId(e.target.value),
|
|
876
|
+
disabled: onboardingInProgress,
|
|
877
|
+
className: "rounded-md border border-ui-border-base bg-transparent px-3 py-2 text-sm disabled:opacity-50",
|
|
878
|
+
placeholder: "Merchant ID"
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
] }),
|
|
882
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:col-span-2 flex items-center gap-2 mt-2", children: [
|
|
883
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
884
|
+
"button",
|
|
885
|
+
{
|
|
886
|
+
type: "button",
|
|
887
|
+
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm font-medium hover:bg-ui-bg-subtle disabled:opacity-50 disabled:cursor-not-allowed",
|
|
888
|
+
onClick: () => setShowManual(false),
|
|
889
|
+
disabled: onboardingInProgress,
|
|
890
|
+
children: "Cancel"
|
|
891
|
+
}
|
|
892
|
+
),
|
|
893
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
894
|
+
"button",
|
|
895
|
+
{
|
|
896
|
+
type: "button",
|
|
897
|
+
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm font-medium bg-ui-bg-base hover:bg-ui-bg-subtle disabled:opacity-50 disabled:cursor-not-allowed",
|
|
898
|
+
disabled: !canSaveManual || onboardingInProgress,
|
|
899
|
+
onClick: handleSaveManual,
|
|
900
|
+
children: "Save credentials"
|
|
901
|
+
}
|
|
902
|
+
)
|
|
903
|
+
] })
|
|
904
|
+
] }) })
|
|
905
|
+
] }) })
|
|
906
|
+
] }),
|
|
907
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
908
|
+
.loader {
|
|
909
|
+
border: 3px solid #f3f3f3;
|
|
910
|
+
border-top: 3px solid #0070ba;
|
|
911
|
+
border-radius: 50%;
|
|
912
|
+
width: 18px;
|
|
913
|
+
height: 18px;
|
|
914
|
+
animation: spin 1s linear infinite;
|
|
915
|
+
display: inline-block;
|
|
916
|
+
vertical-align: middle;
|
|
917
|
+
margin-right: 8px;
|
|
918
|
+
}
|
|
919
|
+
@keyframes spin {
|
|
920
|
+
0% { transform: rotate(0deg); }
|
|
921
|
+
100% { transform: rotate(360deg); }
|
|
922
|
+
}
|
|
923
|
+
` })
|
|
924
|
+
] });
|
|
925
|
+
}
|
|
926
|
+
function formatDate$2(value) {
|
|
927
|
+
if (!value) {
|
|
928
|
+
return "";
|
|
929
|
+
}
|
|
930
|
+
const parsed = new Date(value);
|
|
931
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
932
|
+
return value;
|
|
933
|
+
}
|
|
934
|
+
return parsed.toLocaleString();
|
|
935
|
+
}
|
|
936
|
+
function PayPalAuditLogsPage() {
|
|
937
|
+
const [logs, setLogs] = react.useState([]);
|
|
938
|
+
const [loading, setLoading] = react.useState(false);
|
|
939
|
+
const [error, setError] = react.useState(null);
|
|
940
|
+
const fetchLogs = react.useCallback(async () => {
|
|
941
|
+
try {
|
|
942
|
+
setLoading(true);
|
|
943
|
+
setError(null);
|
|
944
|
+
const response = await fetch("/admin/paypal/audit-logs?limit=50", {
|
|
945
|
+
credentials: "include",
|
|
946
|
+
headers: {
|
|
947
|
+
Accept: "application/json"
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
if (!response.ok) {
|
|
951
|
+
const message = await response.text().catch(() => "");
|
|
952
|
+
throw new Error(message || "Failed to load audit logs.");
|
|
953
|
+
}
|
|
954
|
+
const data = await response.json().catch(() => ({}));
|
|
955
|
+
setLogs((data == null ? void 0 : data.logs) || []);
|
|
956
|
+
} catch (fetchError) {
|
|
957
|
+
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
|
|
958
|
+
setLogs([]);
|
|
959
|
+
} finally {
|
|
960
|
+
setLoading(false);
|
|
961
|
+
}
|
|
962
|
+
}, []);
|
|
963
|
+
react.useEffect(() => {
|
|
964
|
+
fetchLogs();
|
|
965
|
+
}, [fetchLogs]);
|
|
966
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
967
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
968
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
|
|
969
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
|
|
970
|
+
] }),
|
|
971
|
+
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
972
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
973
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
|
|
975
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
type: "button",
|
|
979
|
+
onClick: fetchLogs,
|
|
980
|
+
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
981
|
+
disabled: loading,
|
|
982
|
+
children: loading ? "Refreshing..." : "Refresh"
|
|
983
|
+
}
|
|
984
|
+
)
|
|
985
|
+
] }) }),
|
|
986
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
|
|
987
|
+
error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
|
|
988
|
+
!error && logs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
|
|
989
|
+
logs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full text-left text-sm", children: [
|
|
990
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
991
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
|
|
992
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
|
|
993
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 font-medium", children: "Details" })
|
|
994
|
+
] }) }),
|
|
995
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t border-ui-border-base", children: [
|
|
996
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
|
|
997
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
|
|
998
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap rounded-md bg-ui-bg-subtle p-2 text-xs text-ui-fg-subtle", children: JSON.stringify(entry.metadata || {}, null, 2) }) })
|
|
999
|
+
] }, entry.id)) })
|
|
1000
|
+
] }) }) : null
|
|
1001
|
+
] })
|
|
1002
|
+
] })
|
|
1003
|
+
] }) });
|
|
1004
|
+
}
|
|
1005
|
+
const DEFAULT_FORM = {
|
|
1006
|
+
enabled: true,
|
|
1007
|
+
title: "Credit or Debit Card",
|
|
1008
|
+
disabledCards: [],
|
|
1009
|
+
threeDS: "when_required",
|
|
1010
|
+
cardSaveEnabled: false
|
|
1011
|
+
};
|
|
1012
|
+
function mergeWithDefaults(saved) {
|
|
1013
|
+
if (!saved) return { ...DEFAULT_FORM };
|
|
1014
|
+
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
1015
|
+
return {
|
|
1016
|
+
...DEFAULT_FORM,
|
|
1017
|
+
...Object.fromEntries(entries)
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
const CARD_BRANDS = [
|
|
1021
|
+
{ value: "visa", label: "Visa" },
|
|
1022
|
+
{ value: "mastercard", label: "Mastercard" },
|
|
1023
|
+
{ value: "amex", label: "American Express" },
|
|
1024
|
+
{ value: "discover", label: "Discover" },
|
|
1025
|
+
{ value: "diners", label: "Diners Club" },
|
|
1026
|
+
{ value: "jcb", label: "JCB" },
|
|
1027
|
+
{ value: "unionpay", label: "UnionPay" }
|
|
1028
|
+
];
|
|
1029
|
+
const THREE_DS_OPTIONS = [
|
|
1030
|
+
{
|
|
1031
|
+
value: "when_required",
|
|
1032
|
+
label: "3D Secure when required",
|
|
1033
|
+
hint: "Triggers 3DS only when the card / issuer requires it."
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
value: "sli",
|
|
1037
|
+
label: "3D Secure (SCA) / liability shift (recommended)",
|
|
1038
|
+
hint: "Attempts to optimize for liability shift while remaining compliant."
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
value: "always",
|
|
1042
|
+
label: "Always request 3D Secure",
|
|
1043
|
+
hint: "Forces 3DS challenge whenever possible (may reduce conversion)."
|
|
1044
|
+
}
|
|
1045
|
+
];
|
|
1046
|
+
function cx$1(...parts) {
|
|
1047
|
+
return parts.filter(Boolean).join(" ");
|
|
1048
|
+
}
|
|
1049
|
+
function Pill$1({
|
|
1050
|
+
children,
|
|
1051
|
+
onRemove
|
|
1052
|
+
}) {
|
|
1053
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 rounded-md border border-ui-border-base bg-ui-bg-base px-2 py-1 text-sm text-ui-fg-base", children: [
|
|
1054
|
+
children,
|
|
1055
|
+
onRemove ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1056
|
+
"button",
|
|
1057
|
+
{
|
|
1058
|
+
type: "button",
|
|
1059
|
+
onClick: onRemove,
|
|
1060
|
+
className: "ml-1 rounded px-1 text-ui-fg-subtle hover:text-ui-fg-base",
|
|
1061
|
+
"aria-label": "Remove",
|
|
1062
|
+
children: "×"
|
|
1063
|
+
}
|
|
1064
|
+
) : null
|
|
1065
|
+
] });
|
|
1066
|
+
}
|
|
1067
|
+
function SectionCard$1({
|
|
1068
|
+
title,
|
|
1069
|
+
description,
|
|
1070
|
+
right,
|
|
1071
|
+
children
|
|
1072
|
+
}) {
|
|
1073
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1074
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
|
|
1075
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1076
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: title }),
|
|
1077
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-sm text-ui-fg-subtle", children: description }) : null
|
|
1078
|
+
] }),
|
|
1079
|
+
right
|
|
1080
|
+
] }),
|
|
1081
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children })
|
|
1082
|
+
] });
|
|
1083
|
+
}
|
|
1084
|
+
function FieldRow$1({
|
|
1085
|
+
label,
|
|
1086
|
+
hint,
|
|
1087
|
+
children
|
|
1088
|
+
}) {
|
|
1089
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 items-start gap-4 py-3", children: [
|
|
1090
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12 md:col-span-4", children: [
|
|
1091
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-ui-fg-base", children: label }),
|
|
1092
|
+
hint ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: hint }) : null
|
|
1093
|
+
] }),
|
|
1094
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12 md:col-span-8", children })
|
|
1095
|
+
] });
|
|
1096
|
+
}
|
|
1097
|
+
function AdvancedCardPaymentsTab() {
|
|
1098
|
+
var _a, _b;
|
|
1099
|
+
const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM }));
|
|
1100
|
+
const [loading, setLoading] = react.useState(false);
|
|
1101
|
+
const [saving, setSaving] = react.useState(false);
|
|
1102
|
+
const [toast, setToast] = react.useState(null);
|
|
1103
|
+
const didInit = react.useRef(false);
|
|
1104
|
+
react.useEffect(() => {
|
|
1105
|
+
if (didInit.current) return;
|
|
1106
|
+
didInit.current = true;
|
|
1107
|
+
(async () => {
|
|
1108
|
+
try {
|
|
1109
|
+
setLoading(true);
|
|
1110
|
+
const r = await fetch("/admin/paypal/settings", {
|
|
1111
|
+
credentials: "include",
|
|
1112
|
+
headers: { "Accept": "application/json" }
|
|
1113
|
+
});
|
|
1114
|
+
if (!r.ok) return;
|
|
1115
|
+
const json = await r.json();
|
|
1116
|
+
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
1117
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
1118
|
+
if (saved && typeof saved === "object") {
|
|
1119
|
+
setForm(mergeWithDefaults(saved));
|
|
1120
|
+
}
|
|
1121
|
+
} finally {
|
|
1122
|
+
setLoading(false);
|
|
937
1123
|
}
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
setError((e == null ? void 0 : e.message) || "Failed to save credentials.");
|
|
942
|
-
} finally {
|
|
943
|
-
setOnboardingInProgress(false);
|
|
944
|
-
}
|
|
945
|
-
};
|
|
946
|
-
const handleDisconnect = async () => {
|
|
947
|
-
if (onboardingInProgress) return;
|
|
948
|
-
if (!window.confirm("Disconnect PayPal for this environment?")) return;
|
|
949
|
-
setOnboardingInProgress(true);
|
|
950
|
-
setConnState("loading");
|
|
951
|
-
setError(null);
|
|
952
|
-
setFinalUrl("");
|
|
953
|
-
setShowManual(false);
|
|
1124
|
+
})();
|
|
1125
|
+
}, []);
|
|
1126
|
+
async function onSave() {
|
|
954
1127
|
try {
|
|
955
|
-
|
|
1128
|
+
setSaving(true);
|
|
1129
|
+
const r = await fetch("/admin/paypal/settings", {
|
|
956
1130
|
method: "POST",
|
|
957
|
-
|
|
958
|
-
|
|
1131
|
+
credentials: "include",
|
|
1132
|
+
headers: {
|
|
1133
|
+
"Content-Type": "application/json",
|
|
1134
|
+
"Accept": "application/json"
|
|
1135
|
+
},
|
|
1136
|
+
body: JSON.stringify({ advanced_card_payments: form })
|
|
959
1137
|
});
|
|
960
|
-
if (!
|
|
961
|
-
const t = await
|
|
962
|
-
|
|
1138
|
+
if (!r.ok) {
|
|
1139
|
+
const t = await r.text();
|
|
1140
|
+
setToast({ type: "error", message: "Failed to save settings. " + t });
|
|
1141
|
+
window.setTimeout(() => setToast(null), 3500);
|
|
1142
|
+
return;
|
|
963
1143
|
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1144
|
+
const json = await r.json().catch(() => null);
|
|
1145
|
+
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
1146
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
1147
|
+
if (saved && typeof saved === "object") {
|
|
1148
|
+
setForm(mergeWithDefaults(saved));
|
|
968
1149
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
fetchFreshLink(runId);
|
|
972
|
-
} catch (e) {
|
|
973
|
-
console.error(e);
|
|
974
|
-
setConnState("error");
|
|
975
|
-
setError((e == null ? void 0 : e.message) || "Failed to disconnect.");
|
|
1150
|
+
setToast({ type: "success", message: "Settings saved" });
|
|
1151
|
+
window.setTimeout(() => setToast(null), 2500);
|
|
976
1152
|
} finally {
|
|
977
|
-
|
|
978
|
-
}
|
|
979
|
-
};
|
|
980
|
-
const handleEnvChange = async (e) => {
|
|
981
|
-
const next = e.target.value;
|
|
982
|
-
setEnv(next);
|
|
983
|
-
cachedUrl = null;
|
|
984
|
-
try {
|
|
985
|
-
await fetch("/admin/paypal/environment", {
|
|
986
|
-
method: "POST",
|
|
987
|
-
headers: { "content-type": "application/json" },
|
|
988
|
-
body: JSON.stringify({ environment: next })
|
|
989
|
-
});
|
|
990
|
-
} catch {
|
|
991
|
-
}
|
|
992
|
-
try {
|
|
993
|
-
localStorage.removeItem(CACHE_KEY);
|
|
994
|
-
localStorage.removeItem(RELOAD_KEY);
|
|
995
|
-
} catch {
|
|
1153
|
+
setSaving(false);
|
|
996
1154
|
}
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1033
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-ui-fg-base", children: "Connected PayPal account" }),
|
|
1034
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1", children: [
|
|
1035
|
-
"Email:",
|
|
1036
|
-
" ",
|
|
1037
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-ui-fg-base", children: (statusInfo == null ? void 0 : statusInfo.seller_email) || "Unavailable" })
|
|
1038
|
-
] })
|
|
1039
|
-
] }),
|
|
1040
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1155
|
+
}
|
|
1156
|
+
const disabledSet = react.useMemo(() => new Set(form.disabledCards), [form.disabledCards]);
|
|
1157
|
+
function toggleDisabledCard(value) {
|
|
1158
|
+
setForm((prev) => {
|
|
1159
|
+
const exists = prev.disabledCards.includes(value);
|
|
1160
|
+
return {
|
|
1161
|
+
...prev,
|
|
1162
|
+
disabledCards: exists ? prev.disabledCards.filter((v) => v !== value) : [...prev.disabledCards, value]
|
|
1163
|
+
};
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
function removeDisabledCard(value) {
|
|
1167
|
+
setForm((prev) => ({
|
|
1168
|
+
...prev,
|
|
1169
|
+
disabledCards: prev.disabledCards.filter((v) => v !== value)
|
|
1170
|
+
}));
|
|
1171
|
+
}
|
|
1172
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1173
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
|
|
1174
|
+
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
1175
|
+
toast ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1176
|
+
"div",
|
|
1177
|
+
{
|
|
1178
|
+
className: "fixed right-6 top-6 z-50 rounded-md border border-ui-border-base bg-ui-bg-base px-4 py-3 text-sm shadow-lg",
|
|
1179
|
+
role: "status",
|
|
1180
|
+
"aria-live": "polite",
|
|
1181
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: toast.type === "success" ? "text-ui-fg-base" : "text-ui-fg-error", children: toast.message })
|
|
1182
|
+
}
|
|
1183
|
+
) : null,
|
|
1184
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1185
|
+
SectionCard$1,
|
|
1186
|
+
{
|
|
1187
|
+
title: "Advanced Card Payments",
|
|
1188
|
+
description: "Control card checkout settings, 3D Secure behavior, and card saving.",
|
|
1189
|
+
right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1190
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1041
1191
|
"button",
|
|
1042
1192
|
{
|
|
1043
1193
|
type: "button",
|
|
1044
|
-
onClick:
|
|
1045
|
-
disabled:
|
|
1046
|
-
className: "rounded-md
|
|
1047
|
-
children: "
|
|
1048
|
-
}
|
|
1049
|
-
) })
|
|
1050
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1051
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1052
|
-
"div",
|
|
1053
|
-
{
|
|
1054
|
-
ref: initLoaderRef,
|
|
1055
|
-
id: "init-loader",
|
|
1056
|
-
className: `status-msg mb-4 ${connState !== "loading" ? "hidden" : "block"}`,
|
|
1057
|
-
children: [
|
|
1058
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "loader inline-block align-middle mr-2" }),
|
|
1059
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { id: "loader-text", className: "text-sm", children: onboardingInProgress ? "Configuring connection to PayPal…" : "Checking connection..." })
|
|
1060
|
-
]
|
|
1194
|
+
onClick: onSave,
|
|
1195
|
+
disabled: saving || loading,
|
|
1196
|
+
className: "rounded-md bg-ui-button-neutral px-4 py-2 text-sm font-medium text-ui-fg-on-color shadow-sm hover:opacity-90 disabled:opacity-60",
|
|
1197
|
+
children: saving ? "Saving..." : "Save settings"
|
|
1061
1198
|
}
|
|
1062
1199
|
),
|
|
1063
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
ref: (node) => {
|
|
1068
|
-
paypalButtonRef.current = node;
|
|
1069
|
-
ppBtnMeasureRef.current = node;
|
|
1070
|
-
},
|
|
1071
|
-
id: "paypal-button",
|
|
1072
|
-
"data-paypal-button": "true",
|
|
1073
|
-
href: finalUrl || "#",
|
|
1074
|
-
"data-paypal-onboard-complete": "onboardingCallback",
|
|
1075
|
-
onClick: handleConnectClick,
|
|
1076
|
-
className: "btn-paypal",
|
|
1077
|
-
style: {
|
|
1078
|
-
borderRadius: "50px",
|
|
1079
|
-
textDecoration: "none",
|
|
1080
|
-
display: "inline-block",
|
|
1081
|
-
fontWeight: "bold",
|
|
1082
|
-
border: "none",
|
|
1083
|
-
cursor: onboardingInProgress ? "not-allowed" : "pointer",
|
|
1084
|
-
opacity: onboardingInProgress ? 0.6 : 1,
|
|
1085
|
-
pointerEvents: onboardingInProgress ? "none" : "auto"
|
|
1086
|
-
},
|
|
1087
|
-
children: "Connect to PayPal"
|
|
1088
|
-
}
|
|
1089
|
-
),
|
|
1200
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
|
|
1201
|
+
] }),
|
|
1202
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
1203
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Enable/Disable", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
1090
1204
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1091
|
-
"
|
|
1205
|
+
"input",
|
|
1092
1206
|
{
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
marginBottom: "10px"
|
|
1098
|
-
},
|
|
1099
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] text-ui-fg-muted leading-none", children: "OR" }) })
|
|
1207
|
+
type: "checkbox",
|
|
1208
|
+
checked: form.enabled,
|
|
1209
|
+
onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })),
|
|
1210
|
+
className: "h-4 w-4 rounded border-ui-border-base"
|
|
1100
1211
|
}
|
|
1101
1212
|
),
|
|
1102
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
onClick: () => setShowManual(!showManual),
|
|
1107
|
-
disabled: onboardingInProgress,
|
|
1108
|
-
className: "text-sm text-ui-fg-interactive underline whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1109
|
-
children: "Click here to insert credentials manually"
|
|
1110
|
-
}
|
|
1111
|
-
) })
|
|
1112
|
-
] }),
|
|
1113
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${connState === "ready" ? "hidden" : "block"} mt-3`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1114
|
-
"button",
|
|
1213
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
|
|
1214
|
+
] }) }),
|
|
1215
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Title", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1216
|
+
"input",
|
|
1115
1217
|
{
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
children: "Click here to insert credentials manually"
|
|
1218
|
+
value: form.title,
|
|
1219
|
+
onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })),
|
|
1220
|
+
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",
|
|
1221
|
+
placeholder: "Credit or Debit Card"
|
|
1121
1222
|
}
|
|
1122
1223
|
) }),
|
|
1123
1224
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1124
|
-
|
|
1225
|
+
FieldRow$1,
|
|
1125
1226
|
{
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1227
|
+
label: "Disable specific credit cards",
|
|
1228
|
+
hint: "Select card brands to hide from the card form.",
|
|
1229
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1230
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: form.disabledCards.length ? form.disabledCards.map((v) => {
|
|
1231
|
+
var _a2;
|
|
1232
|
+
const label = ((_a2 = CARD_BRANDS.find((b) => b.value === v)) == null ? void 0 : _a2.label) ?? v;
|
|
1233
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Pill$1, { onRemove: () => removeDisabledCard(v), children: label }, v);
|
|
1234
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No card brands disabled." }) }),
|
|
1235
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base p-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-2 md:grid-cols-2", children: CARD_BRANDS.map((b) => {
|
|
1236
|
+
const checked = disabledSet.has(b.value);
|
|
1237
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1238
|
+
"label",
|
|
1239
|
+
{
|
|
1240
|
+
className: cx$1(
|
|
1241
|
+
"flex items-center gap-2 rounded-md p-2",
|
|
1242
|
+
"hover:bg-ui-bg-subtle"
|
|
1243
|
+
),
|
|
1244
|
+
children: [
|
|
1245
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1246
|
+
"input",
|
|
1247
|
+
{
|
|
1248
|
+
type: "checkbox",
|
|
1249
|
+
checked,
|
|
1250
|
+
onChange: () => toggleDisabledCard(b.value),
|
|
1251
|
+
className: "h-4 w-4 rounded border-ui-border-base"
|
|
1252
|
+
}
|
|
1253
|
+
),
|
|
1254
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: b.label })
|
|
1255
|
+
]
|
|
1256
|
+
},
|
|
1257
|
+
b.value
|
|
1258
|
+
);
|
|
1259
|
+
}) }) })
|
|
1260
|
+
] })
|
|
1130
1261
|
}
|
|
1131
|
-
)
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
"
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
{
|
|
1153
|
-
type: "password",
|
|
1154
|
-
value: secret,
|
|
1155
|
-
onChange: (e) => setSecret(e.target.value),
|
|
1156
|
-
disabled: onboardingInProgress,
|
|
1157
|
-
className: "rounded-md border border-ui-border-base bg-transparent px-3 py-2 text-sm disabled:opacity-50",
|
|
1158
|
-
placeholder: env === "sandbox" ? "Sandbox Secret" : "Live Secret"
|
|
1159
|
-
}
|
|
1160
|
-
)
|
|
1161
|
-
] }),
|
|
1162
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:col-span-2", children: [
|
|
1163
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Merchant ID (optional)" }),
|
|
1262
|
+
),
|
|
1263
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1264
|
+
FieldRow$1,
|
|
1265
|
+
{
|
|
1266
|
+
label: "Contingency for 3D Secure",
|
|
1267
|
+
hint: "Choose when 3D Secure should be triggered during card payments.",
|
|
1268
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1269
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1270
|
+
"select",
|
|
1271
|
+
{
|
|
1272
|
+
value: form.threeDS,
|
|
1273
|
+
onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })),
|
|
1274
|
+
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",
|
|
1275
|
+
children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value))
|
|
1276
|
+
}
|
|
1277
|
+
),
|
|
1278
|
+
((_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
|
|
1279
|
+
] })
|
|
1280
|
+
}
|
|
1281
|
+
),
|
|
1282
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Card Save Enabled", hint: "Allow customers to save a card at checkout for future use.", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
1164
1283
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1165
1284
|
"input",
|
|
1166
1285
|
{
|
|
1167
|
-
type: "
|
|
1168
|
-
|
|
1169
|
-
onChange: (e) =>
|
|
1170
|
-
|
|
1171
|
-
className: "rounded-md border border-ui-border-base bg-transparent px-3 py-2 text-sm disabled:opacity-50",
|
|
1172
|
-
placeholder: "Merchant ID"
|
|
1173
|
-
}
|
|
1174
|
-
)
|
|
1175
|
-
] }),
|
|
1176
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:col-span-2 flex items-center gap-2 mt-2", children: [
|
|
1177
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1178
|
-
"button",
|
|
1179
|
-
{
|
|
1180
|
-
type: "button",
|
|
1181
|
-
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm font-medium hover:bg-ui-bg-subtle disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1182
|
-
onClick: () => setShowManual(false),
|
|
1183
|
-
disabled: onboardingInProgress,
|
|
1184
|
-
children: "Cancel"
|
|
1286
|
+
type: "checkbox",
|
|
1287
|
+
checked: form.cardSaveEnabled,
|
|
1288
|
+
onChange: (e) => setForm((p) => ({ ...p, cardSaveEnabled: e.target.checked })),
|
|
1289
|
+
className: "h-4 w-4 rounded border-ui-border-base"
|
|
1185
1290
|
}
|
|
1186
1291
|
),
|
|
1187
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
type: "button",
|
|
1191
|
-
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm font-medium bg-ui-bg-base hover:bg-ui-bg-subtle disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1192
|
-
disabled: !canSaveManual || onboardingInProgress,
|
|
1193
|
-
onClick: handleSaveManual,
|
|
1194
|
-
children: "Save credentials"
|
|
1195
|
-
}
|
|
1196
|
-
)
|
|
1197
|
-
] })
|
|
1198
|
-
] }) })
|
|
1199
|
-
] }) })
|
|
1200
|
-
] }),
|
|
1201
|
-
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
1202
|
-
.loader {
|
|
1203
|
-
border: 3px solid #f3f3f3;
|
|
1204
|
-
border-top: 3px solid #0070ba;
|
|
1205
|
-
border-radius: 50%;
|
|
1206
|
-
width: 18px;
|
|
1207
|
-
height: 18px;
|
|
1208
|
-
animation: spin 1s linear infinite;
|
|
1209
|
-
display: inline-block;
|
|
1210
|
-
vertical-align: middle;
|
|
1211
|
-
margin-right: 8px;
|
|
1212
|
-
}
|
|
1213
|
-
@keyframes spin {
|
|
1214
|
-
0% { transform: rotate(0deg); }
|
|
1215
|
-
100% { transform: rotate(360deg); }
|
|
1216
|
-
}
|
|
1217
|
-
` })
|
|
1218
|
-
] });
|
|
1219
|
-
}
|
|
1220
|
-
function formatDate$2(value) {
|
|
1221
|
-
if (!value) {
|
|
1222
|
-
return "";
|
|
1223
|
-
}
|
|
1224
|
-
const parsed = new Date(value);
|
|
1225
|
-
if (Number.isNaN(parsed.getTime())) {
|
|
1226
|
-
return value;
|
|
1227
|
-
}
|
|
1228
|
-
return parsed.toLocaleString();
|
|
1229
|
-
}
|
|
1230
|
-
function PayPalAuditLogsPage() {
|
|
1231
|
-
const [logs, setLogs] = react.useState([]);
|
|
1232
|
-
const [loading, setLoading] = react.useState(false);
|
|
1233
|
-
const [error, setError] = react.useState(null);
|
|
1234
|
-
const fetchLogs = react.useCallback(async () => {
|
|
1235
|
-
try {
|
|
1236
|
-
setLoading(true);
|
|
1237
|
-
setError(null);
|
|
1238
|
-
const response = await fetch("/admin/paypal/audit-logs?limit=50", {
|
|
1239
|
-
credentials: "include",
|
|
1240
|
-
headers: {
|
|
1241
|
-
Accept: "application/json"
|
|
1242
|
-
}
|
|
1243
|
-
});
|
|
1244
|
-
if (!response.ok) {
|
|
1245
|
-
const message = await response.text().catch(() => "");
|
|
1246
|
-
throw new Error(message || "Failed to load audit logs.");
|
|
1292
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable card saving at checkout" })
|
|
1293
|
+
] }) })
|
|
1294
|
+
] })
|
|
1247
1295
|
}
|
|
1248
|
-
|
|
1249
|
-
setLogs((data == null ? void 0 : data.logs) || []);
|
|
1250
|
-
} catch (fetchError) {
|
|
1251
|
-
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
|
|
1252
|
-
setLogs([]);
|
|
1253
|
-
} finally {
|
|
1254
|
-
setLoading(false);
|
|
1255
|
-
}
|
|
1256
|
-
}, []);
|
|
1257
|
-
react.useEffect(() => {
|
|
1258
|
-
fetchLogs();
|
|
1259
|
-
}, [fetchLogs]);
|
|
1260
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1261
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1262
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
|
|
1263
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
|
|
1264
|
-
] }),
|
|
1265
|
-
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
1266
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1267
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1268
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
|
|
1269
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1270
|
-
"button",
|
|
1271
|
-
{
|
|
1272
|
-
type: "button",
|
|
1273
|
-
onClick: fetchLogs,
|
|
1274
|
-
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
1275
|
-
disabled: loading,
|
|
1276
|
-
children: loading ? "Refreshing..." : "Refresh"
|
|
1277
|
-
}
|
|
1278
|
-
)
|
|
1279
|
-
] }) }),
|
|
1280
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
|
|
1281
|
-
error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
|
|
1282
|
-
!error && logs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
|
|
1283
|
-
logs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full text-left text-sm", children: [
|
|
1284
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1285
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
|
|
1286
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
|
|
1287
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 font-medium", children: "Details" })
|
|
1288
|
-
] }) }),
|
|
1289
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t border-ui-border-base", children: [
|
|
1290
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
|
|
1291
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
|
|
1292
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap rounded-md bg-ui-bg-subtle p-2 text-xs text-ui-fg-subtle", children: JSON.stringify(entry.metadata || {}, null, 2) }) })
|
|
1293
|
-
] }, entry.id)) })
|
|
1294
|
-
] }) }) : null
|
|
1295
|
-
] })
|
|
1296
|
-
] })
|
|
1296
|
+
)
|
|
1297
1297
|
] }) });
|
|
1298
1298
|
}
|
|
1299
|
+
function PayPalGooglePayPage() {
|
|
1300
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1301
|
+
}
|
|
1299
1302
|
const EMPTY_FILTERS = {
|
|
1300
1303
|
dispute_id: "",
|
|
1301
1304
|
status: "",
|
|
@@ -1488,9 +1491,6 @@ function PayPalDisputesPage() {
|
|
|
1488
1491
|
] })
|
|
1489
1492
|
] }) });
|
|
1490
1493
|
}
|
|
1491
|
-
function PayPalGooglePayPage() {
|
|
1492
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1493
|
-
}
|
|
1494
1494
|
function PayPalPayLaterMessagingPage() {
|
|
1495
1495
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1496
1496
|
}
|
|
@@ -2052,10 +2052,6 @@ const routeModule = {
|
|
|
2052
2052
|
Component: AdditionalSettingsTab,
|
|
2053
2053
|
path: "/settings/paypal/additional-settings"
|
|
2054
2054
|
},
|
|
2055
|
-
{
|
|
2056
|
-
Component: AdvancedCardPaymentsTab,
|
|
2057
|
-
path: "/settings/paypal/advanced-card-payments"
|
|
2058
|
-
},
|
|
2059
2055
|
{
|
|
2060
2056
|
Component: PayPalApplePayPage,
|
|
2061
2057
|
path: "/settings/paypal/apple-pay"
|
|
@@ -2069,13 +2065,17 @@ const routeModule = {
|
|
|
2069
2065
|
path: "/settings/paypal/audit-logs"
|
|
2070
2066
|
},
|
|
2071
2067
|
{
|
|
2072
|
-
Component:
|
|
2073
|
-
path: "/settings/paypal/
|
|
2068
|
+
Component: AdvancedCardPaymentsTab,
|
|
2069
|
+
path: "/settings/paypal/advanced-card-payments"
|
|
2074
2070
|
},
|
|
2075
2071
|
{
|
|
2076
2072
|
Component: PayPalGooglePayPage,
|
|
2077
2073
|
path: "/settings/paypal/google-pay"
|
|
2078
2074
|
},
|
|
2075
|
+
{
|
|
2076
|
+
Component: PayPalDisputesPage,
|
|
2077
|
+
path: "/settings/paypal/disputes"
|
|
2078
|
+
},
|
|
2079
2079
|
{
|
|
2080
2080
|
Component: PayPalPayLaterMessagingPage,
|
|
2081
2081
|
path: "/settings/paypal/pay-later-messaging"
|