@nibgate/sdk 0.2.21 → 0.2.22
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 +47 -5
- package/dist/nibgate.js.map +2 -2
- package/dist/nibgate.min.js +57 -54
- package/dist/nibgate.min.js.map +3 -3
- package/package.json +1 -1
- package/src/browser/default-ui.js +29 -5
package/dist/nibgate.js
CHANGED
|
@@ -27343,21 +27343,63 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
27343
27343
|
if (!el2) return;
|
|
27344
27344
|
el2.textContent = msg || "";
|
|
27345
27345
|
}
|
|
27346
|
+
function esc(s) {
|
|
27347
|
+
const d = document.createElement("div");
|
|
27348
|
+
d.textContent = String(s ?? "");
|
|
27349
|
+
return d.innerHTML;
|
|
27350
|
+
}
|
|
27346
27351
|
function renderDefaultUnlockUI(container, resource, options = {}) {
|
|
27347
27352
|
inject();
|
|
27348
27353
|
const card = el("div", { cls: "nui", style: { animation: "nfade .2s ease-out" } });
|
|
27349
27354
|
const unlockSVG = '<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;margin-right:6px"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/></svg>';
|
|
27350
27355
|
card.innerHTML = `
|
|
27351
|
-
<div style="display:flex;flex-direction:column;align-items:center;text-align:center;max-width:
|
|
27352
|
-
<div
|
|
27356
|
+
<div style="display:flex;flex-direction:column;align-items:center;text-align:center;max-width:580px;margin:0 auto;padding:40px 52px">
|
|
27357
|
+
<div id="nibgate-lottie" style="width:165px;height:168px;margin-bottom:24px"></div>
|
|
27358
|
+
<div style="font-size:50px;font-weight:700;letter-spacing:-.03em;color:${theme.fg};margin-bottom:12px">${esc(resource.price)} USDC</div>
|
|
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</div>
|
|
27353
27361
|
<div data-nibgate-unlock-wrap style="width:100%;position:relative;border-radius:10px;overflow:hidden;cursor:pointer">
|
|
27354
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>
|
|
27355
|
-
<button type="button" data-nibgate-unlock disabled style="width:100%;padding:
|
|
27356
|
-
<div class="nui-stat" style="text-align:center;margin-top:
|
|
27363
|
+
<button type="button" data-nibgate-unlock disabled style="width:100%;padding:14px 0;font-size:17px;font-weight:500;line-height:1;border:0;border-radius:10px;outline:none;cursor:pointer;position:relative;z-index:4;color:${theme.accent};background:rgba(124,154,109,0.08);transition:box-shadow .3s,transform .3s;font-family:inherit;display:flex;align-items:center;justify-content:center">${unlockSVG}Hold to pay</button></div>
|
|
27364
|
+
<div class="nui-stat" style="text-align:center;margin-top:16px" data-nibgate-status></div>
|
|
27357
27365
|
</div>
|
|
27358
|
-
<div data-nibgate-premium hidden style="margin-top:
|
|
27366
|
+
<div data-nibgate-premium hidden style="margin-top:32px;border-top:1px solid ${theme.border};padding-top:32px">${options.premiumContentHTML || ""}</div>
|
|
27359
27367
|
`;
|
|
27360
27368
|
(typeof container === "string" ? document.querySelector(container) : container)?.appendChild(card);
|
|
27369
|
+
(function loadLottie() {
|
|
27370
|
+
if (!document.getElementById("nibgate-lottie")) return;
|
|
27371
|
+
function startAnim(data) {
|
|
27372
|
+
var d = document.getElementById("nibgate-lottie");
|
|
27373
|
+
if (d && window.lottie) window.lottie.loadAnimation({ container: d, animationData: data, loop: true, autoplay: true });
|
|
27374
|
+
}
|
|
27375
|
+
if (window.lottie) {
|
|
27376
|
+
if (window._lottieData) startAnim(window._lottieData);
|
|
27377
|
+
else fetch("/nibgate-unlock-key.json?t=1").then(function(r) {
|
|
27378
|
+
if (!r.ok) throw new Error();
|
|
27379
|
+
return r.json();
|
|
27380
|
+
}).then(function(d) {
|
|
27381
|
+
window._lottieData = d;
|
|
27382
|
+
startAnim(d);
|
|
27383
|
+
}).catch(function() {
|
|
27384
|
+
});
|
|
27385
|
+
return;
|
|
27386
|
+
}
|
|
27387
|
+
if (window._lottieLoading) return;
|
|
27388
|
+
window._lottieLoading = true;
|
|
27389
|
+
var s = document.createElement("script");
|
|
27390
|
+
s.src = "https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie.min.js";
|
|
27391
|
+
s.onload = function() {
|
|
27392
|
+
fetch("/nibgate-unlock-key.json?t=1").then(function(r) {
|
|
27393
|
+
if (!r.ok) throw new Error();
|
|
27394
|
+
return r.json();
|
|
27395
|
+
}).then(function(d) {
|
|
27396
|
+
window._lottieData = d;
|
|
27397
|
+
startAnim(d);
|
|
27398
|
+
}).catch(function() {
|
|
27399
|
+
});
|
|
27400
|
+
};
|
|
27401
|
+
document.head.appendChild(s);
|
|
27402
|
+
})();
|
|
27361
27403
|
const st = card.querySelector("[data-nibgate-status]");
|
|
27362
27404
|
const label = card.querySelector("[data-nibgate-wallet-label]");
|
|
27363
27405
|
const wrap3 = card.querySelector("[data-nibgate-unlock-wrap]");
|