@primer-io/primer-js 1.4.2 → 1.5.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,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 47378b6: feat: re-evaluate payment methods after `refreshClientSession`
8
+
9
+ After `primer.refreshSession()`, payment methods filtered out by Checkout
10
+ Builder visibility rules now disappear from the rendered list instead of
11
+ staying visible. `refreshClientSession` diffs the new configuration against
12
+ the in-memory payment methods, reconciles the shared list in place, and fires
13
+ a new `onAvailablePaymentMethodsRefresh` callback. `refreshSession()` is a
14
+ no-op (with a `[PRIMER]` warning) while a payment is in progress so methods
15
+ can't be yanked out from under the user mid-flow.
16
+
17
+ ### Patch Changes
18
+
19
+ - 8971d41: fix: stop firing false `primer:payment-failure` events for settled payments
20
+
21
+ Three contract fixes for the false-failure class behind the Easol duplicate
22
+ charges (ESC-980). Resume (`POST /payments/{id}/resume`) can answer HTTP 202
23
+ `NoActionsToHandle` while the processor authorisation is still in flight; the
24
+ SDK misread that as an inconsistent state and fired a payment-failure ~2s
25
+ before the AUTHORIZED webhook landed. `resumePaymentUntilSettled` now re-polls
26
+ the unconsumed resume token (2s interval, 30s window) until the payment
27
+ settles, and on window exhaustion fails honestly with the payment id instead
28
+ of claiming failure. `processPayment` no longer drops the created payment's
29
+ `id` when the resume response is leaner, and failure events now surface the
30
+ request `X-Request-Id` as `diagnosticsId` (including for errors deserialized
31
+ across the hosted-pages `postMessage` boundary) so failures are reconcilable
32
+ with backend logs.
33
+
34
+ ## 1.4.3
35
+
36
+ ### Patch Changes
37
+
38
+ - 931337d: fix(primer-js): block concurrent card form submissions
39
+
3
40
  ## 1.4.2
4
41
 
5
42
  ### Patch Changes
package/README.md CHANGED
@@ -101,6 +101,33 @@ checkout.addEventListener('primer:state-change', (event) => {
101
101
  });
102
102
  ```
103
103
 
104
+ ### `primer:payment-approval-required` (MANUAL approval flow)
105
+
106
+ Emitted in the MANUAL approval flow when the payment is awaiting the merchant's
107
+ explicit approval. Send `clientSessionId` and `paymentAttemptId` to your
108
+ backend (which calls `/approve` or `/abort`), then call `continueFlow()` to let
109
+ the SDK fetch the session and resolve the result.
110
+
111
+ ```javascript
112
+ checkout.addEventListener('primer:payment-approval-required', async (event) => {
113
+ const {
114
+ clientSessionId,
115
+ paymentAttemptId,
116
+ paymentMethodToken,
117
+ continueFlow,
118
+ } = event.detail;
119
+
120
+ const response = await fetch('/my-backend/handle-payment-approval', {
121
+ method: 'POST',
122
+ body: JSON.stringify({ clientSessionId, paymentAttemptId }),
123
+ });
124
+
125
+ if (response.ok) {
126
+ await continueFlow();
127
+ }
128
+ });
129
+ ```
130
+
104
131
  ## Support
105
132
 
106
133
  - **Documentation**: [Web Components Documentation](https://primer.io/docs/sdk/primer-checkout-web/sdk-reference-overview)