@easypayment/medusa-paypal 0.3.0 → 0.3.2

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.
@@ -75,9 +75,7 @@ const DEFAULT_FORM$1 = {
75
75
  brandName: "PayPal",
76
76
  landingPage: "no_preference",
77
77
  requireInstantPayment: false,
78
- useShippingAsBilling: true,
79
78
  sendItemDetails: true,
80
- skipOrderReviewPage: true,
81
79
  invoicePrefix: "WC-",
82
80
  creditCardStatementName: "PayPal",
83
81
  logPath: "/uploads/wc-logs/"
@@ -175,18 +173,10 @@ function AdditionalSettingsTab() {
175
173
  /* @__PURE__ */ jsxRuntime.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" }),
176
174
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
177
175
  ] }) }),
178
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Billing Address", hint: "If the billing address is empty and PayPal provides a shipping address, the order will use the shipping address as the billing address.", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
179
- /* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.useShippingAsBilling, onChange: (e) => setForm((p) => ({ ...p, useShippingAsBilling: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
180
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Use PayPal Shipping Address as Billing" })
181
- ] }) }),
182
176
  /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
183
177
  /* @__PURE__ */ jsxRuntime.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" }),
184
178
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
185
179
  ] }) }),
186
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Order Review Page", hint: "Payments from the Product or Cart page skip the review step and go straight to the Thank You page.", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
187
- /* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.skipOrderReviewPage, onChange: (e) => setForm((p) => ({ ...p, skipOrderReviewPage: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
188
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Skip Order Review Page" })
189
- ] }) }),
190
180
  /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Invoice prefix", children: /* @__PURE__ */ jsxRuntime.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-" }) }),
191
181
  /* @__PURE__ */ jsxRuntime.jsx(FieldRow$2, { label: "Credit Card Statement Name", children: /* @__PURE__ */ jsxRuntime.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" }) })
192
182
  ] })
@@ -194,9 +184,6 @@ function AdditionalSettingsTab() {
194
184
  )
195
185
  ] }) });
196
186
  }
197
- function PayPalGooglePayPage() {
198
- return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
199
- }
200
187
  async function adminFetch$1(path, opts = {}) {
201
188
  var _a;
202
189
  const { method = "GET", body, query } = opts;
@@ -230,7 +217,7 @@ async function adminFetch$1(path, opts = {}) {
230
217
  return {};
231
218
  }
232
219
  }
233
- const DEFAULT_FORM = { enabled: true, title: "Credit or Debit Card", disabledCards: [], threeDS: "when_required", cardSaveEnabled: false };
220
+ const DEFAULT_FORM = { enabled: true, title: "Credit or Debit Card", disabledCards: [], threeDS: "when_required" };
234
221
  function mergeWithDefaults(saved) {
235
222
  if (!saved) return { ...DEFAULT_FORM };
236
223
  const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
@@ -334,7 +321,7 @@ function AdvancedCardPaymentsTab() {
334
321
  SectionCard$1,
335
322
  {
336
323
  title: "Advanced Card Payments",
337
- description: "Control card checkout settings, 3D Secure behavior, and card saving.",
324
+ description: "Control card checkout settings and 3D Secure behavior.",
338
325
  right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
339
326
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "rounded-md bg-ui-button-neutral px-4 py-2 text-sm font-medium text-ui-fg-on-color shadow-sm hover:opacity-90 disabled:opacity-60", children: saving ? "Saving..." : "Save settings" }),
340
327
  loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
@@ -358,16 +345,15 @@ function AdvancedCardPaymentsTab() {
358
345
  /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
359
346
  /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value)) }),
360
347
  ((_a = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _a.hint) ? /* @__PURE__ */ jsxRuntime.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
361
- ] }) }),
362
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow$1, { label: "Card Save Enabled", hint: "Allow customers to save a card at checkout for future use.", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
363
- /* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.cardSaveEnabled, onChange: (e) => setForm((p) => ({ ...p, cardSaveEnabled: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
364
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable card saving at checkout" })
365
348
  ] }) })
366
349
  ] })
367
350
  }
368
351
  )
369
352
  ] }) });
370
353
  }
354
+ function PayPalGooglePayPage() {
355
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
356
+ }
371
357
  const config = adminSdk.defineRouteConfig({
372
358
  label: "PayPal Connection",
373
359
  hide: true
@@ -991,13 +977,6 @@ async function adminFetch(path, opts = {}) {
991
977
  return {};
992
978
  }
993
979
  }
994
- const DISPLAY_LOCATION_OPTIONS = [
995
- { value: "product", label: "Product Page" },
996
- { value: "cart", label: "Cart Page" },
997
- { value: "express", label: "Express Checkout" },
998
- { value: "checkout", label: "Checkout Page", disabled: true, hint: "Locked by PayPal eligibility / checkout config" },
999
- { value: "mini_cart", label: "Mini Cart (Side Cart)" }
1000
- ];
1001
980
  const DISABLE_BUTTON_OPTIONS = [
1002
981
  { value: "paypal", label: "PayPal" },
1003
982
  { value: "paylater", label: "Pay Later" },
@@ -1103,7 +1082,6 @@ function PayPalSettingsTab() {
1103
1082
  enabled: true,
1104
1083
  title: "PayPal",
1105
1084
  description: "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account",
1106
- displayOn: ["product", "cart", "express", "mini_cart"],
1107
1085
  disableButtons: [],
1108
1086
  buttonColor: "gold",
1109
1087
  buttonShape: "rect",
@@ -1174,7 +1152,6 @@ function PayPalSettingsTab() {
1174
1152
  setSaving(false);
1175
1153
  }
1176
1154
  }
1177
- react.useMemo(() => new Map(DISPLAY_LOCATION_OPTIONS.map((o) => [o.value, o])), []);
1178
1155
  function toggleMulti(key, value) {
1179
1156
  setForm((prev) => {
1180
1157
  const list = prev[key] || [];
@@ -1208,7 +1185,7 @@ function PayPalSettingsTab() {
1208
1185
  SectionCard,
1209
1186
  {
1210
1187
  title: "PayPal Settings",
1211
- description: "Enable PayPal, set title/description, and choose where Smart Buttons appear.",
1188
+ description: "Enable PayPal and configure checkout title.",
1212
1189
  right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
1213
1190
  /* @__PURE__ */ jsxRuntime.jsx(
1214
1191
  "button",
@@ -1243,69 +1220,7 @@ function PayPalSettingsTab() {
1243
1220
  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",
1244
1221
  placeholder: "PayPal"
1245
1222
  }
1246
- ) }),
1247
- /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Description", children: /* @__PURE__ */ jsxRuntime.jsx(
1248
- "textarea",
1249
- {
1250
- value: form.description,
1251
- onChange: (e) => setForm((p) => ({ ...p, description: e.target.value })),
1252
- className: "min-h-[84px] w-full resize-y 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",
1253
- placeholder: "Pay via PayPal..."
1254
- }
1255
- ) }),
1256
- /* @__PURE__ */ jsxRuntime.jsx(
1257
- FieldRow,
1258
- {
1259
- label: "Display PayPal Buttons On",
1260
- hint: "Choose where PayPal Smart Buttons should render.",
1261
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
1262
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
1263
- DISPLAY_LOCATION_OPTIONS.filter((o) => form.displayOn.includes(o.value)).map((o) => /* @__PURE__ */ jsxRuntime.jsxs(
1264
- Pill,
1265
- {
1266
- disabled: o.disabled,
1267
- onRemove: o.disabled ? void 0 : () => removeMulti("displayOn", o.value),
1268
- children: [
1269
- o.label,
1270
- o.disabled ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1 rounded bg-ui-bg-subtle px-1 py-[1px] text-[10px] text-ui-fg-subtle", children: "Locked" }) : null
1271
- ]
1272
- },
1273
- o.value
1274
- )),
1275
- form.displayOn.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No locations selected." }) : null
1276
- ] }),
1277
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base p-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-2 md:grid-cols-2", children: DISPLAY_LOCATION_OPTIONS.map((o) => {
1278
- const checked = form.displayOn.includes(o.value);
1279
- return /* @__PURE__ */ jsxRuntime.jsxs(
1280
- "label",
1281
- {
1282
- className: cx(
1283
- "flex items-start gap-2 rounded-md p-2",
1284
- o.disabled ? "opacity-60" : "hover:bg-ui-bg-subtle"
1285
- ),
1286
- children: [
1287
- /* @__PURE__ */ jsxRuntime.jsx(
1288
- "input",
1289
- {
1290
- type: "checkbox",
1291
- disabled: o.disabled,
1292
- checked,
1293
- onChange: () => toggleMulti("displayOn", o.value),
1294
- className: "mt-0.5 h-4 w-4 rounded border-ui-border-base"
1295
- }
1296
- ),
1297
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col", children: [
1298
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: o.label }),
1299
- o.hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-ui-fg-subtle", children: o.hint }) : null
1300
- ] })
1301
- ]
1302
- },
1303
- o.value
1304
- );
1305
- }) }) })
1306
- ] })
1307
- }
1308
- )
1223
+ ) })
1309
1224
  ] })
1310
1225
  }
1311
1226
  ),
@@ -1432,14 +1347,14 @@ const routeModule = {
1432
1347
  Component: AdditionalSettingsTab,
1433
1348
  path: "/settings/paypal/additional-settings"
1434
1349
  },
1435
- {
1436
- Component: PayPalGooglePayPage,
1437
- path: "/settings/paypal/google-pay"
1438
- },
1439
1350
  {
1440
1351
  Component: AdvancedCardPaymentsTab,
1441
1352
  path: "/settings/paypal/advanced-card-payments"
1442
1353
  },
1354
+ {
1355
+ Component: PayPalGooglePayPage,
1356
+ path: "/settings/paypal/google-pay"
1357
+ },
1443
1358
  {
1444
1359
  Component: PayPalConnectionPage,
1445
1360
  path: "/settings/paypal/connection"
@@ -74,9 +74,7 @@ const DEFAULT_FORM$1 = {
74
74
  brandName: "PayPal",
75
75
  landingPage: "no_preference",
76
76
  requireInstantPayment: false,
77
- useShippingAsBilling: true,
78
77
  sendItemDetails: true,
79
- skipOrderReviewPage: true,
80
78
  invoicePrefix: "WC-",
81
79
  creditCardStatementName: "PayPal",
82
80
  logPath: "/uploads/wc-logs/"
@@ -174,18 +172,10 @@ function AdditionalSettingsTab() {
174
172
  /* @__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" }),
175
173
  /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Require Instant Payment" })
176
174
  ] }) }),
177
- /* @__PURE__ */ jsx(FieldRow$2, { label: "Billing Address", hint: "If the billing address is empty and PayPal provides a shipping address, the order will use the shipping address as the billing address.", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
178
- /* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.useShippingAsBilling, onChange: (e) => setForm((p) => ({ ...p, useShippingAsBilling: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
179
- /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Use PayPal Shipping Address as Billing" })
180
- ] }) }),
181
175
  /* @__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: [
182
176
  /* @__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" }),
183
177
  /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Send line item details to PayPal" })
184
178
  ] }) }),
185
- /* @__PURE__ */ jsx(FieldRow$2, { label: "Order Review Page", hint: "Payments from the Product or Cart page skip the review step and go straight to the Thank You page.", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
186
- /* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.skipOrderReviewPage, onChange: (e) => setForm((p) => ({ ...p, skipOrderReviewPage: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
187
- /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Skip Order Review Page" })
188
- ] }) }),
189
179
  /* @__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-" }) }),
190
180
  /* @__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" }) })
191
181
  ] })
@@ -193,9 +183,6 @@ function AdditionalSettingsTab() {
193
183
  )
194
184
  ] }) });
195
185
  }
196
- function PayPalGooglePayPage() {
197
- return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
198
- }
199
186
  async function adminFetch$1(path, opts = {}) {
200
187
  var _a;
201
188
  const { method = "GET", body, query } = opts;
@@ -229,7 +216,7 @@ async function adminFetch$1(path, opts = {}) {
229
216
  return {};
230
217
  }
231
218
  }
232
- const DEFAULT_FORM = { enabled: true, title: "Credit or Debit Card", disabledCards: [], threeDS: "when_required", cardSaveEnabled: false };
219
+ const DEFAULT_FORM = { enabled: true, title: "Credit or Debit Card", disabledCards: [], threeDS: "when_required" };
233
220
  function mergeWithDefaults(saved) {
234
221
  if (!saved) return { ...DEFAULT_FORM };
235
222
  const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
@@ -333,7 +320,7 @@ function AdvancedCardPaymentsTab() {
333
320
  SectionCard$1,
334
321
  {
335
322
  title: "Advanced Card Payments",
336
- description: "Control card checkout settings, 3D Secure behavior, and card saving.",
323
+ description: "Control card checkout settings and 3D Secure behavior.",
337
324
  right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
338
325
  /* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "rounded-md bg-ui-button-neutral px-4 py-2 text-sm font-medium text-ui-fg-on-color shadow-sm hover:opacity-90 disabled:opacity-60", children: saving ? "Saving..." : "Save settings" }),
339
326
  loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
@@ -357,16 +344,15 @@ function AdvancedCardPaymentsTab() {
357
344
  /* @__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: [
358
345
  /* @__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)) }),
359
346
  ((_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
360
- ] }) }),
361
- /* @__PURE__ */ jsx(FieldRow$1, { label: "Card Save Enabled", hint: "Allow customers to save a card at checkout for future use.", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
362
- /* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.cardSaveEnabled, onChange: (e) => setForm((p) => ({ ...p, cardSaveEnabled: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
363
- /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable card saving at checkout" })
364
347
  ] }) })
365
348
  ] })
366
349
  }
367
350
  )
368
351
  ] }) });
369
352
  }
353
+ function PayPalGooglePayPage() {
354
+ return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
355
+ }
370
356
  const config = defineRouteConfig({
371
357
  label: "PayPal Connection",
372
358
  hide: true
@@ -990,13 +976,6 @@ async function adminFetch(path, opts = {}) {
990
976
  return {};
991
977
  }
992
978
  }
993
- const DISPLAY_LOCATION_OPTIONS = [
994
- { value: "product", label: "Product Page" },
995
- { value: "cart", label: "Cart Page" },
996
- { value: "express", label: "Express Checkout" },
997
- { value: "checkout", label: "Checkout Page", disabled: true, hint: "Locked by PayPal eligibility / checkout config" },
998
- { value: "mini_cart", label: "Mini Cart (Side Cart)" }
999
- ];
1000
979
  const DISABLE_BUTTON_OPTIONS = [
1001
980
  { value: "paypal", label: "PayPal" },
1002
981
  { value: "paylater", label: "Pay Later" },
@@ -1102,7 +1081,6 @@ function PayPalSettingsTab() {
1102
1081
  enabled: true,
1103
1082
  title: "PayPal",
1104
1083
  description: "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account",
1105
- displayOn: ["product", "cart", "express", "mini_cart"],
1106
1084
  disableButtons: [],
1107
1085
  buttonColor: "gold",
1108
1086
  buttonShape: "rect",
@@ -1173,7 +1151,6 @@ function PayPalSettingsTab() {
1173
1151
  setSaving(false);
1174
1152
  }
1175
1153
  }
1176
- useMemo(() => new Map(DISPLAY_LOCATION_OPTIONS.map((o) => [o.value, o])), []);
1177
1154
  function toggleMulti(key, value) {
1178
1155
  setForm((prev) => {
1179
1156
  const list = prev[key] || [];
@@ -1207,7 +1184,7 @@ function PayPalSettingsTab() {
1207
1184
  SectionCard,
1208
1185
  {
1209
1186
  title: "PayPal Settings",
1210
- description: "Enable PayPal, set title/description, and choose where Smart Buttons appear.",
1187
+ description: "Enable PayPal and configure checkout title.",
1211
1188
  right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
1212
1189
  /* @__PURE__ */ jsx(
1213
1190
  "button",
@@ -1242,69 +1219,7 @@ function PayPalSettingsTab() {
1242
1219
  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",
1243
1220
  placeholder: "PayPal"
1244
1221
  }
1245
- ) }),
1246
- /* @__PURE__ */ jsx(FieldRow, { label: "Description", children: /* @__PURE__ */ jsx(
1247
- "textarea",
1248
- {
1249
- value: form.description,
1250
- onChange: (e) => setForm((p) => ({ ...p, description: e.target.value })),
1251
- className: "min-h-[84px] w-full resize-y 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",
1252
- placeholder: "Pay via PayPal..."
1253
- }
1254
- ) }),
1255
- /* @__PURE__ */ jsx(
1256
- FieldRow,
1257
- {
1258
- label: "Display PayPal Buttons On",
1259
- hint: "Choose where PayPal Smart Buttons should render.",
1260
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
1261
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
1262
- DISPLAY_LOCATION_OPTIONS.filter((o) => form.displayOn.includes(o.value)).map((o) => /* @__PURE__ */ jsxs(
1263
- Pill,
1264
- {
1265
- disabled: o.disabled,
1266
- onRemove: o.disabled ? void 0 : () => removeMulti("displayOn", o.value),
1267
- children: [
1268
- o.label,
1269
- o.disabled ? /* @__PURE__ */ jsx("span", { className: "ml-1 rounded bg-ui-bg-subtle px-1 py-[1px] text-[10px] text-ui-fg-subtle", children: "Locked" }) : null
1270
- ]
1271
- },
1272
- o.value
1273
- )),
1274
- form.displayOn.length === 0 ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No locations selected." }) : null
1275
- ] }),
1276
- /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base p-3", children: /* @__PURE__ */ jsx("div", { className: "grid gap-2 md:grid-cols-2", children: DISPLAY_LOCATION_OPTIONS.map((o) => {
1277
- const checked = form.displayOn.includes(o.value);
1278
- return /* @__PURE__ */ jsxs(
1279
- "label",
1280
- {
1281
- className: cx(
1282
- "flex items-start gap-2 rounded-md p-2",
1283
- o.disabled ? "opacity-60" : "hover:bg-ui-bg-subtle"
1284
- ),
1285
- children: [
1286
- /* @__PURE__ */ jsx(
1287
- "input",
1288
- {
1289
- type: "checkbox",
1290
- disabled: o.disabled,
1291
- checked,
1292
- onChange: () => toggleMulti("displayOn", o.value),
1293
- className: "mt-0.5 h-4 w-4 rounded border-ui-border-base"
1294
- }
1295
- ),
1296
- /* @__PURE__ */ jsxs("span", { className: "flex flex-col", children: [
1297
- /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: o.label }),
1298
- o.hint ? /* @__PURE__ */ jsx("span", { className: "text-xs text-ui-fg-subtle", children: o.hint }) : null
1299
- ] })
1300
- ]
1301
- },
1302
- o.value
1303
- );
1304
- }) }) })
1305
- ] })
1306
- }
1307
- )
1222
+ ) })
1308
1223
  ] })
1309
1224
  }
1310
1225
  ),
@@ -1431,14 +1346,14 @@ const routeModule = {
1431
1346
  Component: AdditionalSettingsTab,
1432
1347
  path: "/settings/paypal/additional-settings"
1433
1348
  },
1434
- {
1435
- Component: PayPalGooglePayPage,
1436
- path: "/settings/paypal/google-pay"
1437
- },
1438
1349
  {
1439
1350
  Component: AdvancedCardPaymentsTab,
1440
1351
  path: "/settings/paypal/advanced-card-payments"
1441
1352
  },
1353
+ {
1354
+ Component: PayPalGooglePayPage,
1355
+ path: "/settings/paypal/google-pay"
1356
+ },
1442
1357
  {
1443
1358
  Component: PayPalConnectionPage,
1444
1359
  path: "/settings/paypal/connection"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easypayment/medusa-paypal",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Industry-standard PayPal integration for Medusa v2",
5
5
  "license": "MIT",
6
6
  "main": "./.medusa/server/src/index.js",
@@ -42,9 +42,7 @@ type AdditionalSettingsForm = {
42
42
  brandName: string
43
43
  landingPage: LandingPage
44
44
  requireInstantPayment: boolean
45
- useShippingAsBilling: boolean
46
45
  sendItemDetails: boolean
47
- skipOrderReviewPage: boolean
48
46
  invoicePrefix: string
49
47
  creditCardStatementName: string
50
48
  logPath?: string
@@ -55,9 +53,7 @@ const DEFAULT_FORM: AdditionalSettingsForm = {
55
53
  brandName: "PayPal",
56
54
  landingPage: "no_preference",
57
55
  requireInstantPayment: false,
58
- useShippingAsBilling: true,
59
56
  sendItemDetails: true,
60
- skipOrderReviewPage: true,
61
57
  invoicePrefix: "WC-",
62
58
  creditCardStatementName: "PayPal",
63
59
  logPath: "/uploads/wc-logs/",
@@ -186,24 +182,12 @@ export default function AdditionalSettingsTab() {
186
182
  <span className="text-sm text-ui-fg-base">Require Instant Payment</span>
187
183
  </label>
188
184
  </FieldRow>
189
- <FieldRow label="Billing Address" hint="If the billing address is empty and PayPal provides a shipping address, the order will use the shipping address as the billing address.">
190
- <label className="inline-flex items-center gap-2">
191
- <input type="checkbox" checked={form.useShippingAsBilling} onChange={(e) => setForm((p) => ({ ...p, useShippingAsBilling: e.target.checked }))} className="h-4 w-4 rounded border-ui-border-base" />
192
- <span className="text-sm text-ui-fg-base">Use PayPal Shipping Address as Billing</span>
193
- </label>
194
- </FieldRow>
195
185
  <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.">
196
186
  <label className="inline-flex items-center gap-2">
197
187
  <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" />
198
188
  <span className="text-sm text-ui-fg-base">Send line item details to PayPal</span>
199
189
  </label>
200
190
  </FieldRow>
201
- <FieldRow label="Order Review Page" hint="Payments from the Product or Cart page skip the review step and go straight to the Thank You page.">
202
- <label className="inline-flex items-center gap-2">
203
- <input type="checkbox" checked={form.skipOrderReviewPage} onChange={(e) => setForm((p) => ({ ...p, skipOrderReviewPage: e.target.checked }))} className="h-4 w-4 rounded border-ui-border-base" />
204
- <span className="text-sm text-ui-fg-base">Skip Order Review Page</span>
205
- </label>
206
- </FieldRow>
207
191
  <FieldRow label="Invoice prefix">
208
192
  <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-" />
209
193
  </FieldRow>