@easypayment/medusa-paypal-ui 1.1.0 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -1,25 +1,97 @@
1
- # Changelog
2
-
3
- All notable changes to `@easypayment/medusa-paypal-ui` are documented here.
4
-
5
- ## 1.1.0
6
-
7
- ### Added
8
- - **Transient-failure retry** in the HTTP client (opt-in `retries`, jittered
9
- backoff on network errors / timeouts / 429 / 5xx). Wired into the idempotent
10
- `markPaymentComplete` and `captureOrder` calls so a network blip right after
11
- capturethe classic "captured but cart not completed" gap is retried
12
- instead of stranding a paid-but-unfinalized order.
13
- - Tests for the retry logic and the capture/complete retry paths.
14
-
15
- ### Changed
16
- - Test environment switched from `node` to `jsdom` so component/hook tests can
17
- run against a DOM (the client tests continue to pass under it).
18
-
19
- ## 1.0.56
20
-
21
- ### Added
22
- - Unit test suite (vitest) for the framework-agnostic client logic: the HTTP
23
- client (base-url/path normalization, publishable-key header, 401/403 handling,
24
- HTML-tag stripping, empty-body and non-JSON guards, timeout surfacing) and the
25
- Next.js router-error detection helper.
1
+ # Changelog
2
+
3
+ All notable changes to `@easypayment/medusa-paypal-ui` are documented here.
4
+
5
+ ## 1.2.0 — 2026-09-02
6
+
7
+ ### Fixed
8
+ - **A reload between capture and finalization no longer strands the buyer.**
9
+ The "money was captured" state is now persisted per cart in
10
+ `sessionStorage`; after a reload/crash the components restore the
11
+ finalize-only "Retry finish placing my order" path instead of showing
12
+ payment buttons that would confusingly fail (or invite a second payment)
13
+ against an already-captured PayPal order.
14
+ - **Cart edits can no longer be answered with a stale-amount PayPal order.**
15
+ `createOrder` now sends a fresh `Idempotency-Key` per attempt, so the
16
+ backend's `PayPal-Request-Id` is unique per click and PayPal cannot replay a
17
+ cached order created for a previous cart total. (Capture requests
18
+ intentionally send no key — the server's per-order key is the correct
19
+ idempotency scope there.)
20
+
21
+ ### Added
22
+ - `credentials` option on the HTTP client (`HttpOptions.credentials`). Defaults
23
+ to the historical `"include"`; set `"omit"`/`"same-origin"` for backends
24
+ answering with `Access-Control-Allow-Origin: *`, which browsers reject for
25
+ credentialed requests.
26
+ - Exported `markCartCaptured` / `wasCartCaptured` / `clearCartCaptured` for
27
+ storefronts with custom payment flows.
28
+ - `usePayPalPaymentMethods` now returns an `error` field (non-null when the
29
+ config fetch failed and the enabled/title values are optimistic defaults),
30
+ so storefronts can stop advertising methods that will fail once selected.
31
+
32
+ ### Changed
33
+ - A payment method the merchant disabled in admin now renders a neutral
34
+ "currently unavailable" notice instead of blank space under the selected
35
+ option.
36
+ - `PayPalPaymentSection` is now a thin wrapper over `MedusaNextPayPalAdapter`
37
+ (previously two ~90%-identical render paths). Public APIs, exports, and
38
+ rendered UI are unchanged; provider-id constants moved to a single module
39
+ and are re-exported from their historical locations.
40
+
41
+ ## 1.1.0
42
+
43
+ ### Fixed (re-audit)
44
+ - **Card submit rejections no longer strand the buyer under the processing
45
+ overlay.** `cardFieldsForm.submit()` returns a promise whose rejection is not
46
+ routed to the provider's `onError`; it is now caught, the overlay/state reset,
47
+ and the validation message shown.
48
+ - **A payment can no longer be taken twice after a finalization failure.** Once
49
+ a capture succeeds, any later failure (order completion, consumer callback)
50
+ now shows a dedicated "Retry — finish placing my order" action that retries
51
+ only the finalization; the PayPal button/card form no longer re-appears to
52
+ invite a second, distinct charge for the same cart.
53
+ - **Back-button (bfcache) restores no longer leave a stuck overlay.** The DOM
54
+ processing overlay and both components' React overlays reset on `pageshow`
55
+ with `persisted: true`.
56
+ - **Requests can no longer hang forever.** The 30s HTTP timeout now also applies
57
+ when a caller passes an `AbortSignal` (hook config fetches), and it covers
58
+ reading the response body, not just the headers.
59
+ - **Buyers now see the backend's error message.** Error bodies are parsed as
60
+ JSON and the backend's buyer-facing `message` (unsupported currency,
61
+ rate-limit, "payment processed but order not finalized", "PayPal is currently
62
+ disabled") is shown instead of a raw JSON blob or a misleading CORS hint.
63
+ - **Ineligible PayPal buttons no longer spin forever.** If the SDK resolves but
64
+ never initializes the buttons (ineligible country/currency/funding), a clear
65
+ "PayPal is not available" message replaces the infinite "Loading PayPal…"
66
+ spinner after 10s.
67
+ - **Missing `orderID` guard added to the card `onApprove`** (matching the
68
+ buttons flow) so an empty id fails fast with a clear message.
69
+ - **Next.js 15 `notFound()` is no longer treated as a payment failure**
70
+ (`NEXT_HTTP_ERROR_FALLBACK` digests are now recognized as router errors).
71
+ - **CJS TypeScript consumers get correct types.** The exports map now serves
72
+ `dist/*.d.cts` under the `require` condition (fixes TS1479 under
73
+ `node16`/`nodenext` resolution).
74
+ - **`PayPalSettingsResponse` now matches the actual endpoint response**
75
+ (`paymentAction`, `advancedCardEnabled`); the old `data` envelope shape is
76
+ kept as deprecated so existing code compiles.
77
+
78
+
79
+ ### Added
80
+ - **Transient-failure retry** in the HTTP client (opt-in `retries`, jittered
81
+ backoff on network errors / timeouts / 429 / 5xx). Wired into the idempotent
82
+ `markPaymentComplete` and `captureOrder` calls so a network blip right after
83
+ capture — the classic "captured but cart not completed" gap — is retried
84
+ instead of stranding a paid-but-unfinalized order.
85
+ - Tests for the retry logic and the capture/complete retry paths.
86
+
87
+ ### Changed
88
+ - Test environment switched from `node` to `jsdom` so component/hook tests can
89
+ run against a DOM (the client tests continue to pass under it).
90
+
91
+ ## 1.0.56
92
+
93
+ ### Added
94
+ - Unit test suite (vitest) for the framework-agnostic client logic: the HTTP
95
+ client (base-url/path normalization, publishable-key header, 401/403 handling,
96
+ HTML-tag stripping, empty-body and non-JSON guards, timeout surfacing) and the
97
+ Next.js router-error detection helper.