@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/dist/index.d.cts
CHANGED
|
@@ -228,7 +228,8 @@ interface ZorealOAuthProviderProps {
|
|
|
228
228
|
pairingUI?: PairingUI;
|
|
229
229
|
/**
|
|
230
230
|
* How long the modal stays open before giving up and cancelling, in ms.
|
|
231
|
-
* Defaults to
|
|
231
|
+
* Defaults to the provider's own expiry (five minutes today), or 300000
|
|
232
|
+
* when it states none; a shorter value of yours wins.
|
|
232
233
|
*/
|
|
233
234
|
pairingTimeoutMs?: number;
|
|
234
235
|
children: ReactNode;
|
|
@@ -270,8 +271,12 @@ declare function ZorealMark({ size, brand, className, }: {
|
|
|
270
271
|
* the rest of a sign-in form for the person's attention at the one moment they
|
|
271
272
|
* need to look at their phone.
|
|
272
273
|
*/
|
|
273
|
-
/**
|
|
274
|
-
|
|
274
|
+
/**
|
|
275
|
+
* How long a pairing sits on screen when the provider states no expiry of
|
|
276
|
+
* its own. The provider does state one (`expires_in`, five minutes today),
|
|
277
|
+
* and that is the deadline unless the site sets a shorter `pairingTimeoutMs`.
|
|
278
|
+
*/
|
|
279
|
+
declare const DEFAULT_PAIRING_TIMEOUT_MS = 300000;
|
|
275
280
|
interface PairingModalProps {
|
|
276
281
|
state: PairingState;
|
|
277
282
|
qrUrl: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -228,7 +228,8 @@ interface ZorealOAuthProviderProps {
|
|
|
228
228
|
pairingUI?: PairingUI;
|
|
229
229
|
/**
|
|
230
230
|
* How long the modal stays open before giving up and cancelling, in ms.
|
|
231
|
-
* Defaults to
|
|
231
|
+
* Defaults to the provider's own expiry (five minutes today), or 300000
|
|
232
|
+
* when it states none; a shorter value of yours wins.
|
|
232
233
|
*/
|
|
233
234
|
pairingTimeoutMs?: number;
|
|
234
235
|
children: ReactNode;
|
|
@@ -270,8 +271,12 @@ declare function ZorealMark({ size, brand, className, }: {
|
|
|
270
271
|
* the rest of a sign-in form for the person's attention at the one moment they
|
|
271
272
|
* need to look at their phone.
|
|
272
273
|
*/
|
|
273
|
-
/**
|
|
274
|
-
|
|
274
|
+
/**
|
|
275
|
+
* How long a pairing sits on screen when the provider states no expiry of
|
|
276
|
+
* its own. The provider does state one (`expires_in`, five minutes today),
|
|
277
|
+
* and that is the deadline unless the site sets a shorter `pairingTimeoutMs`.
|
|
278
|
+
*/
|
|
279
|
+
declare const DEFAULT_PAIRING_TIMEOUT_MS = 300000;
|
|
275
280
|
interface PairingModalProps {
|
|
276
281
|
state: PairingState;
|
|
277
282
|
qrUrl: string;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createContext, useContext, useMemo, useState as useState2 } from "react
|
|
|
5
5
|
|
|
6
6
|
// src/wire.ts
|
|
7
7
|
var WIRE_VERSION = 1;
|
|
8
|
-
var SDK_VERSION = "0.2.
|
|
8
|
+
var SDK_VERSION = "0.2.25";
|
|
9
9
|
var DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
10
10
|
var POLL_INTERVAL_MS = 2e3;
|
|
11
11
|
var POLL_INTERVAL_ENROLLING_MS = 5e3;
|
|
@@ -1425,7 +1425,7 @@ function ensureStyles() {
|
|
|
1425
1425
|
|
|
1426
1426
|
// src/PairingModal.tsx
|
|
1427
1427
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1428
|
-
var DEFAULT_PAIRING_TIMEOUT_MS =
|
|
1428
|
+
var DEFAULT_PAIRING_TIMEOUT_MS = 3e5;
|
|
1429
1429
|
var URGENT_SECONDS = 20;
|
|
1430
1430
|
function mmss(totalSeconds) {
|
|
1431
1431
|
const m = Math.floor(totalSeconds / 60);
|
|
@@ -1447,14 +1447,14 @@ function PairingModal({
|
|
|
1447
1447
|
onCancel,
|
|
1448
1448
|
locale,
|
|
1449
1449
|
theme = "auto",
|
|
1450
|
-
timeoutMs
|
|
1450
|
+
timeoutMs,
|
|
1451
1451
|
intent = "sign-in"
|
|
1452
1452
|
}) {
|
|
1453
1453
|
const t = strings(locale);
|
|
1454
1454
|
const titleId = useId();
|
|
1455
1455
|
const closeRef = useRef(null);
|
|
1456
1456
|
const deadlineRef = useRef(0);
|
|
1457
|
-
const [remaining, setRemaining] = useState(Math.round(timeoutMs / 1e3));
|
|
1457
|
+
const [remaining, setRemaining] = useState(Math.round((timeoutMs ?? DEFAULT_PAIRING_TIMEOUT_MS) / 1e3));
|
|
1458
1458
|
const settled = state.status === "claimed" || state.status === "enrolling";
|
|
1459
1459
|
const [frameUrl, setFrameUrl] = useState(qrUrl);
|
|
1460
1460
|
useEffect(() => {
|
|
@@ -1480,8 +1480,10 @@ function PairingModal({
|
|
|
1480
1480
|
}, []);
|
|
1481
1481
|
useEffect(() => {
|
|
1482
1482
|
const serverMs = typeof state.expiresIn === "number" ? state.expiresIn * 1e3 : Infinity;
|
|
1483
|
-
|
|
1484
|
-
|
|
1483
|
+
const capMs = timeoutMs ?? (Number.isFinite(serverMs) ? serverMs : DEFAULT_PAIRING_TIMEOUT_MS);
|
|
1484
|
+
const ms = Math.min(capMs, serverMs);
|
|
1485
|
+
deadlineRef.current = Date.now() + ms;
|
|
1486
|
+
setRemaining(Math.round(ms / 1e3));
|
|
1485
1487
|
const id = setInterval(() => {
|
|
1486
1488
|
const left = Math.max(0, Math.ceil((deadlineRef.current - Date.now()) / 1e3));
|
|
1487
1489
|
setRemaining(left);
|