@nibgate/sdk 0.2.34 → 0.2.36
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 +20 -8
- package/dist/nibgate.js.map +2 -2
- package/dist/nibgate.min.js +29 -27
- package/dist/nibgate.min.js.map +3 -3
- package/package.json +1 -1
- package/src/browser/default-ui.js +17 -8
package/package.json
CHANGED
|
@@ -82,9 +82,11 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
|
|
|
82
82
|
<div style="font-size:50px;font-weight:700;letter-spacing:-.03em;color:${theme.fg};margin-bottom:12px">${esc(resource.price)} USDC</div>
|
|
83
83
|
<div style="font-size:21px;color:${theme.muted};margin-bottom:48px">Pay to unlock this content</div>
|
|
84
84
|
<div data-nibgate-wallet-label class="nui-mono" style="font-size:18px;color:${theme.muted};margin-bottom:40px;min-height:28px">Connect wallet</div>
|
|
85
|
-
<div data-nibgate-unlock-wrap style="width:100%;position:relative;border-radius:10px;
|
|
86
|
-
<
|
|
87
|
-
|
|
85
|
+
<div data-nibgate-unlock-wrap style="width:100%;position:relative;border-radius:10px;cursor:pointer">
|
|
86
|
+
<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;overflow:hidden;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">
|
|
87
|
+
<div data-nibgate-unlock-progress style="position:absolute;inset:0;width:0%;background:rgba(255,255,255,0.55);border-radius:10px;transition:width .05s linear"></div>
|
|
88
|
+
<span data-nibgate-unlock-text style="position:relative;z-index:1;display:flex;align-items:center;justify-content:center;gap:8px">${unlockSVG}Hold to pay</span>
|
|
89
|
+
</button></div>
|
|
88
90
|
<div class="nui-stat" style="text-align:center;margin-top:16px" data-nibgate-status></div>
|
|
89
91
|
</div>
|
|
90
92
|
<div data-nibgate-premium hidden style="margin-top:32px;border-top:1px solid ${theme.border};padding-top:32px">${options.premiumContentHTML || ''}</div>
|
|
@@ -118,6 +120,7 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
|
|
|
118
120
|
const wrap = card.querySelector('[data-nibgate-unlock-wrap]');
|
|
119
121
|
const prog = card.querySelector('[data-nibgate-unlock-progress]');
|
|
120
122
|
const btn = card.querySelector('[data-nibgate-unlock]');
|
|
123
|
+
const textEl = card.querySelector('[data-nibgate-unlock-text]');
|
|
121
124
|
|
|
122
125
|
const HOLD_MS = 1500;
|
|
123
126
|
let holdTimer = null, holdActive = false, holdComplete = false;
|
|
@@ -159,7 +162,7 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
|
|
|
159
162
|
label.innerHTML = 'Connect wallet';
|
|
160
163
|
btn.disabled = true;
|
|
161
164
|
btn.style.cursor = 'default';
|
|
162
|
-
|
|
165
|
+
textEl.innerHTML = unlockSVG + 'Hold to pay';
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
168
|
|
|
@@ -169,7 +172,7 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
|
|
|
169
172
|
if (b && !b._clickAttached) { b.addEventListener('click', showDeposit); b._clickAttached = true; }
|
|
170
173
|
}
|
|
171
174
|
|
|
172
|
-
function setBtnText(t) {
|
|
175
|
+
function setBtnText(t) { textEl.innerHTML = unlockSVG + t; }
|
|
173
176
|
|
|
174
177
|
function resetHold() {
|
|
175
178
|
holdActive = false;
|
|
@@ -214,9 +217,7 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
|
|
|
214
217
|
}
|
|
215
218
|
|
|
216
219
|
label.addEventListener('click', (e) => {
|
|
217
|
-
if (
|
|
218
|
-
ctrl.disconnect().then(updateLabel);
|
|
219
|
-
} else if (!ctrl.getWalletAddress()) {
|
|
220
|
+
if (!ctrl.getWalletAddress()) {
|
|
220
221
|
ctrl.connect().then(updateLabel).catch(() => updateLabel());
|
|
221
222
|
}
|
|
222
223
|
});
|
|
@@ -227,6 +228,14 @@ export function renderDefaultUnlockUI(container, resource, options = {}) {
|
|
|
227
228
|
document.addEventListener('touchend', cancelHold);
|
|
228
229
|
wrap.addEventListener('mouseleave', cancelHold);
|
|
229
230
|
|
|
231
|
+
function pressIn() { if (!btn.style.transform || btn.style.transform === 'none' || btn.style.transform === '') btn.style.transform = 'scale(0.97)'; }
|
|
232
|
+
function pressOut() { if (!holdActive) btn.style.transform = ''; }
|
|
233
|
+
btn.addEventListener('mousedown', pressIn);
|
|
234
|
+
btn.addEventListener('touchstart', pressIn, { passive: true });
|
|
235
|
+
btn.addEventListener('mouseup', pressOut);
|
|
236
|
+
btn.addEventListener('touchend', pressOut);
|
|
237
|
+
btn.addEventListener('mouseleave', pressOut);
|
|
238
|
+
|
|
230
239
|
setTimeout(updateLabel, 200);
|
|
231
240
|
|
|
232
241
|
const cleanup = () => { document.removeEventListener('mouseup', cancelHold); document.removeEventListener('touchend', cancelHold); };
|