@zoreal/oauth2-react 0.2.24 → 0.2.25
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/README.md +1 -1
- package/dist/index.cjs +8 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -269,7 +269,7 @@ What the modal does:
|
|
|
269
269
|
| **Live status** | The copy and the title follow the pairing: waiting for a scan, then waiting for approval once the holder has claimed the code (the spent QR blurs out behind a phone glyph). |
|
|
270
270
|
| **Title** | Says what the scan is for, inferred from the request: "Scan to sign in" for `openid`, `email` and `profile.name`; "Scan to verify your identity" once a document attribute such as `zoreal.age` or `profile.birthdate` is requested; "Scan to prove you are a real human" for `openid` alone with `acr_values: 'zoreal.live'`. Override with `intent`, one of `'sign-in'`, `'identify'`, `'presence'`, when the scope does not say. |
|
|
271
271
|
| **Countdown** | Counts down to expiry, turning amber under 20s. Reads the clock each tick rather than decrementing, so a backgrounded tab comes back honest. |
|
|
272
|
-
| **Timeout** | Closes and cancels at zero.
|
|
272
|
+
| **Timeout** | Closes and cancels at zero. Follows the provider's expiry (five minutes); `pairingTimeoutMs` can shorten it, never extend it. |
|
|
273
273
|
| **Cancel** | The X, the Cancel button, `Escape`, clicking outside and the timeout are one behaviour: abort the poll, close the modal. An orphaned poll is exactly how a request gets cancelled for over-polling. |
|
|
274
274
|
| **No ZOREAL ID yet** | A footer says the same code also installs the app. Without it the panel reads as "scan this with something I do not have", and the flow dead-ends at the one moment it can still be recovered. |
|
|
275
275
|
| **Themes** | `theme="auto"` (default) follows `prefers-color-scheme`; `"light"` and `"dark"` force it. In dark mode the code is drawn light on the dark surface, the mark included, and the light around it runs brighter and wider. |
|
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var import_react2 = require("react");
|
|
|
42
42
|
|
|
43
43
|
// src/wire.ts
|
|
44
44
|
var WIRE_VERSION = 1;
|
|
45
|
-
var SDK_VERSION = "0.2.
|
|
45
|
+
var SDK_VERSION = "0.2.25";
|
|
46
46
|
var DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
47
47
|
var POLL_INTERVAL_MS = 2e3;
|
|
48
48
|
var POLL_INTERVAL_ENROLLING_MS = 5e3;
|
|
@@ -1462,7 +1462,7 @@ function ensureStyles() {
|
|
|
1462
1462
|
|
|
1463
1463
|
// src/PairingModal.tsx
|
|
1464
1464
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1465
|
-
var DEFAULT_PAIRING_TIMEOUT_MS =
|
|
1465
|
+
var DEFAULT_PAIRING_TIMEOUT_MS = 3e5;
|
|
1466
1466
|
var URGENT_SECONDS = 20;
|
|
1467
1467
|
function mmss(totalSeconds) {
|
|
1468
1468
|
const m = Math.floor(totalSeconds / 60);
|
|
@@ -1484,14 +1484,14 @@ function PairingModal({
|
|
|
1484
1484
|
onCancel,
|
|
1485
1485
|
locale,
|
|
1486
1486
|
theme = "auto",
|
|
1487
|
-
timeoutMs
|
|
1487
|
+
timeoutMs,
|
|
1488
1488
|
intent = "sign-in"
|
|
1489
1489
|
}) {
|
|
1490
1490
|
const t = strings(locale);
|
|
1491
1491
|
const titleId = (0, import_react.useId)();
|
|
1492
1492
|
const closeRef = (0, import_react.useRef)(null);
|
|
1493
1493
|
const deadlineRef = (0, import_react.useRef)(0);
|
|
1494
|
-
const [remaining, setRemaining] = (0, import_react.useState)(Math.round(timeoutMs / 1e3));
|
|
1494
|
+
const [remaining, setRemaining] = (0, import_react.useState)(Math.round((timeoutMs ?? DEFAULT_PAIRING_TIMEOUT_MS) / 1e3));
|
|
1495
1495
|
const settled = state.status === "claimed" || state.status === "enrolling";
|
|
1496
1496
|
const [frameUrl, setFrameUrl] = (0, import_react.useState)(qrUrl);
|
|
1497
1497
|
(0, import_react.useEffect)(() => {
|
|
@@ -1517,8 +1517,10 @@ function PairingModal({
|
|
|
1517
1517
|
}, []);
|
|
1518
1518
|
(0, import_react.useEffect)(() => {
|
|
1519
1519
|
const serverMs = typeof state.expiresIn === "number" ? state.expiresIn * 1e3 : Infinity;
|
|
1520
|
-
|
|
1521
|
-
|
|
1520
|
+
const capMs = timeoutMs ?? (Number.isFinite(serverMs) ? serverMs : DEFAULT_PAIRING_TIMEOUT_MS);
|
|
1521
|
+
const ms = Math.min(capMs, serverMs);
|
|
1522
|
+
deadlineRef.current = Date.now() + ms;
|
|
1523
|
+
setRemaining(Math.round(ms / 1e3));
|
|
1522
1524
|
const id = setInterval(() => {
|
|
1523
1525
|
const left = Math.max(0, Math.ceil((deadlineRef.current - Date.now()) / 1e3));
|
|
1524
1526
|
setRemaining(left);
|