@zoreal/oauth2-js 0.1.23 → 0.1.24

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/dist/index.d.cts CHANGED
@@ -159,7 +159,8 @@ interface StartLoginOptions {
159
159
  theme?: ZorealTheme;
160
160
  /**
161
161
  * How long the modal stays open before giving up and cancelling, in ms.
162
- * Defaults to 120000. The provider's own expiry wins when it is shorter.
162
+ * Defaults to the provider's own expiry (five minutes today), or 300000
163
+ * when it states none; a shorter value of yours wins.
163
164
  */
164
165
  pairingTimeoutMs?: number;
165
166
  }
@@ -243,8 +244,12 @@ declare function resumeLogin(options: Pick<StartLoginOptions, 'clientId' | 'issu
243
244
  * settles. Callers who want their own UI pass `pairingUI: 'none'`.
244
245
  */
245
246
 
246
- /** Our own cap on how long a pairing sits on screen. See `pairingTimeoutMs`. */
247
- declare const DEFAULT_PAIRING_TIMEOUT_MS = 120000;
247
+ /**
248
+ * How long a pairing sits on screen when the provider states no expiry of
249
+ * its own. The provider does state one (`expires_in`, five minutes today),
250
+ * and that is the deadline unless the site sets a shorter `pairingTimeoutMs`.
251
+ */
252
+ declare const DEFAULT_PAIRING_TIMEOUT_MS = 300000;
248
253
  interface PairingModalOptions {
249
254
  onCancel: () => void;
250
255
  locale?: string;
@@ -328,7 +333,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
328
333
  * auth-code mode leaves it to the RP backend.
329
334
  */
330
335
  declare const WIRE_VERSION = 1;
331
- declare const SDK_VERSION = "0.1.23";
336
+ declare const SDK_VERSION = "0.1.24";
332
337
  declare const SDK_NAME = "@zoreal/oauth2-js";
333
338
  declare const DEFAULT_ISSUER = "https://id.zoreal.com";
334
339
  /** Pending TTL is short. Poll gently; over-polling cancels the request. */
package/dist/index.d.ts CHANGED
@@ -159,7 +159,8 @@ interface StartLoginOptions {
159
159
  theme?: ZorealTheme;
160
160
  /**
161
161
  * How long the modal stays open before giving up and cancelling, in ms.
162
- * Defaults to 120000. The provider's own expiry wins when it is shorter.
162
+ * Defaults to the provider's own expiry (five minutes today), or 300000
163
+ * when it states none; a shorter value of yours wins.
163
164
  */
164
165
  pairingTimeoutMs?: number;
165
166
  }
@@ -243,8 +244,12 @@ declare function resumeLogin(options: Pick<StartLoginOptions, 'clientId' | 'issu
243
244
  * settles. Callers who want their own UI pass `pairingUI: 'none'`.
244
245
  */
245
246
 
246
- /** Our own cap on how long a pairing sits on screen. See `pairingTimeoutMs`. */
247
- declare const DEFAULT_PAIRING_TIMEOUT_MS = 120000;
247
+ /**
248
+ * How long a pairing sits on screen when the provider states no expiry of
249
+ * its own. The provider does state one (`expires_in`, five minutes today),
250
+ * and that is the deadline unless the site sets a shorter `pairingTimeoutMs`.
251
+ */
252
+ declare const DEFAULT_PAIRING_TIMEOUT_MS = 300000;
248
253
  interface PairingModalOptions {
249
254
  onCancel: () => void;
250
255
  locale?: string;
@@ -328,7 +333,7 @@ declare function mountPairingModal(state: PairingState, options: PairingModalOpt
328
333
  * auth-code mode leaves it to the RP backend.
329
334
  */
330
335
  declare const WIRE_VERSION = 1;
331
- declare const SDK_VERSION = "0.1.23";
336
+ declare const SDK_VERSION = "0.1.24";
332
337
  declare const SDK_NAME = "@zoreal/oauth2-js";
333
338
  declare const DEFAULT_ISSUER = "https://id.zoreal.com";
334
339
  /** Pending TTL is short. Poll gently; over-polling cancels the request. */
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ function unsafeClaims(idToken) {
14
14
 
15
15
  // src/wire.ts
16
16
  var WIRE_VERSION = 1;
17
- var SDK_VERSION = "0.1.23";
17
+ var SDK_VERSION = "0.1.24";
18
18
  var SDK_NAME = "@zoreal/oauth2-js";
19
19
  var DEFAULT_ISSUER = "https://id.zoreal.com";
20
20
  var POLL_INTERVAL_MS = 2e3;
@@ -1715,7 +1715,7 @@ function interpolate(template, time) {
1715
1715
  }
1716
1716
 
1717
1717
  // src/modal.ts
1718
- var DEFAULT_PAIRING_TIMEOUT_MS = 12e4;
1718
+ var DEFAULT_PAIRING_TIMEOUT_MS = 3e5;
1719
1719
  var URGENT_SECONDS = 20;
1720
1720
  function mmss(totalSeconds) {
1721
1721
  const m = Math.floor(totalSeconds / 60);
@@ -1787,7 +1787,7 @@ function mountPairingModal(state, options) {
1787
1787
  if (typeof document === "undefined") return null;
1788
1788
  ensureStyles();
1789
1789
  const t = strings(options.locale);
1790
- const timeoutMs = options.timeoutMs ?? DEFAULT_PAIRING_TIMEOUT_MS;
1790
+ const timeoutMs = options.timeoutMs;
1791
1791
  let closed = false;
1792
1792
  const scrim = el("div", `${cx("root")} ${cx("scrim")}`);
1793
1793
  scrim.dataset.theme = options.theme ?? "auto";
@@ -1845,7 +1845,8 @@ function mountPairingModal(state, options) {
1845
1845
  card.append(closeBtn, body, help, footer);
1846
1846
  scrim.appendChild(card);
1847
1847
  const serverMs = typeof state.expiresIn === "number" ? state.expiresIn * 1e3 : Infinity;
1848
- const deadline = Date.now() + Math.min(timeoutMs, serverMs);
1848
+ const capMs = timeoutMs ?? (Number.isFinite(serverMs) ? serverMs : DEFAULT_PAIRING_TIMEOUT_MS);
1849
+ const deadline = Date.now() + Math.min(capMs, serverMs);
1849
1850
  let shown = state.qrUrl;
1850
1851
  let loading = null;
1851
1852
  const spent = () => qr.dataset.spent === "true";