@easypayment/medusa-payment-paypal 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +387 -133
- package/.medusa/server/src/admin/index.mjs +387 -133
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts +1 -0
- 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 +5 -1
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/disconnect/route.d.ts +1 -0
- package/.medusa/server/src/api/admin/paypal/disconnect/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/disconnect/route.js +1 -0
- package/.medusa/server/src/api/admin/paypal/disconnect/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/environment/route.d.ts +2 -0
- package/.medusa/server/src/api/admin/paypal/environment/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/environment/route.js +2 -0
- package/.medusa/server/src/api/admin/paypal/environment/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.d.ts +9 -0
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js +9 -4
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.d.ts +7 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js +9 -2
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.d.ts +1 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js +1 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.d.ts +1 -0
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.js +10 -3
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/settings/route.d.ts +2 -0
- package/.medusa/server/src/api/admin/paypal/settings/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/settings/route.js +9 -2
- package/.medusa/server/src/api/admin/paypal/settings/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/status/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/paypal/status/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/status/route.js +9 -1
- package/.medusa/server/src/api/admin/paypal/status/route.js.map +1 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts +4 -0
- 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 +5 -0
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts +8 -0
- package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/capture-order/route.js +23 -3
- package/.medusa/server/src/api/store/paypal/capture-order/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/config/route.d.ts +5 -0
- package/.medusa/server/src/api/store/paypal/config/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/config/route.js +12 -5
- package/.medusa/server/src/api/store/paypal/config/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/create-order/route.d.ts +8 -0
- package/.medusa/server/src/api/store/paypal/create-order/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/create-order/route.js +54 -20
- package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/onboard-return/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/onboard-return/route.js +19 -19
- package/.medusa/server/src/api/store/paypal/onboard-return/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/settings/route.d.ts +1 -0
- package/.medusa/server/src/api/store/paypal/settings/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/settings/route.js +4 -1
- package/.medusa/server/src/api/store/paypal/settings/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/webhook/route.d.ts +7 -0
- package/.medusa/server/src/api/store/paypal/webhook/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/webhook/route.js +34 -3
- package/.medusa/server/src/api/store/paypal/webhook/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal-complete/route.d.ts +8 -0
- package/.medusa/server/src/api/store/paypal-complete/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal-complete/route.js +33 -6
- package/.medusa/server/src/api/store/paypal-complete/route.js.map +1 -1
- package/.medusa/server/src/api/utils/rate-limit.d.ts +4 -0
- package/.medusa/server/src/api/utils/rate-limit.d.ts.map +1 -1
- package/.medusa/server/src/api/utils/rate-limit.js +9 -4
- package/.medusa/server/src/api/utils/rate-limit.js.map +1 -1
- package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts +5 -0
- package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts.map +1 -1
- package/.medusa/server/src/jobs/paypal-webhook-retry.js +13 -2
- package/.medusa/server/src/jobs/paypal-webhook-retry.js.map +1 -1
- package/.medusa/server/src/modules/paypal/index.d.ts +1 -0
- package/.medusa/server/src/modules/paypal/index.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/index.js +1 -0
- package/.medusa/server/src/modules/paypal/index.js.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20260115120000_create_paypal_connection.js +22 -22
- package/.medusa/server/src/modules/paypal/migrations/20260123090000_create_paypal_settings.js +11 -11
- package/.medusa/server/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.js +18 -18
- package/.medusa/server/src/modules/paypal/migrations/20260401090000_create_paypal_metric.js +16 -16
- package/.medusa/server/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.js +20 -20
- package/.medusa/server/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.js +14 -14
- package/.medusa/server/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.js +15 -15
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.js.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.js.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.js.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.js +6 -6
- package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts +5 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_connection.js +5 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.js.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_metric.d.ts +4 -0
- package/.medusa/server/src/modules/paypal/models/paypal_metric.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_metric.js +4 -0
- package/.medusa/server/src/modules/paypal/models/paypal_metric.js.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_settings.d.ts +5 -0
- package/.medusa/server/src/modules/paypal/models/paypal_settings.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_settings.js +5 -0
- package/.medusa/server/src/modules/paypal/models/paypal_settings.js.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.d.ts +7 -0
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js +7 -0
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts +14 -6
- 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 +55 -32
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/index.d.ts +6 -1
- package/.medusa/server/src/modules/paypal/payment-provider/index.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/index.js +6 -4
- package/.medusa/server/src/modules/paypal/payment-provider/index.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts +8 -0
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.js +39 -12
- package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/service.d.ts +72 -2
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/service.js +159 -33
- package/.medusa/server/src/modules/paypal/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/types/config.d.ts +2 -0
- package/.medusa/server/src/modules/paypal/types/config.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/types/config.js +5 -2
- package/.medusa/server/src/modules/paypal/types/config.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/amounts.d.ts +1 -0
- package/.medusa/server/src/modules/paypal/utils/amounts.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/amounts.js +15 -5
- package/.medusa/server/src/modules/paypal/utils/amounts.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js +3 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/currencies.d.ts +9 -0
- package/.medusa/server/src/modules/paypal/utils/currencies.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/currencies.js +13 -0
- package/.medusa/server/src/modules/paypal/utils/currencies.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/payment-session.d.ts +12 -0
- package/.medusa/server/src/modules/paypal/utils/payment-session.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/payment-session.js +4 -3
- package/.medusa/server/src/modules/paypal/utils/payment-session.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.d.ts +1 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.js +1 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.d.ts +11 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js +17 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js +6 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/secret-crypto.d.ts +2 -0
- package/.medusa/server/src/modules/paypal/utils/secret-crypto.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/secret-crypto.js +6 -1
- package/.medusa/server/src/modules/paypal/utils/secret-crypto.js.map +1 -1
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts +43 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/webhook-processor.js +57 -5
- package/.medusa/server/src/modules/paypal/webhook-processor.js.map +1 -1
- package/.medusa/server/src/providers/paypal/index.d.ts +1 -0
- package/.medusa/server/src/providers/paypal/index.d.ts.map +1 -1
- package/.medusa/server/src/providers/paypal/index.js +1 -0
- package/.medusa/server/src/providers/paypal/index.js.map +1 -1
- package/.medusa/server/src/providers/paypal_card/index.d.ts +1 -0
- package/.medusa/server/src/providers/paypal_card/index.d.ts.map +1 -1
- package/.medusa/server/src/providers/paypal_card/index.js +1 -0
- package/.medusa/server/src/providers/paypal_card/index.js.map +1 -1
- package/.medusa/server/src/subscribers/paypal-order-invoice.d.ts +6 -0
- package/.medusa/server/src/subscribers/paypal-order-invoice.d.ts.map +1 -1
- package/.medusa/server/src/subscribers/paypal-order-invoice.js +9 -1
- package/.medusa/server/src/subscribers/paypal-order-invoice.js.map +1 -1
- package/.medusa/server/src/subscribers/paypal-webhook-process.d.ts +1 -0
- package/.medusa/server/src/subscribers/paypal-webhook-process.d.ts.map +1 -1
- package/.medusa/server/src/subscribers/paypal-webhook-process.js +17 -4
- package/.medusa/server/src/subscribers/paypal-webhook-process.js.map +1 -1
- package/CHANGELOG.md +11 -0
- package/README.md +184 -184
- package/package.json +7 -4
- package/src/admin/index.ts +1 -1
- package/src/admin/routes/settings/paypal/_components/FieldRow.tsx +38 -29
- package/src/admin/routes/settings/paypal/_components/SectionCard.tsx +29 -26
- package/src/admin/routes/settings/paypal/_components/Tabs.tsx +49 -48
- package/src/admin/routes/settings/paypal/_components/Toast.tsx +63 -52
- package/src/admin/routes/settings/paypal/_utils/adminFetch.ts +52 -32
- package/src/admin/routes/settings/paypal/additional-settings/page.tsx +246 -139
- package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +208 -123
- package/src/admin/routes/settings/paypal/apple-pay/page.tsx +9 -5
- package/src/admin/routes/settings/paypal/connection/page.tsx +974 -908
- package/src/admin/routes/settings/paypal/google-pay/page.tsx +9 -5
- package/src/admin/routes/settings/paypal/page.tsx +14 -13
- package/src/admin/routes/settings/paypal/pay-later-messaging/page.tsx +9 -5
- package/src/admin/routes/settings/paypal/paypal-settings/page.tsx +304 -273
- package/src/api/admin/payment-collections/[id]/payment-sessions/route.ts +48 -39
- package/src/api/admin/paypal/disconnect/route.ts +15 -14
- package/src/api/admin/paypal/environment/route.ts +34 -32
- package/src/api/admin/paypal/onboard-complete/route.ts +61 -50
- package/src/api/admin/paypal/onboarding-link/route.ts +91 -76
- package/src/api/admin/paypal/onboarding-status/route.ts +21 -20
- package/src/api/admin/paypal/save-credentials/route.ts +48 -37
- package/src/api/admin/paypal/settings/route.ts +63 -45
- package/src/api/admin/paypal/status/route.ts +29 -17
- package/src/api/hooks/paypal/onboard-return/route.ts +15 -15
- package/src/api/hooks/paypal/webhook/route.ts +17 -17
- package/src/api/middlewares.ts +61 -61
- package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +63 -54
- package/src/api/store/paypal/capture-order/route.ts +416 -370
- package/src/api/store/paypal/config/route.ts +121 -115
- package/src/api/store/paypal/create-order/route.ts +586 -539
- package/src/api/store/paypal/onboard-return/route.ts +116 -113
- package/src/api/store/paypal/settings/route.ts +29 -19
- package/src/api/store/paypal/webhook/route.ts +380 -314
- package/src/api/store/paypal-complete/route.ts +157 -128
- package/src/api/utils/rate-limit.ts +143 -129
- package/src/index.ts +1 -1
- package/src/jobs/paypal-webhook-retry.ts +257 -241
- package/src/modules/paypal/index.ts +9 -8
- package/src/modules/paypal/migrations/20260115120000_create_paypal_connection.ts +33 -33
- package/src/modules/paypal/migrations/20260123090000_create_paypal_settings.ts +22 -22
- package/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.ts +29 -29
- package/src/modules/paypal/migrations/20260401090000_create_paypal_metric.ts +27 -27
- package/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.ts +31 -31
- package/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.ts +25 -25
- package/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.ts +26 -26
- package/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.ts +15 -11
- package/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.ts +15 -11
- package/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.ts +15 -11
- package/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.ts +17 -17
- package/src/modules/paypal/migrations/20270202000000_align_nullable_defaults.ts +44 -44
- package/src/modules/paypal/migrations/20270301000000_add_webhook_transmission_id_index.ts +15 -15
- package/src/modules/paypal/models/paypal_connection.ts +28 -23
- package/src/modules/paypal/models/paypal_metric.ts +13 -9
- package/src/modules/paypal/models/paypal_settings.ts +13 -8
- package/src/modules/paypal/models/paypal_webhook_event.ts +26 -19
- package/src/modules/paypal/payment-provider/base-provider.ts +287 -275
- package/src/modules/paypal/payment-provider/card-service.ts +927 -855
- package/src/modules/paypal/payment-provider/index.ts +14 -15
- package/src/modules/paypal/payment-provider/service.ts +906 -836
- package/src/modules/paypal/payment-provider/status-utils.ts +59 -59
- package/src/modules/paypal/payment-provider/webhook-utils.ts +109 -109
- package/src/modules/paypal/service.ts +362 -115
- package/src/modules/paypal/types/config.ts +70 -65
- package/src/modules/paypal/utils/amounts.ts +123 -107
- package/src/modules/paypal/utils/core-workflow.ts +46 -46
- package/src/modules/paypal/utils/credential-resolver.ts +275 -271
- package/src/modules/paypal/utils/currencies.ts +97 -84
- package/src/modules/paypal/utils/partner.ts +8 -8
- package/src/modules/paypal/utils/payment-session.ts +144 -138
- package/src/modules/paypal/utils/paypal-auth.ts +6 -5
- package/src/modules/paypal/utils/paypal-fetch.ts +197 -181
- package/src/modules/paypal/utils/provider-ids.ts +21 -15
- package/src/modules/paypal/utils/secret-crypto.ts +226 -197
- package/src/modules/paypal/utils/webhook-verify.ts +61 -61
- package/src/modules/paypal/webhook-processor.ts +641 -573
- package/src/providers/paypal/index.ts +9 -8
- package/src/providers/paypal_card/index.ts +9 -8
- package/src/subscribers/paypal-order-invoice.ts +180 -173
- package/src/subscribers/paypal-webhook-process.ts +147 -131
- package/tsconfig.json +21 -31
|
@@ -58,7 +58,14 @@ function FieldRow({
|
|
|
58
58
|
}) {
|
|
59
59
|
return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 items-start gap-4 py-3", children: [
|
|
60
60
|
/* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
|
|
61
|
-
htmlFor ? /* @__PURE__ */ jsx(
|
|
61
|
+
htmlFor ? /* @__PURE__ */ jsx(
|
|
62
|
+
"label",
|
|
63
|
+
{
|
|
64
|
+
htmlFor,
|
|
65
|
+
className: "text-sm font-medium text-ui-fg-base",
|
|
66
|
+
children: label
|
|
67
|
+
}
|
|
68
|
+
) : /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-ui-fg-base", children: label }),
|
|
62
69
|
hint ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: hint }) : null
|
|
63
70
|
] }),
|
|
64
71
|
/* @__PURE__ */ jsx("div", { className: "col-span-12 md:col-span-8", children })
|
|
@@ -83,7 +90,15 @@ function Toast({ toast, onClose }) {
|
|
|
83
90
|
role: isSuccess ? "status" : "alert",
|
|
84
91
|
"aria-live": isSuccess ? "polite" : "assertive",
|
|
85
92
|
children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
86
|
-
/* @__PURE__ */ jsx(
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
className: [
|
|
97
|
+
"mt-0.5 h-2.5 w-2.5 rounded-full",
|
|
98
|
+
isSuccess ? "bg-emerald-500" : "bg-rose-500"
|
|
99
|
+
].join(" ")
|
|
100
|
+
}
|
|
101
|
+
),
|
|
87
102
|
/* @__PURE__ */ jsx("div", { className: "flex-1 text-sm text-ui-fg-base", children: toast.message }),
|
|
88
103
|
/* @__PURE__ */ jsx(
|
|
89
104
|
"button",
|
|
@@ -121,8 +136,14 @@ async function adminFetch(path, opts = {}) {
|
|
|
121
136
|
});
|
|
122
137
|
const text = await res.text().catch(() => "");
|
|
123
138
|
if (!res.ok) {
|
|
124
|
-
if (res.status === 401)
|
|
125
|
-
|
|
139
|
+
if (res.status === 401)
|
|
140
|
+
throw new Error(
|
|
141
|
+
"Unauthorized (401) - session may have expired. Please reload and log in again."
|
|
142
|
+
);
|
|
143
|
+
if (res.status === 403)
|
|
144
|
+
throw new Error(
|
|
145
|
+
"Forbidden (403) - you do not have permission to perform this action."
|
|
146
|
+
);
|
|
126
147
|
throw new Error(text || `Request failed with status ${res.status}`);
|
|
127
148
|
}
|
|
128
149
|
if (!text) return {};
|
|
@@ -143,11 +164,18 @@ const DEFAULT_FORM$1 = {
|
|
|
143
164
|
};
|
|
144
165
|
function mergeWithDefaults$1(saved) {
|
|
145
166
|
if (!saved) return { ...DEFAULT_FORM$1 };
|
|
146
|
-
const entries = Object.entries(saved).filter(
|
|
147
|
-
|
|
167
|
+
const entries = Object.entries(saved).filter(
|
|
168
|
+
([, value]) => value !== void 0
|
|
169
|
+
);
|
|
170
|
+
return {
|
|
171
|
+
...DEFAULT_FORM$1,
|
|
172
|
+
...Object.fromEntries(entries)
|
|
173
|
+
};
|
|
148
174
|
}
|
|
149
175
|
function AdditionalSettingsTab() {
|
|
150
|
-
const [form, setForm] = useState(() => ({
|
|
176
|
+
const [form, setForm] = useState(() => ({
|
|
177
|
+
...DEFAULT_FORM$1
|
|
178
|
+
}));
|
|
151
179
|
const [loading, setLoading] = useState(false);
|
|
152
180
|
const [saving, setSaving] = useState(false);
|
|
153
181
|
const [toast, setToast] = useState(null);
|
|
@@ -162,7 +190,8 @@ function AdditionalSettingsTab() {
|
|
|
162
190
|
const json = await adminFetch("/admin/paypal/settings");
|
|
163
191
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
164
192
|
const saved = payload == null ? void 0 : payload.additional_settings;
|
|
165
|
-
if (saved && typeof saved === "object")
|
|
193
|
+
if (saved && typeof saved === "object")
|
|
194
|
+
setForm(mergeWithDefaults$1(saved));
|
|
166
195
|
} catch {
|
|
167
196
|
} finally {
|
|
168
197
|
setLoading(false);
|
|
@@ -173,13 +202,21 @@ function AdditionalSettingsTab() {
|
|
|
173
202
|
try {
|
|
174
203
|
setSaving(true);
|
|
175
204
|
setToast(null);
|
|
176
|
-
const json = await adminFetch("/admin/paypal/settings", {
|
|
205
|
+
const json = await adminFetch("/admin/paypal/settings", {
|
|
206
|
+
method: "POST",
|
|
207
|
+
body: {
|
|
208
|
+
additional_settings: form
|
|
209
|
+
}
|
|
210
|
+
});
|
|
177
211
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
178
212
|
const saved = payload == null ? void 0 : payload.additional_settings;
|
|
179
213
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
|
|
180
214
|
setToast({ kind: "success", message: "Settings saved" });
|
|
181
215
|
} catch (e) {
|
|
182
|
-
setToast({
|
|
216
|
+
setToast({
|
|
217
|
+
kind: "error",
|
|
218
|
+
message: e instanceof Error ? e.message : "Failed to save settings"
|
|
219
|
+
});
|
|
183
220
|
} finally {
|
|
184
221
|
setSaving(false);
|
|
185
222
|
}
|
|
@@ -194,35 +231,137 @@ function AdditionalSettingsTab() {
|
|
|
194
231
|
title: "Additional Settings",
|
|
195
232
|
description: "These settings control checkout behavior and PayPal experience.",
|
|
196
233
|
right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
197
|
-
/* @__PURE__ */ jsx(
|
|
234
|
+
/* @__PURE__ */ jsx(
|
|
235
|
+
"button",
|
|
236
|
+
{
|
|
237
|
+
type: "button",
|
|
238
|
+
onClick: onSave,
|
|
239
|
+
disabled: saving || loading,
|
|
240
|
+
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",
|
|
241
|
+
children: saving ? "Saving..." : "Save settings"
|
|
242
|
+
}
|
|
243
|
+
),
|
|
198
244
|
loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
|
|
199
245
|
] }),
|
|
200
246
|
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(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
247
|
+
/* @__PURE__ */ jsx(FieldRow, { label: "Payment action", htmlFor: "as-payment-action", children: /* @__PURE__ */ jsxs(
|
|
248
|
+
"select",
|
|
249
|
+
{
|
|
250
|
+
id: "as-payment-action",
|
|
251
|
+
value: form.paymentAction,
|
|
252
|
+
onChange: (e) => setForm((p) => ({
|
|
253
|
+
...p,
|
|
254
|
+
paymentAction: e.target.value
|
|
255
|
+
})),
|
|
256
|
+
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",
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsx("option", { value: "capture", children: "Capture" }),
|
|
259
|
+
/* @__PURE__ */ jsx("option", { value: "authorize", children: "Authorize" })
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
) }),
|
|
263
|
+
/* @__PURE__ */ jsx(FieldRow, { label: "Brand Name", htmlFor: "as-brand-name", children: /* @__PURE__ */ jsx(
|
|
264
|
+
"input",
|
|
265
|
+
{
|
|
266
|
+
id: "as-brand-name",
|
|
267
|
+
value: form.brandName,
|
|
268
|
+
onChange: (e) => setForm((p) => ({ ...p, brandName: e.target.value })),
|
|
269
|
+
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",
|
|
270
|
+
placeholder: "PayPal"
|
|
271
|
+
}
|
|
272
|
+
) }),
|
|
273
|
+
/* @__PURE__ */ jsx(FieldRow, { label: "Landing Page", htmlFor: "as-landing-page", children: /* @__PURE__ */ jsxs(
|
|
274
|
+
"select",
|
|
275
|
+
{
|
|
276
|
+
id: "as-landing-page",
|
|
277
|
+
value: form.landingPage,
|
|
278
|
+
onChange: (e) => setForm((p) => ({
|
|
279
|
+
...p,
|
|
280
|
+
landingPage: e.target.value
|
|
281
|
+
})),
|
|
282
|
+
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",
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ jsx("option", { value: "no_preference", children: "No Preference" }),
|
|
285
|
+
/* @__PURE__ */ jsx("option", { value: "login", children: "Login" }),
|
|
286
|
+
/* @__PURE__ */ jsx("option", { value: "billing", children: "Billing" })
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
) }),
|
|
211
290
|
/* @__PURE__ */ jsx(FieldRow, { label: "Instant Payments", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
212
|
-
/* @__PURE__ */ jsx(
|
|
291
|
+
/* @__PURE__ */ jsx(
|
|
292
|
+
"input",
|
|
293
|
+
{
|
|
294
|
+
type: "checkbox",
|
|
295
|
+
checked: form.requireInstantPayment,
|
|
296
|
+
onChange: (e) => setForm((p) => ({
|
|
297
|
+
...p,
|
|
298
|
+
requireInstantPayment: e.target.checked
|
|
299
|
+
})),
|
|
300
|
+
className: "h-4 w-4 rounded border-ui-border-base"
|
|
301
|
+
}
|
|
302
|
+
),
|
|
213
303
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
|
|
214
304
|
] }) }),
|
|
215
|
-
/* @__PURE__ */ jsx(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
305
|
+
/* @__PURE__ */ jsx(
|
|
306
|
+
FieldRow,
|
|
307
|
+
{
|
|
308
|
+
label: "Send Item Details",
|
|
309
|
+
hint: "Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.",
|
|
310
|
+
children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
311
|
+
/* @__PURE__ */ jsx(
|
|
312
|
+
"input",
|
|
313
|
+
{
|
|
314
|
+
type: "checkbox",
|
|
315
|
+
checked: form.sendItemDetails,
|
|
316
|
+
onChange: (e) => setForm((p) => ({
|
|
317
|
+
...p,
|
|
318
|
+
sendItemDetails: e.target.checked
|
|
319
|
+
})),
|
|
320
|
+
className: "h-4 w-4 rounded border-ui-border-base"
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
|
|
324
|
+
] })
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
/* @__PURE__ */ jsx(FieldRow, { label: "Invoice prefix", htmlFor: "as-invoice-prefix", children: /* @__PURE__ */ jsx(
|
|
328
|
+
"input",
|
|
329
|
+
{
|
|
330
|
+
id: "as-invoice-prefix",
|
|
331
|
+
value: form.invoicePrefix,
|
|
332
|
+
onChange: (e) => setForm((p) => ({ ...p, invoicePrefix: e.target.value })),
|
|
333
|
+
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",
|
|
334
|
+
placeholder: "PP-"
|
|
335
|
+
}
|
|
336
|
+
) }),
|
|
337
|
+
/* @__PURE__ */ jsx(
|
|
338
|
+
FieldRow,
|
|
339
|
+
{
|
|
340
|
+
label: "Credit Card Statement Name",
|
|
341
|
+
htmlFor: "as-cc-statement",
|
|
342
|
+
children: /* @__PURE__ */ jsx(
|
|
343
|
+
"input",
|
|
344
|
+
{
|
|
345
|
+
id: "as-cc-statement",
|
|
346
|
+
value: form.creditCardStatementName,
|
|
347
|
+
onChange: (e) => setForm((p) => ({
|
|
348
|
+
...p,
|
|
349
|
+
creditCardStatementName: e.target.value
|
|
350
|
+
})),
|
|
351
|
+
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",
|
|
352
|
+
placeholder: "PayPal"
|
|
353
|
+
}
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
)
|
|
221
357
|
] })
|
|
222
358
|
}
|
|
223
359
|
)
|
|
224
360
|
] }) });
|
|
225
361
|
}
|
|
362
|
+
function PayPalApplePayPage() {
|
|
363
|
+
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
364
|
+
}
|
|
226
365
|
const DEFAULT_FORM = {
|
|
227
366
|
enabled: true,
|
|
228
367
|
title: "Credit or Debit Card",
|
|
@@ -230,17 +369,36 @@ const DEFAULT_FORM = {
|
|
|
230
369
|
};
|
|
231
370
|
function mergeWithDefaults(saved) {
|
|
232
371
|
if (!saved) return { ...DEFAULT_FORM };
|
|
233
|
-
const entries = Object.entries(saved).filter(
|
|
234
|
-
|
|
372
|
+
const entries = Object.entries(saved).filter(
|
|
373
|
+
([, value]) => value !== void 0
|
|
374
|
+
);
|
|
375
|
+
return {
|
|
376
|
+
...DEFAULT_FORM,
|
|
377
|
+
...Object.fromEntries(entries)
|
|
378
|
+
};
|
|
235
379
|
}
|
|
236
380
|
const THREE_DS_OPTIONS = [
|
|
237
|
-
{
|
|
238
|
-
|
|
239
|
-
|
|
381
|
+
{
|
|
382
|
+
value: "when_required",
|
|
383
|
+
label: "3D Secure when required",
|
|
384
|
+
hint: "Triggers 3DS only when the card / issuer requires it."
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
value: "sli",
|
|
388
|
+
label: "3D Secure (SCA) / liability shift (recommended)",
|
|
389
|
+
hint: "Attempts to optimize for liability shift while remaining compliant."
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
value: "always",
|
|
393
|
+
label: "Always request 3D Secure",
|
|
394
|
+
hint: "Forces 3DS challenge whenever possible (may reduce conversion)."
|
|
395
|
+
}
|
|
240
396
|
];
|
|
241
397
|
function AdvancedCardPaymentsTab() {
|
|
242
398
|
var _a, _b;
|
|
243
|
-
const [form, setForm] = useState(() => ({
|
|
399
|
+
const [form, setForm] = useState(() => ({
|
|
400
|
+
...DEFAULT_FORM
|
|
401
|
+
}));
|
|
244
402
|
const [loading, setLoading] = useState(false);
|
|
245
403
|
const [saving, setSaving] = useState(false);
|
|
246
404
|
const [toast, setToast] = useState(null);
|
|
@@ -255,7 +413,8 @@ function AdvancedCardPaymentsTab() {
|
|
|
255
413
|
const json = await adminFetch("/admin/paypal/settings");
|
|
256
414
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
257
415
|
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
258
|
-
if (saved && typeof saved === "object")
|
|
416
|
+
if (saved && typeof saved === "object")
|
|
417
|
+
setForm(mergeWithDefaults(saved));
|
|
259
418
|
} catch {
|
|
260
419
|
} finally {
|
|
261
420
|
setLoading(false);
|
|
@@ -267,14 +426,19 @@ function AdvancedCardPaymentsTab() {
|
|
|
267
426
|
setSaving(true);
|
|
268
427
|
const json = await adminFetch("/admin/paypal/settings", {
|
|
269
428
|
method: "POST",
|
|
270
|
-
body: {
|
|
429
|
+
body: {
|
|
430
|
+
advanced_card_payments: form
|
|
431
|
+
}
|
|
271
432
|
});
|
|
272
433
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
273
434
|
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
274
435
|
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
275
436
|
setToast({ kind: "success", message: "Settings saved" });
|
|
276
437
|
} catch (e) {
|
|
277
|
-
setToast({
|
|
438
|
+
setToast({
|
|
439
|
+
kind: "error",
|
|
440
|
+
message: (e instanceof Error ? e.message : "") || "Failed to save settings."
|
|
441
|
+
});
|
|
278
442
|
} finally {
|
|
279
443
|
setSaving(false);
|
|
280
444
|
}
|
|
@@ -289,27 +453,70 @@ function AdvancedCardPaymentsTab() {
|
|
|
289
453
|
title: "Advanced Card Payments",
|
|
290
454
|
description: "Control card checkout settings and 3D Secure behavior.",
|
|
291
455
|
right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
292
|
-
/* @__PURE__ */ jsx(
|
|
456
|
+
/* @__PURE__ */ jsx(
|
|
457
|
+
"button",
|
|
458
|
+
{
|
|
459
|
+
type: "button",
|
|
460
|
+
onClick: onSave,
|
|
461
|
+
disabled: saving || loading,
|
|
462
|
+
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",
|
|
463
|
+
children: saving ? "Saving..." : "Save settings"
|
|
464
|
+
}
|
|
465
|
+
),
|
|
293
466
|
loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
|
|
294
467
|
] }),
|
|
295
468
|
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
296
469
|
/* @__PURE__ */ jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
297
|
-
/* @__PURE__ */ jsx(
|
|
470
|
+
/* @__PURE__ */ jsx(
|
|
471
|
+
"input",
|
|
472
|
+
{
|
|
473
|
+
type: "checkbox",
|
|
474
|
+
checked: form.enabled,
|
|
475
|
+
onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })),
|
|
476
|
+
className: "h-4 w-4 rounded border-ui-border-base"
|
|
477
|
+
}
|
|
478
|
+
),
|
|
298
479
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
|
|
299
480
|
] }) }),
|
|
300
|
-
/* @__PURE__ */ jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsx(
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
481
|
+
/* @__PURE__ */ jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsx(
|
|
482
|
+
"input",
|
|
483
|
+
{
|
|
484
|
+
id: "acp-title",
|
|
485
|
+
value: form.title,
|
|
486
|
+
onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })),
|
|
487
|
+
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",
|
|
488
|
+
placeholder: "Credit or Debit Card"
|
|
489
|
+
}
|
|
490
|
+
) }),
|
|
491
|
+
/* @__PURE__ */ jsx(
|
|
492
|
+
FieldRow,
|
|
493
|
+
{
|
|
494
|
+
label: "Contingency for 3D Secure",
|
|
495
|
+
hint: "Choose when 3D Secure should be triggered during card payments.",
|
|
496
|
+
htmlFor: "acp-threeds",
|
|
497
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
498
|
+
/* @__PURE__ */ jsx(
|
|
499
|
+
"select",
|
|
500
|
+
{
|
|
501
|
+
id: "acp-threeds",
|
|
502
|
+
value: form.threeDS,
|
|
503
|
+
onChange: (e) => setForm((p) => ({
|
|
504
|
+
...p,
|
|
505
|
+
threeDS: e.target.value
|
|
506
|
+
})),
|
|
507
|
+
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",
|
|
508
|
+
children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
((_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
|
|
512
|
+
] })
|
|
513
|
+
}
|
|
514
|
+
)
|
|
305
515
|
] })
|
|
306
516
|
}
|
|
307
517
|
)
|
|
308
518
|
] }) });
|
|
309
519
|
}
|
|
310
|
-
function PayPalApplePayPage() {
|
|
311
|
-
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
312
|
-
}
|
|
313
520
|
function PayPalGooglePayPage() {
|
|
314
521
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
315
522
|
}
|
|
@@ -341,7 +548,10 @@ function readCachedUrl(env) {
|
|
|
341
548
|
}
|
|
342
549
|
function writeCachedUrl(env, url) {
|
|
343
550
|
try {
|
|
344
|
-
localStorage.setItem(
|
|
551
|
+
localStorage.setItem(
|
|
552
|
+
cacheKeyFor(env),
|
|
553
|
+
JSON.stringify({ url, ts: Date.now() })
|
|
554
|
+
);
|
|
345
555
|
} catch {
|
|
346
556
|
}
|
|
347
557
|
}
|
|
@@ -526,7 +736,8 @@ function PayPalConnectionPage() {
|
|
|
526
736
|
ppScript.async = true;
|
|
527
737
|
document.head.appendChild(ppScript);
|
|
528
738
|
return () => {
|
|
529
|
-
if (preloadLink == null ? void 0 : preloadLink.parentNode)
|
|
739
|
+
if (preloadLink == null ? void 0 : preloadLink.parentNode)
|
|
740
|
+
preloadLink.parentNode.removeChild(preloadLink);
|
|
530
741
|
if (ppScript.parentNode) ppScript.parentNode.removeChild(ppScript);
|
|
531
742
|
};
|
|
532
743
|
}, []);
|
|
@@ -563,7 +774,8 @@ function PayPalConnectionPage() {
|
|
|
563
774
|
async (targetEnv, runId) => {
|
|
564
775
|
if (initLoaderRef.current) {
|
|
565
776
|
const loaderText = initLoaderRef.current.querySelector("#loader-text");
|
|
566
|
-
if (loaderText)
|
|
777
|
+
if (loaderText)
|
|
778
|
+
loaderText.textContent = "Generating onboarding session...";
|
|
567
779
|
}
|
|
568
780
|
try {
|
|
569
781
|
const res = await fetch(SERVICE_URL, {
|
|
@@ -853,61 +1065,73 @@ function PayPalConnectionPage() {
|
|
|
853
1065
|
]
|
|
854
1066
|
}
|
|
855
1067
|
),
|
|
856
|
-
/* @__PURE__ */ jsxs(
|
|
857
|
-
|
|
858
|
-
"a",
|
|
859
|
-
{
|
|
860
|
-
ref: (node) => {
|
|
861
|
-
paypalButtonRef.current = node;
|
|
862
|
-
ppBtnMeasureRef.current = node;
|
|
863
|
-
},
|
|
864
|
-
id: "paypal-button",
|
|
865
|
-
"data-paypal-button": "true",
|
|
866
|
-
href: finalUrl || "#",
|
|
867
|
-
"data-paypal-onboard-complete": "onboardingCallback",
|
|
868
|
-
onClick: handleConnectClick,
|
|
869
|
-
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none no-underline 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",
|
|
870
|
-
style: {
|
|
871
|
-
cursor: onboardingInProgress ? "not-allowed" : "pointer",
|
|
872
|
-
opacity: onboardingInProgress ? 0.6 : 1,
|
|
873
|
-
pointerEvents: onboardingInProgress ? "none" : "auto"
|
|
874
|
-
},
|
|
875
|
-
children: "Connect to PayPal"
|
|
876
|
-
}
|
|
877
|
-
),
|
|
878
|
-
/* @__PURE__ */ jsx(
|
|
879
|
-
"div",
|
|
880
|
-
{
|
|
881
|
-
className: "mt-2",
|
|
882
|
-
style: {
|
|
883
|
-
width: ppBtnWidth ? `${ppBtnWidth}px` : "auto",
|
|
884
|
-
marginTop: "20px",
|
|
885
|
-
marginBottom: "10px"
|
|
886
|
-
},
|
|
887
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-[11px] text-ui-fg-muted leading-none", children: "OR" }) })
|
|
888
|
-
}
|
|
889
|
-
),
|
|
890
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
891
|
-
"button",
|
|
892
|
-
{
|
|
893
|
-
type: "button",
|
|
894
|
-
onClick: () => setShowManual(!showManual),
|
|
895
|
-
disabled: onboardingInProgress,
|
|
896
|
-
className: "text-sm text-ui-fg-interactive underline whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed",
|
|
897
|
-
children: "Click here to insert credentials manually"
|
|
898
|
-
}
|
|
899
|
-
) })
|
|
900
|
-
] }),
|
|
901
|
-
/* @__PURE__ */ jsx("div", { className: `${connState === "ready" ? "hidden" : "block"} mt-3`, children: /* @__PURE__ */ jsx(
|
|
902
|
-
"button",
|
|
1068
|
+
/* @__PURE__ */ jsxs(
|
|
1069
|
+
"div",
|
|
903
1070
|
{
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
1071
|
+
className: `${connState === "ready" ? "block" : "hidden"}`,
|
|
1072
|
+
children: [
|
|
1073
|
+
/* @__PURE__ */ jsx(
|
|
1074
|
+
"a",
|
|
1075
|
+
{
|
|
1076
|
+
ref: (node) => {
|
|
1077
|
+
paypalButtonRef.current = node;
|
|
1078
|
+
ppBtnMeasureRef.current = node;
|
|
1079
|
+
},
|
|
1080
|
+
id: "paypal-button",
|
|
1081
|
+
"data-paypal-button": "true",
|
|
1082
|
+
href: finalUrl || "#",
|
|
1083
|
+
"data-paypal-onboard-complete": "onboardingCallback",
|
|
1084
|
+
onClick: handleConnectClick,
|
|
1085
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none no-underline 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",
|
|
1086
|
+
style: {
|
|
1087
|
+
cursor: onboardingInProgress ? "not-allowed" : "pointer",
|
|
1088
|
+
opacity: onboardingInProgress ? 0.6 : 1,
|
|
1089
|
+
pointerEvents: onboardingInProgress ? "none" : "auto"
|
|
1090
|
+
},
|
|
1091
|
+
children: "Connect to PayPal"
|
|
1092
|
+
}
|
|
1093
|
+
),
|
|
1094
|
+
/* @__PURE__ */ jsx(
|
|
1095
|
+
"div",
|
|
1096
|
+
{
|
|
1097
|
+
className: "mt-2",
|
|
1098
|
+
style: {
|
|
1099
|
+
width: ppBtnWidth ? `${ppBtnWidth}px` : "auto",
|
|
1100
|
+
marginTop: "20px",
|
|
1101
|
+
marginBottom: "10px"
|
|
1102
|
+
},
|
|
1103
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-[11px] text-ui-fg-muted leading-none", children: "OR" }) })
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
1107
|
+
"button",
|
|
1108
|
+
{
|
|
1109
|
+
type: "button",
|
|
1110
|
+
onClick: () => setShowManual(!showManual),
|
|
1111
|
+
disabled: onboardingInProgress,
|
|
1112
|
+
className: "text-sm text-ui-fg-interactive underline whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1113
|
+
children: "Click here to insert credentials manually"
|
|
1114
|
+
}
|
|
1115
|
+
) })
|
|
1116
|
+
]
|
|
909
1117
|
}
|
|
910
|
-
)
|
|
1118
|
+
),
|
|
1119
|
+
/* @__PURE__ */ jsx(
|
|
1120
|
+
"div",
|
|
1121
|
+
{
|
|
1122
|
+
className: `${connState === "ready" ? "hidden" : "block"} mt-3`,
|
|
1123
|
+
children: /* @__PURE__ */ jsx(
|
|
1124
|
+
"button",
|
|
1125
|
+
{
|
|
1126
|
+
type: "button",
|
|
1127
|
+
onClick: () => setShowManual(!showManual),
|
|
1128
|
+
disabled: onboardingInProgress,
|
|
1129
|
+
className: "text-sm text-ui-fg-interactive underline whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1130
|
+
children: "Click here to insert credentials manually"
|
|
1131
|
+
}
|
|
1132
|
+
)
|
|
1133
|
+
}
|
|
1134
|
+
),
|
|
911
1135
|
/* @__PURE__ */ jsx(
|
|
912
1136
|
"div",
|
|
913
1137
|
{
|
|
@@ -920,7 +1144,14 @@ function PayPalConnectionPage() {
|
|
|
920
1144
|
] }) }),
|
|
921
1145
|
showManual && /* @__PURE__ */ jsx("div", { className: "md:col-span-2", children: /* @__PURE__ */ jsxs("div", { className: "ml-[260px] max-w-xl mt-4 grid grid-cols-1 gap-3 md:grid-cols-2", children: [
|
|
922
1146
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
923
|
-
/* @__PURE__ */ jsx(
|
|
1147
|
+
/* @__PURE__ */ jsx(
|
|
1148
|
+
"label",
|
|
1149
|
+
{
|
|
1150
|
+
htmlFor: "pp-manual-client-id",
|
|
1151
|
+
className: "text-sm font-medium",
|
|
1152
|
+
children: "Client ID"
|
|
1153
|
+
}
|
|
1154
|
+
),
|
|
924
1155
|
/* @__PURE__ */ jsx(
|
|
925
1156
|
"input",
|
|
926
1157
|
{
|
|
@@ -935,7 +1166,14 @@ function PayPalConnectionPage() {
|
|
|
935
1166
|
)
|
|
936
1167
|
] }),
|
|
937
1168
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
938
|
-
/* @__PURE__ */ jsx(
|
|
1169
|
+
/* @__PURE__ */ jsx(
|
|
1170
|
+
"label",
|
|
1171
|
+
{
|
|
1172
|
+
htmlFor: "pp-manual-secret",
|
|
1173
|
+
className: "text-sm font-medium",
|
|
1174
|
+
children: "Secret"
|
|
1175
|
+
}
|
|
1176
|
+
),
|
|
939
1177
|
/* @__PURE__ */ jsx(
|
|
940
1178
|
"input",
|
|
941
1179
|
{
|
|
@@ -969,18 +1207,25 @@ function PayPalConnectionPage() {
|
|
|
969
1207
|
"and sign in or create an account."
|
|
970
1208
|
] }),
|
|
971
1209
|
/* @__PURE__ */ jsxs("li", { children: [
|
|
972
|
-
"Select
|
|
1210
|
+
"Select",
|
|
1211
|
+
" ",
|
|
973
1212
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Apps & Credentials" }),
|
|
974
|
-
", then choose
|
|
1213
|
+
", then choose",
|
|
1214
|
+
" ",
|
|
975
1215
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Create App" }),
|
|
976
|
-
"
|
|
1216
|
+
" ",
|
|
1217
|
+
"if you need a new project."
|
|
977
1218
|
] }),
|
|
978
1219
|
/* @__PURE__ */ jsxs("li", { children: [
|
|
979
|
-
"Copy your app's
|
|
1220
|
+
"Copy your app's",
|
|
1221
|
+
" ",
|
|
980
1222
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Client ID" }),
|
|
981
|
-
"
|
|
1223
|
+
" ",
|
|
1224
|
+
"and",
|
|
1225
|
+
" ",
|
|
982
1226
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Secret" }),
|
|
983
|
-
", paste them above, then click
|
|
1227
|
+
", paste them above, then click",
|
|
1228
|
+
" ",
|
|
984
1229
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Save credentials" }),
|
|
985
1230
|
"."
|
|
986
1231
|
] })
|
|
@@ -1079,9 +1324,7 @@ function PayPalSettingsTab() {
|
|
|
1079
1324
|
(async () => {
|
|
1080
1325
|
try {
|
|
1081
1326
|
setLoading(true);
|
|
1082
|
-
const json = await adminFetch(
|
|
1083
|
-
"/admin/paypal/settings"
|
|
1084
|
-
);
|
|
1327
|
+
const json = await adminFetch("/admin/paypal/settings");
|
|
1085
1328
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
1086
1329
|
const saved = payload == null ? void 0 : payload.paypal_settings;
|
|
1087
1330
|
if (saved && typeof saved === "object") {
|
|
@@ -1100,13 +1343,12 @@ function PayPalSettingsTab() {
|
|
|
1100
1343
|
try {
|
|
1101
1344
|
setSaving(true);
|
|
1102
1345
|
const cleaned = { ...form };
|
|
1103
|
-
const json = await adminFetch(
|
|
1104
|
-
"
|
|
1105
|
-
{
|
|
1106
|
-
|
|
1107
|
-
body: { paypal_settings: cleaned }
|
|
1346
|
+
const json = await adminFetch("/admin/paypal/settings", {
|
|
1347
|
+
method: "POST",
|
|
1348
|
+
body: {
|
|
1349
|
+
paypal_settings: cleaned
|
|
1108
1350
|
}
|
|
1109
|
-
);
|
|
1351
|
+
});
|
|
1110
1352
|
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
1111
1353
|
const saved = payload == null ? void 0 : payload.paypal_settings;
|
|
1112
1354
|
if (saved && typeof saved === "object") {
|
|
@@ -1126,10 +1368,7 @@ function PayPalSettingsTab() {
|
|
|
1126
1368
|
}
|
|
1127
1369
|
}
|
|
1128
1370
|
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1129
|
-
/* @__PURE__ */
|
|
1130
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }),
|
|
1131
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2" })
|
|
1132
|
-
] }),
|
|
1371
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
|
|
1133
1372
|
/* @__PURE__ */ jsx(PayPalTabs, {}),
|
|
1134
1373
|
/* @__PURE__ */ jsx(Toast, { toast, onClose: dismissToast }),
|
|
1135
1374
|
/* @__PURE__ */ jsx(
|
|
@@ -1187,7 +1426,10 @@ function PayPalSettingsTab() {
|
|
|
1187
1426
|
{
|
|
1188
1427
|
id: "pp-btn-color",
|
|
1189
1428
|
value: form.buttonColor,
|
|
1190
|
-
onChange: (e) => setForm((p) => ({
|
|
1429
|
+
onChange: (e) => setForm((p) => ({
|
|
1430
|
+
...p,
|
|
1431
|
+
buttonColor: e.target.value
|
|
1432
|
+
})),
|
|
1191
1433
|
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",
|
|
1192
1434
|
children: COLOR_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
|
|
1193
1435
|
}
|
|
@@ -1197,7 +1439,10 @@ function PayPalSettingsTab() {
|
|
|
1197
1439
|
{
|
|
1198
1440
|
id: "pp-btn-shape",
|
|
1199
1441
|
value: form.buttonShape,
|
|
1200
|
-
onChange: (e) => setForm((p) => ({
|
|
1442
|
+
onChange: (e) => setForm((p) => ({
|
|
1443
|
+
...p,
|
|
1444
|
+
buttonShape: e.target.value
|
|
1445
|
+
})),
|
|
1201
1446
|
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",
|
|
1202
1447
|
children: SHAPE_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
|
|
1203
1448
|
}
|
|
@@ -1207,7 +1452,10 @@ function PayPalSettingsTab() {
|
|
|
1207
1452
|
{
|
|
1208
1453
|
id: "pp-btn-width",
|
|
1209
1454
|
value: form.buttonWidth,
|
|
1210
|
-
onChange: (e) => setForm((p) => ({
|
|
1455
|
+
onChange: (e) => setForm((p) => ({
|
|
1456
|
+
...p,
|
|
1457
|
+
buttonWidth: e.target.value
|
|
1458
|
+
})),
|
|
1211
1459
|
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",
|
|
1212
1460
|
children: WIDTH_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
|
|
1213
1461
|
}
|
|
@@ -1217,7 +1465,10 @@ function PayPalSettingsTab() {
|
|
|
1217
1465
|
{
|
|
1218
1466
|
id: "pp-btn-height",
|
|
1219
1467
|
value: String(form.buttonHeight),
|
|
1220
|
-
onChange: (e) => setForm((p) => ({
|
|
1468
|
+
onChange: (e) => setForm((p) => ({
|
|
1469
|
+
...p,
|
|
1470
|
+
buttonHeight: Number(e.target.value)
|
|
1471
|
+
})),
|
|
1221
1472
|
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",
|
|
1222
1473
|
children: HEIGHT_OPTIONS.map((h) => /* @__PURE__ */ jsxs("option", { value: h, children: [
|
|
1223
1474
|
h,
|
|
@@ -1230,7 +1481,10 @@ function PayPalSettingsTab() {
|
|
|
1230
1481
|
{
|
|
1231
1482
|
id: "pp-btn-label",
|
|
1232
1483
|
value: form.buttonLabel,
|
|
1233
|
-
onChange: (e) => setForm((p) => ({
|
|
1484
|
+
onChange: (e) => setForm((p) => ({
|
|
1485
|
+
...p,
|
|
1486
|
+
buttonLabel: e.target.value
|
|
1487
|
+
})),
|
|
1234
1488
|
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",
|
|
1235
1489
|
children: LABEL_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
|
|
1236
1490
|
}
|
|
@@ -1251,14 +1505,14 @@ const routeModule = {
|
|
|
1251
1505
|
Component: AdditionalSettingsTab,
|
|
1252
1506
|
path: "/settings/paypal/additional-settings"
|
|
1253
1507
|
},
|
|
1254
|
-
{
|
|
1255
|
-
Component: AdvancedCardPaymentsTab,
|
|
1256
|
-
path: "/settings/paypal/advanced-card-payments"
|
|
1257
|
-
},
|
|
1258
1508
|
{
|
|
1259
1509
|
Component: PayPalApplePayPage,
|
|
1260
1510
|
path: "/settings/paypal/apple-pay"
|
|
1261
1511
|
},
|
|
1512
|
+
{
|
|
1513
|
+
Component: AdvancedCardPaymentsTab,
|
|
1514
|
+
path: "/settings/paypal/advanced-card-payments"
|
|
1515
|
+
},
|
|
1262
1516
|
{
|
|
1263
1517
|
Component: PayPalGooglePayPage,
|
|
1264
1518
|
path: "/settings/paypal/google-pay"
|