@nibgate/sdk 0.2.33 → 0.2.35
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/nibgate.js +31 -11
- package/dist/nibgate.js.map +2 -2
- package/dist/nibgate.min.js +15 -15
- package/dist/nibgate.min.js.map +3 -3
- package/package.json +1 -1
- package/src/browser/default-ui.js +24 -11
package/dist/nibgate.js
CHANGED
|
@@ -27360,7 +27360,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27360
27360
|
<div data-nibgate-wallet-label class="nui-mono" style="font-size:18px;color:${theme.muted};margin-bottom:40px;min-height:28px">Connect wallet</div>
|
|
27361
27361
|
<div data-nibgate-unlock-wrap style="width:100%;position:relative;border-radius:10px;overflow:hidden;cursor:pointer">
|
|
27362
27362
|
<div data-nibgate-unlock-progress style="position:absolute;inset:0;width:0%;background:rgba(255,255,255,0.35);border-radius:10px;transition:width .05s linear;z-index:2"></div>
|
|
27363
|
-
<button type="button" data-nibgate-unlock
|
|
27363
|
+
<button type="button" data-nibgate-unlock style="width:100%;padding:14px 0;font-size:17px;font-weight:600;line-height:1;border:0;border-radius:10px;outline:none;cursor:pointer;position:relative;z-index:4;color:#fff;background:${theme.accent};box-shadow:0 4px 12px rgba(0,0,0,0.15);transition:transform .1s,box-shadow .1s;font-family:inherit;display:flex;align-items:center;justify-content:center">${unlockSVG}Hold to pay</button></div>
|
|
27364
27364
|
<div class="nui-stat" style="text-align:center;margin-top:16px" data-nibgate-status></div>
|
|
27365
27365
|
</div>
|
|
27366
27366
|
<div data-nibgate-premium hidden style="margin-top:32px;border-top:1px solid ${theme.border};padding-top:32px">${options.premiumContentHTML || ""}</div>
|
|
@@ -27438,12 +27438,12 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27438
27438
|
label.innerHTML = shortAddress(addr) + ' <span data-nibgate-disconnect style="cursor:pointer">\xB7 Disconnect</span> <span data-nibgate-bal style="margin-left:4px;cursor:pointer;white-space:nowrap;color:var(--accent,#7c9a6d)">\xB7 <span data-nibgate-bal-txt></span> | ' + depIcon() + "</span>";
|
|
27439
27439
|
balEl = label.querySelector("[data-nibgate-bal]");
|
|
27440
27440
|
balEl?.addEventListener("click", showDeposit);
|
|
27441
|
-
btn.
|
|
27441
|
+
btn.style.opacity = "1";
|
|
27442
27442
|
btn.style.cursor = "pointer";
|
|
27443
27443
|
} else {
|
|
27444
27444
|
label.innerHTML = "Connect wallet";
|
|
27445
|
-
btn.
|
|
27446
|
-
btn.style.cursor = "
|
|
27445
|
+
btn.style.opacity = "0.6";
|
|
27446
|
+
btn.style.cursor = "pointer";
|
|
27447
27447
|
btn.innerHTML = unlockSVG + "Hold to pay";
|
|
27448
27448
|
}
|
|
27449
27449
|
}
|
|
@@ -27455,7 +27455,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27455
27455
|
}
|
|
27456
27456
|
}
|
|
27457
27457
|
function setBtnText(t) {
|
|
27458
|
-
btn.innerHTML = unlockSVG + t;
|
|
27458
|
+
btn.innerHTML = unlockSVG + (t || "Hold to pay");
|
|
27459
27459
|
}
|
|
27460
27460
|
function resetHold() {
|
|
27461
27461
|
holdActive = false;
|
|
@@ -27464,11 +27464,29 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27464
27464
|
btn.style.transform = "";
|
|
27465
27465
|
btn.style.boxShadow = "";
|
|
27466
27466
|
prog.style.width = "0%";
|
|
27467
|
-
|
|
27467
|
+
setBtnText("Hold to pay");
|
|
27468
27468
|
}
|
|
27469
27469
|
function startHold(e) {
|
|
27470
|
-
if (
|
|
27470
|
+
if (holdActive) return;
|
|
27471
27471
|
e.preventDefault();
|
|
27472
|
+
if (!ctrl.getWalletAddress()) {
|
|
27473
|
+
setBtnText("Connecting\u2026");
|
|
27474
|
+
btn.style.opacity = "0.6";
|
|
27475
|
+
ctrl.connect().then(() => {
|
|
27476
|
+
updateLabel();
|
|
27477
|
+
btn.style.opacity = "1";
|
|
27478
|
+
setBtnText("Hold\u2026");
|
|
27479
|
+
beginHold();
|
|
27480
|
+
}).catch(() => {
|
|
27481
|
+
updateLabel();
|
|
27482
|
+
btn.style.opacity = "1";
|
|
27483
|
+
setBtnText("Hold to pay");
|
|
27484
|
+
});
|
|
27485
|
+
return;
|
|
27486
|
+
}
|
|
27487
|
+
beginHold();
|
|
27488
|
+
}
|
|
27489
|
+
function beginHold() {
|
|
27472
27490
|
holdActive = true;
|
|
27473
27491
|
holdComplete = false;
|
|
27474
27492
|
btn.style.transform = "scale(0.96)";
|
|
@@ -27487,7 +27505,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27487
27505
|
btn.style.boxShadow = "";
|
|
27488
27506
|
prog.style.transition = "width .05s linear";
|
|
27489
27507
|
setBtnText("Processing\u2026");
|
|
27490
|
-
btn.
|
|
27508
|
+
btn.style.opacity = "0.6";
|
|
27491
27509
|
setTimeout(() => ctrl.unlock().then(updateLabel).catch(updateLabel), 300);
|
|
27492
27510
|
}, HOLD_MS);
|
|
27493
27511
|
}
|
|
@@ -27497,7 +27515,9 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27497
27515
|
resetHold();
|
|
27498
27516
|
}
|
|
27499
27517
|
label.addEventListener("click", (e) => {
|
|
27500
|
-
if (
|
|
27518
|
+
if (e.target.dataset.nibgateDisconnect !== void 0) {
|
|
27519
|
+
ctrl.disconnect().then(updateLabel);
|
|
27520
|
+
} else if (!ctrl.getWalletAddress()) {
|
|
27501
27521
|
ctrl.connect().then(updateLabel).catch(() => updateLabel());
|
|
27502
27522
|
}
|
|
27503
27523
|
});
|
|
@@ -27512,7 +27532,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27512
27532
|
document.removeEventListener("touchend", cancelHold);
|
|
27513
27533
|
};
|
|
27514
27534
|
card.addEventListener("remove", cleanup);
|
|
27515
|
-
let gwOverlay = null, balTimer = null;
|
|
27535
|
+
let balEl = null, gwOverlay = null, balTimer = null;
|
|
27516
27536
|
function depIcon() {
|
|
27517
27537
|
return '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline;vertical-align:middle"><path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M19 21H5"/></svg>';
|
|
27518
27538
|
}
|
|
@@ -27567,7 +27587,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27567
27587
|
}
|
|
27568
27588
|
}
|
|
27569
27589
|
if (window.ethereum) {
|
|
27570
|
-
balTimer = setInterval(refreshBal,
|
|
27590
|
+
balTimer = setInterval(refreshBal, 15e3);
|
|
27571
27591
|
setTimeout(refreshBal, 1e3);
|
|
27572
27592
|
window.ethereum.on("accountsChanged", refreshBal);
|
|
27573
27593
|
}
|