@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.esm.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
|
*/
|
|
@@ -1048,7 +1048,7 @@ const CSS_CLASSES = {
|
|
|
1048
1048
|
embedded: "didit-embedded",
|
|
1049
1049
|
curtain: "didit-modal-curtain"
|
|
1050
1050
|
};
|
|
1051
|
-
const SDK_VERSION = "0.
|
|
1051
|
+
const SDK_VERSION = "0.7.0";
|
|
1052
1052
|
/**
|
|
1053
1053
|
* The permissions the verification iframe gets, in a modal and embedded:
|
|
1054
1054
|
* camera and microphone for capture, clipboard-write for the flow's copy
|
|
@@ -1727,6 +1727,8 @@ function getTranslations(language) {
|
|
|
1727
1727
|
const SIZE_ANIMATION_MS = 300;
|
|
1728
1728
|
/** How long the modal waits for the first layout before it shows at step size, so it can never hang. */
|
|
1729
1729
|
const FIRST_LAYOUT_TIMEOUT_MS = 3000;
|
|
1730
|
+
/** A strip is a line or two of text: a taller value is not one, and would push the close button out of reach. */
|
|
1731
|
+
const MAX_TOP_INSET = 160;
|
|
1730
1732
|
/** The flow's ground (site-ground in the design system), which a full-screen modal paints the page with. */
|
|
1731
1733
|
const FLOW_GROUND = { light: "#ffffff", dark: "#0b0b0d" };
|
|
1732
1734
|
class VerificationModal {
|
|
@@ -2110,7 +2112,7 @@ class VerificationModal {
|
|
|
2110
2112
|
}
|
|
2111
2113
|
|
|
2112
2114
|
.${CSS_CLASSES.flowSized} .${CSS_CLASSES.closeButton} {
|
|
2113
|
-
top: 8px;
|
|
2115
|
+
top: calc(8px + var(--didit-top-inset, 0px));
|
|
2114
2116
|
right: 8px;
|
|
2115
2117
|
width: 44px;
|
|
2116
2118
|
height: 44px;
|
|
@@ -2411,11 +2413,12 @@ class VerificationModal {
|
|
|
2411
2413
|
/**
|
|
2412
2414
|
* Reads a didit:layout message's data. Without a positive contentHeight the
|
|
2413
2415
|
* message is ignored; a missing or unknown colorScheme follows the device,
|
|
2414
|
-
*
|
|
2416
|
+
* a missing or unknown dir follows the verification URL's language, and the
|
|
2417
|
+
* close button keeps its place without a plausible topInset.
|
|
2415
2418
|
*/
|
|
2416
2419
|
readFlowLayout(data) {
|
|
2417
2420
|
const fields = typeof data === "object" && data !== null ? data : {};
|
|
2418
|
-
const { contentHeight, colorScheme, dir, kind } = fields;
|
|
2421
|
+
const { contentHeight, colorScheme, dir, kind, topInset } = fields;
|
|
2419
2422
|
if (typeof contentHeight !== "number" || !Number.isFinite(contentHeight) || contentHeight <= 0) {
|
|
2420
2423
|
return null;
|
|
2421
2424
|
}
|
|
@@ -2424,7 +2427,8 @@ class VerificationModal {
|
|
|
2424
2427
|
kind: kind === "handoff" ? "handoff" : "step",
|
|
2425
2428
|
contentHeight: Math.ceil(contentHeight),
|
|
2426
2429
|
colorScheme: colorScheme === "light" || colorScheme === "dark" ? colorScheme : prefersDark ? "dark" : "light",
|
|
2427
|
-
dir: dir === "ltr" || dir === "rtl" ? dir : isRtlLanguage(this.language) ? "rtl" : "ltr"
|
|
2430
|
+
dir: dir === "ltr" || dir === "rtl" ? dir : isRtlLanguage(this.language) ? "rtl" : "ltr",
|
|
2431
|
+
topInset: typeof topInset === "number" && topInset > 0 && topInset <= MAX_TOP_INSET ? Math.ceil(topInset) : 0
|
|
2428
2432
|
};
|
|
2429
2433
|
}
|
|
2430
2434
|
/** Embedded mode keeps filling the integrator's host element, whatever the flow reports. */
|
|
@@ -2438,6 +2442,8 @@ class VerificationModal {
|
|
|
2438
2442
|
// The height the person sees now, before the reported content height can change it.
|
|
2439
2443
|
const shownHeight = this.container.offsetHeight;
|
|
2440
2444
|
this.container.style.setProperty("--didit-content-height", `${layout.contentHeight}px`);
|
|
2445
|
+
// The close button sits under the flow's strip, over its top bar.
|
|
2446
|
+
this.container.style.setProperty("--didit-top-inset", `${layout.topInset}px`);
|
|
2441
2447
|
this.matchPageBackground(layout.colorScheme);
|
|
2442
2448
|
if (this.curtain)
|
|
2443
2449
|
this.curtain.dataset.diditTheme = layout.colorScheme;
|
|
@@ -2641,6 +2647,7 @@ class VerificationModal {
|
|
|
2641
2647
|
delete this.container.dataset.diditDir;
|
|
2642
2648
|
delete this.container.dataset.diditKind;
|
|
2643
2649
|
this.container.style.removeProperty("--didit-content-height");
|
|
2650
|
+
this.container.style.removeProperty("--didit-top-inset");
|
|
2644
2651
|
if (this.firstLayoutTimeout !== null) {
|
|
2645
2652
|
window.clearTimeout(this.firstLayoutTimeout);
|
|
2646
2653
|
this.firstLayoutTimeout = null;
|