@primer-io/primer-js 1.7.0 → 1.8.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,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8390259: feat(primer-js): allow customizing the initialization error UI
8
+ - 95ecde4: support the http.request backend-driven checkout step, and emit redirect.opened once the redirect popup is showing
9
+
10
+ The request layer now speaks one retry vocabulary (`RetryPolicy`: maxAttempts/backoff/baseDelayMs/retryOn, half-jittered delays), primerFetch reads bodies text-first so 204s and non-JSON errors keep their status, supports per-attempt `timeoutMs` and an AbortSignal, and the api-controller iframe can abort in-flight requests by id via `cancelFetch`. http.request steps ride these same rails, through the iframe in sdk-core, and are origin-gated: schema URLs may only target the session's own Primer API hosts, with the api-controller page additionally enforcing `connect-src https://*.primer.io` at the browser level.
11
+
12
+ - d7aaf7b: Add event-driven shipping support for Express Checkout (Apple Pay / Google Pay).
13
+
14
+ Two new events let you compute shipping options and commit the selected option server-side as the shopper interacts with the payment sheet:
15
+ - `primer:shipping-address-change` — fires when the shopper enters or changes their shipping address. Call `setShippingOptions(options)` to display available options in the sheet.
16
+ - `primer:shipping-option-change` — fires when the shopper selects an option. PATCH the authoritative shipping amount onto the client session, then call `continue()` to proceed.
17
+
18
+ ```typescript
19
+ checkout.addEventListener('primer:shipping-address-change', (e) => {
20
+ const { shippingAddress, setShippingOptions } = e.detail;
21
+ setShippingOptions([
22
+ {
23
+ id: 'standard',
24
+ name: 'Standard',
25
+ description: '5-7 days',
26
+ amount: 500,
27
+ },
28
+ ]);
29
+ });
30
+
31
+ checkout.addEventListener('primer:shipping-option-change', (e) => {
32
+ e.preventDefault();
33
+ const { selectedShippingOption, continue: continueCommit } = e.detail;
34
+ // PATCH order.shipping on the client session, then:
35
+ continueCommit();
36
+ });
37
+ ```
38
+
39
+ For Apple Pay and Google Pay, this replaces the previous static `shippingMethodsUrl`-based shipping resolution. Existing `shippingMethodsUrl` integrations are unaffected; new integrations should use these events.
40
+
41
+ Also adds the `ShippingOption` type and removes the now-redundant legacy `ShippingMethod` type.
42
+
43
+ ### Patch Changes
44
+
45
+ - 05cb42b: fix:(paypal): app-switch support
46
+
3
47
  ## 1.7.0
4
48
 
5
49
  ### Minor Changes