@easypayment/medusa-payment-paypal 1.2.3 → 1.2.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 +392 -138
- package/.medusa/server/src/admin/index.mjs +392 -138
- 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 +11 -1
- 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 +80 -26
- 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 +55 -8
- 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 +24 -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 +296 -0
- 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 -7
- 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 +40 -198
- 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 +9 -2
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.js +29 -181
- package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.d.ts +21 -0
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.js +54 -0
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.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 +10 -0
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js +45 -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 +65 -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 +69 -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 +611 -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 +184 -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 +700 -275
- package/src/modules/paypal/payment-provider/card-service.ts +693 -855
- package/src/modules/paypal/payment-provider/index.ts +14 -15
- package/src/modules/paypal/payment-provider/service.ts +673 -836
- package/src/modules/paypal/payment-provider/status-utils.ts +116 -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 +315 -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,30 +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
|
-
function PayPalGooglePayPage() {
|
|
314
|
-
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
315
|
-
}
|
|
316
520
|
const config = defineRouteConfig({
|
|
317
521
|
label: "PayPal Connection"
|
|
318
522
|
});
|
|
@@ -341,7 +545,10 @@ function readCachedUrl(env) {
|
|
|
341
545
|
}
|
|
342
546
|
function writeCachedUrl(env, url) {
|
|
343
547
|
try {
|
|
344
|
-
localStorage.setItem(
|
|
548
|
+
localStorage.setItem(
|
|
549
|
+
cacheKeyFor(env),
|
|
550
|
+
JSON.stringify({ url, ts: Date.now() })
|
|
551
|
+
);
|
|
345
552
|
} catch {
|
|
346
553
|
}
|
|
347
554
|
}
|
|
@@ -526,7 +733,8 @@ function PayPalConnectionPage() {
|
|
|
526
733
|
ppScript.async = true;
|
|
527
734
|
document.head.appendChild(ppScript);
|
|
528
735
|
return () => {
|
|
529
|
-
if (preloadLink == null ? void 0 : preloadLink.parentNode)
|
|
736
|
+
if (preloadLink == null ? void 0 : preloadLink.parentNode)
|
|
737
|
+
preloadLink.parentNode.removeChild(preloadLink);
|
|
530
738
|
if (ppScript.parentNode) ppScript.parentNode.removeChild(ppScript);
|
|
531
739
|
};
|
|
532
740
|
}, []);
|
|
@@ -563,7 +771,8 @@ function PayPalConnectionPage() {
|
|
|
563
771
|
async (targetEnv, runId) => {
|
|
564
772
|
if (initLoaderRef.current) {
|
|
565
773
|
const loaderText = initLoaderRef.current.querySelector("#loader-text");
|
|
566
|
-
if (loaderText)
|
|
774
|
+
if (loaderText)
|
|
775
|
+
loaderText.textContent = "Generating onboarding session...";
|
|
567
776
|
}
|
|
568
777
|
try {
|
|
569
778
|
const res = await fetch(SERVICE_URL, {
|
|
@@ -853,61 +1062,73 @@ function PayPalConnectionPage() {
|
|
|
853
1062
|
]
|
|
854
1063
|
}
|
|
855
1064
|
),
|
|
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",
|
|
1065
|
+
/* @__PURE__ */ jsxs(
|
|
1066
|
+
"div",
|
|
903
1067
|
{
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
1068
|
+
className: `${connState === "ready" ? "block" : "hidden"}`,
|
|
1069
|
+
children: [
|
|
1070
|
+
/* @__PURE__ */ jsx(
|
|
1071
|
+
"a",
|
|
1072
|
+
{
|
|
1073
|
+
ref: (node) => {
|
|
1074
|
+
paypalButtonRef.current = node;
|
|
1075
|
+
ppBtnMeasureRef.current = node;
|
|
1076
|
+
},
|
|
1077
|
+
id: "paypal-button",
|
|
1078
|
+
"data-paypal-button": "true",
|
|
1079
|
+
href: finalUrl || "#",
|
|
1080
|
+
"data-paypal-onboard-complete": "onboardingCallback",
|
|
1081
|
+
onClick: handleConnectClick,
|
|
1082
|
+
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",
|
|
1083
|
+
style: {
|
|
1084
|
+
cursor: onboardingInProgress ? "not-allowed" : "pointer",
|
|
1085
|
+
opacity: onboardingInProgress ? 0.6 : 1,
|
|
1086
|
+
pointerEvents: onboardingInProgress ? "none" : "auto"
|
|
1087
|
+
},
|
|
1088
|
+
children: "Connect to PayPal"
|
|
1089
|
+
}
|
|
1090
|
+
),
|
|
1091
|
+
/* @__PURE__ */ jsx(
|
|
1092
|
+
"div",
|
|
1093
|
+
{
|
|
1094
|
+
className: "mt-2",
|
|
1095
|
+
style: {
|
|
1096
|
+
width: ppBtnWidth ? `${ppBtnWidth}px` : "auto",
|
|
1097
|
+
marginTop: "20px",
|
|
1098
|
+
marginBottom: "10px"
|
|
1099
|
+
},
|
|
1100
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-[11px] text-ui-fg-muted leading-none", children: "OR" }) })
|
|
1101
|
+
}
|
|
1102
|
+
),
|
|
1103
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
1104
|
+
"button",
|
|
1105
|
+
{
|
|
1106
|
+
type: "button",
|
|
1107
|
+
onClick: () => setShowManual(!showManual),
|
|
1108
|
+
disabled: onboardingInProgress,
|
|
1109
|
+
className: "text-sm text-ui-fg-interactive underline whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1110
|
+
children: "Click here to insert credentials manually"
|
|
1111
|
+
}
|
|
1112
|
+
) })
|
|
1113
|
+
]
|
|
909
1114
|
}
|
|
910
|
-
)
|
|
1115
|
+
),
|
|
1116
|
+
/* @__PURE__ */ jsx(
|
|
1117
|
+
"div",
|
|
1118
|
+
{
|
|
1119
|
+
className: `${connState === "ready" ? "hidden" : "block"} mt-3`,
|
|
1120
|
+
children: /* @__PURE__ */ jsx(
|
|
1121
|
+
"button",
|
|
1122
|
+
{
|
|
1123
|
+
type: "button",
|
|
1124
|
+
onClick: () => setShowManual(!showManual),
|
|
1125
|
+
disabled: onboardingInProgress,
|
|
1126
|
+
className: "text-sm text-ui-fg-interactive underline whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1127
|
+
children: "Click here to insert credentials manually"
|
|
1128
|
+
}
|
|
1129
|
+
)
|
|
1130
|
+
}
|
|
1131
|
+
),
|
|
911
1132
|
/* @__PURE__ */ jsx(
|
|
912
1133
|
"div",
|
|
913
1134
|
{
|
|
@@ -920,7 +1141,14 @@ function PayPalConnectionPage() {
|
|
|
920
1141
|
] }) }),
|
|
921
1142
|
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
1143
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
923
|
-
/* @__PURE__ */ jsx(
|
|
1144
|
+
/* @__PURE__ */ jsx(
|
|
1145
|
+
"label",
|
|
1146
|
+
{
|
|
1147
|
+
htmlFor: "pp-manual-client-id",
|
|
1148
|
+
className: "text-sm font-medium",
|
|
1149
|
+
children: "Client ID"
|
|
1150
|
+
}
|
|
1151
|
+
),
|
|
924
1152
|
/* @__PURE__ */ jsx(
|
|
925
1153
|
"input",
|
|
926
1154
|
{
|
|
@@ -935,7 +1163,14 @@ function PayPalConnectionPage() {
|
|
|
935
1163
|
)
|
|
936
1164
|
] }),
|
|
937
1165
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
938
|
-
/* @__PURE__ */ jsx(
|
|
1166
|
+
/* @__PURE__ */ jsx(
|
|
1167
|
+
"label",
|
|
1168
|
+
{
|
|
1169
|
+
htmlFor: "pp-manual-secret",
|
|
1170
|
+
className: "text-sm font-medium",
|
|
1171
|
+
children: "Secret"
|
|
1172
|
+
}
|
|
1173
|
+
),
|
|
939
1174
|
/* @__PURE__ */ jsx(
|
|
940
1175
|
"input",
|
|
941
1176
|
{
|
|
@@ -969,18 +1204,25 @@ function PayPalConnectionPage() {
|
|
|
969
1204
|
"and sign in or create an account."
|
|
970
1205
|
] }),
|
|
971
1206
|
/* @__PURE__ */ jsxs("li", { children: [
|
|
972
|
-
"Select
|
|
1207
|
+
"Select",
|
|
1208
|
+
" ",
|
|
973
1209
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Apps & Credentials" }),
|
|
974
|
-
", then choose
|
|
1210
|
+
", then choose",
|
|
1211
|
+
" ",
|
|
975
1212
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Create App" }),
|
|
976
|
-
"
|
|
1213
|
+
" ",
|
|
1214
|
+
"if you need a new project."
|
|
977
1215
|
] }),
|
|
978
1216
|
/* @__PURE__ */ jsxs("li", { children: [
|
|
979
|
-
"Copy your app's
|
|
1217
|
+
"Copy your app's",
|
|
1218
|
+
" ",
|
|
980
1219
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Client ID" }),
|
|
981
|
-
"
|
|
1220
|
+
" ",
|
|
1221
|
+
"and",
|
|
1222
|
+
" ",
|
|
982
1223
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Secret" }),
|
|
983
|
-
", paste them above, then click
|
|
1224
|
+
", paste them above, then click",
|
|
1225
|
+
" ",
|
|
984
1226
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-ui-fg-base", children: "Save credentials" }),
|
|
985
1227
|
"."
|
|
986
1228
|
] })
|
|
@@ -1030,6 +1272,9 @@ function PayPalConnectionPage() {
|
|
|
1030
1272
|
` })
|
|
1031
1273
|
] });
|
|
1032
1274
|
}
|
|
1275
|
+
function PayPalGooglePayPage() {
|
|
1276
|
+
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1277
|
+
}
|
|
1033
1278
|
function PayPalPayLaterMessagingPage() {
|
|
1034
1279
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1035
1280
|
}
|
|
@@ -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,22 +1505,22 @@ 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
|
},
|
|
1262
1512
|
{
|
|
1263
|
-
Component:
|
|
1264
|
-
path: "/settings/paypal/
|
|
1513
|
+
Component: AdvancedCardPaymentsTab,
|
|
1514
|
+
path: "/settings/paypal/advanced-card-payments"
|
|
1265
1515
|
},
|
|
1266
1516
|
{
|
|
1267
1517
|
Component: PayPalConnectionPage,
|
|
1268
1518
|
path: "/settings/paypal/connection"
|
|
1269
1519
|
},
|
|
1520
|
+
{
|
|
1521
|
+
Component: PayPalGooglePayPage,
|
|
1522
|
+
path: "/settings/paypal/google-pay"
|
|
1523
|
+
},
|
|
1270
1524
|
{
|
|
1271
1525
|
Component: PayPalPayLaterMessagingPage,
|
|
1272
1526
|
path: "/settings/paypal/pay-later-messaging"
|