@qrauth/web-components 0.4.0 → 0.4.1

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,16 @@
1
1
  # @qrauth/web-components
2
2
 
3
+ ## [0.4.1] — 2026-04-29
4
+
5
+ ### Fixed
6
+ - Removed dependency on `api.qrserver.com` for QR rendering. QR codes are now rendered locally as inline SVG via the `qrcode` library. Required for WP.org plugin directory submission and for any consumer with strict CSP.
7
+ - QR quiet zone increased from 1 to 4 modules per ISO/IEC 18004 — restores the scan reliability of the previous external renderer on stricter readers (iPhone Camera, older Android, low-light captures).
8
+ - Capacity overflow in `qrToSvg()` no longer crashes the component render — `QRCode.create` is now wrapped in try/catch and returns an empty SVG on overflow, letting the calling state render its empty-qr fallback.
9
+
10
+ ### Changed
11
+ - New runtime dependency: `qrcode@1.5.4` (already pinned by `@qrauth/animated-qr`).
12
+ - **`<qrauth-login>` and `<qrauth-2fa>` mobile "Continue with QRAuth" CTA** now appends `?dr=1` to the hosted approval URL. Forward-compatible with an upcoming server-side change at `qrauth.io/a/:token` that will gate the post-approval redirect on this flag — same-device clicks redirect, cross-device scans land on a terminal "Approved, you can close this tab" state. No behavior change until the server gating ships; safe to deploy independently.
13
+
3
14
  ## 0.4.0
4
15
 
5
16
  - **`<qrauth-login>` and `<qrauth-2fa>`: new `redirect-uri` attribute.** After the user taps Approve on the mobile CTA path, the QRAuth hosted approval page now navigates back to the consumer site instead of landing on a "you can close this page" dead end. The attribute is forwarded to `POST /api/v1/auth-sessions` as `redirectUrl` and validated server-side against the app's registered `redirectUrls` allowlist (same security model as OAuth 2.0 redirect URIs — strips trailing slash and ignores query + fragment before comparison). No-op on the desktop QR flow since polling in the original tab already handles the transition.
package/README.md CHANGED
@@ -14,12 +14,12 @@ All three components bubble `qrauth:*` events across the Shadow DOM boundary (`c
14
14
  npm install @qrauth/web-components
15
15
  ```
16
16
 
17
- Or load the CDN IIFE directly in any HTML page:
17
+ Or load the CDN IIFE directly in any HTML page (latest hashes at [`https://cdn.qrauth.io/v1/latest.json`](https://cdn.qrauth.io/v1/latest.json)):
18
18
 
19
19
  ```html
20
20
  <script
21
- src="https://cdn.qrauth.io/v1/components.js"
22
- integrity="sha384-..."
21
+ src="https://cdn.qrauth.io/v1/components-0.4.0.js"
22
+ integrity="sha384-ZsvnpXBK9tghmz/PCtZUtR+7qTF7XhR35/SGNfJuJgLOBxnIRi3JYhRt1oFxNtU6"
23
23
  crossorigin="anonymous"
24
24
  ></script>
25
25
 
@@ -57,6 +57,7 @@ Or load the CDN IIFE directly in any HTML page:
57
57
  | `animated` | boolean | off | Enables the pulse animation on the QR. |
58
58
  | `force-mode` | `mobile` \| `desktop` \| `auto` | `auto` | Override automatic mobile detection. |
59
59
  | `mobile-fallback-only` | boolean | off | Keep the QR-first body on every device; disables the mobile CTA path. |
60
+ | `redirect-uri` | URL | — | Where the hosted approval page sends the user after Approve. Required for the mobile flow to feel complete. Must match the app's registered `redirectUrls` allowlist. See [docs.qrauth.io/guide/web-components](https://docs.qrauth.io/guide/web-components#the-mobile-flow) for the URL-callback handler your app needs. |
60
61
 
61
62
  ## Events
62
63
 
package/dist/login.d.ts CHANGED
@@ -53,6 +53,7 @@ export declare class QRAuthLogin extends QRAuthElement {
53
53
  private _codeVerifier;
54
54
  private _status;
55
55
  private _expiresAt;
56
+ private _currentQrUrl;
56
57
  private _timerInterval;
57
58
  private _pollTimeout;
58
59
  get scopes(): string;
@@ -97,6 +98,11 @@ export declare class QRAuthLogin extends QRAuthElement {
97
98
  * The existing polling loop in _beginPolling picks up SCANNED / APPROVED
98
99
  * transitions from the server once the user completes the flow there,
99
100
  * so qrauth:scanned and qrauth:authenticated fire unchanged.
101
+ *
102
+ * The `dr=1` query flag tells the hosted approval page that this is a
103
+ * same-device click (not a cross-device QR scan), and that the
104
+ * post-approval redirect to redirectUrl should fire. The QR matrix
105
+ * encodes the bare /a/:token URL, so a scanner cannot carry this flag.
100
106
  */
101
107
  private _openApprovalPage;
102
108
  private _openModal;