@easypayment/medusa-payment-paypal 1.3.8 → 1.3.9

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 (39) hide show
  1. package/.medusa/server/src/admin/index.js +175 -79
  2. package/.medusa/server/src/admin/index.mjs +110 -16
  3. package/.medusa/server/src/api/admin/paypal/merchant-status/route.d.ts +11 -0
  4. package/.medusa/server/src/api/admin/paypal/merchant-status/route.d.ts.map +1 -0
  5. package/.medusa/server/src/api/admin/paypal/merchant-status/route.js +32 -0
  6. package/.medusa/server/src/api/admin/paypal/merchant-status/route.js.map +1 -0
  7. package/.medusa/server/src/api/store/paypal/create-order/route.d.ts +4 -1
  8. package/.medusa/server/src/api/store/paypal/create-order/route.d.ts.map +1 -1
  9. package/.medusa/server/src/api/store/paypal/create-order/route.js +101 -102
  10. package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
  11. package/.medusa/server/src/modules/paypal/service.d.ts +34 -0
  12. package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
  13. package/.medusa/server/src/modules/paypal/service.js +161 -34
  14. package/.medusa/server/src/modules/paypal/service.js.map +1 -1
  15. package/.medusa/server/src/modules/paypal/types/config.d.ts +12 -0
  16. package/.medusa/server/src/modules/paypal/types/config.d.ts.map +1 -1
  17. package/.medusa/server/src/modules/paypal/types/config.js +25 -1
  18. package/.medusa/server/src/modules/paypal/types/config.js.map +1 -1
  19. package/.medusa/server/src/modules/paypal/utils/merchant-status.d.ts +50 -0
  20. package/.medusa/server/src/modules/paypal/utils/merchant-status.d.ts.map +1 -0
  21. package/.medusa/server/src/modules/paypal/utils/merchant-status.js +106 -0
  22. package/.medusa/server/src/modules/paypal/utils/merchant-status.js.map +1 -0
  23. package/.medusa/server/src/modules/paypal/utils/order-context.d.ts +61 -0
  24. package/.medusa/server/src/modules/paypal/utils/order-context.d.ts.map +1 -0
  25. package/.medusa/server/src/modules/paypal/utils/order-context.js +127 -0
  26. package/.medusa/server/src/modules/paypal/utils/order-context.js.map +1 -0
  27. package/CHANGELOG.md +56 -0
  28. package/README.md +3 -2
  29. package/package.json +1 -1
  30. package/src/admin/routes/settings/paypal/_components/MerchantStatusNotices.tsx +116 -0
  31. package/src/admin/routes/settings/paypal/additional-settings/page.tsx +32 -6
  32. package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +2 -0
  33. package/src/admin/routes/settings/paypal/connection/page.tsx +7 -0
  34. package/src/api/admin/paypal/merchant-status/route.ts +36 -0
  35. package/src/api/store/paypal/create-order/route.ts +176 -157
  36. package/src/modules/paypal/service.ts +222 -43
  37. package/src/modules/paypal/types/config.ts +35 -2
  38. package/src/modules/paypal/utils/merchant-status.ts +185 -0
  39. package/src/modules/paypal/utils/order-context.ts +163 -0
@@ -2,7 +2,9 @@
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const adminSdk = require("@medusajs/admin-sdk");
4
4
  const reactRouterDom = require("react-router-dom");
5
- const react = require("react");
5
+ const React = require("react");
6
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
7
+ const React__default = /* @__PURE__ */ _interopDefault(React);
6
8
  const config$1 = adminSdk.defineRouteConfig({
7
9
  label: "PayPal"
8
10
  });
@@ -73,7 +75,7 @@ function FieldRow({
73
75
  ] });
74
76
  }
75
77
  function Toast({ toast, onClose }) {
76
- react.useEffect(() => {
78
+ React.useEffect(() => {
77
79
  if (!toast) return;
78
80
  const duration = toast.kind === "error" ? 5e3 : 2500;
79
81
  const t = setTimeout(() => onClose(), duration);
@@ -157,9 +159,10 @@ async function adminFetch(path, opts = {}) {
157
159
  const DEFAULT_FORM$1 = {
158
160
  paymentAction: "capture",
159
161
  brandName: "PayPal",
160
- landingPage: "no_preference",
162
+ landingPage: "login",
161
163
  requireInstantPayment: false,
162
164
  sendItemDetails: true,
165
+ sendShippingAddress: true,
163
166
  invoicePrefix: "PP-",
164
167
  creditCardStatementName: "PayPal",
165
168
  debugLogging: false
@@ -169,21 +172,23 @@ function mergeWithDefaults$1(saved) {
169
172
  const entries = Object.entries(saved).filter(
170
173
  ([, value]) => value !== void 0
171
174
  );
172
- return {
175
+ const merged = {
173
176
  ...DEFAULT_FORM$1,
174
177
  ...Object.fromEntries(entries)
175
178
  };
179
+ if (merged.landingPage !== "billing") merged.landingPage = "login";
180
+ return merged;
176
181
  }
177
182
  function AdditionalSettingsTab() {
178
- const [form, setForm] = react.useState(() => ({
183
+ const [form, setForm] = React.useState(() => ({
179
184
  ...DEFAULT_FORM$1
180
185
  }));
181
- const [loading, setLoading] = react.useState(false);
182
- const [saving, setSaving] = react.useState(false);
183
- const [downloading, setDownloading] = react.useState(false);
184
- const [toast, setToast] = react.useState(null);
185
- const didInit = react.useRef(false);
186
- const dismissToast = react.useCallback(() => setToast(null), []);
186
+ const [loading, setLoading] = React.useState(false);
187
+ const [saving, setSaving] = React.useState(false);
188
+ const [downloading, setDownloading] = React.useState(false);
189
+ const [toast, setToast] = React.useState(null);
190
+ const didInit = React.useRef(false);
191
+ const dismissToast = React.useCallback(() => setToast(null), []);
187
192
  async function onDownloadLog() {
188
193
  var _a;
189
194
  try {
@@ -227,7 +232,7 @@ function AdditionalSettingsTab() {
227
232
  setDownloading(false);
228
233
  }
229
234
  }
230
- react.useEffect(() => {
235
+ React.useEffect(() => {
231
236
  if (didInit.current) return;
232
237
  didInit.current = true;
233
238
  (async () => {
@@ -327,9 +332,8 @@ function AdditionalSettingsTab() {
327
332
  })),
328
333
  className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive",
329
334
  children: [
330
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "no_preference", children: "No Preference" }),
331
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "login", children: "Login" }),
332
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "billing", children: "Billing" })
335
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "login", children: "Login (PayPal account)" }),
336
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "billing", children: "Guest checkout (card form)" })
333
337
  ]
334
338
  }
335
339
  ) }),
@@ -370,6 +374,28 @@ function AdditionalSettingsTab() {
370
374
  ] })
371
375
  }
372
376
  ),
377
+ /* @__PURE__ */ jsxRuntime.jsx(
378
+ FieldRow,
379
+ {
380
+ label: "Send Shipping Address",
381
+ hint: "Send the shipping address the customer entered at checkout to PayPal, so PayPal shows that address instead of the ones saved on the customer's PayPal account. Needed for PayPal Seller Protection.",
382
+ children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
383
+ /* @__PURE__ */ jsxRuntime.jsx(
384
+ "input",
385
+ {
386
+ type: "checkbox",
387
+ checked: form.sendShippingAddress,
388
+ onChange: (e) => setForm((p) => ({
389
+ ...p,
390
+ sendShippingAddress: e.target.checked
391
+ })),
392
+ className: "h-4 w-4 rounded border-ui-border-base"
393
+ }
394
+ ),
395
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Send the checkout shipping address to PayPal" })
396
+ ] })
397
+ }
398
+ ),
373
399
  /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Invoice prefix", htmlFor: "as-invoice-prefix", children: /* @__PURE__ */ jsxRuntime.jsx(
374
400
  "input",
375
401
  {
@@ -444,6 +470,68 @@ function AdditionalSettingsTab() {
444
470
  )
445
471
  ] }) });
446
472
  }
473
+ const URL_RE = /(https?:\/\/[^\s]+[^\s.,!?])/g;
474
+ function NoticeText({ message }) {
475
+ const parts = message.split(URL_RE);
476
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: parts.map(
477
+ (part, i) => /^https?:\/\//.test(part) ? /* @__PURE__ */ jsxRuntime.jsx(
478
+ "a",
479
+ {
480
+ href: part,
481
+ target: "_blank",
482
+ rel: "noopener noreferrer",
483
+ className: "underline",
484
+ children: part
485
+ },
486
+ i
487
+ ) : /* @__PURE__ */ jsxRuntime.jsx(React__default.default.Fragment, { children: part }, i)
488
+ ) });
489
+ }
490
+ function MerchantStatusNotices({
491
+ environment,
492
+ only,
493
+ reloadKey
494
+ }) {
495
+ const [notices, setNotices] = React.useState([]);
496
+ React.useEffect(() => {
497
+ let cancelled = false;
498
+ setNotices([]);
499
+ (async () => {
500
+ try {
501
+ const json = await adminFetch(
502
+ "/admin/paypal/merchant-status",
503
+ environment ? { query: { environment } } : {}
504
+ );
505
+ if (cancelled) return;
506
+ setNotices(Array.isArray(json == null ? void 0 : json.notices) ? json.notices : []);
507
+ } catch {
508
+ }
509
+ })();
510
+ return () => {
511
+ cancelled = true;
512
+ };
513
+ }, [environment, reloadKey]);
514
+ const visible = only ? notices.filter((notice) => only.includes(notice.code)) : notices;
515
+ if (visible.length === 0) return null;
516
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", "data-testid": "paypal-merchant-notices", children: visible.map((notice) => /* @__PURE__ */ jsxRuntime.jsx(
517
+ "div",
518
+ {
519
+ role: "alert",
520
+ className: "rounded border p-3 text-sm",
521
+ style: notice.level === "error" ? {
522
+ background: "#fef2f2",
523
+ borderColor: "#fecaca",
524
+ color: "#b91c1c"
525
+ } : {
526
+ background: "#fffbeb",
527
+ borderColor: "#fde68a",
528
+ color: "#92400e"
529
+ },
530
+ children: /* @__PURE__ */ jsxRuntime.jsx(NoticeText, { message: notice.message })
531
+ },
532
+ notice.code
533
+ )) });
534
+ }
447
535
  const DEFAULT_FORM = {
448
536
  enabled: true,
449
537
  title: "Credit or Debit Card",
@@ -478,15 +566,15 @@ const THREE_DS_OPTIONS = [
478
566
  ];
479
567
  function AdvancedCardPaymentsTab() {
480
568
  var _a, _b;
481
- const [form, setForm] = react.useState(() => ({
569
+ const [form, setForm] = React.useState(() => ({
482
570
  ...DEFAULT_FORM
483
571
  }));
484
- const [loading, setLoading] = react.useState(false);
485
- const [saving, setSaving] = react.useState(false);
486
- const [toast, setToast] = react.useState(null);
487
- const didInit = react.useRef(false);
488
- const dismissToast = react.useCallback(() => setToast(null), []);
489
- react.useEffect(() => {
572
+ const [loading, setLoading] = React.useState(false);
573
+ const [saving, setSaving] = React.useState(false);
574
+ const [toast, setToast] = React.useState(null);
575
+ const didInit = React.useRef(false);
576
+ const dismissToast = React.useCallback(() => setToast(null), []);
577
+ React.useEffect(() => {
490
578
  if (didInit.current) return;
491
579
  didInit.current = true;
492
580
  (async () => {
@@ -529,6 +617,7 @@ function AdvancedCardPaymentsTab() {
529
617
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
530
618
  /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
531
619
  /* @__PURE__ */ jsxRuntime.jsx(Toast, { toast, onClose: dismissToast }),
620
+ /* @__PURE__ */ jsxRuntime.jsx(MerchantStatusNotices, { only: ["card_payments_not_enabled"] }),
532
621
  /* @__PURE__ */ jsxRuntime.jsx(
533
622
  SectionCard,
534
623
  {
@@ -599,9 +688,6 @@ function AdvancedCardPaymentsTab() {
599
688
  )
600
689
  ] }) });
601
690
  }
602
- function PayPalGooglePayPage() {
603
- return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
604
- }
605
691
  function PayPalApplePayPage() {
606
692
  return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
607
693
  }
@@ -702,39 +788,39 @@ function clearCachedUrl(env) {
702
788
  }
703
789
  }
704
790
  function PayPalConnectionPage() {
705
- const [env, setEnv] = react.useState("live");
706
- const [envReady, setEnvReady] = react.useState(false);
707
- const [connState, setConnState] = react.useState("loading");
708
- const [error, setError] = react.useState(null);
709
- const [finalUrl, setFinalUrl] = react.useState("");
710
- const [showManual, setShowManual] = react.useState(false);
711
- const [clientId, setClientId] = react.useState("");
712
- const [secret, setSecret] = react.useState("");
713
- const [statusInfo, setStatusInfo] = react.useState(null);
714
- const [onboardingInProgress, setOnboardingInProgress] = react.useState(false);
715
- const initLoaderRef = react.useRef(null);
716
- const paypalButtonRef = react.useRef(null);
717
- const errorLogRef = react.useRef(null);
718
- const runIdRef = react.useRef(0);
719
- const currentRunId = react.useRef(0);
720
- const completedRef = react.useRef(false);
721
- const boundButtonsRef = react.useRef(
791
+ const [env, setEnv] = React.useState("live");
792
+ const [envReady, setEnvReady] = React.useState(false);
793
+ const [connState, setConnState] = React.useState("loading");
794
+ const [error, setError] = React.useState(null);
795
+ const [finalUrl, setFinalUrl] = React.useState("");
796
+ const [showManual, setShowManual] = React.useState(false);
797
+ const [clientId, setClientId] = React.useState("");
798
+ const [secret, setSecret] = React.useState("");
799
+ const [statusInfo, setStatusInfo] = React.useState(null);
800
+ const [onboardingInProgress, setOnboardingInProgress] = React.useState(false);
801
+ const initLoaderRef = React.useRef(null);
802
+ const paypalButtonRef = React.useRef(null);
803
+ const errorLogRef = React.useRef(null);
804
+ const runIdRef = React.useRef(0);
805
+ const currentRunId = React.useRef(0);
806
+ const completedRef = React.useRef(false);
807
+ const boundButtonsRef = React.useRef(
722
808
  /* @__PURE__ */ new WeakMap()
723
809
  );
724
- const envRef = react.useRef(env);
810
+ const envRef = React.useRef(env);
725
811
  envRef.current = env;
726
- const pollTimerRef = react.useRef(null);
727
- const pollAttemptsRef = react.useRef(0);
728
- const ppBtnMeasureRef = react.useRef(null);
729
- const [ppBtnWidth, setPpBtnWidth] = react.useState(null);
730
- const canSaveManual = react.useMemo(() => {
812
+ const pollTimerRef = React.useRef(null);
813
+ const pollAttemptsRef = React.useRef(0);
814
+ const ppBtnMeasureRef = React.useRef(null);
815
+ const [ppBtnWidth, setPpBtnWidth] = React.useState(null);
816
+ const canSaveManual = React.useMemo(() => {
731
817
  return clientId.trim().length > 0 && secret.trim().length > 0;
732
818
  }, [clientId, secret]);
733
- const showError = react.useCallback((msg) => {
819
+ const showError = React.useCallback((msg) => {
734
820
  setConnState("error");
735
821
  setError(msg);
736
822
  }, []);
737
- const closeMiniBrowser = react.useCallback(() => {
823
+ const closeMiniBrowser = React.useCallback(() => {
738
824
  var _a, _b, _c, _d, _e, _f, _g, _h;
739
825
  try {
740
826
  const close1 = (_d = (_c = (_b = (_a = window.PAYPAL) == null ? void 0 : _a.apps) == null ? void 0 : _b.Signup) == null ? void 0 : _c.MiniBrowser) == null ? void 0 : _d.closeFlow;
@@ -747,14 +833,14 @@ function PayPalConnectionPage() {
747
833
  } catch {
748
834
  }
749
835
  }, []);
750
- const stopStatusPolling = react.useCallback(() => {
836
+ const stopStatusPolling = React.useCallback(() => {
751
837
  if (pollTimerRef.current) {
752
838
  clearTimeout(pollTimerRef.current);
753
839
  pollTimerRef.current = null;
754
840
  }
755
841
  pollAttemptsRef.current = 0;
756
842
  }, []);
757
- const refreshStatusAndMaybeConnect = react.useCallback(
843
+ const refreshStatusAndMaybeConnect = React.useCallback(
758
844
  async (activeEnv) => {
759
845
  try {
760
846
  const res = await fetch(`${STATUS_ENDPOINT}?environment=${activeEnv}`, {
@@ -780,7 +866,7 @@ function PayPalConnectionPage() {
780
866
  },
781
867
  [closeMiniBrowser, stopStatusPolling]
782
868
  );
783
- const startStatusPolling = react.useCallback(() => {
869
+ const startStatusPolling = React.useCallback(() => {
784
870
  stopStatusPolling();
785
871
  const MAX_ATTEMPTS = 100;
786
872
  const tick = async () => {
@@ -795,7 +881,7 @@ function PayPalConnectionPage() {
795
881
  };
796
882
  pollTimerRef.current = setTimeout(tick, 3e3);
797
883
  }, [refreshStatusAndMaybeConnect, stopStatusPolling]);
798
- const completeOnboarding = react.useCallback(
884
+ const completeOnboarding = React.useCallback(
799
885
  async (authCode, sharedId) => {
800
886
  if (!authCode || !sharedId) return;
801
887
  if (completedRef.current) return;
@@ -844,12 +930,12 @@ function PayPalConnectionPage() {
844
930
  },
845
931
  [closeMiniBrowser, stopStatusPolling]
846
932
  );
847
- const isConnectButtonBound = react.useCallback(() => {
933
+ const isConnectButtonBound = React.useCallback(() => {
848
934
  const anchor = paypalButtonRef.current;
849
935
  const mb = getMiniBrowser();
850
936
  return !!anchor && !!mb && isMiniBrowserReady() && boundButtonsRef.current.get(anchor) === mb;
851
937
  }, []);
852
- const initPartner = react.useCallback(() => {
938
+ const initPartner = React.useCallback(() => {
853
939
  const anchor = paypalButtonRef.current;
854
940
  const mb = getMiniBrowser();
855
941
  if (!anchor || !mb || !isMiniBrowserReady()) return false;
@@ -864,10 +950,10 @@ function PayPalConnectionPage() {
864
950
  return false;
865
951
  }
866
952
  }, []);
867
- react.useEffect(() => {
953
+ React.useEffect(() => {
868
954
  void loadMiniBrowser();
869
955
  }, []);
870
- const activatePayPal = react.useCallback(
956
+ const activatePayPal = React.useCallback(
871
957
  (url, runId) => {
872
958
  if (paypalButtonRef.current) {
873
959
  paypalButtonRef.current.href = url;
@@ -888,7 +974,7 @@ function PayPalConnectionPage() {
888
974
  },
889
975
  [initPartner, showError]
890
976
  );
891
- const fetchFreshLink = react.useCallback(
977
+ const fetchFreshLink = React.useCallback(
892
978
  async (targetEnv, runId) => {
893
979
  if (initLoaderRef.current) {
894
980
  const loaderText = initLoaderRef.current.querySelector("#loader-text");
@@ -922,7 +1008,7 @@ function PayPalConnectionPage() {
922
1008
  },
923
1009
  [activatePayPal, showError]
924
1010
  );
925
- react.useEffect(() => {
1011
+ React.useEffect(() => {
926
1012
  let alive = true;
927
1013
  fetch(ENVIRONMENT_ENDPOINT, { method: "GET", credentials: "include" }).then((r) => r.json()).then((d) => {
928
1014
  if (!alive) return;
@@ -935,7 +1021,7 @@ function PayPalConnectionPage() {
935
1021
  alive = false;
936
1022
  };
937
1023
  }, []);
938
- react.useEffect(() => {
1024
+ React.useEffect(() => {
939
1025
  if (!envReady) return;
940
1026
  currentRunId.current = ++runIdRef.current;
941
1027
  const runId = currentRunId.current;
@@ -975,7 +1061,7 @@ function PayPalConnectionPage() {
975
1061
  cancelled = true;
976
1062
  };
977
1063
  }, [env, envReady, fetchFreshLink, activatePayPal]);
978
- react.useLayoutEffect(() => {
1064
+ React.useLayoutEffect(() => {
979
1065
  window.onboardingCallback = (authCode, sharedId) => {
980
1066
  void completeOnboarding(authCode, sharedId);
981
1067
  };
@@ -983,7 +1069,7 @@ function PayPalConnectionPage() {
983
1069
  window.onboardingCallback = void 0;
984
1070
  };
985
1071
  }, [completeOnboarding]);
986
- react.useEffect(() => {
1072
+ React.useEffect(() => {
987
1073
  const onMessage = (event) => {
988
1074
  const data = event == null ? void 0 : event.data;
989
1075
  if (!data || data.source !== "paypal-onboarding-return") return;
@@ -1001,8 +1087,8 @@ function PayPalConnectionPage() {
1001
1087
  window.addEventListener("message", onMessage);
1002
1088
  return () => window.removeEventListener("message", onMessage);
1003
1089
  }, [completeOnboarding, refreshStatusAndMaybeConnect]);
1004
- react.useEffect(() => stopStatusPolling, [stopStatusPolling]);
1005
- react.useLayoutEffect(() => {
1090
+ React.useEffect(() => stopStatusPolling, [stopStatusPolling]);
1091
+ React.useLayoutEffect(() => {
1006
1092
  const el = ppBtnMeasureRef.current;
1007
1093
  if (!el) return;
1008
1094
  const update = () => {
@@ -1159,6 +1245,13 @@ function PayPalConnectionPage() {
1159
1245
  }
1160
1246
  )
1161
1247
  ] }),
1248
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsxRuntime.jsx(
1249
+ MerchantStatusNotices,
1250
+ {
1251
+ environment: env,
1252
+ reloadKey: (statusInfo == null ? void 0 : statusInfo.seller_client_id_masked) || ""
1253
+ }
1254
+ ) }),
1162
1255
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 rounded-md border border-ui-border-base bg-ui-bg-subtle p-3 text-xs text-ui-fg-subtle", children: [
1163
1256
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-ui-fg-base", children: "Connected PayPal account" }),
1164
1257
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1", children: [
@@ -1400,7 +1493,7 @@ function PayPalConnectionPage() {
1400
1493
  ` })
1401
1494
  ] });
1402
1495
  }
1403
- function PayPalPayLaterMessagingPage() {
1496
+ function PayPalGooglePayPage() {
1404
1497
  return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
1405
1498
  }
1406
1499
  const COLOR_OPTIONS = [
@@ -1428,7 +1521,7 @@ const LABEL_OPTIONS = [
1428
1521
  { value: "pay", label: "Pay" }
1429
1522
  ];
1430
1523
  function PayPalSettingsTab() {
1431
- const [form, setForm] = react.useState({
1524
+ const [form, setForm] = React.useState({
1432
1525
  enabled: true,
1433
1526
  title: "PayPal",
1434
1527
  description: "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account",
@@ -1438,12 +1531,12 @@ function PayPalSettingsTab() {
1438
1531
  buttonHeight: 48,
1439
1532
  buttonLabel: "paypal"
1440
1533
  });
1441
- const [loading, setLoading] = react.useState(false);
1442
- const [saving, setSaving] = react.useState(false);
1443
- const [toast, setToast] = react.useState(null);
1444
- const didInit = react.useRef(false);
1445
- const dismissToast = react.useCallback(() => setToast(null), []);
1446
- react.useEffect(() => {
1534
+ const [loading, setLoading] = React.useState(false);
1535
+ const [saving, setSaving] = React.useState(false);
1536
+ const [toast, setToast] = React.useState(null);
1537
+ const didInit = React.useRef(false);
1538
+ const dismissToast = React.useCallback(() => setToast(null), []);
1539
+ React.useEffect(() => {
1447
1540
  if (didInit.current) return;
1448
1541
  didInit.current = true;
1449
1542
  (async () => {
@@ -1619,6 +1712,9 @@ function PayPalSettingsTab() {
1619
1712
  )
1620
1713
  ] }) });
1621
1714
  }
1715
+ function PayPalPayLaterMessagingPage() {
1716
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
1717
+ }
1622
1718
  const widgetModule = { widgets: [] };
1623
1719
  const routeModule = {
1624
1720
  routes: [
@@ -1634,10 +1730,6 @@ const routeModule = {
1634
1730
  Component: AdvancedCardPaymentsTab,
1635
1731
  path: "/settings/paypal/advanced-card-payments"
1636
1732
  },
1637
- {
1638
- Component: PayPalGooglePayPage,
1639
- path: "/settings/paypal/google-pay"
1640
- },
1641
1733
  {
1642
1734
  Component: PayPalApplePayPage,
1643
1735
  path: "/settings/paypal/apple-pay"
@@ -1647,12 +1739,16 @@ const routeModule = {
1647
1739
  path: "/settings/paypal/connection"
1648
1740
  },
1649
1741
  {
1650
- Component: PayPalPayLaterMessagingPage,
1651
- path: "/settings/paypal/pay-later-messaging"
1742
+ Component: PayPalGooglePayPage,
1743
+ path: "/settings/paypal/google-pay"
1652
1744
  },
1653
1745
  {
1654
1746
  Component: PayPalSettingsTab,
1655
1747
  path: "/settings/paypal/paypal-settings"
1748
+ },
1749
+ {
1750
+ Component: PayPalPayLaterMessagingPage,
1751
+ path: "/settings/paypal/pay-later-messaging"
1656
1752
  }
1657
1753
  ]
1658
1754
  };