@easypayment/medusa-paypal-ui 1.0.45 → 1.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,8 +1,40 @@
1
- 'use strict';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
19
 
3
- var react = require('react');
4
- var reactPaypalJs = require('@paypal/react-paypal-js');
5
- var jsxRuntime = require('react/jsx-runtime');
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ MedusaNextPayPalAdapter: () => MedusaNextPayPalAdapter,
24
+ PAYPAL_CARD_PROVIDER_ID: () => PAYPAL_CARD_PROVIDER_ID,
25
+ PAYPAL_WALLET_PROVIDER_ID: () => PAYPAL_WALLET_PROVIDER_ID,
26
+ PayPalAdvancedCard: () => PayPalAdvancedCard,
27
+ PayPalCurrencyNotice: () => PayPalCurrencyNotice,
28
+ PayPalPaymentSection: () => PayPalPaymentSection,
29
+ PayPalProvider: () => PayPalProvider,
30
+ PayPalSmartButtons: () => PayPalSmartButtons,
31
+ createPayPalStoreApi: () => createPayPalStoreApi,
32
+ isPayPalProviderId: () => isPayPalProviderId,
33
+ markPaymentComplete: () => markPaymentComplete,
34
+ usePayPalConfig: () => usePayPalConfig,
35
+ usePayPalPaymentMethods: () => usePayPalPaymentMethods
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
6
38
 
7
39
  // src/client/http.ts
8
40
  function toHeaderRecord(headers) {
@@ -41,25 +73,47 @@ function createHttpClient(opts) {
41
73
  "[PayPal] Forbidden (403) \u2014 this request is not allowed. Check your CORS and API key settings."
42
74
  );
43
75
  }
44
- throw new Error(text || `Request failed (${res.status})`);
76
+ throw new Error(
77
+ text.slice(0, 500).replace(/<[^>]*>/g, "") || `Request failed (${res.status})`
78
+ );
79
+ }
80
+ if (!text) {
81
+ throw new Error(`[PayPal] Empty response body from ${path} (${res.status})`);
45
82
  }
46
- if (!text) return {};
47
83
  const contentType = res.headers.get("content-type") || "";
48
84
  if (!contentType.includes("application/json")) {
49
- console.warn("[PayPal] Unexpected non-JSON response:", contentType, text.slice(0, 200));
50
- return {};
85
+ throw new Error(
86
+ `[PayPal] Unexpected non-JSON response (${contentType}) from ${path}`
87
+ );
51
88
  }
52
89
  try {
53
90
  return JSON.parse(text);
54
91
  } catch {
55
- console.warn("[PayPal] Failed to parse JSON response:", text.slice(0, 200));
56
- return {};
92
+ throw new Error(`[PayPal] Failed to parse JSON response from ${path}`);
57
93
  }
58
94
  }
59
95
  return { request };
60
96
  }
61
97
 
62
98
  // src/client/paypal.ts
99
+ async function markPaymentComplete(baseUrl, cartId, publishableApiKey) {
100
+ try {
101
+ const resp = await fetch(`${baseUrl.replace(/\/$/, "")}/store/paypal-complete`, {
102
+ method: "POST",
103
+ headers: {
104
+ "Content-Type": "application/json",
105
+ ...publishableApiKey ? { "x-publishable-api-key": publishableApiKey } : {}
106
+ },
107
+ body: JSON.stringify({ cart_id: cartId }),
108
+ credentials: "include"
109
+ });
110
+ const data = await resp.json().catch(() => ({}));
111
+ return data || {};
112
+ } catch (e) {
113
+ console.warn("[PayPal] paypal-complete call failed:", e);
114
+ return {};
115
+ }
116
+ }
63
117
  function createPayPalStoreApi(opts) {
64
118
  const http = createHttpClient(opts);
65
119
  return {
@@ -86,6 +140,9 @@ function createPayPalStoreApi(opts) {
86
140
  }
87
141
  };
88
142
  }
143
+
144
+ // src/hooks/usePayPalConfig.ts
145
+ var import_react = require("react");
89
146
  var _cache = /* @__PURE__ */ new Map();
90
147
  var CACHE_TTL = 5 * 60 * 1e3;
91
148
  function cacheKey(baseUrl, cartId) {
@@ -97,18 +154,18 @@ function usePayPalConfig({
97
154
  cartId,
98
155
  enabled = true
99
156
  }) {
100
- const api = react.useMemo(
157
+ const api = (0, import_react.useMemo)(
101
158
  () => createPayPalStoreApi({ baseUrl, publishableApiKey }),
102
159
  [baseUrl, publishableApiKey]
103
160
  );
104
161
  const key = cacheKey(baseUrl, cartId);
105
162
  const hit = _cache.get(key);
106
163
  const seedConfig = hit && Date.now() - hit.at < CACHE_TTL ? hit.config : null;
107
- const [config, setConfig] = react.useState(seedConfig);
108
- const [loading, setLoading] = react.useState(seedConfig === null && enabled);
109
- const [error, setError] = react.useState(null);
110
- const fetchIdRef = react.useRef(0);
111
- react.useEffect(() => {
164
+ const [config, setConfig] = (0, import_react.useState)(seedConfig);
165
+ const [loading, setLoading] = (0, import_react.useState)(seedConfig === null && enabled);
166
+ const [error, setError] = (0, import_react.useState)(null);
167
+ const fetchIdRef = (0, import_react.useRef)(0);
168
+ (0, import_react.useEffect)(() => {
112
169
  if (!enabled) {
113
170
  setLoading(false);
114
171
  setError(null);
@@ -148,13 +205,17 @@ function usePayPalConfig({
148
205
  }, [api, baseUrl, cartId, enabled]);
149
206
  return { config, loading, error };
150
207
  }
208
+
209
+ // src/components/PayPalProvider.tsx
210
+ var import_react2 = require("react");
211
+ var import_react_paypal_js = require("@paypal/react-paypal-js");
212
+ var import_jsx_runtime = require("react/jsx-runtime");
151
213
  var BN_CODE = "MBJTechnolabs_SI_SPB";
152
214
  function PayPalProvider(props) {
153
215
  const { config, intent = "capture", disableFunding, children } = props;
154
- const options = react.useMemo(() => {
216
+ const options = (0, import_react2.useMemo)(() => {
155
217
  return {
156
218
  clientId: config.client_id,
157
- "client-id": config.client_id,
158
219
  currency: config.currency,
159
220
  intent,
160
221
  components: config.client_token ? "buttons,card-fields" : "buttons",
@@ -163,8 +224,8 @@ function PayPalProvider(props) {
163
224
  "data-partner-attribution-id": BN_CODE
164
225
  };
165
226
  }, [config, intent, disableFunding]);
166
- return /* @__PURE__ */ jsxRuntime.jsx(
167
- reactPaypalJs.PayPalScriptProvider,
227
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
228
+ import_react_paypal_js.PayPalScriptProvider,
168
229
  {
169
230
  options,
170
231
  children
@@ -172,13 +233,21 @@ function PayPalProvider(props) {
172
233
  `${options.clientId}-${options["data-client-token"] ?? "no-token"}`
173
234
  );
174
235
  }
236
+
237
+ // src/components/PayPalCurrencyNotice.tsx
238
+ var import_jsx_runtime2 = require("react/jsx-runtime");
175
239
  function PayPalCurrencyNotice({ config }) {
176
240
  if (config.currency_supported) return null;
177
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: 12, border: "1px solid #ddd", borderRadius: 10 }, children: [
178
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 600, marginBottom: 6 }, children: "PayPal currency issue" }),
179
- /* @__PURE__ */ jsxRuntime.jsx("ul", { style: { margin: 0, paddingLeft: 18 }, children: (config.currency_errors || []).map((e, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: e }, i)) })
241
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { padding: 12, border: "1px solid #ddd", borderRadius: 10 }, children: [
242
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { fontWeight: 600, marginBottom: 6 }, children: "PayPal currency issue" }),
243
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { style: { margin: 0, paddingLeft: 18 }, children: (config.currency_errors || []).map((e) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: e }, e)) })
180
244
  ] });
181
245
  }
246
+
247
+ // src/components/PayPalSmartButtons.tsx
248
+ var import_react3 = require("react");
249
+ var import_react_paypal_js2 = require("@paypal/react-paypal-js");
250
+ var import_jsx_runtime3 = require("react/jsx-runtime");
182
251
  var SPIN_STYLE = `@keyframes _pp_spin { to { transform: rotate(360deg) } }`;
183
252
  var BUTTON_WIDTH_MAP = {
184
253
  small: "300px",
@@ -186,34 +255,19 @@ var BUTTON_WIDTH_MAP = {
186
255
  large: "500px",
187
256
  responsive: "100%"
188
257
  };
189
- async function markPaymentComplete(baseUrl, cartId, publishableApiKey) {
190
- try {
191
- await fetch(`${baseUrl.replace(/\/$/, "")}/store/paypal-complete`, {
192
- method: "POST",
193
- headers: {
194
- "Content-Type": "application/json",
195
- ...publishableApiKey ? { "x-publishable-api-key": publishableApiKey } : {}
196
- },
197
- body: JSON.stringify({ cart_id: cartId }),
198
- credentials: "include"
199
- });
200
- } catch (e) {
201
- console.warn("[PayPal] paypal-complete call failed:", e);
202
- }
203
- }
204
258
  function PayPalSmartButtons(props) {
205
259
  const { baseUrl, publishableApiKey, cartId, config, onPaid, onError } = props;
206
- const api = react.useMemo(
260
+ const api = (0, import_react3.useMemo)(
207
261
  () => createPayPalStoreApi({ baseUrl, publishableApiKey }),
208
262
  [baseUrl, publishableApiKey]
209
263
  );
210
- const [error, setError] = react.useState(null);
211
- const [processing, setProcessing] = react.useState(false);
264
+ const [error, setError] = (0, import_react3.useState)(null);
265
+ const [processing, setProcessing] = (0, import_react3.useState)(false);
212
266
  if (!config.currency_supported) return null;
213
267
  const containerWidth = BUTTON_WIDTH_MAP[config.button_width ?? "responsive"] ?? "100%";
214
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: containerWidth, position: "relative" }, children: [
215
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: SPIN_STYLE }),
216
- processing && /* @__PURE__ */ jsxRuntime.jsxs(
268
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { width: containerWidth, position: "relative" }, children: [
269
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: SPIN_STYLE }),
270
+ processing && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
217
271
  "div",
218
272
  {
219
273
  style: {
@@ -230,7 +284,7 @@ function PayPalSmartButtons(props) {
230
284
  minHeight: 60
231
285
  },
232
286
  children: [
233
- /* @__PURE__ */ jsxRuntime.jsx(
287
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
234
288
  "div",
235
289
  {
236
290
  style: {
@@ -243,14 +297,14 @@ function PayPalSmartButtons(props) {
243
297
  }
244
298
  }
245
299
  ),
246
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center" }, children: [
247
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, color: "#374151", fontWeight: 500 }, children: "Processing your payment\u2026" }),
248
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#6b7280", marginTop: 4 }, children: "Please do not close or refresh this page" })
300
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { textAlign: "center" }, children: [
301
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 13, color: "#374151", fontWeight: 500 }, children: "Processing your payment\u2026" }),
302
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 12, color: "#6b7280", marginTop: 4 }, children: "Please do not close or refresh this page" })
249
303
  ] })
250
304
  ]
251
305
  }
252
306
  ),
253
- config.environment === "sandbox" && /* @__PURE__ */ jsxRuntime.jsxs(
307
+ config.environment === "sandbox" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
254
308
  "div",
255
309
  {
256
310
  style: {
@@ -267,7 +321,7 @@ function PayPalSmartButtons(props) {
267
321
  marginBottom: 10
268
322
  },
269
323
  children: [
270
- /* @__PURE__ */ jsxRuntime.jsxs(
324
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
271
325
  "svg",
272
326
  {
273
327
  width: "16",
@@ -279,17 +333,17 @@ function PayPalSmartButtons(props) {
279
333
  strokeLinecap: "round",
280
334
  style: { flexShrink: 0, marginTop: 1 },
281
335
  children: [
282
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
283
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 8v4M12 16h.01" })
336
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
337
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 8v4M12 16h.01" })
284
338
  ]
285
339
  }
286
340
  ),
287
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Sandbox mode \u2014 you will not be charged. Use your PayPal sandbox account to complete the payment." })
341
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Sandbox mode \u2014 you will not be charged. Use your PayPal sandbox account to complete the payment." })
288
342
  ]
289
343
  }
290
344
  ),
291
- /* @__PURE__ */ jsxRuntime.jsx(
292
- reactPaypalJs.PayPalButtons,
345
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
346
+ import_react_paypal_js2.PayPalButtons,
293
347
  {
294
348
  style: {
295
349
  layout: "vertical",
@@ -309,12 +363,13 @@ function PayPalSmartButtons(props) {
309
363
  setError(null);
310
364
  const orderId = String(data?.orderID || "");
311
365
  const result = await api.captureOrder(cartId, orderId);
312
- await markPaymentComplete(baseUrl, cartId, publishableApiKey);
313
- onPaid?.(result);
366
+ const completeResult = await markPaymentComplete(baseUrl, cartId, publishableApiKey);
367
+ onPaid?.({ ...result, ...completeResult });
314
368
  } catch (e) {
315
369
  const msg = e instanceof Error ? e.message : "Payment capture failed";
316
370
  setError(msg);
317
371
  onError?.(msg);
372
+ } finally {
318
373
  setProcessing(false);
319
374
  }
320
375
  },
@@ -329,7 +384,7 @@ function PayPalSmartButtons(props) {
329
384
  }
330
385
  }
331
386
  ),
332
- error ? /* @__PURE__ */ jsxRuntime.jsxs(
387
+ error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
333
388
  "div",
334
389
  {
335
390
  style: {
@@ -346,13 +401,18 @@ function PayPalSmartButtons(props) {
346
401
  lineHeight: 1.5
347
402
  },
348
403
  children: [
349
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { flexShrink: 0, fontSize: 15 }, children: "\u26A0\uFE0F" }),
350
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: error })
404
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { flexShrink: 0, fontSize: 15 }, children: "\u26A0\uFE0F" }),
405
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: error })
351
406
  ]
352
407
  }
353
408
  ) : null
354
409
  ] });
355
410
  }
411
+
412
+ // src/components/PayPalAdvancedCard.tsx
413
+ var import_react4 = require("react");
414
+ var import_react_paypal_js3 = require("@paypal/react-paypal-js");
415
+ var import_jsx_runtime4 = require("react/jsx-runtime");
356
416
  var SPIN_STYLE2 = `@keyframes _pp_spin { to { transform: rotate(360deg) } }`;
357
417
  var cardStyle = {
358
418
  input: {
@@ -396,29 +456,14 @@ var labelStyle = {
396
456
  marginBottom: 6,
397
457
  letterSpacing: "0.01em"
398
458
  };
399
- async function markPaymentComplete2(baseUrl, cartId, publishableApiKey) {
400
- try {
401
- await fetch(`${baseUrl.replace(/\/$/, "")}/store/paypal-complete`, {
402
- method: "POST",
403
- headers: {
404
- "Content-Type": "application/json",
405
- ...publishableApiKey ? { "x-publishable-api-key": publishableApiKey } : {}
406
- },
407
- body: JSON.stringify({ cart_id: cartId }),
408
- credentials: "include"
409
- });
410
- } catch (e) {
411
- console.warn("[PayPal Card] paypal-complete call failed:", e);
412
- }
413
- }
414
459
  function SubmitButton({
415
460
  disabled,
416
461
  label,
417
462
  onSubmit
418
463
  }) {
419
- const { cardFieldsForm } = reactPaypalJs.usePayPalCardFields();
464
+ const { cardFieldsForm } = (0, import_react_paypal_js3.usePayPalCardFields)();
420
465
  const isDisabled = disabled || !cardFieldsForm;
421
- return /* @__PURE__ */ jsxRuntime.jsx(
466
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
422
467
  "button",
423
468
  {
424
469
  type: "button",
@@ -445,12 +490,14 @@ function SubmitButton({
445
490
  },
446
491
  onMouseEnter: (e) => {
447
492
  if (!isDisabled) {
493
+ ;
448
494
  e.target.style.background = "linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%)";
449
495
  e.target.style.boxShadow = "0 4px 6px rgba(37,99,235,0.35), 0 2px 4px rgba(0,0,0,0.06)";
450
496
  }
451
497
  },
452
498
  onMouseLeave: (e) => {
453
499
  if (!isDisabled) {
500
+ ;
454
501
  e.target.style.background = "linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%)";
455
502
  e.target.style.boxShadow = "0 1px 3px rgba(37,99,235,0.3), 0 1px 2px rgba(0,0,0,0.06)";
456
503
  }
@@ -461,15 +508,15 @@ function SubmitButton({
461
508
  }
462
509
  function PayPalAdvancedCard(props) {
463
510
  const { baseUrl, publishableApiKey, cartId, config, onPaid, onError } = props;
464
- const api = react.useMemo(
511
+ const api = (0, import_react4.useMemo)(
465
512
  () => createPayPalStoreApi({ baseUrl, publishableApiKey }),
466
513
  [baseUrl, publishableApiKey]
467
514
  );
468
- const [error, setError] = react.useState(null);
469
- const [submitting, setSubmitting] = react.useState(false);
515
+ const [error, setError] = (0, import_react4.useState)(null);
516
+ const [submitting, setSubmitting] = (0, import_react4.useState)(false);
470
517
  if (!config.currency_supported) return null;
471
518
  if (!config.client_token) {
472
- return /* @__PURE__ */ jsxRuntime.jsx(
519
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
473
520
  "div",
474
521
  {
475
522
  style: {
@@ -485,9 +532,9 @@ function PayPalAdvancedCard(props) {
485
532
  );
486
533
  }
487
534
  const isSandbox = config.environment === "sandbox";
488
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
489
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: SPIN_STYLE2 }),
490
- submitting && /* @__PURE__ */ jsxRuntime.jsxs(
535
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { position: "relative" }, children: [
536
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: SPIN_STYLE2 }),
537
+ submitting && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
491
538
  "div",
492
539
  {
493
540
  style: {
@@ -504,7 +551,7 @@ function PayPalAdvancedCard(props) {
504
551
  minHeight: 180
505
552
  },
506
553
  children: [
507
- /* @__PURE__ */ jsxRuntime.jsx(
554
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
508
555
  "div",
509
556
  {
510
557
  style: {
@@ -517,20 +564,20 @@ function PayPalAdvancedCard(props) {
517
564
  }
518
565
  }
519
566
  ),
520
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center" }, children: [
521
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 15, fontWeight: 600, color: "#111827" }, children: "Processing your payment\u2026" }),
522
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, color: "#6b7280", marginTop: 4 }, children: "Please do not close or refresh this page" })
567
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { textAlign: "center" }, children: [
568
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: 15, fontWeight: 600, color: "#111827" }, children: "Processing your payment\u2026" }),
569
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: 13, color: "#6b7280", marginTop: 4 }, children: "Please do not close or refresh this page" })
523
570
  ] })
524
571
  ]
525
572
  }
526
573
  ),
527
- /* @__PURE__ */ jsxRuntime.jsx(
528
- reactPaypalJs.PayPalCardFieldsProvider,
574
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
575
+ import_react_paypal_js3.PayPalCardFieldsProvider,
529
576
  {
530
577
  style: cardStyle,
531
578
  createOrder: async () => {
532
579
  setError(null);
533
- const r = await api.createOrder(cartId);
580
+ const r = await api.createOrder(cartId, true);
534
581
  return r.id;
535
582
  },
536
583
  onApprove: async (data) => {
@@ -538,12 +585,13 @@ function PayPalAdvancedCard(props) {
538
585
  setError(null);
539
586
  const orderId = String(data?.orderID || "");
540
587
  const result = await api.captureOrder(cartId, orderId);
541
- await markPaymentComplete2(baseUrl, cartId, publishableApiKey);
542
- onPaid?.(result);
588
+ const completeResult = await markPaymentComplete(baseUrl, cartId, publishableApiKey);
589
+ onPaid?.({ ...result, ...completeResult });
543
590
  } catch (e) {
544
591
  const msg = e instanceof Error ? e.message : "Card payment failed";
545
592
  setError(msg);
546
593
  onError?.(msg);
594
+ } finally {
547
595
  setSubmitting(false);
548
596
  }
549
597
  },
@@ -556,7 +604,7 @@ function PayPalAdvancedCard(props) {
556
604
  onError?.(msg);
557
605
  setSubmitting(false);
558
606
  },
559
- children: /* @__PURE__ */ jsxRuntime.jsxs(
607
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
560
608
  "div",
561
609
  {
562
610
  style: {
@@ -566,7 +614,7 @@ function PayPalAdvancedCard(props) {
566
614
  width: "100%"
567
615
  },
568
616
  children: [
569
- isSandbox && /* @__PURE__ */ jsxRuntime.jsxs(
617
+ isSandbox && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
570
618
  "div",
571
619
  {
572
620
  style: {
@@ -582,22 +630,22 @@ function PayPalAdvancedCard(props) {
582
630
  lineHeight: 1.55
583
631
  },
584
632
  children: [
585
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 15, flexShrink: 0, marginTop: 1 }, children: "\u{1F9EA}" }),
586
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
633
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: 15, flexShrink: 0, marginTop: 1 }, children: "\u{1F9EA}" }),
634
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
587
635
  "Sandbox mode \u2014 use test card",
588
636
  " ",
589
- /* @__PURE__ */ jsxRuntime.jsx("strong", { style: { fontFamily: "monospace", letterSpacing: "0.05em" }, children: "4111 1111 1111 1111" }),
637
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { style: { fontFamily: "monospace", letterSpacing: "0.05em" }, children: "4111 1111 1111 1111" }),
590
638
  " ",
591
639
  "with any future date and any CVV."
592
640
  ] })
593
641
  ]
594
642
  }
595
643
  ),
596
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
597
- /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle, children: "Card number" }),
598
- /* @__PURE__ */ jsxRuntime.jsx(reactPaypalJs.PayPalNumberField, {})
644
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
645
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: labelStyle, children: "Card number" }),
646
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_paypal_js3.PayPalNumberField, {})
599
647
  ] }),
600
- /* @__PURE__ */ jsxRuntime.jsxs(
648
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
601
649
  "div",
602
650
  {
603
651
  style: {
@@ -606,18 +654,18 @@ function PayPalAdvancedCard(props) {
606
654
  gap: 16
607
655
  },
608
656
  children: [
609
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
610
- /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle, children: "Expiration date" }),
611
- /* @__PURE__ */ jsxRuntime.jsx(reactPaypalJs.PayPalExpiryField, {})
657
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
658
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: labelStyle, children: "Expiration date" }),
659
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_paypal_js3.PayPalExpiryField, {})
612
660
  ] }),
613
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
614
- /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle, children: "Security code" }),
615
- /* @__PURE__ */ jsxRuntime.jsx(reactPaypalJs.PayPalCVVField, {})
661
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
662
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { style: labelStyle, children: "Security code" }),
663
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_paypal_js3.PayPalCVVField, {})
616
664
  ] })
617
665
  ]
618
666
  }
619
667
  ),
620
- /* @__PURE__ */ jsxRuntime.jsxs(
668
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
621
669
  "div",
622
670
  {
623
671
  style: {
@@ -628,7 +676,7 @@ function PayPalAdvancedCard(props) {
628
676
  color: "#6b7280"
629
677
  },
630
678
  children: [
631
- /* @__PURE__ */ jsxRuntime.jsx(
679
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
632
680
  "svg",
633
681
  {
634
682
  width: "14",
@@ -639,14 +687,14 @@ function PayPalAdvancedCard(props) {
639
687
  strokeWidth: "2.5",
640
688
  strokeLinecap: "round",
641
689
  strokeLinejoin: "round",
642
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" })
690
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" })
643
691
  }
644
692
  ),
645
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Your payment is secured with 256-bit SSL encryption" })
693
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Your payment is secured with 256-bit SSL encryption" })
646
694
  ]
647
695
  }
648
696
  ),
649
- /* @__PURE__ */ jsxRuntime.jsx(
697
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
650
698
  SubmitButton,
651
699
  {
652
700
  disabled: submitting,
@@ -657,7 +705,7 @@ function PayPalAdvancedCard(props) {
657
705
  }
658
706
  }
659
707
  ),
660
- error && /* @__PURE__ */ jsxRuntime.jsxs(
708
+ error && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
661
709
  "div",
662
710
  {
663
711
  style: {
@@ -673,8 +721,8 @@ function PayPalAdvancedCard(props) {
673
721
  lineHeight: 1.5
674
722
  },
675
723
  children: [
676
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { flexShrink: 0, marginTop: 1 }, children: "\u26A0\uFE0F" }),
677
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: error })
724
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flexShrink: 0, marginTop: 1 }, children: "\u26A0\uFE0F" }),
725
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: error })
678
726
  ]
679
727
  }
680
728
  )
@@ -685,11 +733,15 @@ function PayPalAdvancedCard(props) {
685
733
  )
686
734
  ] });
687
735
  }
736
+
737
+ // src/adapters/MedusaNextPayPalAdapter.tsx
738
+ var import_react5 = require("react");
739
+ var import_jsx_runtime5 = require("react/jsx-runtime");
688
740
  var DEFAULT_PAYPAL_PROVIDER_ID = "pp_paypal_paypal";
689
741
  var DEFAULT_PAYPAL_CARD_PROVIDER_ID = "pp_paypal_card_paypal_card";
690
742
  var SPIN_STYLE3 = `@keyframes _pp_spin { to { transform: rotate(360deg) } }`;
691
743
  function PayPalLoadingCard() {
692
- return /* @__PURE__ */ jsxRuntime.jsxs(
744
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
693
745
  "div",
694
746
  {
695
747
  style: {
@@ -702,8 +754,8 @@ function PayPalLoadingCard() {
702
754
  borderRadius: 10
703
755
  },
704
756
  children: [
705
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: SPIN_STYLE3 }),
706
- /* @__PURE__ */ jsxRuntime.jsx(
757
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("style", { children: SPIN_STYLE3 }),
758
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
707
759
  "div",
708
760
  {
709
761
  style: {
@@ -717,16 +769,16 @@ function PayPalLoadingCard() {
717
769
  }
718
770
  }
719
771
  ),
720
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
721
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, fontWeight: 500, color: "#111827" }, children: "Connecting to PayPal\u2026" }),
722
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#6b7280", marginTop: 2 }, children: "Setting up secure payment" })
772
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
773
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: 13, fontWeight: 500, color: "#111827" }, children: "Connecting to PayPal\u2026" }),
774
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: 12, color: "#6b7280", marginTop: 2 }, children: "Setting up secure payment" })
723
775
  ] })
724
776
  ]
725
777
  }
726
778
  );
727
779
  }
728
780
  function PayPalErrorCard({ message }) {
729
- return /* @__PURE__ */ jsxRuntime.jsx(
781
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
730
782
  "div",
731
783
  {
732
784
  style: {
@@ -761,7 +813,7 @@ function MedusaNextPayPalAdapter(props) {
761
813
  cartId,
762
814
  enabled: shouldRender
763
815
  });
764
- const handlePaid = react.useCallback(
816
+ const handlePaid = (0, import_react5.useCallback)(
765
817
  (captureResult) => {
766
818
  onPaid?.(captureResult);
767
819
  onSuccess?.(cartId);
@@ -769,21 +821,22 @@ function MedusaNextPayPalAdapter(props) {
769
821
  [cartId, onPaid, onSuccess]
770
822
  );
771
823
  if (!shouldRender) return null;
772
- if (loading) return /* @__PURE__ */ jsxRuntime.jsx(PayPalLoadingCard, {});
773
- if (error) return /* @__PURE__ */ jsxRuntime.jsx(PayPalErrorCard, { message: error });
824
+ if (loading) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PayPalLoadingCard, {});
825
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PayPalErrorCard, { message: error });
774
826
  if (!config) return null;
775
- if (config.paypal_enabled === false) return null;
776
- if (selectedProviderId === paypalCardProviderId && config.card_enabled === false) return null;
827
+ const isCardProvider = selectedProviderId === paypalCardProviderId;
828
+ if (config.paypal_enabled === false && !isCardProvider) return null;
829
+ if (isCardProvider && config.card_enabled === false) return null;
777
830
  const disableFunding = Array.isArray(config.disable_buttons) ? config.disable_buttons.join(",") : void 0;
778
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "grid", gap: 12 }, children: [
779
- /* @__PURE__ */ jsxRuntime.jsx(PayPalCurrencyNotice, { config }),
780
- /* @__PURE__ */ jsxRuntime.jsx(
831
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "grid", gap: 12 }, children: [
832
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PayPalCurrencyNotice, { config }),
833
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
781
834
  PayPalProvider,
782
835
  {
783
836
  config,
784
837
  intent: config.intent === "authorize" ? "authorize" : "capture",
785
838
  disableFunding,
786
- children: selectedProviderId === paypalCardProviderId ? /* @__PURE__ */ jsxRuntime.jsx(
839
+ children: isCardProvider ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
787
840
  PayPalAdvancedCard,
788
841
  {
789
842
  baseUrl,
@@ -793,7 +846,7 @@ function MedusaNextPayPalAdapter(props) {
793
846
  onPaid: handlePaid,
794
847
  onError
795
848
  }
796
- ) : /* @__PURE__ */ jsxRuntime.jsx(
849
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
797
850
  PayPalSmartButtons,
798
851
  {
799
852
  baseUrl,
@@ -808,6 +861,10 @@ function MedusaNextPayPalAdapter(props) {
808
861
  )
809
862
  ] }, selectedProviderId);
810
863
  }
864
+
865
+ // src/components/PayPalPaymentSection.tsx
866
+ var import_react6 = require("react");
867
+ var import_jsx_runtime6 = require("react/jsx-runtime");
811
868
  var PAYPAL_WALLET_PROVIDER_ID = "pp_paypal_paypal";
812
869
  var PAYPAL_CARD_PROVIDER_ID = "pp_paypal_card_paypal_card";
813
870
  var PAYPAL_PROVIDER_IDS = [
@@ -820,7 +877,7 @@ function isPayPalProviderId(id) {
820
877
  }
821
878
  var SPIN_STYLE4 = `@keyframes _pp_section_spin { to { transform: rotate(360deg) } }`;
822
879
  function SessionInitCard() {
823
- return /* @__PURE__ */ jsxRuntime.jsxs(
880
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
824
881
  "div",
825
882
  {
826
883
  style: {
@@ -834,8 +891,8 @@ function SessionInitCard() {
834
891
  borderRadius: 10
835
892
  },
836
893
  children: [
837
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: SPIN_STYLE4 }),
838
- /* @__PURE__ */ jsxRuntime.jsx(
894
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("style", { children: SPIN_STYLE4 }),
895
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
839
896
  "div",
840
897
  {
841
898
  style: {
@@ -849,13 +906,13 @@ function SessionInitCard() {
849
906
  }
850
907
  }
851
908
  ),
852
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, fontWeight: 500, color: "#111827" }, children: "Setting up payment\u2026" })
909
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, fontWeight: 500, color: "#111827" }, children: "Setting up payment\u2026" })
853
910
  ]
854
911
  }
855
912
  );
856
913
  }
857
914
  function ConfigLoadingCard() {
858
- return /* @__PURE__ */ jsxRuntime.jsxs(
915
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
859
916
  "div",
860
917
  {
861
918
  style: {
@@ -868,8 +925,8 @@ function ConfigLoadingCard() {
868
925
  borderRadius: 10
869
926
  },
870
927
  children: [
871
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: SPIN_STYLE4 }),
872
- /* @__PURE__ */ jsxRuntime.jsx(
928
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("style", { children: SPIN_STYLE4 }),
929
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
873
930
  "div",
874
931
  {
875
932
  style: {
@@ -883,16 +940,16 @@ function ConfigLoadingCard() {
883
940
  }
884
941
  }
885
942
  ),
886
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
887
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, fontWeight: 500, color: "#111827" }, children: "Connecting to PayPal\u2026" }),
888
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#6b7280", marginTop: 2 }, children: "Setting up secure payment" })
943
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
944
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, fontWeight: 500, color: "#111827" }, children: "Connecting to PayPal\u2026" }),
945
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 12, color: "#6b7280", marginTop: 2 }, children: "Setting up secure payment" })
889
946
  ] })
890
947
  ]
891
948
  }
892
949
  );
893
950
  }
894
951
  function ErrorCard({ message }) {
895
- return /* @__PURE__ */ jsxRuntime.jsx(
952
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
896
953
  "div",
897
954
  {
898
955
  style: {
@@ -924,7 +981,7 @@ function PayPalPaymentSection({
924
981
  cartId,
925
982
  enabled: shouldRender
926
983
  });
927
- const handlePaid = react.useCallback(
984
+ const handlePaid = (0, import_react6.useCallback)(
928
985
  (captureResult) => {
929
986
  onPaid?.(captureResult);
930
987
  onSuccess?.(cartId);
@@ -932,9 +989,9 @@ function PayPalPaymentSection({
932
989
  [cartId, onPaid, onSuccess]
933
990
  );
934
991
  if (!shouldRender) return null;
935
- if (sessionLoading) return /* @__PURE__ */ jsxRuntime.jsx(SessionInitCard, {});
936
- if (loading) return /* @__PURE__ */ jsxRuntime.jsx(ConfigLoadingCard, {});
937
- if (error) return /* @__PURE__ */ jsxRuntime.jsx(ErrorCard, { message: error });
992
+ if (sessionLoading) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SessionInitCard, {});
993
+ if (loading) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ConfigLoadingCard, {});
994
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ErrorCard, { message: error });
938
995
  if (!config) return null;
939
996
  if (config.paypal_enabled === false && selectedProviderId === PAYPAL_WALLET_PROVIDER_ID) {
940
997
  return null;
@@ -942,15 +999,15 @@ function PayPalPaymentSection({
942
999
  const isCardProvider = selectedProviderId === PAYPAL_CARD_PROVIDER_ID;
943
1000
  if (isCardProvider && config.card_enabled === false) return null;
944
1001
  const disableFunding = Array.isArray(config.disable_buttons) ? config.disable_buttons.join(",") : void 0;
945
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "grid", gap: 12 }, children: [
946
- /* @__PURE__ */ jsxRuntime.jsx(PayPalCurrencyNotice, { config }),
947
- /* @__PURE__ */ jsxRuntime.jsx(
1002
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gap: 12 }, children: [
1003
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PayPalCurrencyNotice, { config }),
1004
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
948
1005
  PayPalProvider,
949
1006
  {
950
1007
  config,
951
1008
  intent: config.intent === "authorize" ? "authorize" : "capture",
952
1009
  disableFunding,
953
- children: isCardProvider ? /* @__PURE__ */ jsxRuntime.jsx(
1010
+ children: isCardProvider ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
954
1011
  PayPalAdvancedCard,
955
1012
  {
956
1013
  baseUrl,
@@ -960,7 +1017,7 @@ function PayPalPaymentSection({
960
1017
  onPaid: handlePaid,
961
1018
  onError
962
1019
  }
963
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1020
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
964
1021
  PayPalSmartButtons,
965
1022
  {
966
1023
  baseUrl,
@@ -975,6 +1032,9 @@ function PayPalPaymentSection({
975
1032
  )
976
1033
  ] }, selectedProviderId);
977
1034
  }
1035
+
1036
+ // src/hooks/usePayPalPaymentMethods.ts
1037
+ var import_react7 = require("react");
978
1038
  var _cache2 = /* @__PURE__ */ new Map();
979
1039
  var CACHE_TTL2 = 5 * 60 * 1e3;
980
1040
  function cacheKey2(baseUrl, cartId) {
@@ -993,16 +1053,16 @@ function usePayPalPaymentMethods({
993
1053
  cartId,
994
1054
  enabled = true
995
1055
  }) {
996
- const api = react.useMemo(
1056
+ const api = (0, import_react7.useMemo)(
997
1057
  () => createPayPalStoreApi({ baseUrl, publishableApiKey }),
998
1058
  [baseUrl, publishableApiKey]
999
1059
  );
1000
1060
  const key = cacheKey2(baseUrl, cartId);
1001
1061
  const hit = _cache2.get(key);
1002
1062
  const seed = hit && Date.now() - hit.at < CACHE_TTL2 ? hit.result : null;
1003
- const [result, setResult] = react.useState(seed ?? { ...DEFAULT_RESULT, loading: enabled });
1004
- const fetchIdRef = react.useRef(0);
1005
- react.useEffect(() => {
1063
+ const [result, setResult] = (0, import_react7.useState)(seed ?? { ...DEFAULT_RESULT, loading: enabled });
1064
+ const fetchIdRef = (0, import_react7.useRef)(0);
1065
+ (0, import_react7.useEffect)(() => {
1006
1066
  if (!enabled) {
1007
1067
  setResult((prev) => ({ ...prev, loading: false }));
1008
1068
  return;
@@ -1053,17 +1113,20 @@ function usePayPalPaymentMethods({
1053
1113
  }, [api, baseUrl, cartId, enabled]);
1054
1114
  return result;
1055
1115
  }
1056
-
1057
- exports.MedusaNextPayPalAdapter = MedusaNextPayPalAdapter;
1058
- exports.PAYPAL_CARD_PROVIDER_ID = PAYPAL_CARD_PROVIDER_ID;
1059
- exports.PAYPAL_WALLET_PROVIDER_ID = PAYPAL_WALLET_PROVIDER_ID;
1060
- exports.PayPalAdvancedCard = PayPalAdvancedCard;
1061
- exports.PayPalCurrencyNotice = PayPalCurrencyNotice;
1062
- exports.PayPalPaymentSection = PayPalPaymentSection;
1063
- exports.PayPalProvider = PayPalProvider;
1064
- exports.PayPalSmartButtons = PayPalSmartButtons;
1065
- exports.createPayPalStoreApi = createPayPalStoreApi;
1066
- exports.isPayPalProviderId = isPayPalProviderId;
1067
- exports.usePayPalConfig = usePayPalConfig;
1068
- exports.usePayPalPaymentMethods = usePayPalPaymentMethods;
1116
+ // Annotate the CommonJS export names for ESM import in node:
1117
+ 0 && (module.exports = {
1118
+ MedusaNextPayPalAdapter,
1119
+ PAYPAL_CARD_PROVIDER_ID,
1120
+ PAYPAL_WALLET_PROVIDER_ID,
1121
+ PayPalAdvancedCard,
1122
+ PayPalCurrencyNotice,
1123
+ PayPalPaymentSection,
1124
+ PayPalProvider,
1125
+ PayPalSmartButtons,
1126
+ createPayPalStoreApi,
1127
+ isPayPalProviderId,
1128
+ markPaymentComplete,
1129
+ usePayPalConfig,
1130
+ usePayPalPaymentMethods
1131
+ });
1069
1132
  //# sourceMappingURL=index.cjs.map