@easypayment/medusa-payment-paypal 0.9.4 → 0.9.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.
Files changed (190) hide show
  1. package/.medusa/server/src/admin/index.d.ts +2 -0
  2. package/.medusa/server/src/admin/index.d.ts.map +1 -0
  3. package/.medusa/server/src/admin/index.js +194 -239
  4. package/.medusa/server/src/admin/index.js.map +1 -0
  5. package/.medusa/server/src/admin/index.mjs +195 -240
  6. package/.medusa/server/src/admin/routes/settings/paypal/_components/FieldRow.d.ts +8 -0
  7. package/.medusa/server/src/admin/routes/settings/paypal/_components/FieldRow.d.ts.map +1 -0
  8. package/.medusa/server/src/admin/routes/settings/paypal/_components/FieldRow.js +8 -0
  9. package/.medusa/server/src/admin/routes/settings/paypal/_components/FieldRow.js.map +1 -0
  10. package/.medusa/server/src/admin/routes/settings/paypal/_components/SectionCard.d.ts +8 -0
  11. package/.medusa/server/src/admin/routes/settings/paypal/_components/SectionCard.d.ts.map +1 -0
  12. package/.medusa/server/src/admin/routes/settings/paypal/_components/SectionCard.js +8 -0
  13. package/.medusa/server/src/admin/routes/settings/paypal/_components/SectionCard.js.map +1 -0
  14. package/.medusa/server/src/admin/routes/settings/paypal/_components/Tabs.d.ts +2 -0
  15. package/.medusa/server/src/admin/routes/settings/paypal/_components/Tabs.d.ts.map +1 -0
  16. package/.medusa/server/src/admin/routes/settings/paypal/_components/Tabs.js +25 -0
  17. package/.medusa/server/src/admin/routes/settings/paypal/_components/Tabs.js.map +1 -0
  18. package/.medusa/server/src/admin/routes/settings/paypal/_components/Toast.d.ts +12 -0
  19. package/.medusa/server/src/admin/routes/settings/paypal/_components/Toast.d.ts.map +1 -0
  20. package/.medusa/server/src/admin/routes/settings/paypal/_components/Toast.js +22 -0
  21. package/.medusa/server/src/admin/routes/settings/paypal/_components/Toast.js.map +1 -0
  22. package/.medusa/server/src/admin/routes/settings/paypal/_utils/adminFetch.d.ts +7 -0
  23. package/.medusa/server/src/admin/routes/settings/paypal/_utils/adminFetch.d.ts.map +1 -0
  24. package/.medusa/server/src/admin/routes/settings/paypal/_utils/adminFetch.js +40 -0
  25. package/.medusa/server/src/admin/routes/settings/paypal/_utils/adminFetch.js.map +1 -0
  26. package/.medusa/server/src/admin/routes/settings/paypal/additional-settings/page.d.ts +2 -0
  27. package/.medusa/server/src/admin/routes/settings/paypal/additional-settings/page.d.ts.map +1 -0
  28. package/.medusa/server/src/admin/routes/settings/paypal/additional-settings/page.js +76 -0
  29. package/.medusa/server/src/admin/routes/settings/paypal/additional-settings/page.js.map +1 -0
  30. package/.medusa/server/src/admin/routes/settings/paypal/advanced-card-payments/page.d.ts +2 -0
  31. package/.medusa/server/src/admin/routes/settings/paypal/advanced-card-payments/page.d.ts.map +1 -0
  32. package/.medusa/server/src/admin/routes/settings/paypal/advanced-card-payments/page.js +81 -0
  33. package/.medusa/server/src/admin/routes/settings/paypal/advanced-card-payments/page.js.map +1 -0
  34. package/.medusa/server/src/admin/routes/settings/paypal/apple-pay/page.d.ts +2 -0
  35. package/.medusa/server/src/admin/routes/settings/paypal/apple-pay/page.d.ts.map +1 -0
  36. package/.medusa/server/src/admin/routes/settings/paypal/apple-pay/page.js +9 -0
  37. package/.medusa/server/src/admin/routes/settings/paypal/apple-pay/page.js.map +1 -0
  38. package/.medusa/server/src/admin/routes/settings/paypal/connection/page.d.ts +20 -0
  39. package/.medusa/server/src/admin/routes/settings/paypal/connection/page.d.ts.map +1 -0
  40. package/.medusa/server/src/admin/routes/settings/paypal/connection/page.js +440 -0
  41. package/.medusa/server/src/admin/routes/settings/paypal/connection/page.js.map +1 -0
  42. package/.medusa/server/src/admin/routes/settings/paypal/google-pay/page.d.ts +2 -0
  43. package/.medusa/server/src/admin/routes/settings/paypal/google-pay/page.d.ts.map +1 -0
  44. package/.medusa/server/src/admin/routes/settings/paypal/google-pay/page.js +9 -0
  45. package/.medusa/server/src/admin/routes/settings/paypal/google-pay/page.js.map +1 -0
  46. package/.medusa/server/src/admin/routes/settings/paypal/page.d.ts +4 -0
  47. package/.medusa/server/src/admin/routes/settings/paypal/page.d.ts.map +1 -0
  48. package/.medusa/server/src/admin/routes/settings/paypal/page.js +14 -0
  49. package/.medusa/server/src/admin/routes/settings/paypal/page.js.map +1 -0
  50. package/.medusa/server/src/admin/routes/settings/paypal/pay-later-messaging/page.d.ts +2 -0
  51. package/.medusa/server/src/admin/routes/settings/paypal/pay-later-messaging/page.d.ts.map +1 -0
  52. package/.medusa/server/src/admin/routes/settings/paypal/pay-later-messaging/page.js +9 -0
  53. package/.medusa/server/src/admin/routes/settings/paypal/pay-later-messaging/page.js.map +1 -0
  54. package/.medusa/server/src/admin/routes/settings/paypal/paypal-settings/page.d.ts +2 -0
  55. package/.medusa/server/src/admin/routes/settings/paypal/paypal-settings/page.d.ts.map +1 -0
  56. package/.medusa/server/src/admin/routes/settings/paypal/paypal-settings/page.js +109 -0
  57. package/.medusa/server/src/admin/routes/settings/paypal/paypal-settings/page.js.map +1 -0
  58. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts +1 -1
  59. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
  60. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js +24 -9
  61. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js.map +1 -1
  62. package/.medusa/server/src/api/admin/paypal/disconnect/route.d.ts.map +1 -1
  63. package/.medusa/server/src/api/admin/paypal/disconnect/route.js +10 -3
  64. package/.medusa/server/src/api/admin/paypal/disconnect/route.js.map +1 -1
  65. package/.medusa/server/src/api/admin/paypal/environment/route.js +2 -2
  66. package/.medusa/server/src/api/admin/paypal/environment/route.js.map +1 -1
  67. package/.medusa/server/src/api/admin/paypal/onboard-complete/route.d.ts.map +1 -1
  68. package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js +3 -2
  69. package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js.map +1 -1
  70. package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js +1 -1
  71. package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js.map +1 -1
  72. package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js +4 -4
  73. package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js.map +1 -1
  74. package/.medusa/server/src/api/admin/paypal/save-credentials/route.d.ts.map +1 -1
  75. package/.medusa/server/src/api/admin/paypal/save-credentials/route.js +21 -8
  76. package/.medusa/server/src/api/admin/paypal/save-credentials/route.js.map +1 -1
  77. package/.medusa/server/src/api/admin/paypal/settings/route.d.ts.map +1 -1
  78. package/.medusa/server/src/api/admin/paypal/settings/route.js +34 -4
  79. package/.medusa/server/src/api/admin/paypal/settings/route.js.map +1 -1
  80. package/.medusa/server/src/api/admin/paypal/status/route.d.ts.map +1 -1
  81. package/.medusa/server/src/api/admin/paypal/status/route.js +11 -5
  82. package/.medusa/server/src/api/admin/paypal/status/route.js.map +1 -1
  83. package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts.map +1 -1
  84. package/.medusa/server/src/api/store/paypal/capture-order/route.js +21 -3
  85. package/.medusa/server/src/api/store/paypal/capture-order/route.js.map +1 -1
  86. package/.medusa/server/src/api/store/paypal/config/route.js +2 -2
  87. package/.medusa/server/src/api/store/paypal/config/route.js.map +1 -1
  88. package/.medusa/server/src/api/store/paypal/create-order/route.d.ts.map +1 -1
  89. package/.medusa/server/src/api/store/paypal/create-order/route.js +13 -9
  90. package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
  91. package/.medusa/server/src/api/store/paypal/settings/route.js +3 -3
  92. package/.medusa/server/src/api/store/paypal/settings/route.js.map +1 -1
  93. package/.medusa/server/src/api/store/paypal/webhook/route.d.ts.map +1 -1
  94. package/.medusa/server/src/api/store/paypal/webhook/route.js +10 -3
  95. package/.medusa/server/src/api/store/paypal/webhook/route.js.map +1 -1
  96. package/.medusa/server/src/api/store/paypal-complete/route.d.ts.map +1 -1
  97. package/.medusa/server/src/api/store/paypal-complete/route.js +7 -4
  98. package/.medusa/server/src/api/store/paypal-complete/route.js.map +1 -1
  99. package/.medusa/server/src/modules/paypal/clients/paypal-seller.client.js +3 -3
  100. package/.medusa/server/src/modules/paypal/clients/paypal-seller.client.js.map +1 -1
  101. package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.d.ts +1 -1
  102. package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.d.ts.map +1 -1
  103. package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.js +1 -1
  104. package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.js.map +1 -1
  105. package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.d.ts +1 -1
  106. package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.d.ts.map +1 -1
  107. package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.js +1 -1
  108. package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.js.map +1 -1
  109. package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.d.ts +1 -1
  110. package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.d.ts.map +1 -1
  111. package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.js +1 -1
  112. package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.js.map +1 -1
  113. package/.medusa/server/src/modules/paypal/migrations/20270202000000_align_nullable_defaults.d.ts +6 -0
  114. package/.medusa/server/src/modules/paypal/migrations/20270202000000_align_nullable_defaults.d.ts.map +1 -0
  115. package/.medusa/server/src/modules/paypal/migrations/20270202000000_align_nullable_defaults.js +25 -0
  116. package/.medusa/server/src/modules/paypal/migrations/20270202000000_align_nullable_defaults.js.map +1 -0
  117. package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts +1 -1
  118. package/.medusa/server/src/modules/paypal/models/paypal_connection.js +3 -3
  119. package/.medusa/server/src/modules/paypal/models/paypal_connection.js.map +1 -1
  120. package/.medusa/server/src/modules/paypal/models/paypal_metric.d.ts +1 -1
  121. package/.medusa/server/src/modules/paypal/models/paypal_metric.js +1 -1
  122. package/.medusa/server/src/modules/paypal/models/paypal_metric.js.map +1 -1
  123. package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.d.ts +1 -1
  124. package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js +1 -1
  125. package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js.map +1 -1
  126. package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts.map +1 -1
  127. package/.medusa/server/src/modules/paypal/payment-provider/card-service.js +95 -76
  128. package/.medusa/server/src/modules/paypal/payment-provider/card-service.js.map +1 -1
  129. package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
  130. package/.medusa/server/src/modules/paypal/payment-provider/service.js +39 -89
  131. package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
  132. package/.medusa/server/src/modules/paypal/payment-provider/webhook-utils.d.ts.map +1 -1
  133. package/.medusa/server/src/modules/paypal/payment-provider/webhook-utils.js +7 -0
  134. package/.medusa/server/src/modules/paypal/payment-provider/webhook-utils.js.map +1 -1
  135. package/.medusa/server/src/modules/paypal/service.d.ts +10 -8
  136. package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
  137. package/.medusa/server/src/modules/paypal/service.js +56 -51
  138. package/.medusa/server/src/modules/paypal/service.js.map +1 -1
  139. package/.medusa/server/src/modules/paypal/types/config.d.ts.map +1 -1
  140. package/.medusa/server/src/modules/paypal/types/config.js +11 -2
  141. package/.medusa/server/src/modules/paypal/types/config.js.map +1 -1
  142. package/.medusa/server/src/modules/paypal/utils/paypal-auth.d.ts.map +1 -1
  143. package/.medusa/server/src/modules/paypal/utils/paypal-auth.js +1 -0
  144. package/.medusa/server/src/modules/paypal/utils/paypal-auth.js.map +1 -1
  145. package/.medusa/server/src/modules/paypal/webhook-processor.d.ts.map +1 -1
  146. package/.medusa/server/src/modules/paypal/webhook-processor.js +1 -1
  147. package/.medusa/server/src/modules/paypal/webhook-processor.js.map +1 -1
  148. package/.medusa/server/src/subscribers/paypal-order-invoice.js +4 -4
  149. package/.medusa/server/src/subscribers/paypal-order-invoice.js.map +1 -1
  150. package/package.json +1 -1
  151. package/src/admin/index.ts +1 -7
  152. package/src/admin/routes/settings/paypal/_components/FieldRow.tsx +29 -0
  153. package/src/admin/routes/settings/paypal/_components/SectionCard.tsx +26 -0
  154. package/src/admin/routes/settings/paypal/_components/Toast.tsx +4 -3
  155. package/src/admin/routes/settings/paypal/_utils/adminFetch.ts +32 -0
  156. package/src/admin/routes/settings/paypal/additional-settings/page.tsx +23 -83
  157. package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +17 -77
  158. package/src/admin/routes/settings/paypal/connection/page.tsx +86 -45
  159. package/src/admin/routes/settings/paypal/paypal-settings/page.tsx +23 -101
  160. package/src/api/admin/payment-collections/[id]/payment-sessions/route.ts +26 -9
  161. package/src/api/admin/paypal/disconnect/route.ts +9 -3
  162. package/src/api/admin/paypal/environment/route.ts +2 -2
  163. package/src/api/admin/paypal/onboard-complete/route.ts +4 -3
  164. package/src/api/admin/paypal/onboarding-link/route.ts +1 -1
  165. package/src/api/admin/paypal/onboarding-status/route.ts +5 -5
  166. package/src/api/admin/paypal/save-credentials/route.ts +24 -9
  167. package/src/api/admin/paypal/settings/route.ts +35 -4
  168. package/src/api/admin/paypal/status/route.ts +10 -5
  169. package/src/api/store/paypal/capture-order/route.ts +27 -3
  170. package/src/api/store/paypal/config/route.ts +2 -2
  171. package/src/api/store/paypal/create-order/route.ts +16 -10
  172. package/src/api/store/paypal/settings/route.ts +3 -3
  173. package/src/api/store/paypal/webhook/route.ts +13 -3
  174. package/src/api/store/paypal-complete/route.ts +8 -4
  175. package/src/modules/paypal/clients/paypal-seller.client.ts +3 -3
  176. package/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.ts +1 -1
  177. package/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.ts +1 -1
  178. package/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.ts +1 -1
  179. package/src/modules/paypal/migrations/20270202000000_align_nullable_defaults.ts +44 -0
  180. package/src/modules/paypal/models/paypal_connection.ts +3 -3
  181. package/src/modules/paypal/models/paypal_metric.ts +1 -1
  182. package/src/modules/paypal/models/paypal_webhook_event.ts +1 -1
  183. package/src/modules/paypal/payment-provider/card-service.ts +120 -80
  184. package/src/modules/paypal/payment-provider/service.ts +44 -93
  185. package/src/modules/paypal/payment-provider/webhook-utils.ts +9 -0
  186. package/src/modules/paypal/service.ts +79 -66
  187. package/src/modules/paypal/types/config.ts +18 -2
  188. package/src/modules/paypal/utils/paypal-auth.ts +1 -0
  189. package/src/modules/paypal/webhook-processor.ts +8 -5
  190. package/src/subscribers/paypal-order-invoice.ts +4 -4
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { defineRouteConfig } from "@medusajs/admin-sdk";
3
3
  import { Navigate, useLocation, Link } from "react-router-dom";
4
- import { useState, useRef, useEffect, useMemo, useCallback, useLayoutEffect } from "react";
4
+ import { useEffect, useState, useRef, useCallback, useMemo, useLayoutEffect } from "react";
5
5
  const config$1 = defineRouteConfig({
6
6
  label: "PayPal"
7
7
  });
@@ -33,7 +33,73 @@ function PayPalTabs() {
33
33
  );
34
34
  }) }) });
35
35
  }
36
- async function adminFetch$2(path, opts = {}) {
36
+ function SectionCard({
37
+ title,
38
+ description,
39
+ children,
40
+ right
41
+ }) {
42
+ return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
43
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
44
+ /* @__PURE__ */ jsxs("div", { children: [
45
+ /* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: title }),
46
+ description ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-sm text-ui-fg-subtle", children: description }) : null
47
+ ] }),
48
+ right
49
+ ] }),
50
+ /* @__PURE__ */ jsx("div", { className: "p-4", children })
51
+ ] });
52
+ }
53
+ function FieldRow({
54
+ label,
55
+ hint,
56
+ htmlFor,
57
+ children
58
+ }) {
59
+ return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 items-start gap-4 py-3", children: [
60
+ /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
61
+ htmlFor ? /* @__PURE__ */ jsx("label", { htmlFor, className: "text-sm font-medium text-ui-fg-base", children: label }) : /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-ui-fg-base", children: label }),
62
+ hint ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: hint }) : null
63
+ ] }),
64
+ /* @__PURE__ */ jsx("div", { className: "col-span-12 md:col-span-8", children })
65
+ ] });
66
+ }
67
+ function Toast({ toast, onClose }) {
68
+ useEffect(() => {
69
+ if (!toast) return;
70
+ const duration = toast.kind === "error" ? 5e3 : 2500;
71
+ const t = setTimeout(() => onClose(), duration);
72
+ return () => clearTimeout(t);
73
+ }, [toast, onClose]);
74
+ if (!toast) return null;
75
+ const isSuccess = toast.kind === "success";
76
+ return /* @__PURE__ */ jsx("div", { className: "fixed right-6 top-6 z-[9999]", children: /* @__PURE__ */ jsx(
77
+ "div",
78
+ {
79
+ className: [
80
+ "min-w-[280px] max-w-[420px] rounded-lg border px-4 py-3 shadow-md",
81
+ isSuccess ? "border-emerald-500/30 bg-emerald-500/10" : "border-rose-500/30 bg-rose-500/10"
82
+ ].join(" "),
83
+ role: isSuccess ? "status" : "alert",
84
+ "aria-live": isSuccess ? "polite" : "assertive",
85
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
86
+ /* @__PURE__ */ jsx("div", { className: ["mt-0.5 h-2.5 w-2.5 rounded-full", isSuccess ? "bg-emerald-500" : "bg-rose-500"].join(" ") }),
87
+ /* @__PURE__ */ jsx("div", { className: "flex-1 text-sm text-ui-fg-base", children: toast.message }),
88
+ /* @__PURE__ */ jsx(
89
+ "button",
90
+ {
91
+ type: "button",
92
+ onClick: onClose,
93
+ className: "text-ui-fg-subtle hover:text-ui-fg-base",
94
+ "aria-label": "Close",
95
+ children: "×"
96
+ }
97
+ )
98
+ ] })
99
+ }
100
+ ) });
101
+ }
102
+ async function adminFetch(path, opts = {}) {
37
103
  var _a;
38
104
  const { method = "GET", body, query } = opts;
39
105
  let url = path;
@@ -72,7 +138,7 @@ const DEFAULT_FORM$1 = {
72
138
  landingPage: "no_preference",
73
139
  requireInstantPayment: false,
74
140
  sendItemDetails: true,
75
- invoicePrefix: "WC-",
141
+ invoicePrefix: "PP-",
76
142
  creditCardStatementName: "PayPal"
77
143
  };
78
144
  function mergeWithDefaults$1(saved) {
@@ -80,40 +146,20 @@ function mergeWithDefaults$1(saved) {
80
146
  const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
81
147
  return { ...DEFAULT_FORM$1, ...Object.fromEntries(entries) };
82
148
  }
83
- function SectionCard$2({ title, description, right, children }) {
84
- return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
85
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
86
- /* @__PURE__ */ jsxs("div", { children: [
87
- /* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: title }),
88
- description ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-sm text-ui-fg-subtle", children: description }) : null
89
- ] }),
90
- right
91
- ] }),
92
- /* @__PURE__ */ jsx("div", { className: "p-4", children })
93
- ] });
94
- }
95
- function FieldRow$2({ label, hint, children }) {
96
- return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 items-start gap-4 py-3", children: [
97
- /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
98
- /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-ui-fg-base", children: label }),
99
- hint ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: hint }) : null
100
- ] }),
101
- /* @__PURE__ */ jsx("div", { className: "col-span-12 md:col-span-8", children })
102
- ] });
103
- }
104
149
  function AdditionalSettingsTab() {
105
150
  const [form, setForm] = useState(() => ({ ...DEFAULT_FORM$1 }));
106
151
  const [loading, setLoading] = useState(false);
107
152
  const [saving, setSaving] = useState(false);
108
153
  const [toast, setToast] = useState(null);
109
154
  const didInit = useRef(false);
155
+ const dismissToast = useCallback(() => setToast(null), []);
110
156
  useEffect(() => {
111
157
  if (didInit.current) return;
112
158
  didInit.current = true;
113
159
  (async () => {
114
160
  try {
115
161
  setLoading(true);
116
- const json = await adminFetch$2("/admin/paypal/settings");
162
+ const json = await adminFetch("/admin/paypal/settings");
117
163
  const payload = (json == null ? void 0 : json.data) ?? json;
118
164
  const saved = payload == null ? void 0 : payload.additional_settings;
119
165
  if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
@@ -127,15 +173,13 @@ function AdditionalSettingsTab() {
127
173
  try {
128
174
  setSaving(true);
129
175
  setToast(null);
130
- const json = await adminFetch$2("/admin/paypal/settings", { method: "POST", body: { additional_settings: form } });
176
+ const json = await adminFetch("/admin/paypal/settings", { method: "POST", body: { additional_settings: form } });
131
177
  const payload = (json == null ? void 0 : json.data) ?? json;
132
178
  const saved = payload == null ? void 0 : payload.additional_settings;
133
179
  if (saved && typeof saved === "object") setForm(mergeWithDefaults$1(saved));
134
- setToast({ type: "success", message: "Settings saved" });
135
- window.setTimeout(() => setToast(null), 2500);
180
+ setToast({ kind: "success", message: "Settings saved" });
136
181
  } catch (e) {
137
- setToast({ type: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
138
- window.setTimeout(() => setToast(null), 3500);
182
+ setToast({ kind: "error", message: e instanceof Error ? e.message : "Failed to save settings" });
139
183
  } finally {
140
184
  setSaving(false);
141
185
  }
@@ -143,74 +187,44 @@ function AdditionalSettingsTab() {
143
187
  return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
144
188
  /* @__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" }) }) }),
145
189
  /* @__PURE__ */ jsx(PayPalTabs, {}),
146
- toast ? /* @__PURE__ */ jsx("div", { className: "fixed right-6 top-6 z-50 rounded-md border border-ui-border-base bg-ui-bg-base px-4 py-3 text-sm shadow-lg", role: "status", "aria-live": "polite", children: /* @__PURE__ */ jsx("span", { className: toast.type === "success" ? "text-ui-fg-base" : "text-ui-fg-error", children: toast.message }) }) : null,
190
+ /* @__PURE__ */ jsx(Toast, { toast, onClose: dismissToast }),
147
191
  /* @__PURE__ */ jsx(
148
- SectionCard$2,
192
+ SectionCard,
149
193
  {
150
194
  title: "Additional Settings",
151
195
  description: "These settings control checkout behavior and PayPal experience.",
152
196
  right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
153
197
  /* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
154
- loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
198
+ loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading" }) : null
155
199
  ] }),
156
200
  children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
157
- /* @__PURE__ */ jsx(FieldRow$2, { label: "Payment action", children: /* @__PURE__ */ jsxs("select", { value: form.paymentAction, onChange: (e) => setForm((p) => ({ ...p, paymentAction: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
201
+ /* @__PURE__ */ jsx(FieldRow, { label: "Payment action", htmlFor: "as-payment-action", children: /* @__PURE__ */ jsxs("select", { id: "as-payment-action", value: form.paymentAction, onChange: (e) => setForm((p) => ({ ...p, paymentAction: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
158
202
  /* @__PURE__ */ jsx("option", { value: "capture", children: "Capture" }),
159
203
  /* @__PURE__ */ jsx("option", { value: "authorize", children: "Authorize" })
160
204
  ] }) }),
161
- /* @__PURE__ */ jsx(FieldRow$2, { label: "Brand Name", children: /* @__PURE__ */ jsx("input", { value: form.brandName, onChange: (e) => setForm((p) => ({ ...p, brandName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) }),
162
- /* @__PURE__ */ jsx(FieldRow$2, { label: "Landing Page", children: /* @__PURE__ */ jsxs("select", { value: form.landingPage, onChange: (e) => setForm((p) => ({ ...p, landingPage: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
205
+ /* @__PURE__ */ jsx(FieldRow, { label: "Brand Name", htmlFor: "as-brand-name", children: /* @__PURE__ */ jsx("input", { id: "as-brand-name", value: form.brandName, onChange: (e) => setForm((p) => ({ ...p, brandName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) }),
206
+ /* @__PURE__ */ jsx(FieldRow, { label: "Landing Page", htmlFor: "as-landing-page", children: /* @__PURE__ */ jsxs("select", { id: "as-landing-page", value: form.landingPage, onChange: (e) => setForm((p) => ({ ...p, landingPage: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: [
163
207
  /* @__PURE__ */ jsx("option", { value: "no_preference", children: "No Preference" }),
164
208
  /* @__PURE__ */ jsx("option", { value: "login", children: "Login" }),
165
209
  /* @__PURE__ */ jsx("option", { value: "billing", children: "Billing" })
166
210
  ] }) }),
167
- /* @__PURE__ */ jsx(FieldRow$2, { label: "Instant Payments", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
211
+ /* @__PURE__ */ jsx(FieldRow, { label: "Instant Payments", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
168
212
  /* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.requireInstantPayment, onChange: (e) => setForm((p) => ({ ...p, requireInstantPayment: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
169
213
  /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
170
214
  ] }) }),
171
- /* @__PURE__ */ jsx(FieldRow$2, { label: "Send Item Details", hint: "Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
215
+ /* @__PURE__ */ jsx(FieldRow, { label: "Send Item Details", hint: "Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
172
216
  /* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.sendItemDetails, onChange: (e) => setForm((p) => ({ ...p, sendItemDetails: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
173
217
  /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
174
218
  ] }) }),
175
- /* @__PURE__ */ jsx(FieldRow$2, { label: "Invoice prefix", children: /* @__PURE__ */ jsx("input", { value: form.invoicePrefix, onChange: (e) => setForm((p) => ({ ...p, invoicePrefix: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "WC-" }) }),
176
- /* @__PURE__ */ jsx(FieldRow$2, { label: "Credit Card Statement Name", children: /* @__PURE__ */ jsx("input", { value: form.creditCardStatementName, onChange: (e) => setForm((p) => ({ ...p, creditCardStatementName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) })
219
+ /* @__PURE__ */ jsx(FieldRow, { label: "Invoice prefix", htmlFor: "as-invoice-prefix", children: /* @__PURE__ */ jsx("input", { id: "as-invoice-prefix", value: form.invoicePrefix, onChange: (e) => setForm((p) => ({ ...p, invoicePrefix: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PP-" }) }),
220
+ /* @__PURE__ */ jsx(FieldRow, { label: "Credit Card Statement Name", htmlFor: "as-cc-statement", children: /* @__PURE__ */ jsx("input", { id: "as-cc-statement", value: form.creditCardStatementName, onChange: (e) => setForm((p) => ({ ...p, creditCardStatementName: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "PayPal" }) })
177
221
  ] })
178
222
  }
179
223
  )
180
224
  ] }) });
181
225
  }
182
- async function adminFetch$1(path, opts = {}) {
183
- var _a;
184
- const { method = "GET", body, query } = opts;
185
- let url = path;
186
- if (query && Object.keys(query).length > 0) {
187
- const params = new URLSearchParams(query);
188
- url = `${path}?${params.toString()}`;
189
- }
190
- const headers = { Accept: "application/json" };
191
- if (body !== void 0) headers["Content-Type"] = "application/json";
192
- if (typeof window !== "undefined") {
193
- const token = (_a = window.__medusa__) == null ? void 0 : _a.token;
194
- if (token) headers["Authorization"] = `Bearer ${token}`;
195
- }
196
- const res = await fetch(url, {
197
- method,
198
- headers,
199
- credentials: "include",
200
- body: body !== void 0 ? JSON.stringify(body) : void 0
201
- });
202
- const text = await res.text().catch(() => "");
203
- if (!res.ok) {
204
- if (res.status === 401) throw new Error("Unauthorized (401) - session may have expired. Please reload and log in again.");
205
- if (res.status === 403) throw new Error("Forbidden (403) - you do not have permission to perform this action.");
206
- throw new Error(text || `Request failed with status ${res.status}`);
207
- }
208
- if (!text) return {};
209
- try {
210
- return JSON.parse(text);
211
- } catch {
212
- return {};
213
- }
226
+ function PayPalApplePayPage() {
227
+ return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
214
228
  }
215
229
  const DEFAULT_FORM = {
216
230
  enabled: true,
@@ -227,27 +241,6 @@ const THREE_DS_OPTIONS = [
227
241
  { value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
228
242
  { value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
229
243
  ];
230
- function SectionCard$1({ title, description, right, children }) {
231
- return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
232
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
233
- /* @__PURE__ */ jsxs("div", { children: [
234
- /* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: title }),
235
- description ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-sm text-ui-fg-subtle", children: description }) : null
236
- ] }),
237
- right
238
- ] }),
239
- /* @__PURE__ */ jsx("div", { className: "p-4", children })
240
- ] });
241
- }
242
- function FieldRow$1({ label, hint, children }) {
243
- return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 items-start gap-4 py-3", children: [
244
- /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
245
- /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-ui-fg-base", children: label }),
246
- hint ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: hint }) : null
247
- ] }),
248
- /* @__PURE__ */ jsx("div", { className: "col-span-12 md:col-span-8", children })
249
- ] });
250
- }
251
244
  function AdvancedCardPaymentsTab() {
252
245
  var _a, _b;
253
246
  const [form, setForm] = useState(() => ({ ...DEFAULT_FORM }));
@@ -255,13 +248,14 @@ function AdvancedCardPaymentsTab() {
255
248
  const [saving, setSaving] = useState(false);
256
249
  const [toast, setToast] = useState(null);
257
250
  const didInit = useRef(false);
251
+ const dismissToast = useCallback(() => setToast(null), []);
258
252
  useEffect(() => {
259
253
  if (didInit.current) return;
260
254
  didInit.current = true;
261
255
  (async () => {
262
256
  try {
263
257
  setLoading(true);
264
- const json = await adminFetch$1("/admin/paypal/settings");
258
+ const json = await adminFetch("/admin/paypal/settings");
265
259
  const payload = (json == null ? void 0 : json.data) ?? json;
266
260
  const saved = payload == null ? void 0 : payload.advanced_card_payments;
267
261
  if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
@@ -274,18 +268,16 @@ function AdvancedCardPaymentsTab() {
274
268
  async function onSave() {
275
269
  try {
276
270
  setSaving(true);
277
- const json = await adminFetch$1("/admin/paypal/settings", {
271
+ const json = await adminFetch("/admin/paypal/settings", {
278
272
  method: "POST",
279
273
  body: { advanced_card_payments: form }
280
274
  });
281
275
  const payload = (json == null ? void 0 : json.data) ?? json;
282
276
  const saved = payload == null ? void 0 : payload.advanced_card_payments;
283
277
  if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
284
- setToast({ type: "success", message: "Settings saved" });
285
- window.setTimeout(() => setToast(null), 2500);
278
+ setToast({ kind: "success", message: "Settings saved" });
286
279
  } catch (e) {
287
- setToast({ type: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
288
- window.setTimeout(() => setToast(null), 3500);
280
+ setToast({ kind: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
289
281
  } finally {
290
282
  setSaving(false);
291
283
  }
@@ -293,24 +285,24 @@ function AdvancedCardPaymentsTab() {
293
285
  return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
294
286
  /* @__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" }) }) }),
295
287
  /* @__PURE__ */ jsx(PayPalTabs, {}),
296
- toast ? /* @__PURE__ */ jsx("div", { className: "fixed right-6 top-6 z-50 rounded-md border border-ui-border-base bg-ui-bg-base px-4 py-3 text-sm shadow-lg", role: "status", "aria-live": "polite", children: /* @__PURE__ */ jsx("span", { className: toast.type === "success" ? "text-ui-fg-base" : "text-ui-fg-error", children: toast.message }) }) : null,
288
+ /* @__PURE__ */ jsx(Toast, { toast, onClose: dismissToast }),
297
289
  /* @__PURE__ */ jsx(
298
- SectionCard$1,
290
+ SectionCard,
299
291
  {
300
292
  title: "Advanced Card Payments",
301
293
  description: "Control card checkout settings and 3D Secure behavior.",
302
294
  right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
303
295
  /* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
304
- loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
296
+ loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading" }) : null
305
297
  ] }),
306
298
  children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
307
- /* @__PURE__ */ jsx(FieldRow$1, { label: "Enable/Disable", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
299
+ /* @__PURE__ */ jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
308
300
  /* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.enabled, onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
309
301
  /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
310
302
  ] }) }),
311
- /* @__PURE__ */ jsx(FieldRow$1, { label: "Title", children: /* @__PURE__ */ jsx("input", { value: form.title, onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "Credit or Debit Card" }) }),
312
- /* @__PURE__ */ jsx(FieldRow$1, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
313
- /* @__PURE__ */ jsx("select", { value: form.threeDS, onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value)) }),
303
+ /* @__PURE__ */ jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsx("input", { id: "acp-title", value: form.title, onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "Credit or Debit Card" }) }),
304
+ /* @__PURE__ */ jsx(FieldRow, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", htmlFor: "acp-threeds", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
305
+ /* @__PURE__ */ jsx("select", { id: "acp-threeds", value: form.threeDS, onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value)) }),
314
306
  ((_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
315
307
  ] }) })
316
308
  ] })
@@ -318,42 +310,15 @@ function AdvancedCardPaymentsTab() {
318
310
  )
319
311
  ] }) });
320
312
  }
321
- function PayPalApplePayPage() {
322
- return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
323
- }
324
313
  function PayPalGooglePayPage() {
325
314
  return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
326
315
  }
327
316
  const config = defineRouteConfig({
328
- label: "PayPal Connection",
329
- hide: true
317
+ label: "PayPal Connection"
330
318
  });
331
- if (typeof window !== "undefined") {
332
- const preloadHref = "https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js";
333
- const existingPreload = document.head.querySelector(
334
- `link[rel="preload"][href="${preloadHref}"]`
335
- );
336
- if (!existingPreload) {
337
- const preloadLink = document.createElement("link");
338
- preloadLink.rel = "preload";
339
- preloadLink.href = preloadHref;
340
- preloadLink.as = "script";
341
- document.head.appendChild(preloadLink);
342
- }
343
- const existingScript = document.getElementById(
344
- "paypal-partner-js"
345
- );
346
- if (!existingScript) {
347
- const ppScript = document.createElement("script");
348
- ppScript.id = "paypal-partner-js";
349
- ppScript.src = preloadHref;
350
- ppScript.async = true;
351
- document.head.appendChild(ppScript);
352
- }
353
- }
319
+ const PARTNER_JS_URL = "https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js";
354
320
  const SERVICE_URL = "/admin/paypal/onboarding-link";
355
321
  const CACHE_KEY = "pp_onboard_cache";
356
- const RELOAD_KEY = "pp_onboard_reloaded_once";
357
322
  const CACHE_EXPIRY = 10 * 60 * 1e3;
358
323
  const ONBOARDING_COMPLETE_ENDPOINT = "/admin/paypal/onboard-complete";
359
324
  const STATUS_ENDPOINT = "/admin/paypal/status";
@@ -376,12 +341,45 @@ if (typeof window !== "undefined") {
376
341
  function PayPalConnectionPage() {
377
342
  const [env, setEnv] = useState("live");
378
343
  useEffect(() => {
379
- fetch("/admin/paypal/environment", { method: "GET" }).then((r) => r.json()).then((d) => {
344
+ fetch("/admin/paypal/environment", { method: "GET", credentials: "include" }).then((r) => r.json()).then((d) => {
380
345
  const v = (d == null ? void 0 : d.environment) === "sandbox" ? "sandbox" : "live";
381
346
  setEnv(v);
382
347
  }).catch(() => {
383
348
  });
384
349
  }, []);
350
+ useEffect(() => {
351
+ const preloadHref = PARTNER_JS_URL;
352
+ let preloadLink = null;
353
+ const existingPreload = document.head.querySelector(
354
+ `link[rel="preload"][href="${preloadHref}"]`
355
+ );
356
+ if (!existingPreload) {
357
+ preloadLink = document.createElement("link");
358
+ preloadLink.rel = "preload";
359
+ preloadLink.href = preloadHref;
360
+ preloadLink.as = "script";
361
+ document.head.appendChild(preloadLink);
362
+ }
363
+ let ppScript = null;
364
+ const existingScript = document.getElementById(
365
+ "paypal-partner-js"
366
+ );
367
+ if (!existingScript) {
368
+ ppScript = document.createElement("script");
369
+ ppScript.id = "paypal-partner-js";
370
+ ppScript.src = preloadHref;
371
+ ppScript.async = true;
372
+ document.head.appendChild(ppScript);
373
+ }
374
+ return () => {
375
+ if (preloadLink && preloadLink.parentNode) {
376
+ preloadLink.parentNode.removeChild(preloadLink);
377
+ }
378
+ if (ppScript && ppScript.parentNode) {
379
+ ppScript.parentNode.removeChild(ppScript);
380
+ }
381
+ };
382
+ }, []);
385
383
  const [connState, setConnState] = useState("loading");
386
384
  const [error, setError] = useState(null);
387
385
  const [finalUrl, setFinalUrl] = useState("");
@@ -410,10 +408,14 @@ function PayPalConnectionPage() {
410
408
  fetch(SERVICE_URL, {
411
409
  method: "POST",
412
410
  headers: { "content-type": "application/json" },
411
+ credentials: "include",
413
412
  body: JSON.stringify({
414
413
  products: ["PPCP"]
415
414
  })
416
- }).then((r) => r.json()).then((data) => {
415
+ }).then((r) => {
416
+ if (!r.ok) throw new Error(`Service returned ${r.status}`);
417
+ return r.json();
418
+ }).then((data) => {
417
419
  if (runId !== currentRunId.current) return;
418
420
  const href = data == null ? void 0 : data.onboarding_url;
419
421
  if (!href) {
@@ -428,11 +430,6 @@ function PayPalConnectionPage() {
428
430
  ts: Date.now()
429
431
  })
430
432
  );
431
- if (!localStorage.getItem(RELOAD_KEY)) {
432
- localStorage.setItem(RELOAD_KEY, "1");
433
- window.location.reload();
434
- return;
435
- }
436
433
  activatePayPal(finalUrl2, runId);
437
434
  }).catch(() => {
438
435
  if (runId !== currentRunId.current) return;
@@ -459,6 +456,8 @@ function PayPalConnectionPage() {
459
456
  paypalButtonRef.current.href = url;
460
457
  }
461
458
  setFinalUrl(url);
459
+ let attempts = 0;
460
+ const MAX_ATTEMPTS = 200;
462
461
  const tryInit = () => {
463
462
  var _a, _b;
464
463
  if (runId !== currentRunId.current) return;
@@ -466,6 +465,11 @@ function PayPalConnectionPage() {
466
465
  showUI();
467
466
  return;
468
467
  }
468
+ attempts++;
469
+ if (attempts >= MAX_ATTEMPTS) {
470
+ showError("PayPal partner script failed to load. Please refresh and try again.");
471
+ return;
472
+ }
469
473
  setTimeout(tryInit, 50);
470
474
  };
471
475
  tryInit();
@@ -482,7 +486,8 @@ function PayPalConnectionPage() {
482
486
  setFinalUrl("");
483
487
  try {
484
488
  const r = await fetch(`${STATUS_ENDPOINT}?environment=${env}`, {
485
- method: "GET"
489
+ method: "GET",
490
+ credentials: "include"
486
491
  });
487
492
  const st = await r.json().catch(() => ({}));
488
493
  if (cancelled || runId !== currentRunId.current) return;
@@ -512,8 +517,7 @@ function PayPalConnectionPage() {
512
517
  window.onboardingCallback = async function(authCode, sharedId) {
513
518
  var _a, _b, _c, _d, _e, _f, _g;
514
519
  try {
515
- ;
516
- window.onbeforeunload = "";
520
+ window.onbeforeunload = null;
517
521
  } catch {
518
522
  }
519
523
  setOnboardingInProgress(true);
@@ -528,6 +532,7 @@ function PayPalConnectionPage() {
528
532
  const res = await fetch(ONBOARDING_COMPLETE_ENDPOINT, {
529
533
  method: "POST",
530
534
  headers: { "content-type": "application/json" },
535
+ credentials: "include",
531
536
  body: JSON.stringify(payload)
532
537
  });
533
538
  if (!res.ok) {
@@ -546,10 +551,22 @@ function PayPalConnectionPage() {
546
551
  }
547
552
  try {
548
553
  localStorage.removeItem(CACHE_KEY);
549
- localStorage.removeItem(RELOAD_KEY);
550
554
  } catch {
551
555
  }
552
- window.location.href = window.location.href;
556
+ try {
557
+ const statusRes = await fetch(`${STATUS_ENDPOINT}?environment=${env}`, {
558
+ method: "GET",
559
+ credentials: "include"
560
+ });
561
+ const refreshedStatus = await statusRes.json().catch(() => ({}));
562
+ setStatusInfo(refreshedStatus || null);
563
+ setConnState("connected");
564
+ setShowManual(false);
565
+ } catch {
566
+ setConnState("connected");
567
+ setShowManual(false);
568
+ }
569
+ setOnboardingInProgress(false);
553
570
  } catch (e) {
554
571
  console.error(e);
555
572
  setConnState("error");
@@ -595,6 +612,7 @@ function PayPalConnectionPage() {
595
612
  const res = await fetch(SAVE_CREDENTIALS_ENDPOINT, {
596
613
  method: "POST",
597
614
  headers: { "content-type": "application/json" },
615
+ credentials: "include",
598
616
  body: JSON.stringify({
599
617
  clientId: clientId.trim(),
600
618
  clientSecret: secret.trim(),
@@ -606,7 +624,8 @@ function PayPalConnectionPage() {
606
624
  throw new Error(txt || `Save credentials failed (${res.status})`);
607
625
  }
608
626
  const statusRes = await fetch(`${STATUS_ENDPOINT}?environment=${env}`, {
609
- method: "GET"
627
+ method: "GET",
628
+ credentials: "include"
610
629
  });
611
630
  const refreshedStatus = await statusRes.json().catch(() => ({}));
612
631
  setConnState("connected");
@@ -614,7 +633,6 @@ function PayPalConnectionPage() {
614
633
  setShowManual(false);
615
634
  try {
616
635
  localStorage.removeItem(CACHE_KEY);
617
- localStorage.removeItem(RELOAD_KEY);
618
636
  } catch {
619
637
  }
620
638
  } catch (e) {
@@ -633,10 +651,12 @@ function PayPalConnectionPage() {
633
651
  setError(null);
634
652
  setFinalUrl("");
635
653
  setShowManual(false);
654
+ setStatusInfo(null);
636
655
  try {
637
656
  const res = await fetch(DISCONNECT_ENDPOINT, {
638
657
  method: "POST",
639
658
  headers: { "content-type": "application/json" },
659
+ credentials: "include",
640
660
  body: JSON.stringify({ environment: env })
641
661
  });
642
662
  if (!res.ok) {
@@ -645,7 +665,6 @@ function PayPalConnectionPage() {
645
665
  }
646
666
  try {
647
667
  localStorage.removeItem(CACHE_KEY);
648
- localStorage.removeItem(RELOAD_KEY);
649
668
  } catch {
650
669
  }
651
670
  currentRunId.current = ++runIdRef.current;
@@ -667,19 +686,19 @@ function PayPalConnectionPage() {
667
686
  await fetch("/admin/paypal/environment", {
668
687
  method: "POST",
669
688
  headers: { "content-type": "application/json" },
689
+ credentials: "include",
670
690
  body: JSON.stringify({ environment: next })
671
691
  });
672
692
  } catch {
673
693
  }
674
694
  try {
675
695
  localStorage.removeItem(CACHE_KEY);
676
- localStorage.removeItem(RELOAD_KEY);
677
696
  } catch {
678
697
  }
679
698
  };
680
699
  return /* @__PURE__ */ jsxs("div", { className: "p-6", children: [
681
700
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
682
- /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold", children: "PayPal Gateway By Easy Payment" }),
701
+ /* @__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" }) }) }),
683
702
  /* @__PURE__ */ jsx(PayPalTabs, {}),
684
703
  /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-y-6 p-4 md:grid-cols-[260px_1fr] md:items-start", children: [
685
704
  /* @__PURE__ */ jsx("div", { className: "text-sm font-medium pt-2", children: "Environment" }),
@@ -809,10 +828,11 @@ function PayPalConnectionPage() {
809
828
  ] }) }),
810
829
  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: [
811
830
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
812
- /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Client ID" }),
831
+ /* @__PURE__ */ jsx("label", { htmlFor: "pp-manual-client-id", className: "text-sm font-medium", children: "Client ID" }),
813
832
  /* @__PURE__ */ jsx(
814
833
  "input",
815
834
  {
835
+ id: "pp-manual-client-id",
816
836
  type: "text",
817
837
  value: clientId,
818
838
  onChange: (e) => setClientId(e.target.value),
@@ -823,10 +843,11 @@ function PayPalConnectionPage() {
823
843
  )
824
844
  ] }),
825
845
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
826
- /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Secret" }),
846
+ /* @__PURE__ */ jsx("label", { htmlFor: "pp-manual-secret", className: "text-sm font-medium", children: "Secret" }),
827
847
  /* @__PURE__ */ jsx(
828
848
  "input",
829
849
  {
850
+ id: "pp-manual-secret",
830
851
  type: "password",
831
852
  value: secret,
832
853
  onChange: (e) => setSecret(e.target.value),
@@ -920,39 +941,6 @@ function PayPalConnectionPage() {
920
941
  function PayPalPayLaterMessagingPage() {
921
942
  return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
922
943
  }
923
- async function adminFetch(path, opts = {}) {
924
- var _a;
925
- const { method = "GET", body, query } = opts;
926
- let url = path;
927
- if (query && Object.keys(query).length > 0) {
928
- const params = new URLSearchParams(query);
929
- url = `${path}?${params.toString()}`;
930
- }
931
- const headers = { Accept: "application/json" };
932
- if (body !== void 0) headers["Content-Type"] = "application/json";
933
- if (typeof window !== "undefined") {
934
- const token = (_a = window.__medusa__) == null ? void 0 : _a.token;
935
- if (token) headers["Authorization"] = `Bearer ${token}`;
936
- }
937
- const res = await fetch(url, {
938
- method,
939
- headers,
940
- credentials: "include",
941
- body: body !== void 0 ? JSON.stringify(body) : void 0
942
- });
943
- const text = await res.text().catch(() => "");
944
- if (!res.ok) {
945
- if (res.status === 401) throw new Error("Unauthorized (401) - session may have expired. Please reload and log in again.");
946
- if (res.status === 403) throw new Error("Forbidden (403) - you do not have permission to perform this action.");
947
- throw new Error(text || `Request failed with status ${res.status}`);
948
- }
949
- if (!text) return {};
950
- try {
951
- return JSON.parse(text);
952
- } catch {
953
- return {};
954
- }
955
- }
956
944
  const COLOR_OPTIONS = [
957
945
  { value: "gold", label: "Gold (Recommended)" },
958
946
  { value: "blue", label: "Blue" },
@@ -977,36 +965,6 @@ const LABEL_OPTIONS = [
977
965
  { value: "buynow", label: "Buy Now" },
978
966
  { value: "pay", label: "Pay" }
979
967
  ];
980
- function SectionCard({
981
- title,
982
- description,
983
- children,
984
- right
985
- }) {
986
- return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
987
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-ui-border-base p-4", children: [
988
- /* @__PURE__ */ jsxs("div", { children: [
989
- /* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: title }),
990
- description ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-sm text-ui-fg-subtle", children: description }) : null
991
- ] }),
992
- right
993
- ] }),
994
- /* @__PURE__ */ jsx("div", { className: "p-4", children })
995
- ] });
996
- }
997
- function FieldRow({
998
- label,
999
- hint,
1000
- children
1001
- }) {
1002
- return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 items-start gap-4 py-3", children: [
1003
- /* @__PURE__ */ jsxs("div", { className: "col-span-12 md:col-span-4", children: [
1004
- /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-ui-fg-base", children: label }),
1005
- hint ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: hint }) : null
1006
- ] }),
1007
- /* @__PURE__ */ jsx("div", { className: "col-span-12 md:col-span-8", children })
1008
- ] });
1009
- }
1010
968
  function PayPalSettingsTab() {
1011
969
  const [form, setForm] = useState({
1012
970
  enabled: true,
@@ -1022,6 +980,7 @@ function PayPalSettingsTab() {
1022
980
  const [saving, setSaving] = useState(false);
1023
981
  const [toast, setToast] = useState(null);
1024
982
  const didInit = useRef(false);
983
+ const dismissToast = useCallback(() => setToast(null), []);
1025
984
  useEffect(() => {
1026
985
  if (didInit.current) return;
1027
986
  didInit.current = true;
@@ -1064,14 +1023,12 @@ function PayPalSettingsTab() {
1064
1023
  ...saved
1065
1024
  }));
1066
1025
  }
1067
- setToast({ type: "success", message: "Settings saved" });
1068
- window.setTimeout(() => setToast(null), 2500);
1026
+ setToast({ kind: "success", message: "Settings saved" });
1069
1027
  } catch (e) {
1070
1028
  setToast({
1071
- type: "error",
1029
+ kind: "error",
1072
1030
  message: (e instanceof Error ? e.message : "") || "Failed to save settings."
1073
1031
  });
1074
- window.setTimeout(() => setToast(null), 3500);
1075
1032
  } finally {
1076
1033
  setSaving(false);
1077
1034
  }
@@ -1082,15 +1039,7 @@ function PayPalSettingsTab() {
1082
1039
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2" })
1083
1040
  ] }),
1084
1041
  /* @__PURE__ */ jsx(PayPalTabs, {}),
1085
- toast ? /* @__PURE__ */ jsx(
1086
- "div",
1087
- {
1088
- className: "fixed right-6 top-6 z-50 rounded-md border border-ui-border-base bg-ui-bg-base px-4 py-3 text-sm shadow-lg",
1089
- role: "status",
1090
- "aria-live": "polite",
1091
- children: /* @__PURE__ */ jsx("span", { className: toast.type === "success" ? "text-ui-fg-base" : "text-ui-fg-error", children: toast.message })
1092
- }
1093
- ) : null,
1042
+ /* @__PURE__ */ jsx(Toast, { toast, onClose: dismissToast }),
1094
1043
  /* @__PURE__ */ jsx(
1095
1044
  SectionCard,
1096
1045
  {
@@ -1122,9 +1071,10 @@ function PayPalSettingsTab() {
1122
1071
  ),
1123
1072
  /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable PayPal" })
1124
1073
  ] }) }),
1125
- /* @__PURE__ */ jsx(FieldRow, { label: "Title", children: /* @__PURE__ */ jsx(
1074
+ /* @__PURE__ */ jsx(FieldRow, { label: "Title", htmlFor: "pp-title", children: /* @__PURE__ */ jsx(
1126
1075
  "input",
1127
1076
  {
1077
+ id: "pp-title",
1128
1078
  value: form.title,
1129
1079
  onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })),
1130
1080
  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",
@@ -1140,36 +1090,40 @@ function PayPalSettingsTab() {
1140
1090
  title: "Button Appearance",
1141
1091
  description: "Control PayPal Smart Button styling (color/shape/size/label).",
1142
1092
  children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
1143
- /* @__PURE__ */ jsx(FieldRow, { label: "Button Color", children: /* @__PURE__ */ jsx(
1093
+ /* @__PURE__ */ jsx(FieldRow, { label: "Button Color", htmlFor: "pp-btn-color", children: /* @__PURE__ */ jsx(
1144
1094
  "select",
1145
1095
  {
1096
+ id: "pp-btn-color",
1146
1097
  value: form.buttonColor,
1147
1098
  onChange: (e) => setForm((p) => ({ ...p, buttonColor: e.target.value })),
1148
1099
  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",
1149
1100
  children: COLOR_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
1150
1101
  }
1151
1102
  ) }),
1152
- /* @__PURE__ */ jsx(FieldRow, { label: "Button Shape", children: /* @__PURE__ */ jsx(
1103
+ /* @__PURE__ */ jsx(FieldRow, { label: "Button Shape", htmlFor: "pp-btn-shape", children: /* @__PURE__ */ jsx(
1153
1104
  "select",
1154
1105
  {
1106
+ id: "pp-btn-shape",
1155
1107
  value: form.buttonShape,
1156
1108
  onChange: (e) => setForm((p) => ({ ...p, buttonShape: e.target.value })),
1157
1109
  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",
1158
1110
  children: SHAPE_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
1159
1111
  }
1160
1112
  ) }),
1161
- /* @__PURE__ */ jsx(FieldRow, { label: "Button Width", children: /* @__PURE__ */ jsx(
1113
+ /* @__PURE__ */ jsx(FieldRow, { label: "Button Width", htmlFor: "pp-btn-width", children: /* @__PURE__ */ jsx(
1162
1114
  "select",
1163
1115
  {
1116
+ id: "pp-btn-width",
1164
1117
  value: form.buttonWidth,
1165
1118
  onChange: (e) => setForm((p) => ({ ...p, buttonWidth: e.target.value })),
1166
1119
  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",
1167
1120
  children: WIDTH_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
1168
1121
  }
1169
1122
  ) }),
1170
- /* @__PURE__ */ jsx(FieldRow, { label: "Button Height", children: /* @__PURE__ */ jsx(
1123
+ /* @__PURE__ */ jsx(FieldRow, { label: "Button Height", htmlFor: "pp-btn-height", children: /* @__PURE__ */ jsx(
1171
1124
  "select",
1172
1125
  {
1126
+ id: "pp-btn-height",
1173
1127
  value: String(form.buttonHeight),
1174
1128
  onChange: (e) => setForm((p) => ({ ...p, buttonHeight: Number(e.target.value) })),
1175
1129
  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",
@@ -1179,9 +1133,10 @@ function PayPalSettingsTab() {
1179
1133
  ] }, h))
1180
1134
  }
1181
1135
  ) }),
1182
- /* @__PURE__ */ jsx(FieldRow, { label: "Button Label", children: /* @__PURE__ */ jsx(
1136
+ /* @__PURE__ */ jsx(FieldRow, { label: "Button Label", htmlFor: "pp-btn-label", children: /* @__PURE__ */ jsx(
1183
1137
  "select",
1184
1138
  {
1139
+ id: "pp-btn-label",
1185
1140
  value: form.buttonLabel,
1186
1141
  onChange: (e) => setForm((p) => ({ ...p, buttonLabel: e.target.value })),
1187
1142
  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",
@@ -1204,14 +1159,14 @@ const routeModule = {
1204
1159
  Component: AdditionalSettingsTab,
1205
1160
  path: "/settings/paypal/additional-settings"
1206
1161
  },
1207
- {
1208
- Component: AdvancedCardPaymentsTab,
1209
- path: "/settings/paypal/advanced-card-payments"
1210
- },
1211
1162
  {
1212
1163
  Component: PayPalApplePayPage,
1213
1164
  path: "/settings/paypal/apple-pay"
1214
1165
  },
1166
+ {
1167
+ Component: AdvancedCardPaymentsTab,
1168
+ path: "/settings/paypal/advanced-card-payments"
1169
+ },
1215
1170
  {
1216
1171
  Component: PayPalGooglePayPage,
1217
1172
  path: "/settings/paypal/google-pay"