@zoreal/oauth2-react 0.2.22 → 0.2.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.cjs +43 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.24";
|
|
46
46
|
var DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
47
47
|
var POLL_INTERVAL_MS = 2e3;
|
|
48
48
|
var POLL_INTERVAL_ENROLLING_MS = 5e3;
|
|
@@ -1652,9 +1652,16 @@ var SVG_NS = "http://www.w3.org/2000/svg";
|
|
|
1652
1652
|
var TAIL = 0.3;
|
|
1653
1653
|
var STACK = Array.from({ length: 12 }, (_, i) => 12 - i);
|
|
1654
1654
|
var HALO = [3, 2, 1];
|
|
1655
|
-
function
|
|
1656
|
-
const
|
|
1657
|
-
|
|
1655
|
+
function cornerOf(radius, width, height) {
|
|
1656
|
+
const raw = radius.trim();
|
|
1657
|
+
const value = parseFloat(raw);
|
|
1658
|
+
const offset = 2;
|
|
1659
|
+
if (raw.endsWith("%") && Number.isFinite(value)) {
|
|
1660
|
+
return [width * value / 100 + offset, height * value / 100 + offset];
|
|
1661
|
+
}
|
|
1662
|
+
const px = Number.isFinite(value) ? value : /infinity/i.test(raw) ? Infinity : 8;
|
|
1663
|
+
const r = Math.min(px, width / 2, height / 2) + offset;
|
|
1664
|
+
return [r, r];
|
|
1658
1665
|
}
|
|
1659
1666
|
function holdBusy(control) {
|
|
1660
1667
|
if (typeof document === "undefined") return () => {
|
|
@@ -1675,12 +1682,11 @@ function holdBusy(control) {
|
|
|
1675
1682
|
overlay.setAttribute("aria-hidden", "true");
|
|
1676
1683
|
const svg = document.createElementNS(SVG_NS, "svg");
|
|
1677
1684
|
svg.setAttribute("class", cx("ring-svg"));
|
|
1678
|
-
const
|
|
1685
|
+
const rects = [];
|
|
1679
1686
|
const layer = (name, len, alpha) => {
|
|
1680
1687
|
const rect = document.createElementNS(SVG_NS, "rect");
|
|
1681
1688
|
rect.setAttribute("class", cx(name));
|
|
1682
|
-
|
|
1683
|
-
rect.setAttribute("ry", String(rx));
|
|
1689
|
+
rects.push(rect);
|
|
1684
1690
|
rect.style.strokeDasharray = `calc(var(--zrl-l) * ${len}) calc(var(--zrl-l) * ${1 - len})`;
|
|
1685
1691
|
rect.style.setProperty("--zrl-s", `calc(var(--zrl-l) * ${-(TAIL - len)})`);
|
|
1686
1692
|
rect.style.opacity = alpha;
|
|
@@ -1703,6 +1709,11 @@ function holdBusy(control) {
|
|
|
1703
1709
|
overlay.style.top = `${box.top}px`;
|
|
1704
1710
|
overlay.style.width = `${box.width}px`;
|
|
1705
1711
|
overlay.style.height = `${box.height}px`;
|
|
1712
|
+
const [rx, ry] = cornerOf(getComputedStyle(control).borderTopLeftRadius, box.width, box.height);
|
|
1713
|
+
for (const rect of rects) {
|
|
1714
|
+
rect.setAttribute("rx", String(rx));
|
|
1715
|
+
rect.setAttribute("ry", String(ry));
|
|
1716
|
+
}
|
|
1706
1717
|
const length = typeof measured?.getTotalLength === "function" ? measured.getTotalLength() : 0;
|
|
1707
1718
|
if (length > 0) overlay.style.setProperty("--zrl-ring-len", `${length}px`);
|
|
1708
1719
|
};
|
|
@@ -1786,6 +1797,30 @@ function markReturnDone(requestId) {
|
|
|
1786
1797
|
function isReturnDone(requestId) {
|
|
1787
1798
|
return storage()?.getItem(DONE + requestId) !== null && storage()?.getItem(DONE + requestId) !== void 0;
|
|
1788
1799
|
}
|
|
1800
|
+
function visibleOrDone(requestId, signal) {
|
|
1801
|
+
if (typeof document === "undefined" || document.visibilityState !== "hidden") {
|
|
1802
|
+
return Promise.resolve(!isReturnDone(requestId));
|
|
1803
|
+
}
|
|
1804
|
+
return new Promise((resolve) => {
|
|
1805
|
+
const finish = (value) => {
|
|
1806
|
+
document.removeEventListener("visibilitychange", onVisible);
|
|
1807
|
+
window.removeEventListener("storage", onStorage);
|
|
1808
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1809
|
+
resolve(value);
|
|
1810
|
+
};
|
|
1811
|
+
const onVisible = () => {
|
|
1812
|
+
if (document.visibilityState !== "hidden") finish(!isReturnDone(requestId));
|
|
1813
|
+
};
|
|
1814
|
+
const onStorage = () => {
|
|
1815
|
+
if (isReturnDone(requestId)) finish(false);
|
|
1816
|
+
};
|
|
1817
|
+
const onAbort = () => finish(false);
|
|
1818
|
+
document.addEventListener("visibilitychange", onVisible);
|
|
1819
|
+
window.addEventListener("storage", onStorage);
|
|
1820
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1821
|
+
if (isReturnDone(requestId)) finish(false);
|
|
1822
|
+
});
|
|
1823
|
+
}
|
|
1789
1824
|
function returnToUrl() {
|
|
1790
1825
|
if (typeof window === "undefined") return void 0;
|
|
1791
1826
|
const { href } = window.location;
|
|
@@ -2348,7 +2383,7 @@ function useZorealFlow(options) {
|
|
|
2348
2383
|
controller.signal,
|
|
2349
2384
|
{ tolerateUnknownUntil: Date.now() + 15e3 }
|
|
2350
2385
|
);
|
|
2351
|
-
if (
|
|
2386
|
+
if (!await visibleOrDone(requestId, controller.signal)) {
|
|
2352
2387
|
throw new DOMException("aborted", "AbortError");
|
|
2353
2388
|
}
|
|
2354
2389
|
} else {
|