@easypayment/medusa-payment-paypal 1.2.2 → 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 +390 -136
- package/.medusa/server/src/admin/index.mjs +390 -136
- 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 +19 -0
- package/README.md +184 -175
- package/package.json +24 -5
- 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
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { Navigate } from "react-router-dom"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Navigate } from "react-router-dom"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Legacy route kept so old bookmarks/links keep working; the feature is not
|
|
5
|
+
* exposed in the current tab bar.
|
|
6
|
+
*/
|
|
7
|
+
export default function PayPalGooglePayPage() {
|
|
8
|
+
return <Navigate to="/settings/paypal/connection" replace />
|
|
9
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { defineRouteConfig } from "@medusajs/admin-sdk"
|
|
3
|
-
import { Navigate } from "react-router-dom"
|
|
4
|
-
|
|
5
|
-
export const config = defineRouteConfig({
|
|
6
|
-
label: "PayPal",
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { defineRouteConfig } from "@medusajs/admin-sdk"
|
|
3
|
+
import { Navigate } from "react-router-dom"
|
|
4
|
+
|
|
5
|
+
export const config = defineRouteConfig({
|
|
6
|
+
label: "PayPal",
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
/** /settings/paypal — the section root simply opens the Connection tab. */
|
|
10
|
+
const PayPalSettingsIndexRoute = () => {
|
|
11
|
+
return <Navigate to="connection" replace />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default PayPalSettingsIndexRoute
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { Navigate } from "react-router-dom"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Navigate } from "react-router-dom"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Legacy route kept so old bookmarks/links keep working; the feature is not
|
|
5
|
+
* exposed in the current tab bar.
|
|
6
|
+
*/
|
|
7
|
+
export default function PayPalPayLaterMessagingPage() {
|
|
8
|
+
return <Navigate to="/settings/paypal/connection" replace />
|
|
9
|
+
}
|
|
@@ -1,273 +1,304 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from "react"
|
|
2
|
-
import PayPalTabs from "../_components/Tabs"
|
|
3
|
-
import SectionCard from "../_components/SectionCard"
|
|
4
|
-
import FieldRow from "../_components/FieldRow"
|
|
5
|
-
import Toast, { ToastState } from "../_components/Toast"
|
|
6
|
-
import { adminFetch } from "../_utils/adminFetch"
|
|
7
|
-
|
|
8
|
-
type ButtonColor = "gold" | "blue" | "silver" | "black" | "white"
|
|
9
|
-
type ButtonShape = "rect" | "pill"
|
|
10
|
-
type ButtonWidth = "small" | "medium" | "large" | "responsive"
|
|
11
|
-
type ButtonLabel = "paypal" | "checkout" | "buynow" | "pay"
|
|
12
|
-
|
|
13
|
-
type PayPalSettingsForm = {
|
|
14
|
-
enabled: boolean
|
|
15
|
-
title: string
|
|
16
|
-
description: string
|
|
17
|
-
buttonColor: ButtonColor
|
|
18
|
-
buttonShape: ButtonShape
|
|
19
|
-
buttonWidth: ButtonWidth
|
|
20
|
-
buttonHeight: number
|
|
21
|
-
buttonLabel: ButtonLabel
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const COLOR_OPTIONS: { value: ButtonColor; label: string }[] = [
|
|
25
|
-
{ value: "gold", label: "Gold (Recommended)" },
|
|
26
|
-
{ value: "blue", label: "Blue" },
|
|
27
|
-
{ value: "silver", label: "Silver" },
|
|
28
|
-
{ value: "black", label: "Black" },
|
|
29
|
-
{ value: "white", label: "White" },
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
const SHAPE_OPTIONS: { value: ButtonShape; label: string }[] = [
|
|
33
|
-
{ value: "rect", label: "Rect (Recommended)" },
|
|
34
|
-
{ value: "pill", label: "Pill" },
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
const WIDTH_OPTIONS: { value: ButtonWidth; label: string }[] = [
|
|
38
|
-
{ value: "small", label: "Small" },
|
|
39
|
-
{ value: "medium", label: "Medium" },
|
|
40
|
-
{ value: "large", label: "Large" },
|
|
41
|
-
{ value: "responsive", label: "Responsive" },
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
const HEIGHT_OPTIONS: number[] = [32, 36, 40, 44, 48, 52, 56]
|
|
45
|
-
|
|
46
|
-
const LABEL_OPTIONS: { value: ButtonLabel; label: string }[] = [
|
|
47
|
-
{ value: "paypal", label: "PayPal" },
|
|
48
|
-
{ value: "checkout", label: "Checkout" },
|
|
49
|
-
{ value: "buynow", label: "Buy Now" },
|
|
50
|
-
{ value: "pay", label: "Pay" },
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const [
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
<div
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
{saving
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
)
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react"
|
|
2
|
+
import PayPalTabs from "../_components/Tabs"
|
|
3
|
+
import SectionCard from "../_components/SectionCard"
|
|
4
|
+
import FieldRow from "../_components/FieldRow"
|
|
5
|
+
import Toast, { ToastState } from "../_components/Toast"
|
|
6
|
+
import { adminFetch } from "../_utils/adminFetch"
|
|
7
|
+
|
|
8
|
+
type ButtonColor = "gold" | "blue" | "silver" | "black" | "white"
|
|
9
|
+
type ButtonShape = "rect" | "pill"
|
|
10
|
+
type ButtonWidth = "small" | "medium" | "large" | "responsive"
|
|
11
|
+
type ButtonLabel = "paypal" | "checkout" | "buynow" | "pay"
|
|
12
|
+
|
|
13
|
+
type PayPalSettingsForm = {
|
|
14
|
+
enabled: boolean
|
|
15
|
+
title: string
|
|
16
|
+
description: string
|
|
17
|
+
buttonColor: ButtonColor
|
|
18
|
+
buttonShape: ButtonShape
|
|
19
|
+
buttonWidth: ButtonWidth
|
|
20
|
+
buttonHeight: number
|
|
21
|
+
buttonLabel: ButtonLabel
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const COLOR_OPTIONS: { value: ButtonColor; label: string }[] = [
|
|
25
|
+
{ value: "gold", label: "Gold (Recommended)" },
|
|
26
|
+
{ value: "blue", label: "Blue" },
|
|
27
|
+
{ value: "silver", label: "Silver" },
|
|
28
|
+
{ value: "black", label: "Black" },
|
|
29
|
+
{ value: "white", label: "White" },
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
const SHAPE_OPTIONS: { value: ButtonShape; label: string }[] = [
|
|
33
|
+
{ value: "rect", label: "Rect (Recommended)" },
|
|
34
|
+
{ value: "pill", label: "Pill" },
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
const WIDTH_OPTIONS: { value: ButtonWidth; label: string }[] = [
|
|
38
|
+
{ value: "small", label: "Small" },
|
|
39
|
+
{ value: "medium", label: "Medium" },
|
|
40
|
+
{ value: "large", label: "Large" },
|
|
41
|
+
{ value: "responsive", label: "Responsive" },
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
const HEIGHT_OPTIONS: number[] = [32, 36, 40, 44, 48, 52, 56]
|
|
45
|
+
|
|
46
|
+
const LABEL_OPTIONS: { value: ButtonLabel; label: string }[] = [
|
|
47
|
+
{ value: "paypal", label: "PayPal" },
|
|
48
|
+
{ value: "checkout", label: "Checkout" },
|
|
49
|
+
{ value: "buynow", label: "Buy Now" },
|
|
50
|
+
{ value: "pay", label: "Pay" },
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
/** Settings → PayPal → PayPal Settings (enable toggle, title, Smart Button styling). */
|
|
54
|
+
export default function PayPalSettingsTab() {
|
|
55
|
+
const [form, setForm] = useState<PayPalSettingsForm>({
|
|
56
|
+
enabled: true,
|
|
57
|
+
title: "PayPal",
|
|
58
|
+
description:
|
|
59
|
+
"Pay via PayPal; you can pay with your credit card if you don't have a PayPal account",
|
|
60
|
+
buttonColor: "gold",
|
|
61
|
+
buttonShape: "rect",
|
|
62
|
+
buttonWidth: "medium",
|
|
63
|
+
buttonHeight: 48,
|
|
64
|
+
buttonLabel: "paypal",
|
|
65
|
+
})
|
|
66
|
+
const [loading, setLoading] = useState(false)
|
|
67
|
+
const [saving, setSaving] = useState(false)
|
|
68
|
+
const [toast, setToast] = useState<ToastState>(null)
|
|
69
|
+
const didInit = useRef(false)
|
|
70
|
+
|
|
71
|
+
const dismissToast = useCallback(() => setToast(null), [])
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (didInit.current) return
|
|
75
|
+
didInit.current = true
|
|
76
|
+
;(async () => {
|
|
77
|
+
try {
|
|
78
|
+
setLoading(true)
|
|
79
|
+
const json = await adminFetch<{
|
|
80
|
+
data?: { paypal_settings?: PayPalSettingsForm }
|
|
81
|
+
paypal_settings?: PayPalSettingsForm
|
|
82
|
+
}>("/admin/paypal/settings")
|
|
83
|
+
const payload = (json?.data ?? json) as any
|
|
84
|
+
const saved = payload?.paypal_settings
|
|
85
|
+
if (saved && typeof saved === "object") {
|
|
86
|
+
setForm((prev) => ({
|
|
87
|
+
...prev,
|
|
88
|
+
...saved,
|
|
89
|
+
}))
|
|
90
|
+
}
|
|
91
|
+
} catch {
|
|
92
|
+
// Keep the defaults if settings can't be loaded; saving still works.
|
|
93
|
+
} finally {
|
|
94
|
+
setLoading(false)
|
|
95
|
+
}
|
|
96
|
+
})()
|
|
97
|
+
}, [])
|
|
98
|
+
|
|
99
|
+
async function onSave() {
|
|
100
|
+
try {
|
|
101
|
+
setSaving(true)
|
|
102
|
+
const cleaned = { ...form }
|
|
103
|
+
const json = await adminFetch<{
|
|
104
|
+
data?: { paypal_settings?: PayPalSettingsForm }
|
|
105
|
+
paypal_settings?: PayPalSettingsForm
|
|
106
|
+
}>("/admin/paypal/settings", {
|
|
107
|
+
method: "POST",
|
|
108
|
+
body: {
|
|
109
|
+
paypal_settings: cleaned as unknown as Record<string, unknown>,
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
const payload = (json?.data ?? json) as any
|
|
113
|
+
const saved = payload?.paypal_settings
|
|
114
|
+
if (saved && typeof saved === "object") {
|
|
115
|
+
setForm((prev) => ({
|
|
116
|
+
...prev,
|
|
117
|
+
...saved,
|
|
118
|
+
}))
|
|
119
|
+
}
|
|
120
|
+
setToast({ kind: "success", message: "Settings saved" })
|
|
121
|
+
} catch (e: unknown) {
|
|
122
|
+
setToast({
|
|
123
|
+
kind: "error",
|
|
124
|
+
message:
|
|
125
|
+
(e instanceof Error ? e.message : "") || "Failed to save settings.",
|
|
126
|
+
})
|
|
127
|
+
} finally {
|
|
128
|
+
setSaving(false)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<div className="p-6">
|
|
134
|
+
<div className="flex flex-col gap-6">
|
|
135
|
+
<div className="flex items-start justify-between gap-4">
|
|
136
|
+
<div>
|
|
137
|
+
<h1 className="text-xl font-semibold text-ui-fg-base">
|
|
138
|
+
PayPal Gateway By Easy Payment
|
|
139
|
+
</h1>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<PayPalTabs />
|
|
144
|
+
|
|
145
|
+
<Toast toast={toast} onClose={dismissToast} />
|
|
146
|
+
|
|
147
|
+
<SectionCard
|
|
148
|
+
title="PayPal Settings"
|
|
149
|
+
description="Enable PayPal and configure checkout title."
|
|
150
|
+
right={
|
|
151
|
+
<div className="flex items-center gap-3">
|
|
152
|
+
<button
|
|
153
|
+
type="button"
|
|
154
|
+
onClick={onSave}
|
|
155
|
+
disabled={saving || loading}
|
|
156
|
+
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"
|
|
157
|
+
>
|
|
158
|
+
{saving ? "Saving..." : "Save settings"}
|
|
159
|
+
</button>
|
|
160
|
+
{loading ? (
|
|
161
|
+
<span className="text-sm text-ui-fg-subtle">Loading…</span>
|
|
162
|
+
) : null}
|
|
163
|
+
</div>
|
|
164
|
+
}
|
|
165
|
+
>
|
|
166
|
+
<div className="divide-y divide-ui-border-base">
|
|
167
|
+
<FieldRow label="Enable/Disable">
|
|
168
|
+
<label className="inline-flex items-center gap-2">
|
|
169
|
+
<input
|
|
170
|
+
type="checkbox"
|
|
171
|
+
checked={form.enabled}
|
|
172
|
+
onChange={(e) =>
|
|
173
|
+
setForm((p) => ({ ...p, enabled: e.target.checked }))
|
|
174
|
+
}
|
|
175
|
+
className="h-4 w-4 rounded border-ui-border-base"
|
|
176
|
+
/>
|
|
177
|
+
<span className="text-sm text-ui-fg-base">Enable PayPal</span>
|
|
178
|
+
</label>
|
|
179
|
+
</FieldRow>
|
|
180
|
+
|
|
181
|
+
<FieldRow label="Title" htmlFor="pp-title">
|
|
182
|
+
<input
|
|
183
|
+
id="pp-title"
|
|
184
|
+
value={form.title}
|
|
185
|
+
onChange={(e) =>
|
|
186
|
+
setForm((p) => ({ ...p, title: e.target.value }))
|
|
187
|
+
}
|
|
188
|
+
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"
|
|
189
|
+
placeholder="PayPal"
|
|
190
|
+
/>
|
|
191
|
+
</FieldRow>
|
|
192
|
+
</div>
|
|
193
|
+
</SectionCard>
|
|
194
|
+
|
|
195
|
+
<SectionCard
|
|
196
|
+
title="Button Appearance"
|
|
197
|
+
description="Control PayPal Smart Button styling (color/shape/size/label)."
|
|
198
|
+
>
|
|
199
|
+
<div className="divide-y divide-ui-border-base">
|
|
200
|
+
<FieldRow label="Button Color" htmlFor="pp-btn-color">
|
|
201
|
+
<select
|
|
202
|
+
id="pp-btn-color"
|
|
203
|
+
value={form.buttonColor}
|
|
204
|
+
onChange={(e) =>
|
|
205
|
+
setForm((p) => ({
|
|
206
|
+
...p,
|
|
207
|
+
buttonColor: e.target.value as ButtonColor,
|
|
208
|
+
}))
|
|
209
|
+
}
|
|
210
|
+
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"
|
|
211
|
+
>
|
|
212
|
+
{COLOR_OPTIONS.map((o) => (
|
|
213
|
+
<option key={o.value} value={o.value}>
|
|
214
|
+
{o.label}
|
|
215
|
+
</option>
|
|
216
|
+
))}
|
|
217
|
+
</select>
|
|
218
|
+
</FieldRow>
|
|
219
|
+
|
|
220
|
+
<FieldRow label="Button Shape" htmlFor="pp-btn-shape">
|
|
221
|
+
<select
|
|
222
|
+
id="pp-btn-shape"
|
|
223
|
+
value={form.buttonShape}
|
|
224
|
+
onChange={(e) =>
|
|
225
|
+
setForm((p) => ({
|
|
226
|
+
...p,
|
|
227
|
+
buttonShape: e.target.value as ButtonShape,
|
|
228
|
+
}))
|
|
229
|
+
}
|
|
230
|
+
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"
|
|
231
|
+
>
|
|
232
|
+
{SHAPE_OPTIONS.map((o) => (
|
|
233
|
+
<option key={o.value} value={o.value}>
|
|
234
|
+
{o.label}
|
|
235
|
+
</option>
|
|
236
|
+
))}
|
|
237
|
+
</select>
|
|
238
|
+
</FieldRow>
|
|
239
|
+
|
|
240
|
+
<FieldRow label="Button Width" htmlFor="pp-btn-width">
|
|
241
|
+
<select
|
|
242
|
+
id="pp-btn-width"
|
|
243
|
+
value={form.buttonWidth}
|
|
244
|
+
onChange={(e) =>
|
|
245
|
+
setForm((p) => ({
|
|
246
|
+
...p,
|
|
247
|
+
buttonWidth: e.target.value as ButtonWidth,
|
|
248
|
+
}))
|
|
249
|
+
}
|
|
250
|
+
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"
|
|
251
|
+
>
|
|
252
|
+
{WIDTH_OPTIONS.map((o) => (
|
|
253
|
+
<option key={o.value} value={o.value}>
|
|
254
|
+
{o.label}
|
|
255
|
+
</option>
|
|
256
|
+
))}
|
|
257
|
+
</select>
|
|
258
|
+
</FieldRow>
|
|
259
|
+
|
|
260
|
+
<FieldRow label="Button Height" htmlFor="pp-btn-height">
|
|
261
|
+
<select
|
|
262
|
+
id="pp-btn-height"
|
|
263
|
+
value={String(form.buttonHeight)}
|
|
264
|
+
onChange={(e) =>
|
|
265
|
+
setForm((p) => ({
|
|
266
|
+
...p,
|
|
267
|
+
buttonHeight: Number(e.target.value),
|
|
268
|
+
}))
|
|
269
|
+
}
|
|
270
|
+
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"
|
|
271
|
+
>
|
|
272
|
+
{HEIGHT_OPTIONS.map((h) => (
|
|
273
|
+
<option key={h} value={h}>
|
|
274
|
+
{h} px
|
|
275
|
+
</option>
|
|
276
|
+
))}
|
|
277
|
+
</select>
|
|
278
|
+
</FieldRow>
|
|
279
|
+
|
|
280
|
+
<FieldRow label="Button Label" htmlFor="pp-btn-label">
|
|
281
|
+
<select
|
|
282
|
+
id="pp-btn-label"
|
|
283
|
+
value={form.buttonLabel}
|
|
284
|
+
onChange={(e) =>
|
|
285
|
+
setForm((p) => ({
|
|
286
|
+
...p,
|
|
287
|
+
buttonLabel: e.target.value as ButtonLabel,
|
|
288
|
+
}))
|
|
289
|
+
}
|
|
290
|
+
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"
|
|
291
|
+
>
|
|
292
|
+
{LABEL_OPTIONS.map((o) => (
|
|
293
|
+
<option key={o.value} value={o.value}>
|
|
294
|
+
{o.label}
|
|
295
|
+
</option>
|
|
296
|
+
))}
|
|
297
|
+
</select>
|
|
298
|
+
</FieldRow>
|
|
299
|
+
</div>
|
|
300
|
+
</SectionCard>
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
)
|
|
304
|
+
}
|