@nibgate/sdk 0.2.31 → 0.2.32
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 +15 -26
- package/dist/nibgate.js.map +2 -2
- package/dist/nibgate.min.js +23 -23
- package/dist/nibgate.min.js.map +3 -3
- package/package.json +1 -1
- package/src/browser/default-ui.js +14 -27
package/dist/nibgate.js
CHANGED
|
@@ -27357,7 +27357,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27357
27357
|
<div id="nibgate-lottie" style="width:165px;height:168px;margin-bottom:24px"></div>
|
|
27358
27358
|
<div style="font-size:50px;font-weight:700;letter-spacing:-.03em;color:${theme.fg};margin-bottom:12px">${esc(resource.price)} USDC</div>
|
|
27359
27359
|
<div style="font-size:21px;color:${theme.muted};margin-bottom:48px">Pay to unlock this content</div>
|
|
27360
|
-
<div data-nibgate-wallet-label class="nui-mono" style="font-size:18px;color:${theme.muted};margin-bottom:40px;min-height:28px">Connect wallet
|
|
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:${theme.accent};opacity:0.15;border-radius:10px;transition:width .05s linear;z-index:2"></div>
|
|
27363
27363
|
<button type="button" data-nibgate-unlock disabled 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};transition:box-shadow .3s,transform .3s;font-family:inherit;display:flex;align-items:center;justify-content:center">${unlockSVG}Hold to pay</button></div>
|
|
@@ -27434,24 +27434,26 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27434
27434
|
}
|
|
27435
27435
|
function updateLabel() {
|
|
27436
27436
|
const addr = ctrl.getWalletAddress();
|
|
27437
|
-
while (label.firstChild) label.removeChild(label.firstChild);
|
|
27438
27437
|
if (addr) {
|
|
27439
|
-
label.
|
|
27440
|
-
|
|
27441
|
-
|
|
27442
|
-
if (e.target.dataset.nibgateDisconnect !== void 0) ctrl.disconnect().then(updateLabel);
|
|
27443
|
-
});
|
|
27444
|
-
label.appendChild(dc);
|
|
27445
|
-
if (balEl?.isConnected) label.appendChild(balEl);
|
|
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
|
+
balEl = label.querySelector("[data-nibgate-bal]");
|
|
27440
|
+
balEl?.addEventListener("click", showDeposit);
|
|
27446
27441
|
btn.disabled = false;
|
|
27447
27442
|
btn.style.cursor = "pointer";
|
|
27448
27443
|
} else {
|
|
27449
|
-
label.
|
|
27444
|
+
label.innerHTML = "Connect wallet";
|
|
27450
27445
|
btn.disabled = true;
|
|
27451
27446
|
btn.style.cursor = "default";
|
|
27452
27447
|
btn.innerHTML = unlockSVG + "Hold to pay";
|
|
27453
27448
|
}
|
|
27454
27449
|
}
|
|
27450
|
+
function attachBalClick() {
|
|
27451
|
+
const b = label.querySelector("[data-nibgate-bal]");
|
|
27452
|
+
if (b && !b._clickAttached) {
|
|
27453
|
+
b.addEventListener("click", showDeposit);
|
|
27454
|
+
b._clickAttached = true;
|
|
27455
|
+
}
|
|
27456
|
+
}
|
|
27455
27457
|
function setBtnText(t) {
|
|
27456
27458
|
btn.innerHTML = unlockSVG + t;
|
|
27457
27459
|
}
|
|
@@ -27510,7 +27512,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27510
27512
|
document.removeEventListener("touchend", cancelHold);
|
|
27511
27513
|
};
|
|
27512
27514
|
card.addEventListener("remove", cleanup);
|
|
27513
|
-
let
|
|
27515
|
+
let gwOverlay = null, balTimer = null;
|
|
27514
27516
|
function depIcon() {
|
|
27515
27517
|
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>';
|
|
27516
27518
|
}
|
|
@@ -27545,27 +27547,14 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27545
27547
|
document.removeEventListener("keydown", onDepKey);
|
|
27546
27548
|
}
|
|
27547
27549
|
}
|
|
27548
|
-
function ensureBal() {
|
|
27549
|
-
if (balEl && balEl.isConnected) return balEl;
|
|
27550
|
-
balEl = label.querySelector("[data-nibgate-bal]");
|
|
27551
|
-
if (balEl) {
|
|
27552
|
-
balEl.style.display = "";
|
|
27553
|
-
balEl.style.marginLeft = "4px";
|
|
27554
|
-
balEl.style.cursor = "pointer";
|
|
27555
|
-
balEl.style.whiteSpace = "nowrap";
|
|
27556
|
-
balEl.style.color = "var(--accent,#7c9a6d)";
|
|
27557
|
-
balEl.innerHTML = "\xB7\xA0<span data-nibgate-bal-txt></span>\xA0|\xA0" + depIcon();
|
|
27558
|
-
balEl.addEventListener("click", showDeposit);
|
|
27559
|
-
}
|
|
27560
|
-
return balEl;
|
|
27561
|
-
}
|
|
27562
27550
|
async function refreshBal() {
|
|
27563
27551
|
if (!card.isConnected || !window.ethereum || !options.gatewayBalanceUrl) return;
|
|
27564
27552
|
try {
|
|
27565
27553
|
const accts = await window.ethereum.request({ method: "eth_accounts" });
|
|
27566
27554
|
const addr = Array.isArray(accts) && accts[0] ? accts[0] : null;
|
|
27567
27555
|
if (!addr) return;
|
|
27568
|
-
|
|
27556
|
+
attachBalClick();
|
|
27557
|
+
const t = label.querySelector("[data-nibgate-bal-txt]");
|
|
27569
27558
|
if (!t) return;
|
|
27570
27559
|
const r = await fetch(options.gatewayBalanceUrl, {
|
|
27571
27560
|
method: "POST",
|