@nibgate/sdk 0.2.31 → 0.2.33
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 +23 -34
- package/dist/nibgate.js.map +2 -2
- package/dist/nibgate.min.js +51 -51
- package/dist/nibgate.min.js.map +3 -3
- package/package.json +1 -1
- package/src/browser/default-ui.js +22 -35
package/dist/nibgate.js
CHANGED
|
@@ -27357,10 +27357,10 @@ ${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
|
-
<div data-nibgate-unlock-progress style="position:absolute;inset:0;width:0%;background
|
|
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};
|
|
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 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};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>
|
|
@@ -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
|
}
|
|
@@ -27459,8 +27461,8 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27459
27461
|
holdActive = false;
|
|
27460
27462
|
holdComplete = false;
|
|
27461
27463
|
holdTimer = null;
|
|
27462
|
-
btn.style.transform = "
|
|
27463
|
-
btn.style.boxShadow = "
|
|
27464
|
+
btn.style.transform = "";
|
|
27465
|
+
btn.style.boxShadow = "";
|
|
27464
27466
|
prog.style.width = "0%";
|
|
27465
27467
|
if (!btn.disabled) setBtnText("Hold to pay");
|
|
27466
27468
|
}
|
|
@@ -27469,8 +27471,8 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27469
27471
|
e.preventDefault();
|
|
27470
27472
|
holdActive = true;
|
|
27471
27473
|
holdComplete = false;
|
|
27472
|
-
btn.style.transform = "scale(.
|
|
27473
|
-
btn.style.boxShadow = "0 2px
|
|
27474
|
+
btn.style.transform = "scale(0.96)";
|
|
27475
|
+
btn.style.boxShadow = "0 2px 8px rgba(0,0,0,0.2)";
|
|
27474
27476
|
prog.style.transition = "none";
|
|
27475
27477
|
prog.style.width = "0%";
|
|
27476
27478
|
setBtnText("Hold\u2026");
|
|
@@ -27481,8 +27483,8 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27481
27483
|
holdTimer = setTimeout(() => {
|
|
27482
27484
|
holdComplete = true;
|
|
27483
27485
|
holdActive = false;
|
|
27484
|
-
btn.style.transform = "
|
|
27485
|
-
btn.style.boxShadow = "
|
|
27486
|
+
btn.style.transform = "";
|
|
27487
|
+
btn.style.boxShadow = "";
|
|
27486
27488
|
prog.style.transition = "width .05s linear";
|
|
27487
27489
|
setBtnText("Processing\u2026");
|
|
27488
27490
|
btn.disabled = true;
|
|
@@ -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",
|