@didit-protocol/sdk-web 0.6.0 → 0.7.0
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/didit-sdk.cjs +13 -6
- package/dist/didit-sdk.cjs.js +13 -6
- package/dist/didit-sdk.cjs.js.map +1 -1
- package/dist/didit-sdk.cjs.map +1 -1
- package/dist/didit-sdk.esm.js +13 -6
- package/dist/didit-sdk.esm.js.map +1 -1
- package/dist/didit-sdk.module.js +13 -6
- package/dist/didit-sdk.module.js.map +1 -1
- package/dist/didit-sdk.umd.js +13 -6
- package/dist/didit-sdk.umd.js.map +1 -1
- package/dist/didit-sdk.umd.min.js +2 -2
- package/dist/didit-sdk.umd.min.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/didit-sdk.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Didit SDK for Web v0.
|
|
2
|
+
* Didit SDK for Web v0.7.0
|
|
3
3
|
* (c) 2026 Didit
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -26,7 +26,7 @@ const CSS_CLASSES = {
|
|
|
26
26
|
embedded: "didit-embedded",
|
|
27
27
|
curtain: "didit-modal-curtain"
|
|
28
28
|
};
|
|
29
|
-
const SDK_VERSION = "0.
|
|
29
|
+
const SDK_VERSION = "0.7.0";
|
|
30
30
|
/**
|
|
31
31
|
* The permissions the verification iframe gets, in a modal and embedded:
|
|
32
32
|
* camera and microphone for capture, clipboard-write for the flow's copy
|
|
@@ -705,6 +705,8 @@ function getTranslations(language) {
|
|
|
705
705
|
const SIZE_ANIMATION_MS = 300;
|
|
706
706
|
/** How long the modal waits for the first layout before it shows at step size, so it can never hang. */
|
|
707
707
|
const FIRST_LAYOUT_TIMEOUT_MS = 3000;
|
|
708
|
+
/** A strip is a line or two of text: a taller value is not one, and would push the close button out of reach. */
|
|
709
|
+
const MAX_TOP_INSET = 160;
|
|
708
710
|
/** The flow's ground (site-ground in the design system), which a full-screen modal paints the page with. */
|
|
709
711
|
const FLOW_GROUND = { light: "#ffffff", dark: "#0b0b0d" };
|
|
710
712
|
class VerificationModal {
|
|
@@ -1088,7 +1090,7 @@ class VerificationModal {
|
|
|
1088
1090
|
}
|
|
1089
1091
|
|
|
1090
1092
|
.${CSS_CLASSES.flowSized} .${CSS_CLASSES.closeButton} {
|
|
1091
|
-
top: 8px;
|
|
1093
|
+
top: calc(8px + var(--didit-top-inset, 0px));
|
|
1092
1094
|
right: 8px;
|
|
1093
1095
|
width: 44px;
|
|
1094
1096
|
height: 44px;
|
|
@@ -1389,11 +1391,12 @@ class VerificationModal {
|
|
|
1389
1391
|
/**
|
|
1390
1392
|
* Reads a didit:layout message's data. Without a positive contentHeight the
|
|
1391
1393
|
* message is ignored; a missing or unknown colorScheme follows the device,
|
|
1392
|
-
*
|
|
1394
|
+
* a missing or unknown dir follows the verification URL's language, and the
|
|
1395
|
+
* close button keeps its place without a plausible topInset.
|
|
1393
1396
|
*/
|
|
1394
1397
|
readFlowLayout(data) {
|
|
1395
1398
|
const fields = typeof data === "object" && data !== null ? data : {};
|
|
1396
|
-
const { contentHeight, colorScheme, dir, kind } = fields;
|
|
1399
|
+
const { contentHeight, colorScheme, dir, kind, topInset } = fields;
|
|
1397
1400
|
if (typeof contentHeight !== "number" || !Number.isFinite(contentHeight) || contentHeight <= 0) {
|
|
1398
1401
|
return null;
|
|
1399
1402
|
}
|
|
@@ -1402,7 +1405,8 @@ class VerificationModal {
|
|
|
1402
1405
|
kind: kind === "handoff" ? "handoff" : "step",
|
|
1403
1406
|
contentHeight: Math.ceil(contentHeight),
|
|
1404
1407
|
colorScheme: colorScheme === "light" || colorScheme === "dark" ? colorScheme : prefersDark ? "dark" : "light",
|
|
1405
|
-
dir: dir === "ltr" || dir === "rtl" ? dir : isRtlLanguage(this.language) ? "rtl" : "ltr"
|
|
1408
|
+
dir: dir === "ltr" || dir === "rtl" ? dir : isRtlLanguage(this.language) ? "rtl" : "ltr",
|
|
1409
|
+
topInset: typeof topInset === "number" && topInset > 0 && topInset <= MAX_TOP_INSET ? Math.ceil(topInset) : 0
|
|
1406
1410
|
};
|
|
1407
1411
|
}
|
|
1408
1412
|
/** Embedded mode keeps filling the integrator's host element, whatever the flow reports. */
|
|
@@ -1416,6 +1420,8 @@ class VerificationModal {
|
|
|
1416
1420
|
// The height the person sees now, before the reported content height can change it.
|
|
1417
1421
|
const shownHeight = this.container.offsetHeight;
|
|
1418
1422
|
this.container.style.setProperty("--didit-content-height", `${layout.contentHeight}px`);
|
|
1423
|
+
// The close button sits under the flow's strip, over its top bar.
|
|
1424
|
+
this.container.style.setProperty("--didit-top-inset", `${layout.topInset}px`);
|
|
1419
1425
|
this.matchPageBackground(layout.colorScheme);
|
|
1420
1426
|
if (this.curtain)
|
|
1421
1427
|
this.curtain.dataset.diditTheme = layout.colorScheme;
|
|
@@ -1619,6 +1625,7 @@ class VerificationModal {
|
|
|
1619
1625
|
delete this.container.dataset.diditDir;
|
|
1620
1626
|
delete this.container.dataset.diditKind;
|
|
1621
1627
|
this.container.style.removeProperty("--didit-content-height");
|
|
1628
|
+
this.container.style.removeProperty("--didit-top-inset");
|
|
1622
1629
|
if (this.firstLayoutTimeout !== null) {
|
|
1623
1630
|
window.clearTimeout(this.firstLayoutTimeout);
|
|
1624
1631
|
this.firstLayoutTimeout = null;
|